Search in sources :

Example 6 with LinearOutSlowInInterpolator

use of android.support.v4.view.animation.LinearOutSlowInInterpolator in project react-native-navigation by wix.

the class VisibilityAnimator method createAnimator.

private ObjectAnimator createAnimator(final boolean show) {
    ObjectAnimator animator = ObjectAnimator.ofFloat(view, View.TRANSLATION_Y, show ? SHOW_END_VALUE : hiddenEndValue);
    animator.setDuration(DURATION);
    animator.setInterpolator(new LinearOutSlowInInterpolator());
    animator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationStart(Animator animation) {
            visibilityState = show ? VisibilityState.AnimateShow : VisibilityState.AnimateHide;
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            visibilityState = show ? VisibilityState.Shown : VisibilityState.Hidden;
        }
    });
    return animator;
}
Also used : LinearOutSlowInInterpolator(android.support.v4.view.animation.LinearOutSlowInInterpolator) ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter)

Example 7 with LinearOutSlowInInterpolator

use of android.support.v4.view.animation.LinearOutSlowInInterpolator in project ahbottomnavigation by aurelhubert.

the class DemoActivity method initUI.

/**
	 * Init UI
	 */
private void initUI() {
    bottomNavigation = (AHBottomNavigation) findViewById(R.id.bottom_navigation);
    viewPager = (AHBottomNavigationViewPager) findViewById(R.id.view_pager);
    floatingActionButton = (FloatingActionButton) findViewById(R.id.floating_action_button);
    if (useMenuResource) {
        tabColors = getApplicationContext().getResources().getIntArray(R.array.tab_colors);
        navigationAdapter = new AHBottomNavigationAdapter(this, R.menu.bottom_navigation_menu_3);
        navigationAdapter.setupWithBottomNavigation(bottomNavigation, tabColors);
    } else {
        AHBottomNavigationItem item1 = new AHBottomNavigationItem(R.string.tab_1, R.drawable.ic_apps_black_24dp, R.color.color_tab_1);
        AHBottomNavigationItem item2 = new AHBottomNavigationItem(R.string.tab_2, R.drawable.ic_maps_local_bar, R.color.color_tab_2);
        AHBottomNavigationItem item3 = new AHBottomNavigationItem(R.string.tab_3, R.drawable.ic_maps_local_restaurant, R.color.color_tab_3);
        bottomNavigationItems.add(item1);
        bottomNavigationItems.add(item2);
        bottomNavigationItems.add(item3);
        bottomNavigation.addItems(bottomNavigationItems);
    }
    bottomNavigation.manageFloatingActionButtonBehavior(floatingActionButton);
    bottomNavigation.setTranslucentNavigationEnabled(true);
    bottomNavigation.setOnTabSelectedListener(new AHBottomNavigation.OnTabSelectedListener() {

        @Override
        public boolean onTabSelected(int position, boolean wasSelected) {
            if (currentFragment == null) {
                currentFragment = adapter.getCurrentFragment();
            }
            if (wasSelected) {
                currentFragment.refresh();
                return true;
            }
            if (currentFragment != null) {
                currentFragment.willBeHidden();
            }
            viewPager.setCurrentItem(position, false);
            currentFragment = adapter.getCurrentFragment();
            currentFragment.willBeDisplayed();
            if (position == 1) {
                bottomNavigation.setNotification("", 1);
                floatingActionButton.setVisibility(View.VISIBLE);
                floatingActionButton.setAlpha(0f);
                floatingActionButton.setScaleX(0f);
                floatingActionButton.setScaleY(0f);
                floatingActionButton.animate().alpha(1).scaleX(1).scaleY(1).setDuration(300).setInterpolator(new OvershootInterpolator()).setListener(new Animator.AnimatorListener() {

                    @Override
                    public void onAnimationStart(Animator animation) {
                    }

                    @Override
                    public void onAnimationEnd(Animator animation) {
                        floatingActionButton.animate().setInterpolator(new LinearOutSlowInInterpolator()).start();
                    }

                    @Override
                    public void onAnimationCancel(Animator animation) {
                    }

                    @Override
                    public void onAnimationRepeat(Animator animation) {
                    }
                }).start();
            } else {
                if (floatingActionButton.getVisibility() == View.VISIBLE) {
                    floatingActionButton.animate().alpha(0).scaleX(0).scaleY(0).setDuration(300).setInterpolator(new LinearOutSlowInInterpolator()).setListener(new Animator.AnimatorListener() {

                        @Override
                        public void onAnimationStart(Animator animation) {
                        }

                        @Override
                        public void onAnimationEnd(Animator animation) {
                            floatingActionButton.setVisibility(View.GONE);
                        }

                        @Override
                        public void onAnimationCancel(Animator animation) {
                            floatingActionButton.setVisibility(View.GONE);
                        }

                        @Override
                        public void onAnimationRepeat(Animator animation) {
                        }
                    }).start();
                }
            }
            return true;
        }
    });
    /*
		bottomNavigation.setOnNavigationPositionListener(new AHBottomNavigation.OnNavigationPositionListener() {
			@Override public void onPositionChange(int y) {
				Log.d("DemoActivity", "BottomNavigation Position: " + y);
			}
		});
		*/
    viewPager.setOffscreenPageLimit(4);
    adapter = new DemoViewPagerAdapter(getSupportFragmentManager());
    viewPager.setAdapter(adapter);
    currentFragment = adapter.getCurrentFragment();
    handler.postDelayed(new Runnable() {

        @Override
        public void run() {
            // Setting custom colors for notification
            AHNotification notification = new AHNotification.Builder().setText(":)").setBackgroundColor(ContextCompat.getColor(DemoActivity.this, R.color.color_notification_back)).setTextColor(ContextCompat.getColor(DemoActivity.this, R.color.color_notification_text)).build();
            bottomNavigation.setNotification(notification, 1);
            Snackbar.make(bottomNavigation, "Snackbar with bottom navigation", Snackbar.LENGTH_SHORT).show();
        }
    }, 3000);
//bottomNavigation.setDefaultBackgroundResource(R.drawable.bottom_navigation_background);
}
Also used : OvershootInterpolator(android.view.animation.OvershootInterpolator) AHBottomNavigation(com.aurelhubert.ahbottomnavigation.AHBottomNavigation) LinearOutSlowInInterpolator(android.support.v4.view.animation.LinearOutSlowInInterpolator) Animator(android.animation.Animator) AHNotification(com.aurelhubert.ahbottomnavigation.notification.AHNotification) AHBottomNavigationAdapter(com.aurelhubert.ahbottomnavigation.AHBottomNavigationAdapter) AHBottomNavigationItem(com.aurelhubert.ahbottomnavigation.AHBottomNavigationItem)

Example 8 with LinearOutSlowInInterpolator

use of android.support.v4.view.animation.LinearOutSlowInInterpolator in project ListenerMusicPlayer by hefuyicoder.

the class FastScroller method show.

private void show() {
    if (!mAnimatingShow) {
        if (mAutoHideAnimator != null) {
            mAutoHideAnimator.cancel();
        }
        mAutoHideAnimator = ObjectAnimator.ofInt(this, "offsetX", 0);
        mAutoHideAnimator.setInterpolator(new LinearOutSlowInInterpolator());
        mAutoHideAnimator.setDuration(150);
        mAutoHideAnimator.addListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationCancel(Animator animation) {
                super.onAnimationCancel(animation);
                mAnimatingShow = false;
            }

            @Override
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
                mAnimatingShow = false;
            }
        });
        mAnimatingShow = true;
        mAutoHideAnimator.start();
    }
    if (mAutoHideEnabled) {
        postAutoHideDelayed();
    } else {
        cancelAutoHide();
    }
}
Also used : LinearOutSlowInInterpolator(android.support.v4.view.animation.LinearOutSlowInInterpolator) ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter)

Example 9 with LinearOutSlowInInterpolator

use of android.support.v4.view.animation.LinearOutSlowInInterpolator in project UltimateRecyclerView by cymcsg.

the class SliderHeader method initSlider.

private View initSlider(UltimateRecyclerView listview) {
    final View view = LayoutInflater.from(getApplication()).inflate(R.layout.list_item_header, null, false);
    final ViewTreeObserver vto = listview.getViewTreeObserver();
    vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {

        @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
        @Override
        public void onGlobalLayout() {
            view.getViewTreeObserver().removeOnGlobalLayoutListener(this);
            //Log.d("vto", "globallayout");
            final SliderLayout sl = (SliderLayout) view.findViewById(R.id.header_slider);
            try {
                sl.setOffscreenPageLimit(1);
                sl.setSliderTransformDuration(500, new LinearOutSlowInInterpolator());
                sl.setPresetTransformer(TransformerL.Default);
                sl.setPresetIndicator(SliderLayout.PresetIndicators.Center_Bottom);
                sl.getPagerIndicator().setDefaultIndicatorColor(R.color.accent, R.color.primaryDark);
                sl.getPagerIndicator().setVisibility(View.GONE);
                setup_double_faces(sl);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
    return view;
}
Also used : SliderLayout(com.hkm.slider.SliderLayout) LinearOutSlowInInterpolator(android.support.v4.view.animation.LinearOutSlowInInterpolator) BaseSliderView(com.hkm.slider.SliderTypes.BaseSliderView) TextSliderView(com.hkm.slider.SliderTypes.TextSliderView) UltimateRecyclerView(com.marshalchen.ultimaterecyclerview.UltimateRecyclerView) View(android.view.View) ViewTreeObserver(android.view.ViewTreeObserver) TargetApi(android.annotation.TargetApi)

Example 10 with LinearOutSlowInInterpolator

use of android.support.v4.view.animation.LinearOutSlowInInterpolator in project Transitions-Everywhere by andkulikov.

the class ScaleSample method onCreateView.

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_scale, container, false);
    final ViewGroup transitionsContainer = (ViewGroup) view.findViewById(R.id.transitions_container);
    final TextView text1 = (TextView) transitionsContainer.findViewById(R.id.text1);
    transitionsContainer.findViewById(R.id.button1).setOnClickListener(new VisibleToggleClickListener() {

        @Override
        protected void changeVisibility(boolean visible) {
            TransitionManager.beginDelayedTransition(transitionsContainer, new Scale());
            text1.setVisibility(visible ? View.VISIBLE : View.INVISIBLE);
        }
    });
    final TextView text2 = (TextView) transitionsContainer.findViewById(R.id.text2);
    transitionsContainer.findViewById(R.id.button2).setOnClickListener(new VisibleToggleClickListener() {

        @Override
        protected void changeVisibility(boolean visible) {
            TransitionSet set = new TransitionSet().addTransition(new Scale(0.7f)).addTransition(new Fade()).setInterpolator(visible ? new LinearOutSlowInInterpolator() : new FastOutLinearInInterpolator());
            TransitionManager.beginDelayedTransition(transitionsContainer, set);
            text2.setVisibility(visible ? View.VISIBLE : View.INVISIBLE);
        }
    });
    return view;
}
Also used : LinearOutSlowInInterpolator(android.support.v4.view.animation.LinearOutSlowInInterpolator) TransitionSet(com.transitionseverywhere.TransitionSet) ViewGroup(android.view.ViewGroup) FastOutLinearInInterpolator(android.support.v4.view.animation.FastOutLinearInInterpolator) TextView(android.widget.TextView) Scale(com.transitionseverywhere.extra.Scale) TextView(android.widget.TextView) View(android.view.View) Fade(com.transitionseverywhere.Fade) Nullable(android.support.annotation.Nullable)

Aggregations

LinearOutSlowInInterpolator (android.support.v4.view.animation.LinearOutSlowInInterpolator)11 Animator (android.animation.Animator)7 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)6 View (android.view.View)5 ObjectAnimator (android.animation.ObjectAnimator)4 ValueAnimator (android.animation.ValueAnimator)2 TargetApi (android.annotation.TargetApi)2 Nullable (android.support.annotation.Nullable)2 FastOutSlowInInterpolator (android.support.v4.view.animation.FastOutSlowInInterpolator)2 ExitFragmentTransition (com.kogitune.activity_transition.fragment.ExitFragmentTransition)2 AnimatorSet (android.animation.AnimatorSet)1 AnimatorUpdateListener (android.animation.ValueAnimator.AnimatorUpdateListener)1 FastOutLinearInInterpolator (android.support.v4.view.animation.FastOutLinearInInterpolator)1 ViewGroup (android.view.ViewGroup)1 ViewTreeObserver (android.view.ViewTreeObserver)1 OvershootInterpolator (android.view.animation.OvershootInterpolator)1 TextView (android.widget.TextView)1 AHBottomNavigation (com.aurelhubert.ahbottomnavigation.AHBottomNavigation)1 AHBottomNavigationAdapter (com.aurelhubert.ahbottomnavigation.AHBottomNavigationAdapter)1 AHBottomNavigationItem (com.aurelhubert.ahbottomnavigation.AHBottomNavigationItem)1