Search in sources :

Example 1 with ContentFragment

use of yalantis.com.sidemenu.sample.fragment.ContentFragment in project Side-Menu.Android by Yalantis.

the class MainActivity method replaceFragment.

private ScreenShotable replaceFragment(ScreenShotable screenShotable, int topPosition) {
    this.res = this.res == R.drawable.content_music ? R.drawable.content_films : R.drawable.content_music;
    View view = findViewById(R.id.content_frame);
    int finalRadius = Math.max(view.getWidth(), view.getHeight());
    SupportAnimator animator = ViewAnimationUtils.createCircularReveal(view, 0, topPosition, 0, finalRadius);
    animator.setInterpolator(new AccelerateInterpolator());
    animator.setDuration(ViewAnimator.CIRCULAR_REVEAL_ANIMATION_DURATION);
    findViewById(R.id.content_overlay).setBackgroundDrawable(new BitmapDrawable(getResources(), screenShotable.getBitmap()));
    animator.start();
    ContentFragment contentFragment = ContentFragment.newInstance(this.res);
    getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, contentFragment).commit();
    return contentFragment;
}
Also used : ContentFragment(yalantis.com.sidemenu.sample.fragment.ContentFragment) AccelerateInterpolator(android.view.animation.AccelerateInterpolator) SupportAnimator(io.codetail.animation.SupportAnimator) BitmapDrawable(android.graphics.drawable.BitmapDrawable) View(android.view.View)

Aggregations

BitmapDrawable (android.graphics.drawable.BitmapDrawable)1 View (android.view.View)1 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)1 SupportAnimator (io.codetail.animation.SupportAnimator)1 ContentFragment (yalantis.com.sidemenu.sample.fragment.ContentFragment)1