Example usage for android.transition Explode Explode

List of usage examples for android.transition Explode Explode

Introduction

In this page you can find the example usage for android.transition Explode Explode.

Prototype

public Explode() 

Source Link

Usage

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 w w  w  .  ja  v  a 2 s  .c om*/

    // 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:com.nasahapps.awkwardratings.ui.MainActivity.java

@TargetApi(21)
@Override//ww  w.  j a  v a 2  s  .  c  om
protected void onCreate(Bundle savedInstanceState) {
    if (Utils.isAtApiLevel(21)) {
        // Set window transitions for when user clicks a movie
        getWindow().setAllowEnterTransitionOverlap(true);
        getWindow().setAllowReturnTransitionOverlap(true);
        getWindow().setExitTransition(new Explode());
    }
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity);
    if (savedInstanceState == null) {
        getSupportFragmentManager().beginTransaction().add(R.id.container, new MainFragment()).commit();
    }

    AnalyticsHelper.getInstance(this).sendScreenViewAnalytics("Main page");
}

From source file:by.gdgminsk.animationguide.ContactDetailsActivity.java

private void exit() {
    if (mInitialOrientation != mCurrentOrientation || mCurrentCollapsingRate > 0.9f) {
        // remove tranistion name on exit to let activity explode insted of playing
        // reverse shared element animation. Better override return transition and
        // not to play shared element back because if returning activity recreated
        // there is a glitch because the end coordinate of shared element may not exist
        ViewCompat.setTransitionName(mPhotoView, null);

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            Explode transition = new Explode();
            transition.setPropagation(new CircularPropagation());
            transition.setDuration(getResources().getInteger(R.integer.duration_explode));
            transition.setInterpolator(AnimUtils.EASE_OUT_INTERPOLATOR);
            getWindow().setReturnTransition(transition);
        }/*from  w  ww. j  a  v a 2  s.c om*/
    }
    supportFinishAfterTransition();
}