Java Examples for android.transition.TransitionManager
The following java examples will help you to understand the usage of android.transition.TransitionManager. These source code samples are taken from different open source projects.
Example 1
| Project: demos-master File: AnimAndCheckBoxActivity.java View source code |
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mBinding = DataBindingUtil.setContentView(this, R.layout.activity_anim);
mBinding.setP(new Presenter());
mBinding.addOnRebindCallback(new OnRebindCallback() {
@Override
public boolean onPreBind(ViewDataBinding binding) {
ViewGroup viewGroup = (ViewGroup) binding.getRoot();
TransitionManager.beginDelayedTransition(viewGroup);
return super.onPreBind(binding);
}
});
}Example 2
| Project: scoop-master File: AutoTransition.java View source code |
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public void transition(final ViewGroup root, final View from, final View to, final TransitionListener transitionListener) {
Scene toScene = new Scene(root, to);
android.transition.AutoTransition transition = new android.transition.AutoTransition();
transition.addListener(new Transition.TransitionListener() {
@Override
public void onTransitionStart(Transition transition) {
}
@Override
public void onTransitionEnd(Transition transition) {
transitionListener.onTransitionCompleted();
}
@Override
public void onTransitionCancel(Transition transition) {
transitionListener.onTransitionCompleted();
}
@Override
public void onTransitionPause(Transition transition) {
}
@Override
public void onTransitionResume(Transition transition) {
}
});
TransitionManager.go(toScene, transition);
}Example 3
| Project: android-sdk-sources-for-api-level-23-master File: PhoneWindow.java View source code |
private void installDecor() {
if (mDecor == null) {
mDecor = generateDecor();
mDecor.setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);
mDecor.setIsRootNamespace(true);
if (!mInvalidatePanelMenuPosted && mInvalidatePanelMenuFeatures != 0) {
mDecor.postOnAnimation(mInvalidatePanelMenuRunnable);
}
}
if (mContentParent == null) {
mContentParent = generateLayout(mDecor);
// Set up decor part of UI to ignore fitsSystemWindows if appropriate.
mDecor.makeOptionalFitsSystemWindows();
final DecorContentParent decorContentParent = (DecorContentParent) mDecor.findViewById(R.id.decor_content_parent);
if (decorContentParent != null) {
mDecorContentParent = decorContentParent;
mDecorContentParent.setWindowCallback(getCallback());
if (mDecorContentParent.getTitle() == null) {
mDecorContentParent.setWindowTitle(mTitle);
}
final int localFeatures = getLocalFeatures();
for (int i = 0; i < FEATURE_MAX; i++) {
if ((localFeatures & (1 << i)) != 0) {
mDecorContentParent.initFeature(i);
}
}
mDecorContentParent.setUiOptions(mUiOptions);
if ((mResourcesSetFlags & FLAG_RESOURCE_SET_ICON) != 0 || (mIconRes != 0 && !mDecorContentParent.hasIcon())) {
mDecorContentParent.setIcon(mIconRes);
} else if ((mResourcesSetFlags & FLAG_RESOURCE_SET_ICON) == 0 && mIconRes == 0 && !mDecorContentParent.hasIcon()) {
mDecorContentParent.setIcon(getContext().getPackageManager().getDefaultActivityIcon());
mResourcesSetFlags |= FLAG_RESOURCE_SET_ICON_FALLBACK;
}
if ((mResourcesSetFlags & FLAG_RESOURCE_SET_LOGO) != 0 || (mLogoRes != 0 && !mDecorContentParent.hasLogo())) {
mDecorContentParent.setLogo(mLogoRes);
}
// Invalidate if the panel menu hasn't been created before this.
// Panel menu invalidation is deferred avoiding application onCreateOptionsMenu
// being called in the middle of onCreate or similar.
// A pending invalidation will typically be resolved before the posted message
// would run normally in order to satisfy instance state restoration.
PanelFeatureState st = getPanelState(FEATURE_OPTIONS_PANEL, false);
if (!isDestroyed() && (st == null || st.menu == null) && !mIsStartingWindow) {
invalidatePanelMenu(FEATURE_ACTION_BAR);
}
} else {
mTitleView = (TextView) findViewById(R.id.title);
if (mTitleView != null) {
mTitleView.setLayoutDirection(mDecor.getLayoutDirection());
if ((getLocalFeatures() & (1 << FEATURE_NO_TITLE)) != 0) {
View titleContainer = findViewById(R.id.title_container);
if (titleContainer != null) {
titleContainer.setVisibility(View.GONE);
} else {
mTitleView.setVisibility(View.GONE);
}
if (mContentParent instanceof FrameLayout) {
((FrameLayout) mContentParent).setForeground(null);
}
} else {
mTitleView.setText(mTitle);
}
}
}
if (mDecor.getBackground() == null && mBackgroundFallbackResource != 0) {
mDecor.setBackgroundFallback(mBackgroundFallbackResource);
}
// already set a custom one.
if (hasFeature(FEATURE_ACTIVITY_TRANSITIONS)) {
if (mTransitionManager == null) {
final int transitionRes = getWindowStyle().getResourceId(R.styleable.Window_windowContentTransitionManager, 0);
if (transitionRes != 0) {
final TransitionInflater inflater = TransitionInflater.from(getContext());
mTransitionManager = inflater.inflateTransitionManager(transitionRes, mContentParent);
} else {
mTransitionManager = new TransitionManager();
}
}
mEnterTransition = getTransition(mEnterTransition, null, R.styleable.Window_windowEnterTransition);
mReturnTransition = getTransition(mReturnTransition, USE_DEFAULT_TRANSITION, R.styleable.Window_windowReturnTransition);
mExitTransition = getTransition(mExitTransition, null, R.styleable.Window_windowExitTransition);
mReenterTransition = getTransition(mReenterTransition, USE_DEFAULT_TRANSITION, R.styleable.Window_windowReenterTransition);
mSharedElementEnterTransition = getTransition(mSharedElementEnterTransition, null, R.styleable.Window_windowSharedElementEnterTransition);
mSharedElementReturnTransition = getTransition(mSharedElementReturnTransition, USE_DEFAULT_TRANSITION, R.styleable.Window_windowSharedElementReturnTransition);
mSharedElementExitTransition = getTransition(mSharedElementExitTransition, null, R.styleable.Window_windowSharedElementExitTransition);
mSharedElementReenterTransition = getTransition(mSharedElementReenterTransition, USE_DEFAULT_TRANSITION, R.styleable.Window_windowSharedElementReenterTransition);
if (mAllowEnterTransitionOverlap == null) {
mAllowEnterTransitionOverlap = getWindowStyle().getBoolean(R.styleable.Window_windowAllowEnterTransitionOverlap, true);
}
if (mAllowReturnTransitionOverlap == null) {
mAllowReturnTransitionOverlap = getWindowStyle().getBoolean(R.styleable.Window_windowAllowReturnTransitionOverlap, true);
}
if (mBackgroundFadeDurationMillis < 0) {
mBackgroundFadeDurationMillis = getWindowStyle().getInteger(R.styleable.Window_windowTransitionBackgroundFadeDuration, DEFAULT_BACKGROUND_FADE_DURATION_MS);
}
if (mSharedElementsUseOverlay == null) {
mSharedElementsUseOverlay = getWindowStyle().getBoolean(R.styleable.Window_windowSharedElementsUseOverlay, true);
}
}
}
}Example 4
| Project: android_frameworks_base-master File: PhoneWindow.java View source code |
private void installDecor() {
mForceDecorInstall = false;
if (mDecor == null) {
mDecor = generateDecor(-1);
mDecor.setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);
mDecor.setIsRootNamespace(true);
if (!mInvalidatePanelMenuPosted && mInvalidatePanelMenuFeatures != 0) {
mDecor.postOnAnimation(mInvalidatePanelMenuRunnable);
}
} else {
mDecor.setWindow(this);
}
if (mContentParent == null) {
mContentParent = generateLayout(mDecor);
// Set up decor part of UI to ignore fitsSystemWindows if appropriate.
mDecor.makeOptionalFitsSystemWindows();
final DecorContentParent decorContentParent = (DecorContentParent) mDecor.findViewById(R.id.decor_content_parent);
if (decorContentParent != null) {
mDecorContentParent = decorContentParent;
mDecorContentParent.setWindowCallback(getCallback());
if (mDecorContentParent.getTitle() == null) {
mDecorContentParent.setWindowTitle(mTitle);
}
final int localFeatures = getLocalFeatures();
for (int i = 0; i < FEATURE_MAX; i++) {
if ((localFeatures & (1 << i)) != 0) {
mDecorContentParent.initFeature(i);
}
}
mDecorContentParent.setUiOptions(mUiOptions);
if ((mResourcesSetFlags & FLAG_RESOURCE_SET_ICON) != 0 || (mIconRes != 0 && !mDecorContentParent.hasIcon())) {
mDecorContentParent.setIcon(mIconRes);
} else if ((mResourcesSetFlags & FLAG_RESOURCE_SET_ICON) == 0 && mIconRes == 0 && !mDecorContentParent.hasIcon()) {
mDecorContentParent.setIcon(getContext().getPackageManager().getDefaultActivityIcon());
mResourcesSetFlags |= FLAG_RESOURCE_SET_ICON_FALLBACK;
}
if ((mResourcesSetFlags & FLAG_RESOURCE_SET_LOGO) != 0 || (mLogoRes != 0 && !mDecorContentParent.hasLogo())) {
mDecorContentParent.setLogo(mLogoRes);
}
// Invalidate if the panel menu hasn't been created before this.
// Panel menu invalidation is deferred avoiding application onCreateOptionsMenu
// being called in the middle of onCreate or similar.
// A pending invalidation will typically be resolved before the posted message
// would run normally in order to satisfy instance state restoration.
PanelFeatureState st = getPanelState(FEATURE_OPTIONS_PANEL, false);
if (!isDestroyed() && (st == null || st.menu == null) && !mIsStartingWindow) {
invalidatePanelMenu(FEATURE_ACTION_BAR);
}
} else {
mTitleView = (TextView) findViewById(R.id.title);
if (mTitleView != null) {
if ((getLocalFeatures() & (1 << FEATURE_NO_TITLE)) != 0) {
final View titleContainer = findViewById(R.id.title_container);
if (titleContainer != null) {
titleContainer.setVisibility(View.GONE);
} else {
mTitleView.setVisibility(View.GONE);
}
mContentParent.setForeground(null);
} else {
mTitleView.setText(mTitle);
}
}
}
if (mDecor.getBackground() == null && mBackgroundFallbackResource != 0) {
mDecor.setBackgroundFallback(mBackgroundFallbackResource);
}
// already set a custom one.
if (hasFeature(FEATURE_ACTIVITY_TRANSITIONS)) {
if (mTransitionManager == null) {
final int transitionRes = getWindowStyle().getResourceId(R.styleable.Window_windowContentTransitionManager, 0);
if (transitionRes != 0) {
final TransitionInflater inflater = TransitionInflater.from(getContext());
mTransitionManager = inflater.inflateTransitionManager(transitionRes, mContentParent);
} else {
mTransitionManager = new TransitionManager();
}
}
mEnterTransition = getTransition(mEnterTransition, null, R.styleable.Window_windowEnterTransition);
mReturnTransition = getTransition(mReturnTransition, USE_DEFAULT_TRANSITION, R.styleable.Window_windowReturnTransition);
mExitTransition = getTransition(mExitTransition, null, R.styleable.Window_windowExitTransition);
mReenterTransition = getTransition(mReenterTransition, USE_DEFAULT_TRANSITION, R.styleable.Window_windowReenterTransition);
mSharedElementEnterTransition = getTransition(mSharedElementEnterTransition, null, R.styleable.Window_windowSharedElementEnterTransition);
mSharedElementReturnTransition = getTransition(mSharedElementReturnTransition, USE_DEFAULT_TRANSITION, R.styleable.Window_windowSharedElementReturnTransition);
mSharedElementExitTransition = getTransition(mSharedElementExitTransition, null, R.styleable.Window_windowSharedElementExitTransition);
mSharedElementReenterTransition = getTransition(mSharedElementReenterTransition, USE_DEFAULT_TRANSITION, R.styleable.Window_windowSharedElementReenterTransition);
if (mAllowEnterTransitionOverlap == null) {
mAllowEnterTransitionOverlap = getWindowStyle().getBoolean(R.styleable.Window_windowAllowEnterTransitionOverlap, true);
}
if (mAllowReturnTransitionOverlap == null) {
mAllowReturnTransitionOverlap = getWindowStyle().getBoolean(R.styleable.Window_windowAllowReturnTransitionOverlap, true);
}
if (mBackgroundFadeDurationMillis < 0) {
mBackgroundFadeDurationMillis = getWindowStyle().getInteger(R.styleable.Window_windowTransitionBackgroundFadeDuration, DEFAULT_BACKGROUND_FADE_DURATION_MS);
}
if (mSharedElementsUseOverlay == null) {
mSharedElementsUseOverlay = getWindowStyle().getBoolean(R.styleable.Window_windowSharedElementsUseOverlay, true);
}
}
}
}Example 5
| Project: Material-Animations-master File: RevealActivity.java View source code |
private void revealRed() {
final ViewGroup.LayoutParams originalParams = btnRed.getLayoutParams();
Transition transition = TransitionInflater.from(this).inflateTransition(R.transition.changebounds_with_arcmotion);
transition.addListener(new Transition.TransitionListener() {
@Override
public void onTransitionStart(Transition transition) {
}
@Override
public void onTransitionEnd(Transition transition) {
animateRevealColor(bgViewGroup, R.color.sample_red);
body.setText(R.string.reveal_body3);
body.setTextColor(ContextCompat.getColor(RevealActivity.this, R.color.theme_red_background));
btnRed.setLayoutParams(originalParams);
}
@Override
public void onTransitionCancel(Transition transition) {
}
@Override
public void onTransitionPause(Transition transition) {
}
@Override
public void onTransitionResume(Transition transition) {
}
});
TransitionManager.beginDelayedTransition(bgViewGroup, transition);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
btnRed.setLayoutParams(layoutParams);
}Example 6
| Project: platform_frameworks_base-master File: PhoneWindow.java View source code |
private void installDecor() {
mForceDecorInstall = false;
if (mDecor == null) {
mDecor = generateDecor(-1);
mDecor.setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);
mDecor.setIsRootNamespace(true);
if (!mInvalidatePanelMenuPosted && mInvalidatePanelMenuFeatures != 0) {
mDecor.postOnAnimation(mInvalidatePanelMenuRunnable);
}
} else {
mDecor.setWindow(this);
}
if (mContentParent == null) {
mContentParent = generateLayout(mDecor);
// Set up decor part of UI to ignore fitsSystemWindows if appropriate.
mDecor.makeOptionalFitsSystemWindows();
final DecorContentParent decorContentParent = (DecorContentParent) mDecor.findViewById(R.id.decor_content_parent);
if (decorContentParent != null) {
mDecorContentParent = decorContentParent;
mDecorContentParent.setWindowCallback(getCallback());
if (mDecorContentParent.getTitle() == null) {
mDecorContentParent.setWindowTitle(mTitle);
}
final int localFeatures = getLocalFeatures();
for (int i = 0; i < FEATURE_MAX; i++) {
if ((localFeatures & (1 << i)) != 0) {
mDecorContentParent.initFeature(i);
}
}
mDecorContentParent.setUiOptions(mUiOptions);
if ((mResourcesSetFlags & FLAG_RESOURCE_SET_ICON) != 0 || (mIconRes != 0 && !mDecorContentParent.hasIcon())) {
mDecorContentParent.setIcon(mIconRes);
} else if ((mResourcesSetFlags & FLAG_RESOURCE_SET_ICON) == 0 && mIconRes == 0 && !mDecorContentParent.hasIcon()) {
mDecorContentParent.setIcon(getContext().getPackageManager().getDefaultActivityIcon());
mResourcesSetFlags |= FLAG_RESOURCE_SET_ICON_FALLBACK;
}
if ((mResourcesSetFlags & FLAG_RESOURCE_SET_LOGO) != 0 || (mLogoRes != 0 && !mDecorContentParent.hasLogo())) {
mDecorContentParent.setLogo(mLogoRes);
}
// Invalidate if the panel menu hasn't been created before this.
// Panel menu invalidation is deferred avoiding application onCreateOptionsMenu
// being called in the middle of onCreate or similar.
// A pending invalidation will typically be resolved before the posted message
// would run normally in order to satisfy instance state restoration.
PanelFeatureState st = getPanelState(FEATURE_OPTIONS_PANEL, false);
if (!isDestroyed() && (st == null || st.menu == null) && !mIsStartingWindow) {
invalidatePanelMenu(FEATURE_ACTION_BAR);
}
} else {
mTitleView = (TextView) findViewById(R.id.title);
if (mTitleView != null) {
if ((getLocalFeatures() & (1 << FEATURE_NO_TITLE)) != 0) {
final View titleContainer = findViewById(R.id.title_container);
if (titleContainer != null) {
titleContainer.setVisibility(View.GONE);
} else {
mTitleView.setVisibility(View.GONE);
}
mContentParent.setForeground(null);
} else {
mTitleView.setText(mTitle);
}
}
}
if (mDecor.getBackground() == null && mBackgroundFallbackResource != 0) {
mDecor.setBackgroundFallback(mBackgroundFallbackResource);
}
// already set a custom one.
if (hasFeature(FEATURE_ACTIVITY_TRANSITIONS)) {
if (mTransitionManager == null) {
final int transitionRes = getWindowStyle().getResourceId(R.styleable.Window_windowContentTransitionManager, 0);
if (transitionRes != 0) {
final TransitionInflater inflater = TransitionInflater.from(getContext());
mTransitionManager = inflater.inflateTransitionManager(transitionRes, mContentParent);
} else {
mTransitionManager = new TransitionManager();
}
}
mEnterTransition = getTransition(mEnterTransition, null, R.styleable.Window_windowEnterTransition);
mReturnTransition = getTransition(mReturnTransition, USE_DEFAULT_TRANSITION, R.styleable.Window_windowReturnTransition);
mExitTransition = getTransition(mExitTransition, null, R.styleable.Window_windowExitTransition);
mReenterTransition = getTransition(mReenterTransition, USE_DEFAULT_TRANSITION, R.styleable.Window_windowReenterTransition);
mSharedElementEnterTransition = getTransition(mSharedElementEnterTransition, null, R.styleable.Window_windowSharedElementEnterTransition);
mSharedElementReturnTransition = getTransition(mSharedElementReturnTransition, USE_DEFAULT_TRANSITION, R.styleable.Window_windowSharedElementReturnTransition);
mSharedElementExitTransition = getTransition(mSharedElementExitTransition, null, R.styleable.Window_windowSharedElementExitTransition);
mSharedElementReenterTransition = getTransition(mSharedElementReenterTransition, USE_DEFAULT_TRANSITION, R.styleable.Window_windowSharedElementReenterTransition);
if (mAllowEnterTransitionOverlap == null) {
mAllowEnterTransitionOverlap = getWindowStyle().getBoolean(R.styleable.Window_windowAllowEnterTransitionOverlap, true);
}
if (mAllowReturnTransitionOverlap == null) {
mAllowReturnTransitionOverlap = getWindowStyle().getBoolean(R.styleable.Window_windowAllowReturnTransitionOverlap, true);
}
if (mBackgroundFadeDurationMillis < 0) {
mBackgroundFadeDurationMillis = getWindowStyle().getInteger(R.styleable.Window_windowTransitionBackgroundFadeDuration, DEFAULT_BACKGROUND_FADE_DURATION_MS);
}
if (mSharedElementsUseOverlay == null) {
mSharedElementsUseOverlay = getWindowStyle().getBoolean(R.styleable.Window_windowSharedElementsUseOverlay, true);
}
}
}
}Example 7
| Project: TransitionExample-master File: SceneChangeClipBoundsActivity.java View source code |
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_scene_change_clip_bounds);
initToolbar();
ViewGroup sceneRoot = (ViewGroup) findViewById(R.id.scene_root);
View inflate = LayoutInflater.from(this).inflate(R.layout.scene_1_changeclipbounds, null);
View inflate2 = LayoutInflater.from(this).inflate(R.layout.scene_2_changeclipbounds, null);
ImageView imageView = (ImageView) inflate.findViewById(R.id.cutegirl);
ImageView imageView2 = (ImageView) inflate2.findViewById(R.id.cutegirl);
imageView.setClipBounds(new Rect(0, 0, 200, 200));
imageView2.setClipBounds(new Rect(200, 200, 400, 400));
scene1 = new Scene(sceneRoot, inflate);
scene2 = new Scene(sceneRoot, inflate2);
TransitionManager.go(scene1);
}Example 8
| Project: android-proguards-master File: HomeActivity.java View source code |
@Override
public void onAvailable(Network network) {
connected = true;
if (adapter.getDataItemCount() != 0)
return;
runOnUiThread(new Runnable() {
@Override
public void run() {
TransitionManager.beginDelayedTransition(drawer);
noConnection.setVisibility(View.GONE);
loading.setVisibility(View.VISIBLE);
dataManager.loadAllDataSources();
}
});
}Example 9
| Project: plaid-master File: HomeActivity.java View source code |
@Override
public void onAvailable(Network network) {
connected = true;
if (adapter.getDataItemCount() != 0)
return;
runOnUiThread(new Runnable() {
@Override
public void run() {
TransitionManager.beginDelayedTransition(drawer);
noConnection.setVisibility(View.GONE);
loading.setVisibility(View.VISIBLE);
dataManager.loadAllDataSources();
}
});
}Example 10
| Project: sbt-android-master File: DribbbleShot.java View source code |
@Override
public void onClick(View v) {
boolean isExpanded = reply.getVisibility() == View.VISIBLE;
TransitionManager.beginDelayedTransition((ViewGroup) view);
view.setActivated(!isExpanded);
if (!isExpanded) {
// do expand
expandedCommentPosition = position;
reply.setVisibility(View.VISIBLE);
likeHeart.setVisibility(View.VISIBLE);
likesCount.setVisibility(View.VISIBLE);
if (comment.liked == null) {
dribbbleApi.likedComment(shot.id, comment.id, new retrofit.Callback<Like>() {
@Override
public void success(Like like, Response response) {
comment.liked = true;
likeHeart.setChecked(true);
likeHeart.jumpDrawablesToCurrentState();
}
@Override
public void failure(RetrofitError error) {
comment.liked = false;
likeHeart.setChecked(false);
likeHeart.jumpDrawablesToCurrentState();
}
});
}
} else {
// do collapse
expandedCommentPosition = ListView.INVALID_POSITION;
reply.setVisibility(View.GONE);
likeHeart.setVisibility(View.GONE);
likesCount.setVisibility(View.GONE);
}
notifyDataSetChanged();
}Example 11
| Project: ulti-master File: MaterialAnimationActivity.java View source code |
private void setupLayout() {
sceneRoot = (LinearLayout) findViewById(R.id.scene_root);
squareRed = findViewById(R.id.square_red);
squareRed.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(MaterialAnimationActivity.this, DetailActivity1.class);
ActivityOptions transitionActivityOptions = ActivityOptions.makeSceneTransitionAnimation(MaterialAnimationActivity.this);
startActivity(i, transitionActivityOptions.toBundle());
}
});
squareBlue = findViewById(R.id.square_blue);
squareBlue.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(MaterialAnimationActivity.this, DetailActivity2.class);
View sharedView = squareBlue;
String transitionName = "square_blue_name";
ActivityOptions transitionActivityOptions = ActivityOptions.makeSceneTransitionAnimation(MaterialAnimationActivity.this, sharedView, transitionName);
startActivity(i, transitionActivityOptions.toBundle());
}
});
squareGreen = findViewById(R.id.square_green);
squareGreen.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
TransitionManager.beginDelayedTransition(sceneRoot);
setViewWidth(squareRed, 500);
setViewWidth(squareBlue, 500);
setViewWidth(squareGreen, 500);
setViewWidth(squareOrange, 500);
}
});
squareOrange = findViewById(R.id.square_orange);
squareOrange.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(MaterialAnimationActivity.this, DetailActivity3.class);
View sharedView = squareOrange;
String transitionName = "square_orange_name";
ActivityOptions transitionActivityOptions = ActivityOptions.makeSceneTransitionAnimation(MaterialAnimationActivity.this, sharedView, transitionName);
startActivity(i, transitionActivityOptions.toBundle());
}
});
}Example 12
| Project: UltimateAndroid-master File: MaterialAnimationActivity.java View source code |
private void setupLayout() {
sceneRoot = (LinearLayout) findViewById(R.id.scene_root);
squareRed = findViewById(R.id.square_red);
squareRed.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(MaterialAnimationActivity.this, DetailActivity1.class);
ActivityOptions transitionActivityOptions = ActivityOptions.makeSceneTransitionAnimation(MaterialAnimationActivity.this);
startActivity(i, transitionActivityOptions.toBundle());
}
});
squareBlue = findViewById(R.id.square_blue);
squareBlue.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(MaterialAnimationActivity.this, DetailActivity2.class);
View sharedView = squareBlue;
String transitionName = "square_blue_name";
ActivityOptions transitionActivityOptions = ActivityOptions.makeSceneTransitionAnimation(MaterialAnimationActivity.this, sharedView, transitionName);
startActivity(i, transitionActivityOptions.toBundle());
}
});
squareGreen = findViewById(R.id.square_green);
squareGreen.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
TransitionManager.beginDelayedTransition(sceneRoot);
setViewWidth(squareRed, 500);
setViewWidth(squareBlue, 500);
setViewWidth(squareGreen, 500);
setViewWidth(squareOrange, 500);
}
});
squareOrange = findViewById(R.id.square_orange);
squareOrange.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(MaterialAnimationActivity.this, DetailActivity3.class);
View sharedView = squareOrange;
String transitionName = "square_orange_name";
ActivityOptions transitionActivityOptions = ActivityOptions.makeSceneTransitionAnimation(MaterialAnimationActivity.this, sharedView, transitionName);
startActivity(i, transitionActivityOptions.toBundle());
}
});
}Example 13
| Project: andevcon-2014-jl-master File: Transitions.java View source code |
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.transition);
mSceneRoot = (ViewGroup) findViewById(R.id.sceneRoot);
TransitionInflater inflater = TransitionInflater.from(this);
// Note that this is not the only way to create a Scene object, but that
// loading them from layout resources cooperates with the
// TransitionManager that we are also loading from resources, and which
// uses the same layout resource files to determine the scenes to transition
// from/to.
mScene1 = Scene.getSceneForLayout(mSceneRoot, R.layout.transition_scene1, this);
mScene2 = Scene.getSceneForLayout(mSceneRoot, R.layout.transition_scene2, this);
mScene3 = Scene.getSceneForLayout(mSceneRoot, R.layout.transition_scene3, this);
mTransitionManager = inflater.inflateTransitionManager(R.transition.transitions_mgr, mSceneRoot);
}Example 14
| Project: ApiDemos-master File: Transitions.java View source code |
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.transition);
mSceneRoot = (ViewGroup) findViewById(R.id.sceneRoot);
TransitionInflater inflater = TransitionInflater.from(this);
// Note that this is not the only way to create a Scene object, but that
// loading them from layout resources cooperates with the
// TransitionManager that we are also loading from resources, and which
// uses the same layout resource files to determine the scenes to transition
// from/to.
mScene1 = Scene.getSceneForLayout(mSceneRoot, R.layout.transition_scene1, this);
mScene2 = Scene.getSceneForLayout(mSceneRoot, R.layout.transition_scene2, this);
mScene3 = Scene.getSceneForLayout(mSceneRoot, R.layout.transition_scene3, this);
mTransitionManager = inflater.inflateTransitionManager(R.transition.transitions_mgr, mSceneRoot);
}Example 15
| Project: ApkLauncher-master File: Transitions.java View source code |
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.transition);
mSceneRoot = (ViewGroup) findViewById(R.id.sceneRoot);
TransitionInflater inflater = TransitionInflater.from(this);
// Note that this is not the only way to create a Scene object, but that
// loading them from layout resources cooperates with the
// TransitionManager that we are also loading from resources, and which
// uses the same layout resource files to determine the scenes to transition
// from/to.
mScene1 = Scene.getSceneForLayout(mSceneRoot, R.layout.transition_scene1, this);
mScene2 = Scene.getSceneForLayout(mSceneRoot, R.layout.transition_scene2, this);
mScene3 = Scene.getSceneForLayout(mSceneRoot, R.layout.transition_scene3, this);
mTransitionManager = inflater.inflateTransitionManager(R.transition.transitions_mgr, mSceneRoot);
}Example 16
| Project: ApkLauncher_legacy-master File: Transitions.java View source code |
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.transition);
mSceneRoot = (ViewGroup) findViewById(R.id.sceneRoot);
TransitionInflater inflater = TransitionInflater.from(this);
// Note that this is not the only way to create a Scene object, but that
// loading them from layout resources cooperates with the
// TransitionManager that we are also loading from resources, and which
// uses the same layout resource files to determine the scenes to transition
// from/to.
mScene1 = Scene.getSceneForLayout(mSceneRoot, R.layout.transition_scene1, this);
mScene2 = Scene.getSceneForLayout(mSceneRoot, R.layout.transition_scene2, this);
mScene3 = Scene.getSceneForLayout(mSceneRoot, R.layout.transition_scene3, this);
mTransitionManager = inflater.inflateTransitionManager(R.transition.transitions_mgr, mSceneRoot);
}Example 17
| Project: DroidCon-master File: SmoothStateChangeFragment.java View source code |
@Override
public void onNextPressed() {
switch(++currentStep) {
case 2:
TransitionSet set = new TransitionSet();
set.setOrdering(TransitionSet.ORDERING_SEQUENTIAL);
set.addTransition(new TextTransform()).addTransition(new Fade(Fade.IN));
TransitionManager.beginDelayedTransition(container, set);
container.setGravity(Gravity.TOP);
text1.setTextSize(60f);
text1.setTextColor(grey_light);
ObjectAnimator background = ObjectAnimator.ofObject(container, "backgroundColor", new ArgbEvaluator(), grey_light, pink);
background.start();
break;
case 3:
container2.setVisibility(View.VISIBLE);
gif1.setVisibility(View.VISIBLE);
Utils.startGifDelayed(gif1);
break;
case 4:
gif2.setVisibility(View.VISIBLE);
Utils.stopGif(gif1);
Utils.startGifDelayed(gif2);
break;
case 5:
Utils.startGif(gif1);
break;
default:
super.onNextPressed();
}
}Example 18
| Project: felix-on-android-master File: Transitions.java View source code |
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.transition);
mSceneRoot = (ViewGroup) findViewById(R.id.sceneRoot);
TransitionInflater inflater = TransitionInflater.from(this);
// Note that this is not the only way to create a Scene object, but that
// loading them from layout resources cooperates with the
// TransitionManager that we are also loading from resources, and which
// uses the same layout resource files to determine the scenes to transition
// from/to.
mScene1 = Scene.getSceneForLayout(mSceneRoot, R.layout.transition_scene1, this);
mScene2 = Scene.getSceneForLayout(mSceneRoot, R.layout.transition_scene2, this);
mScene3 = Scene.getSceneForLayout(mSceneRoot, R.layout.transition_scene3, this);
mTransitionManager = inflater.inflateTransitionManager(R.transition.transitions_mgr, mSceneRoot);
}Example 19
| Project: GradleCodeLab-master File: Transitions.java View source code |
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.transition);
mSceneRoot = (ViewGroup) findViewById(R.id.sceneRoot);
TransitionInflater inflater = TransitionInflater.from(this);
// Note that this is not the only way to create a Scene object, but that
// loading them from layout resources cooperates with the
// TransitionManager that we are also loading from resources, and which
// uses the same layout resource files to determine the scenes to transition
// from/to.
mScene1 = Scene.getSceneForLayout(mSceneRoot, R.layout.transition_scene1, this);
mScene2 = Scene.getSceneForLayout(mSceneRoot, R.layout.transition_scene2, this);
mScene3 = Scene.getSceneForLayout(mSceneRoot, R.layout.transition_scene3, this);
mTransitionManager = inflater.inflateTransitionManager(R.transition.transitions_mgr, mSceneRoot);
}Example 20
| Project: Material-SearchTransition-master File: SearchActivity.java View source code |
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_search);
searchbar = (Searchbar) findViewById(R.id.search_toolbar);
setSupportActionBar(searchbar);
// we don't want to play the enter animation on configuration changes (i.e. orientation)
if (isFirstTimeRunning(savedInstanceState)) {
// Start with an empty looking Toolbar
// We are going to fade its contents in, as long as the activity finishes rendering
searchbar.hideContent();
ViewTreeObserver viewTreeObserver = searchbar.getViewTreeObserver();
viewTreeObserver.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
searchbar.getViewTreeObserver().removeOnGlobalLayoutListener(this);
// after the activity has finished drawing the initial layout, we are going to continue the animation
// that we left off from the MainActivity
showSearch();
}
private void showSearch() {
// use the TransitionManager to animate the changes of the Toolbar
TransitionManager.beginDelayedTransition(searchbar, FadeInTransition.createTransition());
// here we are just changing all children to VISIBLE
searchbar.showContent();
}
});
}
}Example 21
| Project: Conductor-master File: TransitionChangeHandler.java View source code |
@Override
public void performChange(@NonNull final ViewGroup container, @Nullable final View from, @Nullable final View to, final boolean isPush, @NonNull final ControllerChangeCompletedListener changeListener) {
if (canceled) {
changeListener.onChangeCompleted();
return;
}
final Transition transition = getTransition(container, from, to, isPush);
transition.addListener(new TransitionListener() {
@Override
public void onTransitionStart(Transition transition) {
}
@Override
public void onTransitionEnd(Transition transition) {
changeListener.onChangeCompleted();
}
@Override
public void onTransitionCancel(Transition transition) {
changeListener.onChangeCompleted();
}
@Override
public void onTransitionPause(Transition transition) {
}
@Override
public void onTransitionResume(Transition transition) {
}
});
prepareForTransition(container, from, to, transition, isPush, new OnTransitionPreparedListener() {
@Override
public void onPrepared() {
if (!canceled) {
TransitionManager.beginDelayedTransition(container, transition);
executePropertyChanges(container, from, to, transition, isPush);
}
}
});
}Example 22
| Project: material-element-master File: ChoreographyActivity.java View source code |
@Override
public boolean onLongClick(View v) {
if (AndroidVersionUtil.isGreaterThanL()) {
final Scene scene = Scene.getSceneForLayout(cardView, isScene1 ? R.layout.all_element_share_scene2 : R.layout.all_element_share_scene1, ChoreographyActivity.this);
final Transition transition = TransitionInflater.from(ChoreographyActivity.this).inflateTransition(isScene1 ? R.transition.choreography_all_element_share_enter : R.transition.choreography_all_element_share_return);
TransitionManager.go(scene, transition);
((ImageView) scene.getSceneRoot().findViewById(R.id.all_element_share_image)).setImageDrawable(rowImage.getDrawable());
isScene1 = !isScene1;
} else {
Toast.makeText(ChoreographyActivity.this, R.string.all_not_support_os_version, Toast.LENGTH_LONG).show();
}
return true;
}Example 23
| Project: SignUpTransition-master File: MainActivity.java View source code |
@Override
public void run() {
final LoginLoadingView loginView = (LoginLoadingView) mFrtContent.findViewById(R.id.login_view);
loginView.postDelayed(new Runnable() {
@Override
public void run() {
loginView.setStatus(LoginLoadingView.STATUS_LOGGING);
}
}, mDuration);
loginView.postDelayed(new Runnable() {
@Override
public void run() {
loginView.setStatus(LoginLoadingView.STATUS_LOGIN_SUCCESS);
}
}, 4000);
loginView.postDelayed(new Runnable() {
@Override
public void run() {
TransitionManager.go(mSceneMain, new ChangeBounds().setDuration(mDuration).setInterpolator(new DecelerateInterpolator()));
}
}, 6000);
}Example 24
| Project: android-search-and-stories-master File: InstructionDialogFragment.java View source code |
private void initInstructionType(boolean isChromeType, boolean withAnimation) {
if (withAnimation) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
TransitionManager.beginDelayedTransition(transitionRoot);
}
}
chromeInstructionContainer.setVisibility(isChromeType ? View.VISIBLE : View.GONE);
firefoxInstructionContainer.setVisibility(isChromeType ? View.GONE : View.VISIBLE);
toggleInstructionImageView.setImageResource(isChromeType ? R.drawable.firefox : R.drawable.chrome);
toggleInstructionTextView.setText(String.format(getString(R.string.add_to), getString(isChromeType ? R.string.browser_firefox : R.string.browser_chrome)));
titleTextView.setText(String.format(getString(R.string.add_to), getString(isChromeType ? R.string.browser_chrome : R.string.browser_firefox)));
}Example 25
| Project: Opengur-master File: ViewUtils.java View source code |
/**
* Attempts to clear the decor view from the transition manager which causes a leak.
* <p/><a href="http://stackoverflow.com/questions/32698049/sharedelement-and-custom-entertransition-causes-memory-leak">StackOverflow
* Explanation</a>
*
* @param activity
*/
public static void fixTransitionLeak(@NonNull Activity activity) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP)
return;
Class transitionManagerClass = TransitionManager.class;
try {
Field runningTransitionsField = transitionManagerClass.getDeclaredField("sRunningTransitions");
runningTransitionsField.setAccessible(true);
//noinspection unchecked
ThreadLocal<WeakReference<ArrayMap<ViewGroup, ArrayList<Transition>>>> runningTransitions = (ThreadLocal<WeakReference<ArrayMap<ViewGroup, ArrayList<Transition>>>>) runningTransitionsField.get(transitionManagerClass);
if (runningTransitions.get() == null || runningTransitions.get().get() == null) {
return;
}
ArrayMap map = runningTransitions.get().get();
View decorView = activity.getWindow().getDecorView();
if (map.containsKey(decorView)) {
map.remove(decorView);
}
} catch (NoSuchFieldException e) {
} catch (IllegalAccessException e) {
}
}Example 26
| Project: faboptions-master File: FabOptions.java View source code |
private void open() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
AnimatedVectorDrawable drawable = (AnimatedVectorDrawable) getResources().getDrawable(R.drawable.faboptions_ic_menu_animatable, null);
mFab.setImageDrawable(drawable);
drawable.start();
} else {
mFab.setImageResource(R.drawable.faboptions_ic_close);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
TransitionManager.beginDelayedTransition(this, new OpenMorphTransition(mButtonContainer));
}
animateBackground(true);
animateButtons(true);
// } else {
// openCompatAnimation();
// }
mIsOpen = true;
}Example 27
| Project: From-design-to-Android-part1-master File: OrderDialogFragment.java View source code |
private void changeToConfirmScene() {
final LayoutOrderConfirmationBinding confBinding = prepareConfirmationBinding();
final Scene scene = new Scene(binding.content, ((ViewGroup) confBinding.getRoot()));
scene.setEnterAction(onEnterConfirmScene(confBinding));
final Transition transition = TransitionInflater.from(getContext()).inflateTransition(R.transition.transition_confirmation_view);
TransitionManager.go(scene, transition);
}Example 28
| Project: AcDisplay-master File: AcDisplayFragment.java View source code |
//-- SCENES MANAGEMENT ----------------------------------------------------
/**
* Changes current scene to given one.
*
* @see #showWidget(com.achep.acdisplay.ui.components.Widget)
*/
@SuppressLint("NewApi")
protected final synchronized void goScene(@NonNull SceneCompat sceneCompat, boolean animate) {
if (mCurrentScene == sceneCompat)
return;
mCurrentScene = sceneCompat;
if (DEBUG)
Log.d(TAG, "Going to " + sceneCompat);
if (Device.hasKitKatApi())
animate &= mSceneContainer.isLaidOut();
if (!animate) {
sceneCompat.enter();
return;
}
if (Device.hasKitKatApi()) {
final Scene scene = sceneCompat.getScene();
try {
// This must be a synchronization problem with Android's Scene or TransitionManager,
// but those were declared as final classes, so I have no idea how to fix it.
TransitionManager.go(scene, mTransitionSwitchScene);
} catch (IllegalStateException e) {
Log.w(TAG, "TransitionManager has failed switching scenes!");
ViewGroup viewGroup = (ViewGroup) getSceneView().getParent();
viewGroup.removeView(getSceneView());
try {
int id = Resources.getSystem().getIdentifier("current_scene", "id", "android");
Method method = View.class.getMethod("setTagInternal", int.class, Object.class);
method.setAccessible(true);
method.invoke(viewGroup, id, null);
} catch (NoSuchMethodExceptionIllegalAccessException | InvocationTargetException | e2) {
throw new RuntimeException("An attempt to fix the TransitionManager has failed.");
}
TransitionManager.go(scene, mTransitionSwitchScene);
}
} else {
sceneCompat.enter();
if (getActivity() != null) {
// TODO: Better animation for Jelly Bean users.
float density = getResources().getDisplayMetrics().density;
getSceneView().setAlpha(0.6f);
getSceneView().setRotationX(6f);
getSceneView().setTranslationY(6f * density);
getSceneView().animate().alpha(1).rotationX(0).translationY(0);
}
}
}Example 29
| Project: Easy-Notification-master File: EasyNotificationFragment.java View source code |
//-- SCENES MANAGEMENT ----------------------------------------------------
/**
* Changes current scene to given one.
*
* @see #showWidget(com.bullmobi.message.ui.components.Widget)
*/
@SuppressLint("NewApi")
protected final synchronized void goScene(@NonNull SceneCompat sceneCompat, boolean animate) {
if (mCurrentScene == sceneCompat)
return;
mCurrentScene = sceneCompat;
if (DEBUG)
Log.d(TAG, "Going to " + sceneCompat);
if (Device.hasKitKatApi())
animate &= mSceneContainer.isLaidOut();
if (!animate) {
sceneCompat.enter();
return;
}
if (Device.hasKitKatApi()) {
final Scene scene = sceneCompat.getScene();
try {
// This must be a synchronization problem with Android's Scene or TransitionManager,
// but those were declared as final classes, so I have no idea how to fix it.
TransitionManager.go(scene, mTransitionSwitchScene);
} catch (IllegalStateException e) {
Log.w(TAG, "TransitionManager has failed switching scenes!");
ViewGroup viewGroup = (ViewGroup) getSceneView().getParent();
viewGroup.removeView(getSceneView());
try {
int id = Resources.getSystem().getIdentifier("current_scene", "id", "android");
Method method = View.class.getMethod("setTagInternal", int.class, Object.class);
method.setAccessible(true);
method.invoke(viewGroup, id, null);
} catch (NoSuchMethodExceptionIllegalAccessException | InvocationTargetException | e2) {
throw new RuntimeException("An attempt to fix the TransitionManager has failed.");
}
TransitionManager.go(scene, mTransitionSwitchScene);
}
} else {
sceneCompat.enter();
if (getActivity() != null) {
// TODO: Better animation for Jelly Bean users.
float density = getResources().getDisplayMetrics().density;
getSceneView().setAlpha(0.6f);
getSceneView().setRotationX(6f);
getSceneView().setTranslationY(6f * density);
getSceneView().animate().alpha(1).rotationX(0).translationY(0);
}
}
}Example 30
| Project: Gadgetbridge-master File: GBDeviceAdapterv2.java View source code |
@Override
public void onBindViewHolder(ViewHolder holder, final int position) {
final GBDevice device = deviceList.get(position);
final DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(device);
holder.container.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (device.isInitialized() || device.isConnected()) {
showTransientSnackbar(R.string.controlcenter_snackbar_need_longpress);
} else {
showTransientSnackbar(R.string.controlcenter_snackbar_connecting);
GBApplication.deviceService().connect(device);
}
}
});
holder.container.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
if (device.getState() != GBDevice.State.NOT_CONNECTED) {
showTransientSnackbar(R.string.controlcenter_snackbar_disconnecting);
GBApplication.deviceService().disconnect();
}
return true;
}
});
holder.deviceImageView.setImageResource(R.drawable.level_list_device);
//level-list does not allow negative values, hence we always add 100 to the key.
holder.deviceImageView.setImageLevel(device.getType().getKey() + 100 + (device.isInitialized() ? 100 : 0));
holder.deviceNameLabel.setText(getUniqueDeviceName(device));
if (device.isBusy()) {
holder.deviceStatusLabel.setText(device.getBusyTask());
holder.busyIndicator.setVisibility(View.VISIBLE);
} else {
holder.deviceStatusLabel.setText(device.getStateString());
holder.busyIndicator.setVisibility(View.INVISIBLE);
}
//begin of action row
//battery
holder.batteryStatusBox.setVisibility(View.GONE);
short batteryLevel = device.getBatteryLevel();
if (batteryLevel != GBDevice.BATTERY_UNKNOWN) {
holder.batteryStatusBox.setVisibility(View.VISIBLE);
holder.batteryStatusLabel.setText(device.getBatteryLevel() + "%");
BatteryState batteryState = device.getBatteryState();
if (BatteryState.BATTERY_CHARGING.equals(batteryState) || BatteryState.BATTERY_CHARGING_FULL.equals(batteryState)) {
holder.batteryIcon.setImageLevel(device.getBatteryLevel() + 100);
} else {
holder.batteryIcon.setImageLevel(device.getBatteryLevel());
}
}
//fetch activity data
holder.fetchActivityDataBox.setVisibility((device.isInitialized() && coordinator.supportsActivityDataFetching()) ? View.VISIBLE : View.GONE);
holder.fetchActivityData.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showTransientSnackbar(R.string.busy_task_fetch_activity_data);
GBApplication.deviceService().onFetchActivityData();
}
});
//take screenshot
holder.takeScreenshotView.setVisibility((device.isInitialized() && coordinator.supportsScreenshots()) ? View.VISIBLE : View.GONE);
holder.takeScreenshotView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showTransientSnackbar(R.string.controlcenter_snackbar_requested_screenshot);
GBApplication.deviceService().onScreenshotReq();
}
});
//manage apps
holder.manageAppsView.setVisibility((device.isInitialized() && coordinator.supportsAppsManagement()) ? View.VISIBLE : View.GONE);
holder.manageAppsView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(device);
Class<? extends Activity> appsManagementActivity = coordinator.getAppsManagementActivity();
if (appsManagementActivity != null) {
Intent startIntent = new Intent(context, appsManagementActivity);
startIntent.putExtra(GBDevice.EXTRA_DEVICE, device);
context.startActivity(startIntent);
}
}
});
//set alarms
holder.setAlarmsView.setVisibility(coordinator.supportsAlarmConfiguration() ? View.VISIBLE : View.GONE);
holder.setAlarmsView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent startIntent;
startIntent = new Intent(context, ConfigureAlarms.class);
context.startActivity(startIntent);
}
});
//show graphs
holder.showActivityGraphs.setVisibility(coordinator.supportsActivityTracking() ? View.VISIBLE : View.GONE);
holder.showActivityGraphs.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent startIntent;
startIntent = new Intent(context, ChartsActivity.class);
startIntent.putExtra(GBDevice.EXTRA_DEVICE, device);
context.startActivity(startIntent);
}
});
ItemWithDetailsAdapter infoAdapter = new ItemWithDetailsAdapter(context, device.getDeviceInfos());
infoAdapter.setHorizontalAlignment(true);
holder.deviceInfoList.setAdapter(infoAdapter);
justifyListViewHeightBasedOnChildren(holder.deviceInfoList);
holder.deviceInfoList.setFocusable(false);
final boolean detailsShown = position == expandedDevicePosition;
boolean showInfoIcon = device.hasDeviceInfos() && !device.isBusy();
holder.deviceInfoView.setVisibility(showInfoIcon ? View.VISIBLE : View.GONE);
holder.deviceInfoBox.setActivated(detailsShown);
holder.deviceInfoBox.setVisibility(detailsShown ? View.VISIBLE : View.GONE);
holder.deviceInfoView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
expandedDevicePosition = detailsShown ? -1 : position;
TransitionManager.beginDelayedTransition(parent);
notifyDataSetChanged();
}
});
holder.findDevice.setVisibility(device.isInitialized() ? View.VISIBLE : View.GONE);
holder.findDevice.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (device.getType() == DeviceType.VIBRATISSIMO) {
Intent startIntent;
startIntent = new Intent(context, VibrationActivity.class);
startIntent.putExtra(GBDevice.EXTRA_DEVICE, device);
context.startActivity(startIntent);
return;
}
GBApplication.deviceService().onFindDevice(true);
//TODO: extract string resource if we like this solution.
Snackbar.make(parent, R.string.control_center_find_lost_device, Snackbar.LENGTH_INDEFINITE).setAction("Found it!", new View.OnClickListener() {
@Override
public void onClick(View v) {
GBApplication.deviceService().onFindDevice(false);
}
}).setCallback(new Snackbar.Callback() {
@Override
public void onDismissed(Snackbar snackbar, int event) {
GBApplication.deviceService().onFindDevice(false);
super.onDismissed(snackbar, event);
}
}).show();
// ProgressDialog.show(
// context,
// context.getString(R.string.control_center_find_lost_device),
// context.getString(R.string.control_center_cancel_to_stop_vibration),
// true, true,
// new DialogInterface.OnCancelListener() {
// @Override
// public void onCancel(DialogInterface dialog) {
// GBApplication.deviceService().onFindDevice(false);
// }
// });
}
});
//remove device, hidden under details
holder.removeDevice.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new AlertDialog.Builder(context).setCancelable(true).setTitle(context.getString(R.string.controlcenter_delete_device_name, device.getName())).setMessage(R.string.controlcenter_delete_device_dialogmessage).setPositiveButton(R.string.Delete, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
try {
DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(device);
if (coordinator != null) {
coordinator.deleteDevice(device);
}
DeviceHelper.getInstance().removeBond(device);
} catch (Exception ex) {
GB.toast(context, "Error deleting device: " + ex.getMessage(), Toast.LENGTH_LONG, GB.ERROR, ex);
} finally {
Intent refreshIntent = new Intent(DeviceManager.ACTION_REFRESH_DEVICELIST);
LocalBroadcastManager.getInstance(context).sendBroadcast(refreshIntent);
}
}
}).setNegativeButton(R.string.Cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// do nothing
}
}).show();
}
});
}Example 31
| Project: boardgamegeek4android-master File: GameFragment.java View source code |
@DebugLog
private void openOrCloseRanks() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
TransitionManager.beginDelayedTransition(subtypeContainer, expansionTransition);
}
subtypeContainer.setVisibility(isRanksExpanded ? View.VISIBLE : View.GONE);
subtypeExpander.setImageResource(isRanksExpanded ? R.drawable.expander_close : R.drawable.expander_open);
}Example 32
| Project: packages-apps-Contacts-master File: ExpandingEntryCardView.java View source code |
private void expand() {
ChangeBounds boundsTransition = new ChangeBounds();
boundsTransition.setDuration(DURATION_EXPAND_ANIMATION_CHANGE_BOUNDS);
Fade fadeIn = new Fade(Fade.IN);
fadeIn.setDuration(DURATION_EXPAND_ANIMATION_FADE_IN);
fadeIn.setStartDelay(DELAY_EXPAND_ANIMATION_FADE_IN);
TransitionSet transitionSet = new TransitionSet();
transitionSet.addTransition(boundsTransition);
transitionSet.addTransition(fadeIn);
transitionSet.excludeTarget(R.id.text, /* exclude = */
true);
final ViewGroup transitionViewContainer = mAnimationViewGroup == null ? this : mAnimationViewGroup;
transitionSet.addListener(new TransitionListener() {
@Override
public void onTransitionStart(Transition transition) {
mListener.onExpand();
}
@Override
public void onTransitionEnd(Transition transition) {
mListener.onExpandDone();
}
@Override
public void onTransitionCancel(Transition transition) {
}
@Override
public void onTransitionPause(Transition transition) {
}
@Override
public void onTransitionResume(Transition transition) {
}
});
TransitionManager.beginDelayedTransition(transitionViewContainer, transitionSet);
mIsExpanded = true;
// In order to insert new entries, we may need to inflate them for the first time
inflateAllEntries(LayoutInflater.from(getContext()));
insertEntriesIntoViewGroup();
updateExpandCollapseButton(getCollapseButtonText(), DURATION_EXPAND_ANIMATION_CHANGE_BOUNDS);
}Example 33
| Project: platform_packages_apps_contacts-master File: ExpandingEntryCardView.java View source code |
private void expand() {
ChangeBounds boundsTransition = new ChangeBounds();
boundsTransition.setDuration(DURATION_EXPAND_ANIMATION_CHANGE_BOUNDS);
Fade fadeIn = new Fade(Fade.IN);
fadeIn.setDuration(DURATION_EXPAND_ANIMATION_FADE_IN);
fadeIn.setStartDelay(DELAY_EXPAND_ANIMATION_FADE_IN);
TransitionSet transitionSet = new TransitionSet();
transitionSet.addTransition(boundsTransition);
transitionSet.addTransition(fadeIn);
transitionSet.excludeTarget(R.id.text, /* exclude = */
true);
final ViewGroup transitionViewContainer = mAnimationViewGroup == null ? this : mAnimationViewGroup;
transitionSet.addListener(new TransitionListener() {
@Override
public void onTransitionStart(Transition transition) {
mListener.onExpand();
}
@Override
public void onTransitionEnd(Transition transition) {
mListener.onExpandDone();
}
@Override
public void onTransitionCancel(Transition transition) {
}
@Override
public void onTransitionPause(Transition transition) {
}
@Override
public void onTransitionResume(Transition transition) {
}
});
TransitionManager.beginDelayedTransition(transitionViewContainer, transitionSet);
mIsExpanded = true;
// In order to insert new entries, we may need to inflate them for the first time
inflateAllEntries(LayoutInflater.from(getContext()));
insertEntriesIntoViewGroup();
updateExpandCollapseButton(getCollapseButtonText(), DURATION_EXPAND_ANIMATION_CHANGE_BOUNDS);
}Example 34
| Project: packages_apps_settings-master File: SettingsActivity.java View source code |
/**
* Switch to a specific Fragment with taking care of validation, Title and BackStack
*/
private Fragment switchToFragment(String fragmentName, Bundle args, boolean validate, boolean addToBackStack, int titleResId, CharSequence title, boolean withTransition) {
if (ROMCONTROL_FRAGMENT.equals(fragmentName)) {
Intent ROMControlIntent = new Intent();
ROMControlIntent.setClassName("com.aokp.romcontrol", "com.aokp.romcontrol.MainActivity");
startActivity(ROMControlIntent);
finish();
return null;
} else if (THEMES_FRAGMENT.equals(fragmentName)) {
Intent themesIntent = new Intent();
themesIntent.setClassName("projekt.substratum", "projekt.substratum.LaunchActivity");
startActivity(themesIntent);
finish();
return null;
}
if (validate && !isValidFragment(fragmentName)) {
throw new IllegalArgumentException("Invalid fragment for this activity: " + fragmentName);
}
Fragment f = Fragment.instantiate(this, fragmentName, args);
FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.replace(R.id.main_content, f);
if (withTransition) {
TransitionManager.beginDelayedTransition(mContent);
}
if (addToBackStack) {
transaction.addToBackStack(SettingsActivity.BACK_STACK_PREFS);
}
if (titleResId > 0) {
transaction.setBreadCrumbTitle(titleResId);
} else if (title != null) {
transaction.setBreadCrumbTitle(title);
}
transaction.commitAllowingStateLoss();
getFragmentManager().executePendingTransactions();
return f;
}Example 35
| Project: platform_packages_apps_settings-master File: SettingsActivity.java View source code |
/**
* Switch to a specific Fragment with taking care of validation, Title and BackStack
*/
private Fragment switchToFragment(String fragmentName, Bundle args, boolean validate, boolean addToBackStack, int titleResId, CharSequence title, boolean withTransition) {
if (validate && !isValidFragment(fragmentName)) {
throw new IllegalArgumentException("Invalid fragment for this activity: " + fragmentName);
}
Fragment f = Fragment.instantiate(this, fragmentName, args);
FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.replace(R.id.main_content, f);
if (withTransition) {
TransitionManager.beginDelayedTransition(mContent);
}
if (addToBackStack) {
transaction.addToBackStack(SettingsActivity.BACK_STACK_PREFS);
}
if (titleResId > 0) {
transaction.setBreadCrumbTitle(titleResId);
} else if (title != null) {
transaction.setBreadCrumbTitle(title);
}
transaction.commitAllowingStateLoss();
getFragmentManager().executePendingTransactions();
return f;
}Example 36
| Project: CompositeAndroid-master File: ActivityDelegate.java View source code |
public TransitionManager getContentTransitionManager() { if (mPlugins.isEmpty()) { return getOriginal().super_getContentTransitionManager(); } final ListIterator<ActivityPlugin> iterator = mPlugins.listIterator(mPlugins.size()); final CallFun0<TransitionManager> superCall = new CallFun0<TransitionManager>("getContentTransitionManager()") { @Override public TransitionManager call() { if (iterator.hasPrevious()) { return iterator.previous().getContentTransitionManager(this); } else { return getOriginal().super_getContentTransitionManager(); } } }; return superCall.call(); }
Example 37
| Project: platform_frameworks_support-master File: TransitionManagerStaticsKitKat.java View source code |
@Override
public void go(SceneImpl scene) {
android.transition.TransitionManager.go(((SceneWrapper) scene).mScene);
}Example 38
| Project: BasicSceneExample-master File: MainActivity.java View source code |
@Override
public void onClick(View view) {
if (!transitionFlag) {
TransitionManager.go(scene2);
} else {
TransitionManager.go(scene1);
}
transitionFlag = !transitionFlag;
}Example 39
| Project: cogitolearning-examples-master File: MainActivity.java View source code |
public void showWebSiteForm(View view) {
TransitionManager.go(webSiteForm);
}Example 40
| Project: Noyze-master File: TransitionKitKat.java View source code |
@Override
public void beginDelayedTransition(ViewGroup sceneRoot) {
TransitionManager.beginDelayedTransition(sceneRoot);
}Example 41
| Project: opentok-android-sdk-samples-master File: ConstraintSetHelper.java View source code |
public void applyToLayout(ConstraintLayout layout, boolean animated) {
if (animated) {
TransitionManager.beginDelayedTransition(layout);
}
set.applyTo(layout);
}Example 42
| Project: ud862-samples-master File: MainActivity.java View source code |
public void click(View view) {
Slide slide = new Slide();
slide.setSlideEdge(Gravity.TOP);
ViewGroup root = (ViewGroup) findViewById(android.R.id.content);
TransitionManager.beginDelayedTransition(root, slide);
imageView.setVisibility(View.INVISIBLE);
}Example 43
| Project: android-ConstraintLayoutExamples-master File: ConstraintSetExampleActivity.java View source code |
// Method called when the ImageView within R.layout.constraintset_example_main
// is clicked.
public void toggleMode(View v) {
TransitionManager.beginDelayedTransition(mRootLayout);
mShowBigImage = !mShowBigImage;
applyConfig();
}Example 44
| Project: android-ui-toolkit-demos-master File: ListBindingAdapters.java View source code |
/**
* Starts a transition only if on KITKAT or higher.
*
* @param root The scene root
*/
private static void startTransition(ViewGroup root) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
TransitionManager.beginDelayedTransition(root);
}
}Example 45
| Project: android-OurStreets-master File: DetailFragment.java View source code |
private void setDescriptionText(@NonNull String title, @NonNull String detail) {
View view = getView();
if (view == null) {
return;
}
TransitionManager.beginDelayedTransition(((ViewGroup) view), mDescriptionChange);
ViewUtils.setTextOn(view, R.id.text_title, title);
ViewUtils.setTextOn(view, R.id.text_detail, detail);
}Example 46
| Project: android-PictureInPicture-master File: MovieView.java View source code |
/**
* Shows all the controls.
*/
public void showControls() {
TransitionManager.beginDelayedTransition(this);
mShade.setVisibility(View.VISIBLE);
mToggle.setVisibility(View.VISIBLE);
mFastForward.setVisibility(View.VISIBLE);
mFastRewind.setVisibility(View.VISIBLE);
mMinimize.setVisibility(View.VISIBLE);
}Example 47
| Project: IntranetEpitechV2-master File: FragmentTransitionCompat21.java View source code |
public static void beginDelayedTransition(ViewGroup sceneRoot, Object transitionObject) {
Transition transition = (Transition) transitionObject;
TransitionManager.beginDelayedTransition(sceneRoot, transition);
}Example 48
| Project: SulfurKeyboard-master File: FragmentTransitionCompat21.java View source code |
public static void beginDelayedTransition(ViewGroup sceneRoot, Object transitionObject) {
Transition transition = (Transition) transitionObject;
TransitionManager.beginDelayedTransition(sceneRoot, transition);
}Example 49
| Project: android-support-v4-master File: FragmentTransitionCompat21.java View source code |
public static void beginDelayedTransition(ViewGroup sceneRoot, Object transitionObject) {
Transition transition = (Transition) transitionObject;
TransitionManager.beginDelayedTransition(sceneRoot, transition);
}Example 50
| Project: ifican-master File: AnimUtils.java View source code |
public static void beginDelayedTransition(ViewGroup container) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
TransitionManager.beginDelayedTransition(container);
}Example 51
| Project: qconrio-master File: AnimUtils.java View source code |
public static void beginDelayedTransition(ViewGroup container) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
TransitionManager.beginDelayedTransition(container);
}Example 52
| Project: sdk-support-master File: FragmentTransitionCompat21.java View source code |
public static void beginDelayedTransition(ViewGroup sceneRoot, Object transitionObject) {
Transition transition = (Transition) transitionObject;
TransitionManager.beginDelayedTransition(sceneRoot, transition);
}