use of android.transition.Transition in project MaterialLogin by fanrunqi.
the class RegisterActivity method ShowEnterAnimation.
private void ShowEnterAnimation() {
Transition transition = TransitionInflater.from(this).inflateTransition(R.transition.fabtransition);
getWindow().setSharedElementEnterTransition(transition);
transition.addListener(new Transition.TransitionListener() {
@Override
public void onTransitionStart(Transition transition) {
cvAdd.setVisibility(View.GONE);
}
@Override
public void onTransitionEnd(Transition transition) {
transition.removeListener(this);
animateRevealShow();
}
@Override
public void onTransitionCancel(Transition transition) {
}
@Override
public void onTransitionPause(Transition transition) {
}
@Override
public void onTransitionResume(Transition transition) {
}
});
}
use of android.transition.Transition in project LookLook by xinghongfei.
the class TopNewsDescribeActivity method initData.
protected void initData() {
id = getIntent().getStringExtra("docid");
title = getIntent().getStringExtra("title");
mTextView.setText(title);
mImageUrl = getIntent().getStringExtra("image");
scrollListener = new NestedScrollView.OnScrollChangeListener() {
@Override
public void onScrollChange(NestedScrollView v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
if (oldScrollY < 168) {
mShot.setOffset(-oldScrollY);
mTextView.setOffset(-oldScrollY);
}
}
};
Glide.with(this).load(mImageUrl).override(width, heigh).listener(glideLoadListener).centerCrop().diskCacheStrategy(DiskCacheStrategy.SOURCE).into(mShot);
mTopNewsDesPresenter = new TopNewsDesPresenterImpl(this);
mNest.setOnScrollChangeListener(scrollListener);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
postponeEnterTransition();
mShot.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
@Override
public boolean onPreDraw() {
mShot.getViewTreeObserver().removeOnPreDrawListener(this);
startPostponedEnterTransition();
return true;
}
});
}
mReturnHomeListener = new AnimUtils.TransitionListenerAdapter() {
@Override
public void onTransitionStart(Transition transition) {
super.onTransitionStart(transition);
// hide the fab as for some reason it jumps position?? TODO work out why
mToolbar.animate().alpha(0f).setDuration(100).setInterpolator(new AccelerateInterpolator());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
mShot.setElevation(1f);
mToolbar.setElevation(0f);
}
mNest.animate().alpha(0f).setDuration(50).setInterpolator(new AccelerateInterpolator());
}
};
mEnterTrasitionListener = new AnimUtils.TransitionListenerAdapter() {
@Override
public void onTransitionEnd(Transition transition) {
super.onTransitionEnd(transition);
// 解决5.0 shara element bug
ValueAnimator valueAnimator = ValueAnimator.ofInt(0, 100).setDuration(100);
valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
// mShot.setOffset((Integer) valueAnimator.getAnimatedValue() * 10);
mNest.smoothScrollTo((Integer) valueAnimator.getAnimatedValue() / 10, 0);
}
});
valueAnimator.start();
// mShot.setAlpha(0.5f);
// mShot.animate().alpha(1f).setDuration(800L).start();
}
@Override
public void onTransitionResume(Transition transition) {
super.onTransitionResume(transition);
}
};
}
use of android.transition.Transition in project Hummingbird-for-Android by xiprox.
the class FullscreenImageActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
int black = Color.parseColor("#000000");
getWindow().setBackgroundDrawable(new ColorDrawable(black));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
Transition sharedElem = TransitionInflater.from(this).inflateTransition(R.transition.move_transition);
getWindow().setSharedElementEnterTransition(sharedElem);
getWindow().setSharedElementExitTransition(sharedElem);
getWindow().setStatusBarColor(black);
}
super.onCreate(savedInstanceState);
ImageView mImageView = new ImageView(this);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
mImageView.setTransitionName(TRANSITION_NAME_IMAGE);
setContentView(mImageView);
Bundle bundle = getIntent().getExtras();
if (bundle != null && bundle.getString(ARG_IMAGE_URL) != null)
mImageUrl = bundle.getString(ARG_IMAGE_URL);
if (mImageUrl != null) {
Picasso.with(this).load(mImageUrl).into(mImageView);
} else {
Toast.makeText(this, R.string.error_cant_load_image, Toast.LENGTH_SHORT).show();
finish();
}
new PhotoViewAttacher(mImageView);
}
use of android.transition.Transition in project Music-Player by andremion.
the class DetailActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.content_detail);
mCoverView = (MusicCoverView) findViewById(R.id.cover);
mCoverView.setCallbacks(new MusicCoverView.Callbacks() {
@Override
public void onMorphEnd(MusicCoverView coverView) {
// Nothing to do
}
@Override
public void onRotateEnd(MusicCoverView coverView) {
supportFinishAfterTransition();
}
});
getWindow().getSharedElementEnterTransition().addListener(new TransitionAdapter() {
@Override
public void onTransitionEnd(Transition transition) {
play();
mCoverView.start();
}
});
}
use of android.transition.Transition in project platform_frameworks_base by android.
the class BackStackRecord method mergeTransitions.
private static Transition mergeTransitions(Transition enterTransition, Transition exitTransition, Transition sharedElementTransition, Fragment inFragment, boolean isBack) {
boolean overlap = true;
if (enterTransition != null && exitTransition != null && inFragment != null) {
overlap = isBack ? inFragment.getAllowReturnTransitionOverlap() : inFragment.getAllowEnterTransitionOverlap();
}
// Wrap the transitions. Explicit targets like in enter and exit will cause the
// views to be targeted regardless of excluded views. If that happens, then the
// excluded fragments views (hidden fragments) will still be in the transition.
Transition transition;
if (overlap) {
// Regular transition -- do it all together
TransitionSet transitionSet = new TransitionSet();
if (enterTransition != null) {
transitionSet.addTransition(enterTransition);
}
if (exitTransition != null) {
transitionSet.addTransition(exitTransition);
}
if (sharedElementTransition != null) {
transitionSet.addTransition(sharedElementTransition);
}
transition = transitionSet;
} else {
// First do exit, then enter, but allow shared element transition to happen
// during both.
Transition staggered = null;
if (exitTransition != null && enterTransition != null) {
staggered = new TransitionSet().addTransition(exitTransition).addTransition(enterTransition).setOrdering(TransitionSet.ORDERING_SEQUENTIAL);
} else if (exitTransition != null) {
staggered = exitTransition;
} else if (enterTransition != null) {
staggered = enterTransition;
}
if (sharedElementTransition != null) {
TransitionSet together = new TransitionSet();
if (staggered != null) {
together.addTransition(staggered);
}
together.addTransition(sharedElementTransition);
transition = together;
} else {
transition = staggered;
}
}
return transition;
}
Aggregations