Search in sources :

Example 1 with MasterDetailStateClearStrategy

use of com.example.stackmasterdetail.util.MasterDetailStateClearStrategy in project simple-stack by Zhuinden.

the class MainActivity method onCreate.

/**
     * Pay attention to the {@link #setContentView} call here. It's creating a responsive layout
     * for us.
     * <p>
     * Notice that the app has two root_layout files. The main one, in {@code res/layout} is used by
     * mobile devices and by tablets in portrait orientation. It holds a generic {@link
     * com.example.stackmasterdetail.util.pathview.FramePathContainerView}.
     * <p>
     * The interesting one, loaded by tablets in landscape mode, is {@code res/layout-sw600dp-land}.
     * It loads a {@link TabletMasterDetailRoot}, with a master list on the
     * left and a detail view on the right.
     * <p>
     * But this master activity knows nothing about those two view types. It only requires that
     * the view loaded by {@code root_layout.xml} implements the {@link com.example.stackmasterdetail.util.Container} interface,
     * to render whatever is appropriate for the screens received from {@link com.zhuinden.simplestack.Backstack} via
     * {@link #handleStateChange}.
     */
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    final ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayShowHomeEnabled(false);
    setContentView(R.layout.root_layout);
    container = (ViewGroup) findViewById(R.id.container);
    containerAsStateChanger = (StateChanger) container;
    containerAsBackTarget = (HandlesBack) containerAsStateChanger;
    Navigator.configure().setStateChanger(this).setStateClearStrategy(new MasterDetailStateClearStrategy()).setShouldPersistContainerChild(false).install(this, container, HistoryBuilder.single(ConversationListPath.create()));
}
Also used : MasterDetailStateClearStrategy(com.example.stackmasterdetail.util.MasterDetailStateClearStrategy) ActionBar(android.support.v7.app.ActionBar)

Aggregations

ActionBar (android.support.v7.app.ActionBar)1 MasterDetailStateClearStrategy (com.example.stackmasterdetail.util.MasterDetailStateClearStrategy)1