Search in sources :

Example 1 with VerticalExplodeTransition

use of de.geeksfactory.opacclient.ui.VerticalExplodeTransition in project opacclient by opacapp.

the class SearchResultDetailActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // 
    if (savedInstanceState == null) {
        // Create the detail fragment and add it to the activity
        // using a fragment transaction.
        Bundle arguments = new Bundle();
        arguments.putInt(SearchResultDetailFragment.ARG_ITEM_NR, getIntent().getIntExtra(SearchResultDetailFragment.ARG_ITEM_NR, 0));
        if (getIntent().hasExtra(SearchResultDetailFragment.ARG_ITEM_ID)) {
            arguments.putString(SearchResultDetailFragment.ARG_ITEM_ID, getIntent().getStringExtra(SearchResultDetailFragment.ARG_ITEM_ID));
        }
        if (getIntent().hasExtra(SearchResultDetailFragment.ARG_ITEM_COVER_BITMAP)) {
            arguments.putParcelable(SearchResultDetailFragment.ARG_ITEM_COVER_BITMAP, getIntent().getParcelableExtra(SearchResultDetailFragment.ARG_ITEM_COVER_BITMAP));
        }
        if (getIntent().hasExtra(SearchResultDetailFragment.ARG_ITEM_MEDIATYPE)) {
            arguments.putString(SearchResultDetailFragment.ARG_ITEM_MEDIATYPE, getIntent().getStringExtra(SearchResultDetailFragment.ARG_ITEM_MEDIATYPE));
        }
        detailFragment = new SearchResultDetailFragment();
        detailFragment.setArguments(arguments);
        getSupportFragmentManager().beginTransaction().add(R.id.searchresult_detail_container, detailFragment).commit();
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            int touchX = getIntent().getIntExtra(ARG_TOUCH_POSITION_X, 0);
            int touchY = getIntent().getIntExtra(ARG_TOUCH_POSITION_Y, 0);
            TransitionSet enterTransition = new TransitionSet();
            enterTransition.addTransition(new CircularRevealTransition().setStartPosition(this, touchX, touchY).addTarget(R.id.gradient_top).addTarget(R.id.gradient_bottom));
            enterTransition.addTransition(new VerticalExplodeTransition().excludeTarget(R.id.gradient_bottom, true).excludeTarget(R.id.gradient_top, true));
            enterTransition.excludeTarget(android.R.id.statusBarBackground, true);
            getWindow().setEnterTransition(enterTransition);
            TransitionSet exitTransition = new TransitionSet();
            exitTransition.addTransition(new Fade().addTarget(R.id.gradient_bottom).addTarget(R.id.gradient_top));
            exitTransition.addTransition(new VerticalExplodeTransition().excludeTarget(R.id.gradient_bottom, true).excludeTarget(R.id.gradient_top, true));
            exitTransition.excludeTarget(android.R.id.statusBarBackground, true);
            getWindow().setReturnTransition(exitTransition);
            getWindow().setSharedElementsUseOverlay(false);
        }
    }
}
Also used : TransitionSet(android.transition.TransitionSet) Bundle(android.os.Bundle) CircularRevealTransition(de.geeksfactory.opacclient.ui.CircularRevealTransition) VerticalExplodeTransition(de.geeksfactory.opacclient.ui.VerticalExplodeTransition) Fade(android.transition.Fade)

Aggregations

Bundle (android.os.Bundle)1 Fade (android.transition.Fade)1 TransitionSet (android.transition.TransitionSet)1 CircularRevealTransition (de.geeksfactory.opacclient.ui.CircularRevealTransition)1 VerticalExplodeTransition (de.geeksfactory.opacclient.ui.VerticalExplodeTransition)1