List of usage examples for android.transition TransitionInflater from
public static TransitionInflater from(Context context)
From source file:com.example.android.basictransition.BasicTransitionFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_basic_transition, container, false); assert view != null; RadioGroup radioGroup = (RadioGroup) view.findViewById(R.id.select_scene); radioGroup.setOnCheckedChangeListener(this); mSceneRoot = (ViewGroup) view.findViewById(R.id.scene_root); // BEGIN_INCLUDE(instantiation_from_view) // A Scene can be instantiated from a live view hierarchy. mScene1 = new Scene(mSceneRoot, (ViewGroup) mSceneRoot.findViewById(R.id.container)); // END_INCLUDE(instantiation_from_view) // BEGIN_INCLUDE(instantiation_from_resource) // You can also inflate a generate a Scene from a layout resource file. mScene2 = Scene.getSceneForLayout(mSceneRoot, R.layout.scene2, getActivity()); // END_INCLUDE(instantiation_from_resource) // Another scene from a layout resource file. mScene3 = Scene.getSceneForLayout(mSceneRoot, R.layout.scene3, getActivity()); // BEGIN_INCLUDE(custom_transition_manager) // We create a custom TransitionManager for Scene 3, in which ChangeBounds and Fade // take place at the same time. mTransitionManagerForScene3 = TransitionInflater.from(getActivity()) .inflateTransitionManager(R.transition.scene3_transition_manager, mSceneRoot); // END_INCLUDE(custom_transition_manager) return view;//from w w w .j a v a 2 s . co m }
From source file:com.example.st.animsharedemo.transitions.BasicTransitionFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_basic_transition, container, false); assert view != null; RadioGroup radioGroup = (RadioGroup) view.findViewById(R.id.select_scene); radioGroup.setOnCheckedChangeListener(this); mSceneRoot = (ViewGroup) view.findViewById(R.id.scene_root); // BEGIN_INCLUDE(instantiation_from_view) // A Scene can be instantiated from a live view hierarchy. mScene1 = new Scene(mSceneRoot, (ViewGroup) mSceneRoot.findViewById(R.id.container)); // END_INCLUDE(instantiation_from_view) // BEGIN_INCLUDE(instantiation_from_resource) // You can also inflate a generate a Scene from a layout resource file. mScene2 = Scene.getSceneForLayout(mSceneRoot, R.layout.scene22, getActivity()); // END_INCLUDE(instantiation_from_resource) // Another scene from a layout resource file. mScene3 = Scene.getSceneForLayout(mSceneRoot, R.layout.scene33, getActivity()); // BEGIN_INCLUDE(custom_transition_manager) // We create a custom TransitionManager for Scene 3, in which ChangeBounds and Fade // take place at the same time. mTransitionManagerForScene3 = TransitionInflater.from(getActivity()) .inflateTransitionManager(R.transition.scene3_transition_manager, mSceneRoot); // END_INCLUDE(custom_transition_manager) return view;// w ww . j av a 2 s.c o m }
From source file:org.xbmc.kore.ui.AddonsActivity.java
@TargetApi(21) @Override//from w w w . j a v a 2 s.c om protected void onCreate(Bundle savedInstanceState) { // Request transitions on lollipop if (Utils.isLollipopOrLater()) { getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS); } super.onCreate(savedInstanceState); setContentView(R.layout.activity_generic_media); // Set up the drawer. navigationDrawerFragment = (NavigationDrawerFragment) getSupportFragmentManager() .findFragmentById(R.id.navigation_drawer); navigationDrawerFragment.setUp(R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout)); if (savedInstanceState == null) { AddonListContainerFragment addonListFragment = new AddonListContainerFragment(); // Setup animations if (Utils.isLollipopOrLater()) { //Fade added to prevent shared element from disappearing very shortly at the start of the transition. Transition fade = TransitionInflater.from(this).inflateTransition(android.R.transition.fade); addonListFragment.setExitTransition(fade); addonListFragment.setReenterTransition(fade); addonListFragment.setSharedElementReturnTransition( TransitionInflater.from(this).inflateTransition(R.transition.change_image)); android.support.v4.app.SharedElementCallback seCallback = new android.support.v4.app.SharedElementCallback() { @Override public void onMapSharedElements(List<String> names, Map<String, View> sharedElements) { if (clearSharedElements) { names.clear(); sharedElements.clear(); clearSharedElements = false; } } }; addonListFragment.setExitSharedElementCallback(seCallback); } getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, addonListFragment).commit(); } else { selectedAddonId = savedInstanceState.getString(ADDONID, null); selectedAddonTitle = savedInstanceState.getString(ADDONTITLE, null); } setupActionBar(selectedAddonTitle); }
From source file:com.syncedsynapse.kore2.ui.TVShowsActivity.java
@TargetApi(21) @Override/*from w ww .j av a 2s . com*/ protected void onCreate(Bundle savedInstanceState) { // Request transitions on lollipop if (Utils.isLollipopOrLater()) { getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS); } super.onCreate(savedInstanceState); setContentView(R.layout.activity_generic_media); // Set up the drawer. navigationDrawerFragment = (NavigationDrawerFragment) getSupportFragmentManager() .findFragmentById(R.id.navigation_drawer); navigationDrawerFragment.setUp(R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout)); if (savedInstanceState == null) { TVShowListFragment tvshowListFragment = new TVShowListFragment(); // Setup animations if (Utils.isLollipopOrLater()) { tvshowListFragment.setExitTransition(null); tvshowListFragment.setReenterTransition( TransitionInflater.from(this).inflateTransition(android.R.transition.fade)); } getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, tvshowListFragment) .commit(); } else { selectedTVShowId = savedInstanceState.getInt(TVSHOWID, -1); selectedTVShowTitle = savedInstanceState.getString(TVSHOWTITLE, null); selectedEpisodeId = savedInstanceState.getInt(EPISODEID, -1); } setupActionBar(selectedTVShowTitle); // // Setup system bars and content padding, allowing averlap with the bottom bar // setupSystemBarsColors(); // UIUtils.setPaddingForSystemBars(this, findViewById(R.id.fragment_container), true, true, true); // UIUtils.setPaddingForSystemBars(this, findViewById(R.id.drawer_layout), true, true, true); }
From source file:org.xbmc.kore.ui.MoviesActivity.java
@TargetApi(21) @Override/*from www .ja va 2s . co m*/ protected void onCreate(Bundle savedInstanceState) { // Request transitions on lollipop if (Utils.isLollipopOrLater()) { getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS); } super.onCreate(savedInstanceState); setContentView(R.layout.activity_generic_media); // Set up the drawer. navigationDrawerFragment = (NavigationDrawerFragment) getSupportFragmentManager() .findFragmentById(R.id.navigation_drawer); navigationDrawerFragment.setUp(R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout)); if (savedInstanceState == null) { movieListFragment = new MovieListFragment(); // Setup animations if (Utils.isLollipopOrLater()) { //Fade added to prevent shared element from disappearing very shortly at the start of the transition. Transition fade = TransitionInflater.from(this).inflateTransition(android.R.transition.fade); movieListFragment.setExitTransition(fade); movieListFragment.setReenterTransition(fade); movieListFragment.setSharedElementReturnTransition( TransitionInflater.from(this).inflateTransition(R.transition.change_image)); android.support.v4.app.SharedElementCallback seCallback = new android.support.v4.app.SharedElementCallback() { @Override public void onMapSharedElements(List<String> names, Map<String, View> sharedElements) { if (clearSharedElements) { names.clear(); sharedElements.clear(); clearSharedElements = false; } } }; movieListFragment.setExitSharedElementCallback(seCallback); } getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, movieListFragment).commit(); } else { selectedMovieId = savedInstanceState.getInt(MOVIEID, -1); selectedMovieTitle = savedInstanceState.getString(MOVIETITLE, null); } setupActionBar(selectedMovieTitle); }
From source file:io.plaidapp.ui.AboutActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_about); ButterKnife.bind(this); pager.setAdapter(new AboutPagerAdapter(this)); pager.setPageMargin(getResources().getDimensionPixelSize(R.dimen.spacing_normal)); pageIndicator.setViewPager(pager);//from www . ja v a2s . c o m draggableFrame.addListener(new ElasticDragDismissFrameLayout.SystemChromeFader(getWindow()) { @Override public void onDragDismissed() { // if we drag dismiss downward then the default reversal of the enter // transition would slide content upward which looks weird. So reverse it. if (draggableFrame.getTranslationY() > 0) { getWindow().setReturnTransition(TransitionInflater.from(AboutActivity.this) .inflateTransition(R.transition.about_return_downward)); } finishAfterTransition(); } }); }
From source file:com.example.tripi.transitionanimation.BasicTransitionFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_basic_transition, container, false); assert view != null; RadioGroup radioGroup = (RadioGroup) view.findViewById(R.id.select_scene); radioGroup.setOnCheckedChangeListener(this); mSceneRoot = (ViewGroup) view.findViewById(R.id.scene_root); // BEGIN_INCLUDE(instantiation_from_view) // A Scene can be instantiated from a live view hierarchy. mScene1 = Scene.getSceneForLayout(mSceneRoot, R.layout.scene1, getActivity()); // mScene1 = new Scene(mSceneRoot, (ViewGroup) mSceneRoot.findViewById(R.id.container)); // END_INCLUDE(instantiation_from_view) // BEGIN_INCLUDE(instantiation_from_resource) // You can also inflate a generate a Scene from a layout resource file. mScene2 = Scene.getSceneForLayout(mSceneRoot, R.layout.scene2, getActivity()); // END_INCLUDE(instantiation_from_resource) // Another scene from a layout resource file. mScene3 = Scene.getSceneForLayout(mSceneRoot, R.layout.scene3, getActivity()); // BEGIN_INCLUDE(custom_transition_manager) // We create a custom TransitionManager for Scene 3, in which ChangeBounds and Fade // take place at the same time. mTransitionManagerForScene3 = TransitionInflater.from(getActivity()) .inflateTransitionManager(R.transition.scene3_transition_manager, mSceneRoot); mTransitionManagerForScene2 = TransitionInflater.from(getActivity()) .inflateTransitionManager(R.transition.scene2_transition_manager, mSceneRoot); mTransitionManagerForScene1 = TransitionInflater.from(getActivity()) .inflateTransitionManager(R.transition.scene1_transition_manager, mSceneRoot); // END_INCLUDE(custom_transition_manager) return view;//w w w . j a va2 s . c o m }
From source file:org.xbmc.kore.ui.PVRActivity.java
@TargetApi(21) @Override//from w w w . j a v a 2 s . com protected void onCreate(Bundle savedInstanceState) { // Request transitions on lollipop if (Utils.isLollipopOrLater()) { getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS); } super.onCreate(savedInstanceState); setContentView(R.layout.activity_generic_media); // Set up the drawer. navigationDrawerFragment = (NavigationDrawerFragment) getSupportFragmentManager() .findFragmentById(R.id.navigation_drawer); navigationDrawerFragment.setUp(R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout)); if (savedInstanceState == null) { PVRListFragment pvrListFragment = new PVRListFragment(); // Setup animations if (Utils.isLollipopOrLater()) { pvrListFragment.setExitTransition(null); pvrListFragment.setReenterTransition( TransitionInflater.from(this).inflateTransition(android.R.transition.fade)); } getSupportFragmentManager().beginTransaction() .add(R.id.fragment_container, pvrListFragment, LISTFRAGMENTTAG).commit(); } else { selectedChannelId = savedInstanceState.getInt(CHANNELID, -1); selectedChannelTitle = savedInstanceState.getString(CHANNELTITLE, null); selectedChannelGroupId = savedInstanceState.getInt(CHANNELGROUPID, -1); selectedChannelGroupTitle = savedInstanceState.getString(CHANNELGROUPTITLE, null); } setupActionBar(selectedChannelGroupTitle, selectedChannelTitle); }
From source file:org.xbmc.kore.ui.TVShowsActivity.java
@TargetApi(21) @Override//from www .j a v a2 s.c o m protected void onCreate(Bundle savedInstanceState) { // Request transitions on lollipop if (Utils.isLollipopOrLater()) { getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS); } super.onCreate(savedInstanceState); setContentView(R.layout.activity_generic_media); // Set up the drawer. navigationDrawerFragment = (NavigationDrawerFragment) getSupportFragmentManager() .findFragmentById(R.id.navigation_drawer); navigationDrawerFragment.setUp(R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout)); if (savedInstanceState == null) { TVShowListFragment tvshowListFragment = new TVShowListFragment(); // Setup animations if (Utils.isLollipopOrLater()) { //Fade added to prevent shared element from disappearing very shortly at the start of the transition. Transition fade = TransitionInflater.from(this).inflateTransition(android.R.transition.fade); tvshowListFragment.setExitTransition(fade); tvshowListFragment.setReenterTransition(fade); tvshowListFragment.setSharedElementReturnTransition( TransitionInflater.from(this).inflateTransition(R.transition.change_image)); android.support.v4.app.SharedElementCallback seCallback = new android.support.v4.app.SharedElementCallback() { @Override public void onMapSharedElements(List<String> names, Map<String, View> sharedElements) { if (clearSharedElements) { names.clear(); sharedElements.clear(); clearSharedElements = false; } } }; tvshowListFragment.setExitSharedElementCallback(seCallback); } getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, tvshowListFragment) .commit(); } else { selectedTVShowId = savedInstanceState.getInt(TVSHOWID, -1); selectedTVShowTitle = savedInstanceState.getString(TVSHOWTITLE, null); selectedEpisodeId = savedInstanceState.getInt(EPISODEID, -1); } setupActionBar(selectedTVShowTitle); // // Setup system bars and content padding, allowing averlap with the bottom bar // setupSystemBarsColors(); // UIUtils.setPaddingForSystemBars(this, findViewById(R.id.fragment_container), true, true, true); // UIUtils.setPaddingForSystemBars(this, findViewById(R.id.drawer_layout), true, true, true); }
From source file:org.goodev.material.AboutActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_about); ButterKnife.bind(this); pager.setAdapter(new AboutPagerAdapter(this)); pager.setPageMargin(getResources().getDimensionPixelSize(R.dimen.spacing_normal)); pageIndicator.setViewPager(pager);//w w w . j a v a 2 s .c o m draggableFrame.addListener(new ElasticDragDismissFrameLayout.SystemChromeFader(getWindow()) { @TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override public void onDragDismissed() { if (!UI.isLollipop()) { return; } // if we drag dismiss downward then the default reversal of the enter // transition would slide content upward which looks weird. So reverse it. if (draggableFrame.getTranslationY() > 0) { getWindow().setReturnTransition(TransitionInflater.from(AboutActivity.this) .inflateTransition(R.transition.about_return_downward)); } finishAfterTransition(); } }); }