Example usage for android.view.animation AccelerateDecelerateInterpolator AccelerateDecelerateInterpolator

List of usage examples for android.view.animation AccelerateDecelerateInterpolator AccelerateDecelerateInterpolator

Introduction

In this page you can find the example usage for android.view.animation AccelerateDecelerateInterpolator AccelerateDecelerateInterpolator.

Prototype

public AccelerateDecelerateInterpolator() 

Source Link

Usage

From source file:ru.yandex.metricaworkshop.receiver.BarFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    mContext = getActivity();/*from   w ww .  ja  v a 2s  .c o  m*/
    mResources = getResources();
    mRequestHelper = RequestHelper.getInstance(getActivity());
    ArrayList<Bar> aBars = new ArrayList<Bar>();
    final View v = inflater.inflate(R.layout.fragment_bargraph, container, false);
    final BarGraph barGraph = (BarGraph) v.findViewById(R.id.bargraph);
    mBarGraph = barGraph;
    barGraph.setBars(aBars);

    barGraph.setDuration(1500);//default if unspecified is 300 ms
    barGraph.setInterpolator(new AccelerateDecelerateInterpolator());//Only use over/undershoot  when not inserting/deleting
    barGraph.setAnimationListener(getAnimationListener());

    return v;
}

From source file:zjut.soft.finalwork.fragment.RightFragment.java

public void plannerScaleAction() {
    ScaleAnimation scaleanim1 = new ScaleAnimation(0.0f, 1.0f, 0.0f, 1.0f, Animation.RELATIVE_TO_SELF, 0.5f,
            Animation.RELATIVE_TO_SELF, 0.5f);
    scaleanim1.setDuration(1500);/*from ww w .j  av  a2s .  c o m*/
    scaleanim1.setFillAfter(true);
    scaleanim1.setRepeatCount(Animation.INFINITE);
    scaleanim1.setRepeatMode(Animation.REVERSE);
    scaleanim1.setInterpolator(new AccelerateDecelerateInterpolator());

    plannerIV.setAnimation(scaleanim1);
    scaleanim1.startNow();
}

From source file:com.yoloo.android.util.AnimUtils.java

public static Interpolator getAccelerateDecelerateInterpolator() {
    if (accelerateDecelerate == null) {
        accelerateDecelerate = new AccelerateDecelerateInterpolator();
    }//from   w  w  w.  j  a  va 2s . c  o m
    return accelerateDecelerate;
}

From source file:com.aniruddhc.acemusic.player.WelcomeActivity.MusicFoldersFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    mContext = getActivity().getApplicationContext();
    mApp = (Common) mContext;/*from   ww w.j  a  va 2  s  .c o m*/
    View rootView = (View) getActivity().getLayoutInflater().inflate(R.layout.fragment_welcome_screen_2, null);

    mFoldersLayout = (RelativeLayout) rootView.findViewById(R.id.folders_fragment_holder);
    if (mApp.getSharedPreferences().getInt("MUSIC_FOLDERS_SELECTION", 0) == 0) {
        mFoldersLayout.setVisibility(View.INVISIBLE);
        mFoldersLayout.setEnabled(false);
    } else {
        mFoldersLayout.setVisibility(View.VISIBLE);
        mFoldersLayout.setEnabled(true);
    }

    mSlideInAnimation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF,
            0.0f, Animation.RELATIVE_TO_SELF, 2.0f, Animation.RELATIVE_TO_SELF, 0.0f);

    mSlideInAnimation.setDuration(600);
    mSlideInAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
    mSlideInAnimation.setAnimationListener(slideInListener);

    mSlideOutAnimation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF,
            0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 2.0f);
    mSlideOutAnimation.setDuration(600);
    mSlideOutAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
    mSlideOutAnimation.setAnimationListener(slideOutListener);

    mChildFragmentManager = this.getChildFragmentManager();
    mChildFragmentManager.beginTransaction()
            .add(R.id.folders_fragment_holder, getMusicFoldersSelectionFragment()).commit();

    mWelcomeHeader = (TextView) rootView.findViewById(R.id.welcome_header);
    mWelcomeHeader.setTypeface(TypefaceHelper.getTypeface(mContext, "Roboto-Light"));

    mMusicFoldersOptions = (RadioGroup) rootView.findViewById(R.id.music_library_welcome_radio_group);
    RadioButton getAllSongsRadioButton = (RadioButton) mMusicFoldersOptions
            .findViewById(R.id.get_all_songs_radio);
    RadioButton letMePickFoldersRadioButton = (RadioButton) mMusicFoldersOptions
            .findViewById(R.id.pick_folders_radio);

    getAllSongsRadioButton.setTypeface(TypefaceHelper.getTypeface(mContext, "Roboto-Regular"));
    letMePickFoldersRadioButton.setTypeface(TypefaceHelper.getTypeface(mContext, "Roboto-Regular"));

    mMusicFoldersOptions.setOnCheckedChangeListener(onCheckedChangeListener);
    return rootView;
}

From source file:com.google.cloud.android.dialogflow.ui.AudioIndicatorView.java

private void startAnimating() {
    mAnimator = ObjectAnimator.ofFloat(this, View.ALPHA, 1.f, 0.3f);
    mAnimator.setRepeatCount(ObjectAnimator.INFINITE);
    mAnimator.setRepeatMode(ObjectAnimator.REVERSE);
    mAnimator.setDuration(1000);//from w w w.  j  a  v  a  2s  .  co m
    mAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
    mAnimator.start();
}

From source file:com.hippo.anani.AnimationUtils.java

private static Interpolator createInterpolatorFromXml(Context context, XmlPullParser parser)
        throws XmlPullParserException, IOException {

    Interpolator interpolator = null;//w  ww .j a  va  2s . c o  m

    // Make sure we are on a start tag.
    int type;
    int depth = parser.getDepth();

    while (((type = parser.next()) != XmlPullParser.END_TAG || parser.getDepth() > depth)
            && type != XmlPullParser.END_DOCUMENT) {

        if (type != XmlPullParser.START_TAG) {
            continue;
        }

        AttributeSet attrs = Xml.asAttributeSet(parser);

        String name = parser.getName();

        if (name.equals("linearInterpolator")) {
            interpolator = new LinearInterpolator();
        } else if (name.equals("accelerateInterpolator")) {
            interpolator = new AccelerateInterpolator(context, attrs);
        } else if (name.equals("decelerateInterpolator")) {
            interpolator = new DecelerateInterpolator(context, attrs);
        } else if (name.equals("accelerateDecelerateInterpolator")) {
            interpolator = new AccelerateDecelerateInterpolator();
        } else if (name.equals("cycleInterpolator")) {
            interpolator = new CycleInterpolator(context, attrs);
        } else if (name.equals("anticipateInterpolator")) {
            interpolator = new AnticipateInterpolator(context, attrs);
        } else if (name.equals("overshootInterpolator")) {
            interpolator = new OvershootInterpolator(context, attrs);
        } else if (name.equals("anticipateOvershootInterpolator")) {
            interpolator = new AnticipateOvershootInterpolator(context, attrs);
        } else if (name.equals("bounceInterpolator")) {
            interpolator = new BounceInterpolator();
        } else if (name.equals("pathInterpolator")) {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                interpolator = new android.view.animation.PathInterpolator(context, attrs);
            } else {
                interpolator = new PathInterpolator(context, attrs);
            }
        } else {
            throw new RuntimeException("Unknown interpolator name: " + parser.getName());
        }
    }
    return interpolator;
}

From source file:io.github.marktony.espresso.mvp.packages.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Set the navigation bar color
    if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("navigation_bar_tint", true)) {
        getWindow().setNavigationBarColor(ContextCompat.getColor(this, R.color.colorPrimaryDark));
    }//from   ww  w  . j  a v a2 s.  co m

    // Begin the slide animation.
    Slide slide = new Slide();
    slide.setDuration(500);
    slide.setInterpolator(new AccelerateDecelerateInterpolator());
    getWindow().setExitTransition(slide);

    Explode explode = new Explode();
    explode.setDuration(500);
    explode.setInterpolator(new AccelerateDecelerateInterpolator());
    getWindow().setEnterTransition(explode);

    initViews();

    // Init the fragments.
    if (savedInstanceState != null) {
        packagesFragment = (PackagesFragment) getSupportFragmentManager().getFragment(savedInstanceState,
                "PackagesFragment");
        companiesFragment = (CompaniesFragment) getSupportFragmentManager().getFragment(savedInstanceState,
                "CompaniesFragment");
        selectedNavItem = savedInstanceState.getInt(KEY_NAV_ITEM);
    } else {
        packagesFragment = (PackagesFragment) getSupportFragmentManager().findFragmentById(R.id.content_main);
        if (packagesFragment == null) {
            packagesFragment = PackagesFragment.newInstance();
        }

        companiesFragment = (CompaniesFragment) getSupportFragmentManager().findFragmentById(R.id.content_main);
        if (companiesFragment == null) {
            companiesFragment = CompaniesFragment.newInstance();
        }
    }

    // Add the fragments.
    if (!packagesFragment.isAdded()) {
        getSupportFragmentManager().beginTransaction()
                .add(R.id.content_main, packagesFragment, "PackagesFragment").commit();
    }

    if (!companiesFragment.isAdded()) {
        getSupportFragmentManager().beginTransaction()
                .add(R.id.content_main, companiesFragment, "CompaniesFragment").commit();
    }

    // Make sure the data in repository is the latest.
    // Also to void the repo only contains a package
    // when user has already gone to detail page
    // by check a notification or widget.
    PackagesRepository.destroyInstance();
    // Init the presenters.
    packagesPresenter = new PackagesPresenter(packagesFragment, PackagesRepository
            .getInstance(PackagesRemoteDataSource.getInstance(), PackagesLocalDataSource.getInstance()));

    new CompaniesPresenter(companiesFragment,
            CompaniesRepository.getInstance(CompaniesLocalDataSource.getInstance()));

    // Get data from Bundle.
    if (savedInstanceState != null) {
        PackageFilterType currentFiltering = (PackageFilterType) savedInstanceState
                .getSerializable(CURRENT_FILTERING_KEY);
        packagesPresenter.setFiltering(currentFiltering);
    }

    // Show the default fragment.
    if (selectedNavItem == 0) {
        showPackagesFragment();
    } else if (selectedNavItem == 1) {
        showCompaniesFragment();
    }

    PushUtil.startReminderService(this);

}

From source file:io.github.prefanatic.cleantap.ui.BeerInfoActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setupAnimations();//from   w ww. ja v  a 2 s  .c  om

    setContentView(R.layout.activity_beer_info);

    stats = (BeerStatsDto) getIntent().getSerializableExtra("beer");
    presenter.getBeerInfo(stats.beer.bid);

    adapter = new BeerInfoAdapter(this);
    recycler.setAdapter(adapter);
    recycler.setItemAnimator(new SlideInUpAnimator(new AccelerateDecelerateInterpolator()));
    recycler.setLayoutManager(new LinearLayoutManager(this));
    recycler.addOnChildAttachStateChangeListener(new RecyclerView.OnChildAttachStateChangeListener() {
        @Override
        public void onChildViewAttachedToWindow(View view) {
            startPostponedEnterTransition();
            //animateViewsOnEnter();
            recycler.removeOnChildAttachStateChangeListener(this);
        }

        @Override
        public void onChildViewDetachedFromWindow(View view) {

        }
    });

    adapter.addItem(stats);
    adapter.addItem(stats.brewery);

    toolbar.setNavigationIcon(R.drawable.ic_arrow_back_24dp);
    toolbarLayout.setTitle(stats.beer.beer_name);

    watch(RxToolbar.navigationClicks(toolbar).subscribe(v -> onBackPressed()));
    watch(RxRecyclerView.scrollEvents(recycler).subscribe(this::handleFabOnScrollOnRecycler));
    watch(RxAppBarLayout.offsetChanges(appbarLayout).subscribe(this::handleFabOnScrollOnAppBar));
    watch(RxView.preDraws(recycler, new Func0<Boolean>() {
        @Override
        public Boolean call() {
            //animateViewsOnEnter();
            return true;
        }
    }).subscribe());
}

From source file:com.cocarechina.pullrefreshview.layout.FlingLayout.java

public void init(Context context) {
    version = android.os.Build.VERSION.SDK_INT;
    mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
    mScroller = new Scroller(context, new AccelerateDecelerateInterpolator());
    mParentHelper = new NestedScrollingParentHelper(this);
    mChildHelper = new NestedScrollingChildHelper(this);
}

From source file:com.stepstone.stepper.internal.DottedProgressBar.java

private void update(boolean shouldAnimate) {
    for (int i = 0; i < mDotCount; i++) {
        final AccelerateDecelerateInterpolator interpolator = new AccelerateDecelerateInterpolator();
        if (i == mCurrent) {
            getChildAt(i).animate().scaleX(FULL_SCALE).scaleY(FULL_SCALE)
                    .setDuration(shouldAnimate ? SCALE_ANIMATION_DEFAULT_DURATION : DURATION_IMMEDIATE)
                    .setInterpolator(interpolator).start();
            colorChildAtPosition(i, true);
        } else {/*from   www  .  ja  v a  2 s  . co  m*/
            getChildAt(i).animate().scaleX(HALF_SCALE).scaleY(HALF_SCALE)
                    .setDuration(shouldAnimate ? SCALE_ANIMATION_DEFAULT_DURATION : DURATION_IMMEDIATE)
                    .setInterpolator(interpolator).start();
            colorChildAtPosition(i, false);
        }
    }
}