当前位置: 首页>>代码示例>>Java>>正文


Java BackstackDelegate.setStateChanger方法代码示例

本文整理汇总了Java中com.zhuinden.simplestack.BackstackDelegate.setStateChanger方法的典型用法代码示例。如果您正苦于以下问题:Java BackstackDelegate.setStateChanger方法的具体用法?Java BackstackDelegate.setStateChanger怎么用?Java BackstackDelegate.setStateChanger使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.zhuinden.simplestack.BackstackDelegate的用法示例。


在下文中一共展示了BackstackDelegate.setStateChanger方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreate

import com.zhuinden.simplestack.BackstackDelegate; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    serviceTree = Injector.get().serviceTree();
    MainComponent mainComponent;
    if(!serviceTree.hasNodeWithKey(TAG)) {
        ServiceTree.Node node = serviceTree.createRootNode(TAG);
        ApplicationComponent applicationComponent = node.getService(Services.DAGGER_COMPONENT);
        mainComponent = DaggerMainComponent.builder().applicationComponent(applicationComponent).build();
        node.bindService(Services.DAGGER_COMPONENT, mainComponent);
    } else {
        mainComponent = Services.getNode(TAG).getService(Services.DAGGER_COMPONENT);
    }
    mainComponent.inject(this);

    backstackDelegate = new BackstackDelegate(null);
    backstackDelegate.onCreate(savedInstanceState, //
            getLastCustomNonConfigurationInstance(), //
            HistoryBuilder.single(FirstKey.create()));
    backstackHolder.setBackstack(backstackDelegate.getBackstack());
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    ButterKnife.bind(this);
    backstackDelegate.setStateChanger(this);
}
 
开发者ID:Zhuinden,项目名称:service-tree,代码行数:25,代码来源:MainActivity.java

示例2: onCreate

import com.zhuinden.simplestack.BackstackDelegate; //导入方法依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    backstackDelegate = new BackstackDelegate(null);
    backstackDelegate.onCreate(savedInstanceState, getLastCustomNonConfigurationInstance(), HistoryBuilder.single(TasksKey.create()));
    backstackDelegate.registerForLifecycleCallbacks(this);
    BackstackHolder backstackHolder = Injection.get().backstackHolder();
    backstackHolder.setBackstack(backstackDelegate.getBackstack()); // <-- make Backstack globally available through Dagger

    super.onCreate(savedInstanceState);
    setContentView(R.layout.main_activity);
    ButterKnife.bind(this);
    setupDrawer();

    fragmentStateChanger = new FragmentStateChanger(this, getSupportFragmentManager(), R.id.contentFrame);
    backstackDelegate.setStateChanger(this);
}
 
开发者ID:Zhuinden,项目名称:simple-stack,代码行数:17,代码来源:MainActivity.java

示例3: onCreate

import com.zhuinden.simplestack.BackstackDelegate; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    backstackDelegate = new BackstackDelegate(null);
    backstackDelegate.onCreate(savedInstanceState, getLastCustomNonConfigurationInstance(), HistoryBuilder.single(GridKey.create()));
    backstackDelegate.registerForLifecycleCallbacks(this);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    fragmentStateChanger = new FragmentStateChanger(getSupportFragmentManager(), R.id.container);
    backstackDelegate.setStateChanger(this);
}
 
开发者ID:Zhuinden,项目名称:simple-stack,代码行数:11,代码来源:MainActivity.java

示例4: onCreate

import com.zhuinden.simplestack.BackstackDelegate; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    backstackDelegate = new BackstackDelegate(null);
    backstackDelegate.onCreate(savedInstanceState,
            getLastCustomNonConfigurationInstance(),
            HistoryBuilder.single(HomeKey.create()));
    backstackDelegate.registerForLifecycleCallbacks(this);
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);
    ButterKnife.bind(this);

    navigation.setOnNavigationItemSelectedListener(item -> {
        switch(item.getItemId()) {
            case R.id.navigation_home:
                replaceHistory(HomeKey.create());
                return true;
            case R.id.navigation_dashboard:
                replaceHistory(DashboardKey.create());
                return true;
            case R.id.navigation_notifications:
                replaceHistory(NotificationKey.create());
                return true;
        }
        return false;
    });
    router = Conductor.attachRouter(this, root, savedInstanceState);
    controllerStateChanger = new ControllerStateChanger(router);
    backstackDelegate.setStateChanger(this);
}
 
开发者ID:Zhuinden,项目名称:simple-stack,代码行数:31,代码来源:MainActivity.java

示例5: onCreate

import com.zhuinden.simplestack.BackstackDelegate; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    backstackDelegate = new BackstackDelegate(null);
    backstackDelegate.onCreate(savedInstanceState,
            getLastCustomNonConfigurationInstance(),
            HistoryBuilder.single(HomeKey.create()));
    backstackDelegate.registerForLifecycleCallbacks(this);
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);
    ButterKnife.bind(this);

    navigation.setOnNavigationItemSelectedListener(item -> {
        switch(item.getItemId()) {
            case R.id.navigation_home:
                replaceHistory(HomeKey.create());
                return true;
            case R.id.navigation_dashboard:
                replaceHistory(DashboardKey.create());
                return true;
            case R.id.navigation_notifications:
                replaceHistory(NotificationKey.create());
                return true;
        }
        return false;
    });
    Log.i(TAG, "History [" + Arrays.toString(backstackDelegate.getBackstack().getHistory().toArray()) + "]");
    fragmentStateChanger = new FragmentStateChanger(getSupportFragmentManager(), R.id.root);
    backstackDelegate.setStateChanger(this);
}
 
开发者ID:Zhuinden,项目名称:simple-stack,代码行数:31,代码来源:MainActivity.java

示例6: onCreate

import com.zhuinden.simplestack.BackstackDelegate; //导入方法依赖的package包/类
/**
 * 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.stackmasterdetailfrag.util.pathview.SinglePaneRoot}.
 * <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 StateChanger 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);
    backstackDelegate = new BackstackDelegate(null);
    backstackDelegate.setStateClearStrategy(new MasterDetailStateClearStrategy());
    backstackDelegate.onCreate(savedInstanceState,
            getLastCustomNonConfigurationInstance(), HistoryBuilder.single(ConversationListPath.create()));
    backstackDelegate.registerForLifecycleCallbacks(this);
    setContentView(R.layout.root_layout);
    container = (StateChanger) findViewById(R.id.container);
    containerAsBackTarget = (HandlesBack) container;
    backstackDelegate.setStateChanger(this);
}
 
开发者ID:Zhuinden,项目名称:simple-stack,代码行数:33,代码来源:MainActivity.java


注:本文中的com.zhuinden.simplestack.BackstackDelegate.setStateChanger方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。