本文整理匯總了Java中android.transition.TransitionValues類的典型用法代碼示例。如果您正苦於以下問題:Java TransitionValues類的具體用法?Java TransitionValues怎麽用?Java TransitionValues使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
TransitionValues類屬於android.transition包,在下文中一共展示了TransitionValues類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createAnimator
import android.transition.TransitionValues; //導入依賴的package包/類
@Override
public Animator createAnimator(ViewGroup sceneRoot, TransitionValues startValues, TransitionValues endValues) {
if (startValues == null || endValues == null) {
return null;
}
Float startSize = (Float) startValues.values.get(PROPNAME_TEXT_SIZE);
Float endSize = (Float) endValues.values.get(PROPNAME_TEXT_SIZE);
if (startSize == null || endSize == null || startSize.floatValue() == endSize.floatValue()) {
return null;
}
TextView view = (TextView) endValues.view;
view.setTextSize(TypedValue.COMPLEX_UNIT_PX, startSize);
return ObjectAnimator.ofFloat(view, TEXT_SIZE_PROPERTY, startSize, endSize);
}
示例2: captureStartValues
import android.transition.TransitionValues; //導入依賴的package包/類
@Override
public void captureStartValues(TransitionValues transitionValues) {
final View view = transitionValues.view;
if (view.getWidth() <= 0 || view.getHeight() <= 0) {
return;
}
captureValues(transitionValues);
Bitmap bitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(),
Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
view.draw(canvas);
transitionValues.values.put(PROPERTY_IMAGE, bitmap);
}
示例3: createAnimator
import android.transition.TransitionValues; //導入依賴的package包/類
@Override
public Animator createAnimator(ViewGroup sceneRoot,
TransitionValues startValues,
TransitionValues endValues) {
if (animatable == null || endValues == null
|| !(endValues.view instanceof ImageView)) return null;
ImageView iv = (ImageView) endValues.view;
iv.setImageDrawable((Drawable) animatable);
// need to return a non-null Animator even though we just want to listen for the start
ValueAnimator transition = ValueAnimator.ofInt(0, 1);
transition.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
animatable.start();
}
});
return transition;
}
示例4: onAppear
import android.transition.TransitionValues; //導入依賴的package包/類
@Override
public Animator onAppear(ViewGroup sceneRoot, View view,
TransitionValues startValues,
TransitionValues endValues) {
view.setPivotX(view.getWidth());
view.setPivotY(view.getHeight()/2);
return ObjectAnimator.ofFloat(view,View.SCALE_X,0,1).setDuration(400);
}
示例5: captureEndValues
import android.transition.TransitionValues; //導入依賴的package包/類
@Override
public void captureEndValues(TransitionValues transitionValues) {
super.captureEndValues(transitionValues);
final View view = transitionValues.view;
if (view.getWidth() <= 0 || view.getHeight() <= 0) {
return;
}
transitionValues.values.put(PROPERTY_COLOR, endColor);//ContextCompat.getColor(view.getContext(), R.color.dialog_background_color)
transitionValues.values.put(PROPERTY_CORNER_RADIUS, endCornerRadius);
}
示例6: captureEndValues
import android.transition.TransitionValues; //導入依賴的package包/類
@Override
public void captureEndValues(TransitionValues transitionValues) {
super.captureEndValues(transitionValues);
Photo photo = Mysplash.getInstance().getPhoto();
if (photo != null) {
int screenWidth = context.getResources().getDisplayMetrics().widthPixels;
int[] sizes = FreedomImageView.getMeasureSize(
context, screenWidth, photo.width, photo.height, true);
Rect bounds = (Rect) transitionValues.values.get(PROPNAME_BOUNDS);
bounds.left = 0;
bounds.top = 0;
bounds.right = sizes[0];
bounds.bottom = sizes[1];
transitionValues.values.put(PROPNAME_BOUNDS, bounds);
}
}
示例7: onAppear
import android.transition.TransitionValues; //導入依賴的package包/類
@Override
public Animator onAppear(ViewGroup sceneRoot, View view,
TransitionValues startValues, TransitionValues endValues) {
view.setRotationY(-90);
Animator rotateY = ObjectAnimator.ofFloat(view, "rotationY", 0);
rotateY.setDuration(1000);
rotateY.setStartDelay(500);
CardFlipRotationListener listener = new CardFlipRotationListener(view);
rotateY.addListener(listener);
addListener(listener);
rotateY.addPauseListener(listener);
// set Interpolator later
return rotateY;
}
示例8: onAppear
import android.transition.TransitionValues; //導入依賴的package包/類
@Override
public Animator onAppear(ViewGroup sceneRoot, View view, TransitionValues startValues,
TransitionValues endValues) {
if (endValues == null) {
return null;
}
int[] position = (int[]) endValues.values.get(PROPNAME_SCREEN_POSITION);
int left = position[0];
float endX = view.getTranslationX();
float startX = mSlideCalculator.getGoneX(sceneRoot, view, position, mDistance);
final Animator slideAnimator = TranslationAnimationCreator.createAnimation(view, endValues,
left, startX, endX, APPEAR_INTERPOLATOR, this);
if (slideAnimator == null) {
return null;
}
mFade.setInterpolator(APPEAR_INTERPOLATOR);
final AnimatorSet set = new AnimatorSet();
set.play(slideAnimator).with(mFade.onAppear(sceneRoot, view, startValues, endValues));
Long delay = (Long ) endValues.values.get(PROPNAME_DELAY);
if (delay != null) {
set.setStartDelay(delay);
}
return set;
}
示例9: onDisappear
import android.transition.TransitionValues; //導入依賴的package包/類
@Override
public Animator onDisappear(ViewGroup sceneRoot, final View view, TransitionValues startValues,
TransitionValues endValues) {
if (!(view instanceof ImageView)) {
return null;
}
final ImageView iv = (ImageView) view;
final Drawable drawable = iv.getDrawable();
if (drawable == null) {
return null;
}
final ValueAnimator anim = ValueAnimator.ofInt(255, 0);
anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
final int alpha = (int) valueAnimator.getAnimatedValue();
drawable.setAlpha(alpha);
}
});
return anim;
}
示例10: createAnimator
import android.transition.TransitionValues; //導入依賴的package包/類
@Override
public Animator createAnimator(final ViewGroup sceneRoot,
TransitionValues startValues,
final TransitionValues endValues) {
Animator changeBounds = super.createAnimator(sceneRoot, startValues, endValues);
if (startValues == null || endValues == null || changeBounds == null)
return null;
// if (endValues.view instanceof ViewGroup) {
// ViewGroup vg = (ViewGroup) endValues.view;
// float offset = vg.getHeight() / 3;
// for (int i = 0; i < vg.getChildCount(); i++) {
// View v = vg.getChildAt(i);
// v.setTranslationY(offset);
// v.setAlpha(0f);
// v.animate()
// .alpha(1f)
// .translationY(0f)
// .setDuration(150)
// .setStartDelay(150)
// .setInterpolator(AnimationUtils.loadInterpolator(vg.getContext(),
// android.R.interpolator.fast_out_slow_in));
// offset *= 1.8f;
// }
// }
changeBounds.setDuration(500);
changeBounds.setInterpolator(AnimationUtils.loadInterpolator(sceneRoot.getContext(),
android.R.interpolator.fast_out_slow_in));
return changeBounds;
}
示例11: createAnimator
import android.transition.TransitionValues; //導入依賴的package包/類
@Override public Animator createAnimator(final ViewGroup sceneRoot, TransitionValues startValues,
TransitionValues endValues) {
senderNameView.setVisibility(View.INVISIBLE);
senderMailView.setVisibility(View.INVISIBLE);
separatorLine.setVisibility(View.INVISIBLE);
return super.createAnimator(sceneRoot, startValues, endValues);
}
示例12: onAppear
import android.transition.TransitionValues; //導入依賴的package包/類
@Override
public Animator onAppear(ViewGroup sceneRoot, final View view, TransitionValues startValues,
TransitionValues endValues) {
Animator reveal = ViewAnimationUtils.createCircularReveal(view, 140, 200,
0, 1000);
return new NoPauseAnimator(reveal);
}
示例13: onDisappear
import android.transition.TransitionValues; //導入依賴的package包/類
@Override
public Animator onDisappear(ViewGroup sceneRoot, View view, TransitionValues startValues,
TransitionValues endValues) {
Animator reveal = ViewAnimationUtils.createCircularReveal(view, 140, 200,
1000, 0);
return new NoPauseAnimator(reveal);
}
示例14: onAppear
import android.transition.TransitionValues; //導入依賴的package包/類
@Override
public Animator onAppear(ViewGroup sceneRoot, View view, TransitionValues startValues, TransitionValues endValues) {
Animator animator = ViewAnimationUtils.createCircularReveal(view, mEpicenter.x, mEpicenter.y,
mSmallRadius, mBigRadius);
animator.setDuration(mDuration);
return new PauseableAnimator(animator);
}
示例15: onDisappear
import android.transition.TransitionValues; //導入依賴的package包/類
@Override
public Animator onDisappear(ViewGroup sceneRoot, View view, TransitionValues startValues, TransitionValues endValues) {
Animator animator = ViewAnimationUtils.createCircularReveal(view, mEpicenter.x, mEpicenter.y,
mBigRadius, mSmallRadius);
animator.setDuration(mDuration);
return new PauseableAnimator(animator);
}