android.support.v4.view.animation.LinearOutSlowInInterpolator Java Examples

The following examples show how to use android.support.v4.view.animation.LinearOutSlowInInterpolator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Case1Scene.java    From scene with Apache License 2.0 7 votes vote down vote up
@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);
}
 
Example #2
Source File: PaymentRequestUI.java    From 365browser with Apache License 2.0 7 votes vote down vote up
@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();
}
 
Example #3
Source File: PaymentRequestUI.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@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();
}
 
Example #4
Source File: MultiChoicesCircleButton.java    From MultiChoicesCircleButton with MIT License 6 votes vote down vote up
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();
}
 
Example #5
Source File: SegmentedButtonGroup.java    From SegmentedButton with Apache License 2.0 6 votes vote down vote up
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();
    }
}
 
Example #6
Source File: PaymentRequestUI.java    From delion with Apache License 2.0 6 votes vote down vote up
@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();
}
 
Example #7
Source File: BrowserActionsFallbackMenuDialog.java    From custom-tabs-client with Apache License 2.0 6 votes vote down vote up
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();
}
 
Example #8
Source File: RequestFragment.java    From candybar-library with Apache License 2.0 6 votes vote down vote up
@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();
    }
}
 
Example #9
Source File: IconsBaseFragment.java    From candybar-library with Apache License 2.0 6 votes vote down vote up
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();
}
 
Example #10
Source File: StaggeredAnimationGroupTest.java    From StaggeredAnimationGroup with Apache License 2.0 6 votes vote down vote up
@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);
}
 
Example #11
Source File: ViewTransformer.java    From hawkular-android-client with Apache License 2.0 6 votes vote down vote up
@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();
}
 
Example #12
Source File: SubredditListView.java    From Slide with GNU General Public License v3.0 6 votes vote down vote up
@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;
}
 
Example #13
Source File: Android8DefaultSceneAnimatorExecutor.java    From scene with Apache License 2.0 6 votes vote down vote up
@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);
}
 
Example #14
Source File: Case3Scene.java    From scene with Apache License 2.0 6 votes vote down vote up
@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);
}
 
Example #15
Source File: ContainersLayout.java    From MaterialMasterDetail with Apache License 2.0 6 votes vote down vote up
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();
        }
    });
}
 
Example #16
Source File: Utils.java    From ExpandableLayout with Apache License 2.0 5 votes vote down vote up
/**
 * Creates interpolator.
 *
 * @param interpolatorType
 * @return
 */
public static TimeInterpolator createInterpolator(@IntRange(from = 0, to = 10) final int interpolatorType) {
    switch (interpolatorType) {
        case ACCELERATE_DECELERATE_INTERPOLATOR:
            return new AccelerateDecelerateInterpolator();
        case ACCELERATE_INTERPOLATOR:
            return new AccelerateInterpolator();
        case ANTICIPATE_INTERPOLATOR:
            return new AnticipateInterpolator();
        case ANTICIPATE_OVERSHOOT_INTERPOLATOR:
            return new AnticipateOvershootInterpolator();
        case BOUNCE_INTERPOLATOR:
            return new BounceInterpolator();
        case DECELERATE_INTERPOLATOR:
            return new DecelerateInterpolator();
        case FAST_OUT_LINEAR_IN_INTERPOLATOR:
            return new FastOutLinearInInterpolator();
        case FAST_OUT_SLOW_IN_INTERPOLATOR:
            return new FastOutSlowInInterpolator();
        case LINEAR_INTERPOLATOR:
            return new LinearInterpolator();
        case LINEAR_OUT_SLOW_IN_INTERPOLATOR:
            return new LinearOutSlowInInterpolator();
        case OVERSHOOT_INTERPOLATOR:
            return new OvershootInterpolator();
        default:
            return new LinearInterpolator();
    }
}
 
Example #17
Source File: IntroScreenSlidePagerAdapter.java    From QuickLyric with GNU General Public License v3.0 5 votes vote down vote up
public IntroScreenSlidePagerAdapter(final Activity activity) {
    super(activity.getFragmentManager());
    this.mActivity = activity;
    mPager = mActivity.findViewById(R.id.pager);
    mPager.setOnTouchListener(exitTouchListener);
    if (Build.VERSION.SDK_INT >= 17)
        rightToLeft = TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()) == 1;
    if (rightToLeft) {
        List<Integer> list = Arrays.asList(colors);
        Collections.reverse(list);
        colors = (Integer[]) list.toArray();
    }
    ImageButton pagerArrow = mActivity.findViewById(R.id.pager_arrow);
    Button okButton = mActivity.findViewById(R.id.pager_ok);
    okButton.setOnClickListener(v -> {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && !Tutorial_4.nlEnabled) {
            final ViewGroup nlFrame = activity.findViewById(R.id.NL_frame);
            final ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(),
                    Color.parseColor("#30000000"), Color.parseColor("#80FFFFFF"));
            colorAnimation.addUpdateListener(animation -> nlFrame.setBackgroundColor((int) animation.getAnimatedValue()));
            colorAnimation.setInterpolator(new LinearOutSlowInInterpolator());
            colorAnimation.setRepeatCount(3);
            colorAnimation.setRepeatMode(ValueAnimator.REVERSE);
            colorAnimation.setDuration(650L);
            colorAnimation.start();
        } else if (!hasClicked) {
            exitAction();
            hasClicked = true;
        }
    });
    pagerArrow.setOnClickListener(v -> nextAction());
}
 
Example #18
Source File: TakePictueActivity.java    From ESeal with Apache License 2.0 5 votes vote down vote up
private void startIntroAnimation() {
    controlPanel.animate()
            .translationY(0)
            .setStartDelay(300)
            .setDuration(400)
            .setInterpolator(new LinearOutSlowInInterpolator())
            .start();
}
 
Example #19
Source File: NiceSpinner.java    From nice-spinner with Apache License 2.0 5 votes vote down vote up
private void animateArrow(boolean shouldRotateUp) {
    int start = shouldRotateUp ? 0 : MAX_LEVEL;
    int end = shouldRotateUp ? MAX_LEVEL : 0;
    arrowAnimator = ObjectAnimator.ofInt(arrowDrawable, "level", start, end);
    arrowAnimator.setInterpolator(new LinearOutSlowInInterpolator());
    arrowAnimator.start();
}
 
Example #20
Source File: MultiChoicesCircleButton.java    From MultiChoicesCircleButton with MIT License 5 votes vote down vote up
public void show(boolean withAnimation) {
    if (!mHidden) {
        return;
    }
    mHidden = false;
    ViewCompat.animate(this)
            .translationY(0)
            .setInterpolator(new LinearOutSlowInInterpolator())
            .setDuration(withAnimation ? 200 : 0)
            .start();
}
 
Example #21
Source File: RadioRealButtonGroup.java    From RadioRealButton with Apache License 2.0 5 votes vote down vote up
private void initInterpolations() {
    Class[] interpolations = {
            FastOutSlowInInterpolator.class,
            BounceInterpolator.class,
            LinearInterpolator.class,
            DecelerateInterpolator.class,
            CycleInterpolator.class,
            AnticipateInterpolator.class,
            AccelerateDecelerateInterpolator.class,
            AccelerateInterpolator.class,
            AnticipateOvershootInterpolator.class,
            FastOutLinearInInterpolator.class,
            LinearOutSlowInInterpolator.class,
            OvershootInterpolator.class};

    try {
        interpolatorText = (Interpolator) interpolations[animateTextsEnter].newInstance();
        interpolatorDrawablesEnter = (Interpolator) interpolations[animateDrawablesEnter].newInstance();
        interpolatorSelector = (Interpolator) interpolations[animateSelector].newInstance();

        interpolatorTextExit = (Interpolator) interpolations[animateTextsExit].newInstance();
        interpolatorDrawablesExit = (Interpolator) interpolations[animateDrawablesExit].newInstance();

    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example #22
Source File: AllFragment.java    From nono-android with GNU General Public License v3.0 5 votes vote down vote up
private void addCoolAnimToRecycleView(RecyclerView recyclerView, NoteAllItemAdapter noteAdapter) {
    SlideInBottomAnimationAdapter alphaAdapter = new SlideInBottomAnimationAdapter(noteAdapter);
    alphaAdapter.setDuration(200);
    alphaAdapter.setInterpolator(new AccelerateDecelerateInterpolator());
    alphaAdapter.setFirstOnly(false);
    recyclerView.setAdapter(alphaAdapter );
    recyclerView.setItemAnimator(new SlideInUpAnimator(new LinearOutSlowInInterpolator()));
}
 
Example #23
Source File: MultiredditView.java    From Slide with GNU General Public License v3.0 5 votes vote down vote up
private List<Submission> clearSeenPosts(boolean forever) {
    if (posts.posts != null) {

        List<Submission> originalDataSetPosts = posts.posts;

        OfflineSubreddit o = OfflineSubreddit.getSubreddit("multi" + posts.multiReddit.getDisplayName().toLowerCase(
                Locale.ENGLISH), false, getActivity());
        for (int i = posts.posts.size(); i > -1; i--) {
            try {
                if (HasSeen.getSeen(posts.posts.get(i))) {
                    if (forever) {
                        Hidden.setHidden(posts.posts.get(i));
                    }
                    o.clearPost(posts.posts.get(i));
                    posts.posts.remove(i);
                    if (posts.posts.isEmpty()) {
                        adapter.notifyDataSetChanged();
                    } else {
                        rv.setItemAnimator(new AlphaInAnimator());
                        adapter.notifyItemRemoved(i + 1);
                    }
                }
            } catch (IndexOutOfBoundsException e) {
                //Let the loop reset itself
            }
        }
        o.writeToMemoryNoStorage();
        rv.setItemAnimator(new SlideUpAlphaAnimator().withInterpolator(new LinearOutSlowInInterpolator()));
        return originalDataSetPosts;
    }

    return null;
}
 
Example #24
Source File: SubmissionsView.java    From Slide with GNU General Public License v3.0 5 votes vote down vote up
public List<Submission> clearSeenPosts(boolean forever) {
    if (adapter.dataSet.posts != null) {

        List<Submission> originalDataSetPosts = adapter.dataSet.posts;
        OfflineSubreddit o =
                OfflineSubreddit.getSubreddit(id.toLowerCase(Locale.ENGLISH), false, getActivity());

        for (int i = adapter.dataSet.posts.size(); i > -1; i--) {
            try {
                if (HasSeen.getSeen(adapter.dataSet.posts.get(i))) {
                    if (forever) {
                        Hidden.setHidden(adapter.dataSet.posts.get(i));
                    }
                    o.clearPost(adapter.dataSet.posts.get(i));
                    adapter.dataSet.posts.remove(i);
                    if (adapter.dataSet.posts.isEmpty()) {
                        adapter.notifyDataSetChanged();
                    } else {
                        rv.setItemAnimator(new AlphaInAnimator());
                        adapter.notifyItemRemoved(i + 1);
                    }
                }
            } catch (IndexOutOfBoundsException e) {
                //Let the loop reset itself
            }
        }
        adapter.notifyItemRangeChanged(0, adapter.dataSet.posts.size());
        o.writeToMemoryNoStorage();
        rv.setItemAnimator(new SlideUpAlphaAnimator().withInterpolator(new LinearOutSlowInInterpolator()));
        return originalDataSetPosts;
    }

    return null;
}
 
Example #25
Source File: BottomViewHideShowAnimation.java    From ExoMedia with Apache License 2.0 5 votes vote down vote up
public BottomViewHideShowAnimation(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 startY = toVisible ? getHideShowDelta(view) : 0;
    int endY = toVisible ? 0 : getHideShowDelta(view);
    TranslateAnimation translateAnimation = new TranslateAnimation(0, 0, startY, endY);
    translateAnimation.setInterpolator(toVisible ? new LinearOutSlowInInterpolator() : new FastOutLinearInInterpolator());
    translateAnimation.setDuration(duration);


    //Adds the animations to the set
    addAnimation(alphaAnimation);
    addAnimation(translateAnimation);

    setAnimationListener(new Listener());
}
 
Example #26
Source File: NewsView.java    From Slide with GNU General Public License v3.0 5 votes vote down vote up
public List<Submission> clearSeenPosts(boolean forever) {
    if (adapter.dataSet.posts != null) {

        List<Submission> originalDataSetPosts = adapter.dataSet.posts;
        OfflineSubreddit o =
                OfflineSubreddit.getSubreddit(id.toLowerCase(Locale.ENGLISH), false,
                        getActivity());

        for (int i = adapter.dataSet.posts.size(); i > -1; i--) {
            try {
                if (HasSeen.getSeen(adapter.dataSet.posts.get(i))) {
                    if (forever) {
                        Hidden.setHidden(adapter.dataSet.posts.get(i));
                    }
                    o.clearPost(adapter.dataSet.posts.get(i));
                    adapter.dataSet.posts.remove(i);
                    if (adapter.dataSet.posts.isEmpty()) {
                        adapter.notifyDataSetChanged();
                    } else {
                        rv.setItemAnimator(new AlphaInAnimator());
                        adapter.notifyItemRemoved(i + 1);
                    }
                }
            } catch (IndexOutOfBoundsException e) {
                //Let the loop reset itself
            }
        }
        adapter.notifyItemRangeChanged(0, adapter.dataSet.posts.size());
        o.writeToMemoryNoStorage();
        rv.setItemAnimator(new SlideUpAlphaAnimator().withInterpolator(new LinearOutSlowInInterpolator()));
        return originalDataSetPosts;
    }

    return null;
}
 
Example #27
Source File: PaymentRequestSection.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public void run() {
    Animation out = new AlphaAnimation(mUpdatedView.getAlpha(), 0.0f);
    out.setDuration(UPDATE_TEXT_ANIMATION_DURATION_MS);
    out.setInterpolator(new LinearOutSlowInInterpolator());
    out.setFillAfter(true);
    mUpdatedView.startAnimation(out);
}
 
Example #28
Source File: PaymentRequestSection.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Starts the animation to make the update text view fade in then fade out.
 */
private void startUpdateViewAnimation() {
    // Create and start a fade in anmiation for the mUpdatedView. Re-use the current alpha
    // to avoid restarting a previous or current fade in animation.
    Animation in = new AlphaAnimation(mUpdatedView.getAlpha(), 1.0f);
    in.setDuration(UPDATE_TEXT_ANIMATION_DURATION_MS);
    in.setInterpolator(new LinearOutSlowInInterpolator());
    in.setFillAfter(true);
    mUpdatedView.startAnimation(in);

    // Cancel all pending fade out animations and create a new on to be executed a little
    // while after the fade in.
    mHandler.removeCallbacks(mFadeOutRunnable);
    mHandler.postDelayed(mFadeOutRunnable, UPDATE_TEXT_VISIBILITY_DURATION_MS);
}
 
Example #29
Source File: PaymentRequestUI.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@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, 255);
    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();
}
 
Example #30
Source File: PaymentRequestUI.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@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);

    mSheetAnimator = ObjectAnimator.ofFloat(
            mRequestView, View.TRANSLATION_Y, mAnimatorTranslation, 0);
    mSheetAnimator.setDuration(DIALOG_ENTER_ANIMATION_MS);
    mSheetAnimator.setInterpolator(new LinearOutSlowInInterpolator());
    mSheetAnimator.addListener(this);
    mSheetAnimator.start();
}