Example usage for android.transition Explode setDuration

List of usage examples for android.transition Explode setDuration

Introduction

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

Prototype

public Transition setDuration(long duration) 

Source Link

Document

Sets the duration of this transition.

Usage

From source file:com.example.bobbyranjan.ybsandroid.BaseActivity.java

protected void setUpAnimation() {

    Explode enterTransition = new Explode();
    enterTransition.setDuration(getResources().getInteger(R.integer.anim_duration));
    getWindow().setEnterTransition(enterTransition);
}

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);// w  w w. j  a v a  2 s . com

    // 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.packagedetails.PackageDetailsActivity.java

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.container);//w w  w  .  j  a  v  a2s  . c om

    // 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.companydetails.CompanyDetailActivity.java

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.container);/*from  w  w  w.ja v  a 2 s.co  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 = (CompanyDetailFragment) getSupportFragmentManager().getFragment(savedInstanceState,
                "CompanyDetailFragment");
    } else {
        fragment = CompanyDetailFragment.newInstance();
    }

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

    new CompanyDetailPresenter(fragment,
            CompaniesRepository.getInstance(CompaniesLocalDataSource.getInstance()),
            getIntent().getStringExtra(COMPANY_ID));

}

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);//from   w  ww. j  a  v a 2 s  .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: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));
    }/*  ww  w.  j a v a  2  s .  co  m*/

    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: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);
        }//  w  ww . j a  v a  2  s.c  om
    }
    supportFinishAfterTransition();
}

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  ww  .j a 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);

}