下面列出了怎么用android.support.v4.view.animation.LinearOutSlowInInterpolator的API类实例代码及写法,或者点击链接到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);
}
@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);
}
@NonNull
@Override
protected Animator onPopAnimator(final AnimationInfo fromInfo, final AnimationInfo toInfo) {
if (fromInfo.mIsTranslucent) {
return mDialogSceneAnimatorExecutor.onPopAnimator(fromInfo, 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);
fromAlphaAnimator.setStartDelay(50);
ValueAnimator fromTranslateAnimator = ObjectAnimator.ofFloat(fromView, View.TRANSLATION_Y, 0, 0.08f * toView.getHeight());
fromTranslateAnimator.setInterpolator(new AccelerateInterpolator(2));
fromTranslateAnimator.setDuration(200);
ValueAnimator toAlphaAnimator = ObjectAnimator.ofFloat(toView, View.ALPHA, 0.7f, 1.0f);
toAlphaAnimator.setInterpolator(new LinearOutSlowInInterpolator());
toAlphaAnimator.setDuration(200);
return TransitionUtils.mergeAnimators(fromAlphaAnimator, fromTranslateAnimator, toAlphaAnimator);
}
private void animateInFrameDetails() {
frameDetails.setVisibility(View.VISIBLE);
ViewUtils.onLaidOut(frameDetails, new Runnable() {
@Override
public void run() {
ObjectAnimator alpha = ObjectAnimator.ofFloat(frameDetails, View.ALPHA, 0.4f, 1f);
ObjectAnimator translate = ofFloat(frameDetails, View.TRANSLATION_Y, frameDetails.getHeight() * 0.3f, 0f);
AnimatorSet set = new AnimatorSet();
set.playTogether(alpha, translate);
set.setDuration(ANIM_DURATION);
set.setInterpolator(new LinearOutSlowInInterpolator());
set.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
frameMaster.setVisibility(View.GONE);
}
});
set.start();
}
});
}
@Test
public void preparePartialTransition_setsPartialInterpolator() {
//given
final StaggeredAnimationGroup spiedGroup = prepareSpiedGroup();
final TimeInterpolator testInterpolator = new LinearOutSlowInInterpolator();
final Transition spiedTransition = spy(new AutoTransition());
final StaggeredAnimationGroup.PartialTransitionFactory factory =
new StaggeredAnimationGroup.PartialTransitionFactory() {
@Override
public Transition createPartialTransition(boolean show, int viewId, int indexInTransition) {
return spiedTransition;
}
};
spiedGroup.setPartialTransitionFactory(factory);
spiedGroup.setPartialInterpolator(testInterpolator);
//when
spiedGroup.preparePartialTransition(true, 0, 0);
//then
verify(spiedTransition, times(1)).setInterpolator(testInterpolator);
}
private void initTabs() {
AnimationHelper.slideDownIn(mTabLayout)
.interpolator(new LinearOutSlowInInterpolator())
.callback(new AnimationHelper.Callback() {
@Override
public void onAnimationStart() {
}
@Override
public void onAnimationEnd() {
if (getActivity() == null) return;
if (Preferences.get(getActivity()).isToolbarShadowEnabled()) {
AnimationHelper.fade(getActivity().findViewById(R.id.shadow)).start();
}
mGetIcons = new IconsLoader().execute();
}
})
.start();
}
@Override
protected void onPostExecute(Boolean aBoolean) {
super.onPostExecute(aBoolean);
if (getActivity() == null) return;
if (getActivity().isFinishing()) return;
mAsyncTask = null;
mProgress.setVisibility(View.GONE);
if (aBoolean) {
setHasOptionsMenu(true);
mAdapter = new RequestAdapter(getActivity(),
requests, mManager.getSpanCount());
mRecyclerView.setAdapter(mAdapter);
AnimationHelper.show(mFab)
.interpolator(new LinearOutSlowInInterpolator())
.start();
TapIntroHelper.showRequestIntro(getActivity(), mRecyclerView);
} else {
mRecyclerView.setAdapter(null);
Toast.makeText(getActivity(), R.string.request_appfilter_failed, Toast.LENGTH_LONG).show();
}
}
@Override
public void onLayoutChange(View v, int left, int top, int right, int bottom,
int oldLeft, int oldTop, int oldRight, int oldBottom) {
if (mSheetAnimator != null) mSheetAnimator.cancel();
mRequestView.removeOnLayoutChangeListener(this);
mContainerHeightDifference = (bottom - top) - (oldBottom - oldTop);
ValueAnimator containerAnimator = ValueAnimator.ofFloat(1f, 0f);
containerAnimator.addUpdateListener(new AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
float alpha = (Float) animation.getAnimatedValue();
update(alpha);
}
});
mSheetAnimator = containerAnimator;
mSheetAnimator.setDuration(DIALOG_ENTER_ANIMATION_MS);
mSheetAnimator.setInterpolator(new LinearOutSlowInInterpolator());
mSheetAnimator.addListener(this);
mSheetAnimator.start();
}
private void initInterpolations() {
ArrayList<Class> interpolatorList = new ArrayList<Class>() {{
add(FastOutSlowInInterpolator.class);
add(BounceInterpolator.class);
add(LinearInterpolator.class);
add(DecelerateInterpolator.class);
add(CycleInterpolator.class);
add(AnticipateInterpolator.class);
add(AccelerateDecelerateInterpolator.class);
add(AccelerateInterpolator.class);
add(AnticipateOvershootInterpolator.class);
add(FastOutLinearInInterpolator.class);
add(LinearOutSlowInInterpolator.class);
add(OvershootInterpolator.class);
}};
try {
interpolatorSelector = (Interpolator) interpolatorList.get(animateSelector).newInstance();
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onLayoutChange(View v, int left, int top, int right, int bottom,
int oldLeft, int oldTop, int oldRight, int oldBottom) {
if (mSheetAnimator != null) mSheetAnimator.cancel();
mRequestView.removeOnLayoutChangeListener(this);
mContainerHeightDifference = (bottom - top) - (oldBottom - oldTop);
ValueAnimator containerAnimator = ValueAnimator.ofFloat(1f, 0f);
containerAnimator.addUpdateListener(new AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
float alpha = (Float) animation.getAnimatedValue();
update(alpha);
}
});
mSheetAnimator = containerAnimator;
mSheetAnimator.setDuration(DIALOG_ENTER_ANIMATION_MS);
mSheetAnimator.setInterpolator(new LinearOutSlowInInterpolator());
mSheetAnimator.addListener(this);
mSheetAnimator.start();
}
public void hide(boolean withAnimation) {
if (mHidden) {
return;
}
mHidden = true;
if (mState == STATE_EXPANDED) {
mState = STATE_COLLAPSED;
mCurrentExpandProgress = 0;
mHoverItemIndex = -1;
invalidate();
}
ViewCompat.animate(this)
.translationY(mCollapseRadius)
.setInterpolator(new LinearOutSlowInInterpolator())
.setDuration(withAnimation ? 200 : 0)
.start();
}
private void startAnimation(final boolean isEnterAnimation) {
float from = isEnterAnimation ? 0f : 1f;
float to = isEnterAnimation ? 1f : 0f;
long duration = isEnterAnimation ? ENTER_ANIMATION_DURATION_MS : EXIT_ANIMATION_DURATION_MS;
mContentView.setScaleX(from);
mContentView.setScaleY(from);
mContentView.animate()
.scaleX(to)
.scaleY(to)
.setDuration(duration)
.setInterpolator(new LinearOutSlowInInterpolator())
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (!isEnterAnimation) {
BrowserActionsFallbackMenuDialog.super.dismiss();
}
}
})
.start();
}
@Override
public void onLayoutChange(View v, int left, int top, int right, int bottom,
int oldLeft, int oldTop, int oldRight, int oldBottom) {
if (mSheetAnimator != null) mSheetAnimator.cancel();
mRequestView.removeOnLayoutChangeListener(this);
mContainerHeightDifference = (bottom - top) - (oldBottom - oldTop);
ValueAnimator containerAnimator = ValueAnimator.ofFloat(1f, 0f);
containerAnimator.addUpdateListener(new AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
float alpha = (Float) animation.getAnimatedValue();
update(alpha);
}
});
mSheetAnimator = containerAnimator;
mSheetAnimator.setDuration(DIALOG_ENTER_ANIMATION_MS);
mSheetAnimator.setInterpolator(new LinearOutSlowInInterpolator());
mSheetAnimator.addListener(this);
mSheetAnimator.start();
}
@UiThread
public void collapse() {
ValueAnimator animator = ValueAnimator.ofInt(Views.measureHeight(view), 0);
animator.setInterpolator(new LinearOutSlowInInterpolator());
animator.setDuration(Durations.MEDIUM);
animator.addUpdateListener(this);
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
view.setVisibility(View.GONE);
}
});
animator.start();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final Context contextThemeWrapper = new ContextThemeWrapper(getActivity(), new ColorPreferences(inflater.getContext()).getThemeSubreddit(where));
View v = ((LayoutInflater) contextThemeWrapper.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.fragment_verticalcontent, container, false);
rv = ((RecyclerView) v.findViewById(R.id.vertical_content));
final RecyclerView.LayoutManager mLayoutManager = new PreCachingLayoutManager(getActivity());
rv.setLayoutManager(mLayoutManager);
rv.setItemAnimator(new SlideUpAlphaAnimator().withInterpolator(new LinearOutSlowInInterpolator()));
mSwipeRefreshLayout = (SwipeRefreshLayout) v.findViewById(R.id.activity_main_swipe_refresh_layout);
mSwipeRefreshLayout.setColorSchemeColors(Palette.getColors("no sub", getContext()));
//If we use 'findViewById(R.id.header).getMeasuredHeight()', 0 is always returned.
//So, we estimate the height of the header in dp
mSwipeRefreshLayout.setProgressViewOffset(false,
Constants.TAB_HEADER_VIEW_OFFSET - Constants.PTR_OFFSET_TOP,
Constants.TAB_HEADER_VIEW_OFFSET + Constants.PTR_OFFSET_BOTTOM);
v.findViewById(R.id.post_floating_action_button).setVisibility(View.GONE);
doAdapter();
return v;
}
public RightViewHideShowAnimation(View view, boolean toVisible, long duration) {
super(false);
this.toVisible = toVisible;
this.animationView = view;
//Creates the Alpha animation for the transition
float startAlpha = toVisible ? 0 : 1;
float endAlpha = toVisible ? 1 : 0;
AlphaAnimation alphaAnimation = new AlphaAnimation(startAlpha, endAlpha);
alphaAnimation.setDuration(duration);
//Creates the Translate animation for the transition
int startX = toVisible ? getHideShowDelta(view) : 0;
int endX = toVisible ? 0 : getHideShowDelta(view);
TranslateAnimation translateAnimation = new TranslateAnimation(startX, endX, 0, 0);
translateAnimation.setInterpolator(toVisible ? new LinearOutSlowInInterpolator() : new FastOutLinearInInterpolator());
translateAnimation.setDuration(duration);
//Adds the animations to the set
addAnimation(alphaAnimation);
addAnimation(translateAnimation);
setAnimationListener(new Listener());
}
public RightViewHideShowAnimation(View view, boolean toVisible, long duration) {
super(false);
this.toVisible = toVisible;
this.animationView = view;
//Creates the Alpha animation for the transition
float startAlpha = toVisible ? 0 : 1;
float endAlpha = toVisible ? 1 : 0;
AlphaAnimation alphaAnimation = new AlphaAnimation(startAlpha, endAlpha);
alphaAnimation.setDuration(duration);
//Creates the Translate animation for the transition
int startX = toVisible ? getHideShowDelta(view) : 0;
int endX = toVisible ? 0 : getHideShowDelta(view);
TranslateAnimation translateAnimation = new TranslateAnimation(startX, endX, 0, 0);
translateAnimation.setInterpolator(toVisible ? new LinearOutSlowInInterpolator() : new FastOutLinearInInterpolator());
translateAnimation.setDuration(duration);
//Adds the animations to the set
addAnimation(alphaAnimation);
addAnimation(translateAnimation);
setAnimationListener(new Listener());
}
public void bindView(View view){
if (view == null)
throw new NullPointerException("The view is cannot null");
this.view = view;
if (viewPropertyAnimator == null){
viewPropertyAnimator = view.animate();
viewPropertyAnimator.setDuration(300);
viewPropertyAnimator.setInterpolator(new LinearOutSlowInInterpolator());
}
}
private void changeVisibility() {
View music_info_cardView = findViewById(R.id.music_info_cardView);
View control_layout = findViewById(R.id.control_layout);
View seekbar_layout = findViewById(R.id.seekbar_layout);
View lrcView = findViewById(R.id.other_lrc_view);
View gradient = findViewById(R.id.gradient);
View gradient_bottom = findViewById(R.id.gradient_bottom);
View gradient_top = findViewById(R.id.gradient_top);
TransitionManager.beginDelayedTransition(transitionsContainer, new TransitionSet().addTransition(new Fade()).setInterpolator(visible ? new LinearOutSlowInInterpolator() : new FastOutLinearInInterpolator()));
if (music_info_cardView.getVisibility() == VISIBLE) {
music_info_cardView.setVisibility(GONE);
control_layout.setVisibility(GONE);
seekbar_layout.setVisibility(GONE);
lrcView.setVisibility(VISIBLE);
gradient.setVisibility(VISIBLE);
gradient_bottom.setVisibility(VISIBLE);
gradient_top.setVisibility(VISIBLE);
} else {
music_info_cardView.setVisibility(VISIBLE);
control_layout.setVisibility(VISIBLE);
seekbar_layout.setVisibility(VISIBLE);
lrcView.setVisibility(GONE);
gradient.setVisibility(GONE);
gradient_bottom.setVisibility(GONE);
gradient_top.setVisibility(GONE);
}
visible = !visible;
}
private void init() {
mLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
mDecorView = (ViewGroup) mContext.getWindow().getDecorView();
mPopup = new PopupLayer(mContext, mRadius);
mPopup.setVisibility(INVISIBLE);
mAlphAnimator = new ValueAnimator();
mAlphAnimator.setFloatValues(0.0f, 1.0f);
mAlphAnimator.setDuration(mAnimDuration);
mAlphAnimator.setInterpolator(new LinearOutSlowInInterpolator());
mAlphAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
mPopup.setShadowViewAlpha(Float.valueOf(animation.getAnimatedValue() + ""));
}
});
addOnLayoutChangeListener(new OnLayoutChangeListener() {
@Override
public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
initButtons();
if (onButtonPreparedListener != null)
onButtonPreparedListener.onPrepared(mButtons);
}
});
}
@OnClick(R.id.btnSubmit)
public void onSubmitClick()
{
if (isAnimated)
{
// Feedback has been written
txtThanks.setVisibility(View.VISIBLE);
// Perfrom Animations
ViewAnimator
.animate(ratingBar)
.dp().translationY(-100, -130)
.interpolator(new LinearOutSlowInInterpolator())
.duration(200)
.alpha(1,0)
.andAnimate(lblWeHearFeedback)
.dp().translationY(-20, -90)
.interpolator(new LinearOutSlowInInterpolator())
.duration(250)
.alpha(1,0)
.andAnimate(txtComments)
.dp().translationY(-30, -120)
.interpolator(new LinearOutSlowInInterpolator())
.duration(300)
.alpha(1,0)
.andAnimate(btnSubmit)
.dp().translationY(-35, -200)
.interpolator(new LinearOutSlowInInterpolator())
.duration(340)
.alpha(1,0)
.andAnimate(txtThanks)
.dp().translationY(0, -200)
.interpolator(new LinearOutSlowInInterpolator())
.duration(600)
.start();
}
}
private void clearAdapter() {
if (mAdapter == null) return;
mAdapter.clearItems();
if (mSearchResult.getVisibility() == View.VISIBLE) {
AnimationHelper.fade(mSearchResult).start();
}
AnimationHelper.setBackgroundColor(mRecyclerView,
((ColorDrawable) mRecyclerView.getBackground()).getColor(),
Color.TRANSPARENT)
.interpolator(new LinearOutSlowInInterpolator())
.start();
}
private void initAppBar() {
mAppBar.addOnOffsetChangedListener((appBarLayout, verticalOffset) -> {
int maxScroll = mAppBar.getTotalScrollRange();
float percentage = (float) Math.abs(verticalOffset) / (float) maxScroll;
if (percentage == 1f) {
if (mIsSearchBarShown) {
mIsSearchBarShown = false;
mSearchBar.animate().cancel();
mSearchBar.animate().translationY(-mSearchBarTranslationY)
.setInterpolator(new DecelerateInterpolator())
.setDuration(400)
.start();
}
} else if (percentage < 0.8f) {
if (!mIsSearchBarShown) {
mIsSearchBarShown = true;
mSearchBar.animate().cancel();
mSearchBar.animate().translationY(0)
.setInterpolator(new LinearOutSlowInInterpolator())
.setDuration(400)
.start();
}
}
if (percentage < 0.2f) {
if (!mIsAppBarExpanded) {
mIsAppBarExpanded = true;
int color = ColorHelper.getAttributeColor(getActivity(), R.attr.colorPrimary);
ColorHelper.setupStatusBarIconColor(getActivity(), ColorHelper.isLightColor(color));
}
} else if (percentage == 1.0f) {
if (mIsAppBarExpanded) {
mIsAppBarExpanded = false;
ColorHelper.setupStatusBarIconColor(getActivity(), false);
}
}
});
}
private void setFavorite(@NonNull ImageView imageView, @ColorInt int color, int position, boolean animate) {
if (position < 0 || position > mWallpapers.size()) return;
if (mIsFavoriteMode) {
imageView.setImageDrawable(DrawableHelper.getTintedDrawable(mContext, R.drawable.ic_toolbar_love, color));
return;
}
boolean isFavorite = mWallpapers.get(position).isFavorite();
if (animate) {
AnimationHelper.show(imageView)
.interpolator(new LinearOutSlowInInterpolator())
.callback(new AnimationHelper.Callback() {
@Override
public void onAnimationStart() {
imageView.setImageDrawable(DrawableHelper.getTintedDrawable(mContext,
isFavorite ? R.drawable.ic_toolbar_love : R.drawable.ic_toolbar_unlove, color));
}
@Override
public void onAnimationEnd() {
}
})
.start();
return;
}
imageView.setImageDrawable(DrawableHelper.getTintedDrawable(mContext,
isFavorite ? R.drawable.ic_toolbar_love : R.drawable.ic_toolbar_unlove, color));
}
private void setFavorite(@NonNull ImageView imageView, @ColorInt int color, int position, boolean animate) {
if (position < 0 || position > mWallpapers.size()) return;
boolean isFavorite = mWallpapers.get(position).isFavorite();
if (animate) {
AnimationHelper.show(imageView)
.interpolator(new LinearOutSlowInInterpolator())
.callback(new AnimationHelper.Callback() {
@Override
public void onAnimationStart() {
imageView.setImageDrawable(DrawableHelper.getTintedDrawable(mContext,
isFavorite ? R.drawable.ic_toolbar_love : R.drawable.ic_toolbar_unlove, color));
}
@Override
public void onAnimationEnd() {
}
})
.start();
return;
}
imageView.setImageDrawable(DrawableHelper.getTintedDrawable(mContext,
isFavorite ? R.drawable.ic_toolbar_love : R.drawable.ic_toolbar_unlove, color));
}
@Test
public void partialInterpolator_isModified_when_setPartialInterpolator_isCalled() {
//given
StaggeredAnimationGroup spiedGroup = prepareSpiedGroup();
Interpolator testInterpolator = new LinearOutSlowInInterpolator();
//when
spiedGroup.setPartialInterpolator(testInterpolator);
//then
assertThat(spiedGroup.partialInterpolator).isEqualTo(testInterpolator);
}
/**
* Enables creation of views for quizzes.
*
* @param context The context for this view.
* @param category The {@link Category} this view is running in.
* @param quiz The actual {@link Quiz} that is going to be displayed.
*/
public AbsQuizView(Context context, Category category, Q quiz) {
super(context);
mQuiz = quiz;
mCategory = category;
mSpacingDouble = getResources().getDimensionPixelSize(R.dimen.spacing_double);
mLayoutInflater = LayoutInflater.from(context);
mSubmitAnswer = getSubmitButton();
mLinearOutSlowInInterpolator = new LinearOutSlowInInterpolator();
mHandler = new Handler();
mInputMethodManager = (InputMethodManager) context.getSystemService
(Context.INPUT_METHOD_SERVICE);
setId(quiz.getId());
setUpQuestionView();
LinearLayout container = createContainerLayout(context);
View quizContentView = getInitializedContentView();
addContentView(container, quizContentView);
addOnLayoutChangeListener(new OnLayoutChangeListener() {
@Override
public void onLayoutChange(View v, int left, int top, int right, int bottom,
int oldLeft,
int oldTop, int oldRight, int oldBottom) {
removeOnLayoutChangeListener(this);
addFloatingActionButton();
}
});
}
private void showPopupBubble() {
int wallpapersCount = Database.get(getActivity()).getWallpapersCount();
if (wallpapersCount == 0) return;
if (Preferences.get(getActivity()).getAvailableWallpapersCount() > wallpapersCount) {
AnimationHelper.show(mPopupBubble)
.interpolator(new LinearOutSlowInInterpolator())
.start();
}
}
protected void scrollDown() {
ViewCompat.animate(this)
.translationY(getBarHeight())
.setInterpolator(new LinearOutSlowInInterpolator())
.setDuration(DEFAULT_ANIMATION_DURATION)
.start();
}
@Override
public void onLayoutChange(View v, int left, int top, int right, int bottom,
int oldLeft, int oldTop, int oldRight, int oldBottom) {
mRequestView.removeOnLayoutChangeListener(this);
Animator scrimFader = ObjectAnimator.ofInt(mFullContainer.getBackground(),
AnimatorProperties.DRAWABLE_ALPHA_PROPERTY, 0, 127);
Animator alphaAnimator = ObjectAnimator.ofFloat(mFullContainer, View.ALPHA, 0f, 1f);
AnimatorSet alphaSet = new AnimatorSet();
alphaSet.playTogether(scrimFader, alphaAnimator);
alphaSet.setDuration(DIALOG_ENTER_ANIMATION_MS);
alphaSet.setInterpolator(new LinearOutSlowInInterpolator());
alphaSet.start();
}