Example usage for android.view Window FEATURE_CONTENT_TRANSITIONS

List of usage examples for android.view Window FEATURE_CONTENT_TRANSITIONS

Introduction

In this page you can find the example usage for android.view Window FEATURE_CONTENT_TRANSITIONS.

Prototype

int FEATURE_CONTENT_TRANSITIONS

To view the source code for android.view Window FEATURE_CONTENT_TRANSITIONS.

Click Source Link

Document

Flag for requesting that window content changes should be animated using a TransitionManager.

Usage

From source file:it.ndorigatti.android.revealpathmotion.StartingActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
    getWindow().setAllowEnterTransitionOverlap(true);
    getWindow().setAllowReturnTransitionOverlap(true);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_starting);
    findViewById(R.id.container).setOnClickListener(this);
}

From source file:org.xbmc.kore.ui.FileActivity.java

@TargetApi(21)
@Override//from  w  w w . j  a va  2  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) {
        FileListFragment fileListFragment = new FileListFragment();

        // Setup animations
        if (Utils.isLollipopOrLater()) {
            fileListFragment.setExitTransition(null);
            fileListFragment.setReenterTransition(
                    TransitionInflater.from(this).inflateTransition(android.R.transition.fade));
        }
        getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, fileListFragment).commit();
    }
    setupActionBar(getString(R.string.file_browser));
}

From source file:com.syncedsynapse.kore2.ui.AddonsActivity.java

@TargetApi(21)
@Override/*from  w w w.j  ava  2 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) {
        AddonListFragment addonListFragment = new AddonListFragment();

        // Setup animations
        if (Utils.isLollipopOrLater()) {
            addonListFragment.setExitTransition(null);
            addonListFragment.setReenterTransition(
                    TransitionInflater.from(this).inflateTransition(android.R.transition.fade));
        }
        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.MoviesActivity.java

@TargetApi(21)
@Override/*from  w  ww . jav  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) {
        MovieListFragment movieListFragment = new MovieListFragment();

        // Setup animations
        if (Utils.isLollipopOrLater()) {
            movieListFragment.setExitTransition(null);
            movieListFragment.setReenterTransition(
                    TransitionInflater.from(this).inflateTransition(android.R.transition.fade));
        }
        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:org.xbmc.kore.ui.AddonsActivity.java

@TargetApi(21)
@Override/*  w  w  w  .  j a v  a2s  .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) {
        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.freshdigitable.udonroad.ReplyActivity.java

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
    }//from w  w w.  j  a v a 2s . c  o  m
    binding = DataBindingUtil.setContentView(this, R.layout.activity_reply);
    ViewCompat.setTransitionName(binding.replyStatus, TRANSITION_NAME);

    InjectionUtil.getComponent(this).inject(this);
    final long statusId = getStatusId();
    if (statusId < 0) {
        finish();
    }
}

From source file:com.syncedsynapse.kore2.ui.TVShowsActivity.java

@TargetApi(21)
@Override//from  w w  w  . j  a v  a 2  s  .  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) {
        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 ww  w .  ja v a  2  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) {
        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:org.xbmc.kore.ui.PVRActivity.java

@TargetApi(21)
@Override//w w  w.  ja va 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) {
        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:com.fallahpoor.tehranbrt.MainActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
    }//from ww w  .  j  av a2 s  .com

    setDefaultLanguage(LANGUAGE_FA);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawerLayout);
    ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, mDrawerLayout, toolbar,
            R.string.navigation_drawer_open, R.string.navigation_drawer_close);
    mDrawerLayout.addDrawerListener(toggle);
    toggle.syncState();

    NavigationView navigationView = (NavigationView) findViewById(R.id.navigationView);
    navigationView.setNavigationItemSelectedListener(this);

    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
    linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);

    RoutesAdapter adapter = new RoutesAdapter(this, Route.getRoutes(this), this);

    RecyclerView routesRecyclerView = (RecyclerView) findViewById(R.id.routesRecyclerView);
    routesRecyclerView.setAdapter(adapter);
    routesRecyclerView.setLayoutManager(linearLayoutManager);

    setupWindowAnimation();

}