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:com.example.kyle.myapplication.MainActivity.java

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

    viewGroup = (ViewGroup) findViewById(R.id.view_group);

    textView = (TextView) findViewById(R.id.textView);
    textView.setText("Animation demo");

    imageView = (ImageView) findViewById(R.id.imageView);
    imageView2 = (ImageView) findViewById(R.id.imageView2);
    imageView3 = (ImageView) findViewById(R.id.imageView3);

    button = (Button) findViewById(R.id.button);
    button.setText("OK");
    button.setOnClickListener(new View.OnClickListener() {
        @Override/*  w  ww .  j  a v  a2  s . co m*/
        public void onClick(View v) {
            TransitionManager.beginDelayedTransition(viewGroup, new Explode());
            toggle(textView, imageView, imageView2, imageView3);
        }
    });
}

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);/*w w  w .  j  a v  a2s .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 = (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.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  va 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);//from ww w  .  ja  v a2  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);

    // 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:org.opensilk.common.ui.mortarfragment.FragmentManagerOwner.java

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public int addFragment(Fragment frag, String tag, boolean addToBackstack) {
    if (!hasView())
        return -1;
    FragmentTransaction ft = getView().getSupportFragmentManager().beginTransaction();
    if (VersionUtils.hasLollipop()) {
        frag.setEnterTransition(new Explode());
        frag.setExitTransition(new Explode());
    } else {//from  www . j  a v  a2  s .c o m
        ft.setTransitionStyle(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
    }
    ft.add(frag, tag);
    if (addToBackstack)
        ft.addToBackStack(tag);
    return ft.commit();
}

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 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));
    }

    // 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);//from   ww w.j  a  v a2s. 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 = (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.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:com.melkir.ourstreets.fragment.GalleryFragment.java

public GalleryFragment() {

    final Fade fade = new Fade();
    fade.addTarget(R.id.appbar);//from www .j  a  v a 2 s  .c  o  m

    Explode explode = new Explode();
    explode.excludeTarget(R.id.appbar, true);

    Elevation elevation = new Elevation();
    elevation.addTarget(R.id.gallery_card);
    elevation.setStartDelay(250); // arbitrarily chosen delay

    TransitionSet exit = new TransitionSet();
    exit.addTransition(fade);
    exit.addTransition(explode);
    exit.addTransition(elevation);

    setExitTransition(exit);
}

From source file:com.tutosandroidfrance.designsupporttest.MainActivity.java

private void setupWindowAnimations() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {

        Explode explode = new Explode();
        getWindow().setExitTransition(explode);

        Fade fade = new Fade();
        getWindow().setReenterTransition(fade);
    }/*from  ww w. j  av  a 2 s .  co m*/
}