下面列出了android.view.animation.CycleInterpolator#android.view.animation.AccelerateInterpolator 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@NonNull
@Override
protected Animator onPopAnimator(final AnimationInfo fromInfo, final AnimationInfo toInfo) {
final View toView = toInfo.mSceneView;
final View fromView = fromInfo.mSceneView;
ValueAnimator fromAlphaAnimator = ObjectAnimator.ofFloat(fromView, View.ALPHA, 1.0f, 0.0f);
fromAlphaAnimator.setInterpolator(new LinearInterpolator());
fromAlphaAnimator.setDuration(150 * 20);
fromAlphaAnimator.setStartDelay(50 * 20);
ValueAnimator fromTranslateAnimator = ObjectAnimator.ofFloat(fromView, View.TRANSLATION_Y, 0, 0.08f * toView.getHeight());
fromTranslateAnimator.setInterpolator(new AccelerateInterpolator(2));
fromTranslateAnimator.setDuration(200 * 20);
ValueAnimator toAlphaAnimator = ObjectAnimator.ofFloat(toView, View.ALPHA, 0.7f, 1.0f);
toAlphaAnimator.setInterpolator(new LinearOutSlowInInterpolator());
toAlphaAnimator.setDuration(20 * 20);
return TransitionUtils.mergeAnimators(fromAlphaAnimator, fromTranslateAnimator, toAlphaAnimator);
}
private void runRotateAnimation(View view, long delay) {
view.setAlpha(0);
AnimatorSet set = new AnimatorSet();
ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(view,
"rotation", 0f, 360f);
ObjectAnimator objectAnimator2 = ObjectAnimator.ofFloat(view, "scaleX",
0f, 1f);
ObjectAnimator objectAnimator3 = ObjectAnimator.ofFloat(view, "scaleY",
0f, 1f);
ObjectAnimator objectAnimator4 = ObjectAnimator.ofFloat(view, "alpha",
0f, 1f);
objectAnimator2.setInterpolator(new AccelerateInterpolator(1.0f));
objectAnimator3.setInterpolator(new AccelerateInterpolator(1.0f));
set.setDuration(mDuration);
set.playTogether(objectAnimator, objectAnimator2, objectAnimator3,
objectAnimator4);
set.setStartDelay(delay);
set.start();
}
@Override
public void onPrevPressed() {
if (--currentStep > 0) {
switch (currentStep) {
case 2:
text2.setVisibility(View.GONE);
break;
case 1:
image.animate().alpha(0f).scaleY(0f).scaleX(0f)
.rotation(0).setInterpolator(new AccelerateInterpolator())
.setDuration(1000).setListener(new SimpleAnimatorListener() {
@Override
public void onAnimationEnd(Animator animation) {
container.setVisibility(View.GONE);
}
});
break;
}
return;
}
super.onPrevPressed();
}
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
if (isMainActivity) {
float toolbarTranslationY = mMainToolbar.getTranslationY(); // Save the Y value to a variable to prevent "getting" it multiple times
int TOOLBAR_HEIGHT = (int) mActivity.getResources().getDimension(R.dimen.main_toolbar_height);
if (mActivity.getSupportActionBar() != null) {
TOOLBAR_HEIGHT = mActivity.getSupportActionBar().getHeight();
}
// If the toolbar is not fully drawn when the scrolling state is idle - animate to be either fully shown or fully hidden.
// But don't run the animation if the amountScrolled amount is less that the toolbar height
// Also animate the shadow the length and direction
if (amountScrolled > mActivity.getResources().getDimension(R.dimen.additional_toolbar_height)) {
if (newState == 0 && toolbarTranslationY > -TOOLBAR_HEIGHT && toolbarTranslationY < -(TOOLBAR_HEIGHT / 2) && amountScrolled > TOOLBAR_HEIGHT) {
// Hide animation
mToolbarShadow.animate().translationY(-TOOLBAR_HEIGHT).setInterpolator(new AccelerateInterpolator()).start();
mMainToolbar.animate().translationY(-TOOLBAR_HEIGHT).setInterpolator(new AccelerateInterpolator()).start();
} else if (newState == 0 && toolbarTranslationY > -(TOOLBAR_HEIGHT / 2) && toolbarTranslationY < 0 && amountScrolled > TOOLBAR_HEIGHT) {
// Show animation
mToolbarShadow.animate().translationY(0).setInterpolator(new AccelerateInterpolator()).start();
mMainToolbar.animate().translationY(0).setInterpolator(new AccelerateInterpolator()).start();
}
}
}
}
public void updateTransition(View v) {
mDrawerListenerAdapter.removeAllTransitions();
ViewTransitionBuilder builder = ViewTransitionBuilder.transit(mGradient).translationX(-mGradient.getWidth(), 0);
switch (v.getId()) {
case R.id.interpolator_default:
break;
case R.id.interpolator_linear:
builder.interpolator(new LinearInterpolator());
break;
case R.id.interpolator_accelerate:
builder.interpolator(new AccelerateInterpolator());
break;
case R.id.interpolator_decelerate:
builder.interpolator(new DecelerateInterpolator());
break;
case R.id.interpolator_fastout:
builder.interpolator(new FastOutLinearInInterpolator());
break;
case R.id.interpolator_anticipate:
builder.interpolator(new AnticipateInterpolator());
break;
}
mDrawerListenerAdapter.addTransition(builder);
}
public void showBouceAnimation() {
playPauseFab.clearAnimation();
playPauseFab.setScaleX(0.9f);
playPauseFab.setScaleY(0.9f);
playPauseFab.setVisibility(View.VISIBLE);
playPauseFab.setPivotX(playPauseFab.getWidth() / 2);
playPauseFab.setPivotY(playPauseFab.getHeight() / 2);
playPauseFab.animate()
.setDuration(200)
.setInterpolator(new DecelerateInterpolator())
.scaleX(1.1f)
.scaleY(1.1f)
.withEndAction(() -> playPauseFab.animate()
.setDuration(200)
.setInterpolator(new AccelerateInterpolator())
.scaleX(1f)
.scaleY(1f)
.alpha(1f)
.start())
.start();
}
public void hideLogo() {
_isLogoVisible = false;
runOnUiThread(new Runnable() {
@Override
public void run() {
Animation fadeOut = new AlphaAnimation(0.8f, 0);
fadeOut.setInterpolator(new AccelerateInterpolator()); //and this
fadeOut.setStartOffset(0);
fadeOut.setDuration(500);
//
AnimationSet animation = new AnimationSet(false); //change to false
animation.addAnimation(fadeOut);
animation.setFillAfter(true);
RelativeLayout ivLogo = (RelativeLayout) findViewById(R.id.logo);
ivLogo.startAnimation(animation);
}
});
}
public void startCircleMajor(final Callback callback) {
PropertyValuesHolder rp = PropertyValuesHolder.ofFloat("radius", 0, circleMaxRadius);
PropertyValuesHolder ap = PropertyValuesHolder.ofFloat("alpha", 1, 0);
PropertyValuesHolder sp = PropertyValuesHolder.ofInt("stroke", (int) (circleMaxRadius * .15f), 0);
ValueAnimator va = ValueAnimator.ofPropertyValuesHolder(rp, ap, sp);
va.setInterpolator(new AccelerateInterpolator(.4f));
va.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
circleRadius = (float) animation.getAnimatedValue("radius");
circleAlpha = (float) animation.getAnimatedValue("alpha");
circleStroke = (int) animation.getAnimatedValue("stroke");
callback.onValueUpdated();
}
});
va.setDuration(450);
va.start();
}
private void createAnimators() {
alphaDownAnimator = ObjectAnimator.ofFloat(mView.get(), "alpha", config.getAlpha());
alphaUpAnimator = ObjectAnimator.ofFloat(mView.get(), "alpha", 1.0f);
scaleXDownAnimator = ObjectAnimator.ofFloat(mView.get(), "scaleX", config.getScaleDown());
scaleXUpAnimator = ObjectAnimator.ofFloat(mView.get(), "scaleX", 1.0f);
scaleYDownAnimator = ObjectAnimator.ofFloat(mView.get(), "scaleY", config.getScaleDown());
scaleYUpAnimator = ObjectAnimator.ofFloat(mView.get(), "scaleY", 1.0f);
downSet = new AnimatorSet();
downSet.setDuration(config.getDuration());
downSet.setInterpolator(new AccelerateInterpolator());
downSet.playTogether(alphaDownAnimator, scaleXDownAnimator, scaleYDownAnimator);
upSet = new AnimatorSet();
upSet.setDuration(config.getDuration());
upSet.setInterpolator(new FastOutSlowInInterpolator());
upSet.playTogether(alphaUpAnimator, scaleXUpAnimator, scaleYUpAnimator);
finalAnimationListener = new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
onClick(mView.get());
}
};
}
/**
* Internal void to start the circles animation.
* <p>
* when this void is called the circles radius would be updated by a
* {@link ValueAnimator} and then it will call the {@link View}'s
* invalidate() void witch calls the onDraw void each time so a bigger
* circle would be drawn each time till the cirlce's fill the whole screen.
* </p>
*/
private void animateCirlce() {
if (circles_fill_type == CIRLCES_FILL_HEIGHT_TYPE) {
circle_max_radius = screen_height + (screen_height / 4);
} else {
circle_max_radius = screen_width + (screen_width / 4);
}
ValueAnimator va = ValueAnimator.ofInt(0, circle_max_radius / 3);
va.setDuration(1000);
va.addListener(this);
va.setInterpolator(new AccelerateInterpolator());
va.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
public void onAnimationUpdate(ValueAnimator animation) {
int value = (int) animation.getAnimatedValue();
circle_radius = value * 3;
invalidate();
}
});
va.start();
}
private void setAnimator(final int index){
valueAnimators[index] = ValueAnimator.ofFloat(maxScale, minScale);
valueAnimators[index].setStartDelay(delays[index]);
valueAnimators[index].setDuration(650);
valueAnimators[index].setRepeatCount(ValueAnimator.INFINITE);
valueAnimators[index].setRepeatMode(ValueAnimator.REVERSE);
valueAnimators[index].setInterpolator(new AccelerateInterpolator());
valueAnimators[index].addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
yScale[index] = (float) animation.getAnimatedValue();
if(index == 0 || index == valueAnimators.length){
getTarget().invalidate();
}
}
});
}
public TaskGuide(Context context, QQToken qqtoken)
{
super(context, qqtoken);
d = null;
e = null;
g = new Handler(Looper.getMainLooper());
i = com.tencent.open.z.a;
j = com.tencent.open.z.a;
A = 0;
B = 0;
C = 0.0F;
D = new AccelerateInterpolator();
E = false;
a = false;
F = false;
G = false;
L = null;
M = null;
f = (WindowManager)context.getSystemService("window");
d();
}
protected void initAnimation(final boolean show) {
mAnimation = new Animation() {
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
if (interpolatedTime < 0) { // 预处理加速器可能出现负数
return;
}
MarginLayoutParams params = (MarginLayoutParams) mView.getLayoutParams();
policyMargin(interpolatedTime, params, show);
mView.setLayoutParams(params);
}
};
// mAnimation.setInterpolator(new AnticipateInterpolator());
mAnimation.setInterpolator(new AccelerateInterpolator());
mAnimation.setDuration(300);
}
@Override
public int onFinish(@NonNull RefreshLayout layout, boolean success) {
mShowOuter = false;
mShowBoll = false;
ValueAnimator animator = ValueAnimator.ofFloat(0, 1);
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
mFinishRatio = (float) animation.getAnimatedValue();
RefreshCircleHeader.this.invalidate();
}
});
animator.setInterpolator(new AccelerateInterpolator());
animator.setDuration(DURATION_FINISH);
animator.start();
return DURATION_FINISH;
}
private void init(Context context, View target) {
this.context = context;
this.target = target;
fadeIn = new AlphaAnimation(0.0f, 1.0f);
fadeIn.setInterpolator(new DecelerateInterpolator());
fadeIn.setDuration(200);
fadeOut = new AlphaAnimation(1.0f, 0.0f);
fadeOut.setInterpolator(new AccelerateInterpolator());
fadeOut.setDuration(200);
this.isShown = false;
if (this.target != null) {
applyTo(this.target);
} else {
show();
}
}
@OnClick(R.id.fab)
public void onClick(View view) {
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)
== PackageManager.PERMISSION_GRANTED) {
ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(mFab, "translationY", 0, mFab
.getHeight() * 2).setDuration(200L);
objectAnimator.setInterpolator(new AccelerateInterpolator());
objectAnimator.addListener(this);
objectAnimator.start();
} else {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.permission_setting);
builder.setMessage(R.string.permission_need_des);
builder.setPositiveButton(R.string.permission_go, (dialog, which) -> {
Intent intent = new Intent();
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
Uri uri = Uri.fromParts("package", getPackageName(), null);
intent.setData(uri);
startActivity(intent);
});
builder.setNegativeButton(R.string.cancel, null);
builder.show();
}
}
@Override
public void onDragDismiss(final ArtboardView view, boolean isDragDown) {
mIsDragDismiss = true;
switchToArtboardListView();
view.animate().alpha(0.0F)
.translationY(isDragDown ? -view.getHeight() : view.getHeight())
.setDuration(AnimUtils.DURATION)
.setInterpolator(new AccelerateInterpolator())
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
mIsDragDismiss = false;
mArtboardPagerView.getBackground().mutate().setAlpha(255);
view.setTranslationY(0.0F);
view.setAlpha(1.0F);
}
})
.start();
}
public static void showHeight(final View view,float start,float end){
final ValueAnimator animator=ValueAnimator.ofFloat(start,end);
final ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
float value = (Float) animator.getAnimatedValue();
layoutParams.height=(int) value;
view.setLayoutParams(layoutParams);
Log.i(TAG, "onAnimationUpdate: value="+value);
}
});
animator.setDuration(500);
animator.setInterpolator(new AccelerateInterpolator());
animator.start();
}
public static Completable fadeOut(final View view, final int duration) {
return animate(view, new AccelerateInterpolator())
.duration(duration)
.fadeOut()
.onAnimationCancel(aView -> aView.setAlpha(TRANSPARENT))
.schedule();
}
@Override
protected Animation initExitAnimation() {
AlphaAnimation alphaAnimation = new AlphaAnimation(1.0F, 0.0F);
alphaAnimation.setDuration(300L);
alphaAnimation.setInterpolator(new AccelerateInterpolator());
return alphaAnimation;
}
@Override
public void onScrollStateChanged(RecyclerView recyclerView, final int newState) {
super.onScrollStateChanged(recyclerView, newState);
if (RecyclerView.SCROLL_STATE_IDLE == newState || RecyclerView.SCROLL_STATE_SETTLING == newState) {
if (Math.abs(offsetY) >= LIMIT) {
if (expandableButton.getState() == ExpandableButtonView.State.FINISHED) {
expandableButton.removeBottomToolbar();
expandableButton.setState(State.IDLE);
hasStopped = false;
} else if (hasStopped && expandableButton.getState() == State.IDLE) {
if (expandableButton.getScaleX() > 0f) {
expandableButton.setClickable(false);
expandableButton.animate().setInterpolator(new AccelerateInterpolator())
.scaleY(0.f).scaleX(0.f).setDuration(FADE_IN_OUT_DURATION).start();
}
}
if (!hasStopped) {
hasStopped = (newState == RecyclerView.SCROLL_STATE_IDLE)
|| (Math.abs(offsetY) >= 8 * LIMIT);
}
offsetY = 0;
}
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
if (expandableButton.getScaleX() < 1.f) {
expandableButton.setClickable(true);
expandableButton.animate().scaleX(1.f).setListener(null).
setInterpolator(new DecelerateInterpolator()).scaleY(1.f).
setDuration(FADE_IN_OUT_DURATION / 2).start();
}
}
}
}
private void init(Context context, View target, int tabIndex) {
this.context = context;
this.target = target;
this.targetTabIndex = tabIndex;
// apply defaults
badgePosition = DEFAULT_POSITION;
badgeMarginH = dipToPixels(DEFAULT_MARGIN_DIP);
badgeMarginV = badgeMarginH;
badgeColor = DEFAULT_BADGE_COLOR;
setTypeface(Typeface.DEFAULT_BOLD);
int paddingPixels = dipToPixels(DEFAULT_LR_PADDING_DIP);
setPadding(paddingPixels, 0, paddingPixels, 0);
setTextColor(DEFAULT_TEXT_COLOR);
fadeIn = new AlphaAnimation(0, 1);
fadeIn.setInterpolator(new DecelerateInterpolator());
fadeIn.setDuration(200);
fadeOut = new AlphaAnimation(1, 0);
fadeOut.setInterpolator(new AccelerateInterpolator());
fadeOut.setDuration(200);
isShown = false;
if (this.target != null) {
applyTo(this.target);
} else {
show();
}
}
private void showListView() {
if (animationInProgress || scrollInProgress || listViewIsShown) return;
listView.setEnabled(true);
animationInProgress = true;
this.setVisibility(View.VISIBLE);
this.bringToFront();
this.readyToHide = false;
// Scale picker box if animations enabled
if (selectorAnimationsEnabled && null != this.pickerBox) {
ScaleAnimation scaleAnimation = new ScaleAnimation(1f, 1f + scaleFactorDelta, 1f, 1f + scaleFactorDelta,
Animation.RELATIVE_TO_SELF, selectorAnimationCenterPivot ? 0.5f : 0f, Animation.RELATIVE_TO_SELF, 0.5f);
scaleAnimation.setInterpolator(new AccelerateInterpolator());
scaleAnimation.setDuration(100);
scaleAnimation.setFillAfter(true);
this.pickerBox.getCellRoot().startAnimation(scaleAnimation);
}
// Show picker view animation
AlphaAnimation showAnimation = new AlphaAnimation(0f, 1f);
showAnimation.setDuration(200);
showAnimation.setInterpolator(new AccelerateInterpolator());
showAnimation.setAnimationListener(new AnimationListenerAdapter() {
@Override
public void onAnimationEnd(Animation animation) {
animationInProgress = false;
listViewIsShown = true;
hideListView();
}
});
this.startAnimation(showAnimation);
}
private void newHideAnim() {
ObjectAnimator translationHide = ObjectAnimator.ofFloat(rvAlbumItems, "translationY", 0, rootSelectorView.getTop());
ObjectAnimator alphaHide = ObjectAnimator.ofFloat(rootViewAlbumItems, "alpha", 1.0f, 0.0f);
translationHide.setDuration(200);
setHide = new AnimatorSet();
setHide.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
rootViewAlbumItems.setVisibility(View.GONE);
}
});
setHide.setInterpolator(new AccelerateInterpolator());
setHide.play(translationHide).with(alphaHide);
}
public static Animator animFadeIn(View view)
{
ObjectAnimator objectanimator = ObjectAnimator.ofFloat(view, "alpha", new float[] {
0.3F, 1.0F
});
objectanimator.setInterpolator(new AccelerateInterpolator());
return objectanimator;
}
public CustomSwipeRefreshLayout(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
setWillNotDraw(false);
mTopProgressBar = new CustomSwipeProgressBar(this);
setProgressBarHeight(PROGRESS_BAR_HEIGHT);
mDecelerateInterpolator = new DecelerateInterpolator(DECELERATE_INTERPOLATION_FACTOR);
mAccelerateInterpolator = new AccelerateInterpolator(ACCELERATE_INTERPOLATION_FACTOR);
final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CustomSwipeRefreshLayout);
if (a != null) {
refresshMode = a.getInteger(R.styleable.CustomSwipeRefreshLayout_refresh_mode, REFRESH_MODE_SWIPE);
setRefreshMode(refresshMode);
boolean progressBarEnabled = a.getBoolean(R.styleable.CustomSwipeRefreshLayout_enable_top_progress_bar, true);
mReturnToOriginalTimeout = a.getInteger(R.styleable.CustomSwipeRefreshLayout_time_out_return_to_top,
RETURN_TO_ORIGINAL_POSITION_TIMEOUT);
mRefreshCompleteTimeout = a.getInteger(R.styleable.CustomSwipeRefreshLayout_time_out_refresh_complete,
REFRESH_COMPLETE_POSITION_TIMEOUT);
mReturnToTopDuration = a.getInteger(R.styleable.CustomSwipeRefreshLayout_return_to_top_duration,
RETURN_TO_TOP_DURATION);
mReturnToHeaderDuration = a.getInteger(R.styleable.CustomSwipeRefreshLayout_return_to_header_duration,
RETURN_TO_HEADER_DURATION);
keepTopRefreshingHead = a.getBoolean(R.styleable.CustomSwipeRefreshLayout_keep_refresh_head, false);
int color1 = a.getColor(R.styleable.CustomSwipeRefreshLayout_top_progress_bar_color_1, 0);
int color2 = a.getColor(R.styleable.CustomSwipeRefreshLayout_top_progress_bar_color_2, 0);
int color3 = a.getColor(R.styleable.CustomSwipeRefreshLayout_top_progress_bar_color_3, 0);
int color4 = a.getColor(R.styleable.CustomSwipeRefreshLayout_top_progress_bar_color_4, 0);
setProgressBarColor(color1, color2, color3, color4);
enableTopProgressBar(progressBarEnabled);
a.recycle();
}
}
@Override
public void onNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton child, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) {
super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);
if (dyConsumed > 0)
child.animate().translationY(child.getHeight() * 4).setInterpolator(new AccelerateInterpolator(2)).start();
else
child.animate().translationY(/*-Measure.getNavigationBarSize(coordinatorLayout
.getContext()).y*/0).setInterpolator(new DecelerateInterpolator(2)).start();
}
public void showHeartAnimation() {
favoriteIcon.clearAnimation();
favoriteIcon.setAlpha(0f);
favoriteIcon.setScaleX(0f);
favoriteIcon.setScaleY(0f);
favoriteIcon.setVisibility(View.VISIBLE);
favoriteIcon.setPivotX(favoriteIcon.getWidth() / 2);
favoriteIcon.setPivotY(favoriteIcon.getHeight() / 2);
favoriteIcon.animate()
.setDuration(ViewUtil.PHONOGRAPH_ANIM_TIME / 2)
.setInterpolator(new DecelerateInterpolator())
.scaleX(1f)
.scaleY(1f)
.alpha(1f)
.setListener(new SimpleAnimatorListener() {
@Override
public void onAnimationCancel(Animator animation) {
favoriteIcon.setVisibility(View.INVISIBLE);
}
})
.withEndAction(new Runnable() {
@Override
public void run() {
favoriteIcon.animate()
.setDuration(ViewUtil.PHONOGRAPH_ANIM_TIME / 2)
.setInterpolator(new AccelerateInterpolator())
.scaleX(0f)
.scaleY(0f)
.alpha(0f)
.start();
}
})
.start();
}
private void init(Context context, View target, int tabIndex) {
this.context = context;
this.target = target;
this.targetTabIndex = tabIndex;
// apply defaults
badgePosition = DEFAULT_POSITION;
badgeMarginH = dipToPixels(DEFAULT_MARGIN_DIP);
badgeMarginV = badgeMarginH;
badgeColor = DEFAULT_BADGE_COLOR;
setTypeface(Typeface.DEFAULT_BOLD);
int paddingPixels = dipToPixels(DEFAULT_LR_PADDING_DIP);
setPadding(paddingPixels, 0, paddingPixels, 0);
setTextColor(DEFAULT_TEXT_COLOR);
fadeIn = new AlphaAnimation(0, 1);
fadeIn.setInterpolator(new DecelerateInterpolator());
fadeIn.setDuration(200);
fadeOut = new AlphaAnimation(1, 0);
fadeOut.setInterpolator(new AccelerateInterpolator());
fadeOut.setDuration(200);
isShown = false;
if (this.target != null) {
applyTo(this.target);
} else {
show();
}
}
protected final void translateChild(View v, Point prev, Point now) {
TranslateAnimation translate = new TranslateAnimation(Animation.ABSOLUTE, -now.x + prev.x, Animation.ABSOLUTE, 0, Animation.ABSOLUTE, -now.y
+ prev.y, Animation.ABSOLUTE, 0);
translate.setInterpolator(new AccelerateInterpolator(4f));
translate.setDuration(350);
translate.setFillEnabled(false);
translate.setFillAfter(false);
v.clearAnimation();
v.startAnimation(translate);
}