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:io.github.marktony.espresso.ui.PrefsActivity.java

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

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

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

    initViews();

    Intent intent = getIntent();
    Fragment fragment;

    if (intent.getIntExtra(EXTRA_FLAG, 0) == FLAG_SETTINGS) {
        setTitle(R.string.nav_settings);
        fragment = new SettingsFragment();
    } else if (intent.getIntExtra(EXTRA_FLAG, 0) == FLAG_ABOUT) {
        setTitle(R.string.nav_about);
        fragment = new AboutFragment();
    } else if (intent.getIntExtra(EXTRA_FLAG, 0) == FLAG_LICENSES) {
        setTitle(R.string.licenses);
        fragment = new LicensesFragment();
    } else {
        throw new RuntimeException("Please set flag when launching PrefsActivity.");
    }

    getSupportFragmentManager().beginTransaction().replace(R.id.container, fragment).commit();

}

From source file:io.github.marktony.espresso.mvp.packagedetails.PackageDetailsActivity.java

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.container);/*www .  j  a  v a2s.  com*/

    // Set the navigation bar color
    if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("navigation_bar_tint", true)) {
        getWindow().setNavigationBarColor(ContextCompat.getColor(this, R.color.colorPrimaryDark));
    }

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

    // Restore the status.
    if (savedInstanceState != null) {
        fragment = (PackageDetailsFragment) getSupportFragmentManager().getFragment(savedInstanceState,
                "PackageDetailsFragment");
    } else {
        fragment = PackageDetailsFragment.newInstance();
    }

    getSupportFragmentManager().beginTransaction().replace(R.id.container, fragment).commit();

    // Create the presenter.
    new PackageDetailsPresenter(getIntent().getStringExtra(PACKAGE_ID), PackagesRepository.getInstance(
            PackagesRemoteDataSource.getInstance(), PackagesLocalDataSource.getInstance()), fragment);

}

From source file:io.github.marktony.espresso.mvp.search.SearchActivity.java

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.container);//from  w  w w  .  j  a v a  2s. co  m

    // Set the navigation bar color
    if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("navigation_bar_tint", true)) {
        getWindow().setNavigationBarColor(ContextCompat.getColor(this, R.color.colorPrimaryDark));
    }

    // Set the animations.
    Explode explode = new Explode();
    explode.setDuration(500);
    explode.setInterpolator(new AccelerateDecelerateInterpolator());
    getWindow().setEnterTransition(explode);

    if (savedInstanceState != null) {
        fragment = (SearchFragment) getSupportFragmentManager().getFragment(savedInstanceState,
                "SearchFragment");
    } else {
        fragment = SearchFragment.newInstance();
    }

    getSupportFragmentManager().beginTransaction().replace(R.id.container, fragment).commit();

    new SearchPresenter(fragment,
            PackagesRepository.getInstance(PackagesRemoteDataSource.getInstance(),
                    PackagesLocalDataSource.getInstance()),
            CompaniesRepository.getInstance(CompaniesLocalDataSource.getInstance()));

}

From source file:io.github.marktony.espresso.mvp.addpackage.AddPackageActivity.java

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.container);//  ww w. ja va 2s . c  o m

    // Set the navigation bar color
    if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("navigation_bar_tint", true)) {
        getWindow().setNavigationBarColor(ContextCompat.getColor(this, R.color.colorPrimaryDark));
    }

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

    if (savedInstanceState != null) {
        fragment = (AddPackageFragment) getSupportFragmentManager().getFragment(savedInstanceState,
                "AddPackageFragment");
    } else {
        fragment = AddPackageFragment.newInstance();
    }

    if (!fragment.isAdded()) {
        getSupportFragmentManager().beginTransaction().replace(R.id.container, fragment, "AddPackageFragment")
                .commit();
    }

    // Create the presenter.
    new AddPackagePresenter(
            PackagesRepository.getInstance(PackagesRemoteDataSource.getInstance(),
                    PackagesLocalDataSource.getInstance()),
            CompaniesRepository.getInstance(CompaniesLocalDataSource.getInstance()), fragment);

}

From source file:com.example.toolbardemo.Fragment.CircularRevealFragment.java

/**
 * {@inheritDoc}/*from  ww  w. j a  va2 s. c  o m*/
 * @see android.support.v4.app.Fragment#onActivityCreated(android.os.Bundle)
 */
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onActivityCreated(savedInstanceState);
    tv1 = (TextView) getActivity().findViewById(R.id.textView1);
    tv2 = (TextView) getActivity().findViewById(R.id.textView2);
    tv3 = (TextView) getActivity().findViewById(R.id.textView3);
    tv4 = (TextView) getActivity().findViewById(R.id.textView4);
    tv1.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Animator animator = ViewAnimationUtils.createCircularReveal(tv1, tv1.getWidth() / 2,
                    tv1.getHeight() / 2, tv1.getWidth(), 0);
            animator.setInterpolator(new AccelerateDecelerateInterpolator());
            animator.setDuration(1000);
            animator.start();
        }
    });
    tv2.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Animator animator = ViewAnimationUtils.createCircularReveal(tv2, 0, 0, 0,
                    (float) Math.hypot(tv2.getWidth(), tv2.getHeight()));
            animator.setInterpolator(new AccelerateInterpolator());
            animator.setDuration(1000);
            animator.start();
        }
    });
    tv3.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Animator animator = ViewAnimationUtils.createCircularReveal(tv3, tv3.getWidth() / 2,
                    tv3.getHeight() / 2, 0, tv3.getWidth());
            animator.setInterpolator(new AccelerateInterpolator());
            animator.setDuration(1000);
            animator.start();
        }
    });
    tv4.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Animator animator = ViewAnimationUtils.createCircularReveal(tv4, 0, 0,
                    (float) Math.hypot(tv4.getWidth(), tv4.getHeight()), 0);
            animator.setInterpolator(new AccelerateInterpolator());
            animator.setDuration(1000);
            animator.start();
        }
    });
}

From source file:org.cyanogenmod.designertools.ui.CreditsActivity.java

private void circularRevealActivity(View v) {

    int cx = v.getWidth() / 2;
    int cy = v.getHeight() / 2;

    float finalRadius = Math.max(v.getWidth(), v.getHeight());

    // create the animator for this view (the start radius is zero)
    Animator circularReveal = ViewAnimationUtils.createCircularReveal(v, cx, cy, 0, finalRadius);
    circularReveal.setDuration(getResources().getInteger(R.integer.credits_circular_reveal_duration));

    // make the view visible and start the animation
    v.setVisibility(View.VISIBLE);
    circularReveal.setInterpolator(new AccelerateDecelerateInterpolator());
    circularReveal.addListener(new Animator.AnimatorListener() {
        @Override/*from   w ww . j  a  v  a2 s  .c o m*/
        public void onAnimationStart(Animator animator) {
        }

        @Override
        public void onAnimationEnd(Animator animator) {
            animateContent();
        }

        @Override
        public void onAnimationCancel(Animator animator) {
        }

        @Override
        public void onAnimationRepeat(Animator animator) {
        }
    });
    circularReveal.start();
}

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

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

    mContext = getActivity();/*from   ww w .  ja va2  s.c  om*/
    mRequestHelper = RequestHelper.getInstance(getActivity());
    final View v = inflater.inflate(R.layout.fragment_piegraph, container, false);
    mPieGraph = (PieGraph) v.findViewById(R.id.piegraph);
    mPieGraph.setDuration(Consts.PIE_GRAPH_ANIMATION_DURATION);
    mPieGraph.setInterpolator(new AccelerateDecelerateInterpolator());

    return v;
}

From source file:com.savvasdalkitsis.betwixt.Interpolators.java

/**
 * <strong>ANDROID INTERPOLATOR</strong><br/><br/>
 * An interpolator where the rate of change starts and ends slowly but accelerates through the middle.
 *///  ww w . j a va 2s.  c  om
@NonNull
public static Interpolator accelerateDecelerate() {
    return new AccelerateDecelerateInterpolator();
}

From source file:com.example.android.revealeffectbasic.RevealEffectBasicFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final View rootView = inflater.inflate(R.layout.reveal_effect_basic, container, false);

    View button = rootView.findViewById(R.id.button);

    // Set a listener to reveal the view when clicked.
    button.setOnClickListener(new View.OnClickListener() {
        @Override/* w ww  .  j  a  v a  2 s. c  om*/
        public void onClick(View view) {
            View shape = rootView.findViewById(R.id.circle);

            // Create a reveal {@link Animator} that starts clipping the view from
            // the top left corner until the whole view is covered.
            Animator animator = ViewAnimationUtils.createCircularReveal(shape, 0, 0, 0,
                    (float) Math.hypot(shape.getWidth(), shape.getHeight()));

            // Set a natural ease-in/ease-out interpolator.
            animator.setInterpolator(new AccelerateDecelerateInterpolator());

            // Finally start the animation
            animator.start();

            Log.d(TAG, "Starting Reveal animation");
        }
    });

    return rootView;
}

From source file:com.github.rubensousa.floatingtoolbar.FloatingAnimatorImpl.java

@Override
public void show() {
    super.show();
    int rootWidth = getRootView().getWidth();
    float endFabX;

    if (getFab().getLeft() > rootWidth / 2f) {
        endFabX = getFab().getLeft() - getFab().getWidth();
    } else {/*from w w  w.  j  a v a2  s.c om*/
        endFabX = getFab().getLeft() + getFab().getWidth();
    }

    PropertyValuesHolder xProperty = PropertyValuesHolder.ofFloat(View.X, endFabX);
    PropertyValuesHolder yProperty = PropertyValuesHolder.ofFloat(View.Y, getFloatingToolbar().getY() * 0.95f);
    PropertyValuesHolder scaleXProperty = PropertyValuesHolder.ofFloat(View.SCALE_X, 0);
    PropertyValuesHolder scaleYProperty = PropertyValuesHolder.ofFloat(View.SCALE_Y, 0);

    ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(getFab(), xProperty, yProperty,
            scaleXProperty, scaleYProperty);
    animator.setDuration(FAB_MORPH_DURATION);
    animator.setInterpolator(new AccelerateInterpolator());
    animator.start();

    ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(getFloatingToolbar(), "scaleX", 1f);
    objectAnimator.setDuration(CIRCULAR_REVEAL_DURATION);
    objectAnimator.setStartDelay(CIRCULAR_REVEAL_DELAY);
    objectAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
    objectAnimator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationStart(Animator animation) {
            getFloatingToolbar().setVisibility(View.VISIBLE);
            getFab().setVisibility(View.INVISIBLE);
        }
    });
    objectAnimator.start();
}