本文整理汇总了Java中com.zhuinden.simplestack.BackstackDelegate类的典型用法代码示例。如果您正苦于以下问题:Java BackstackDelegate类的具体用法?Java BackstackDelegate怎么用?Java BackstackDelegate使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BackstackDelegate类属于com.zhuinden.simplestack包,在下文中一共展示了BackstackDelegate类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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);
}
示例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);
}
示例4: onCreate
import com.zhuinden.simplestack.BackstackDelegate; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
CustomApplication.get(this).initialize();
DatabaseManager databaseManager = Injector.get().databaseManager();
BackstackHolder backstackHolder = Injector.get().backstackHolder();
databaseManager.init(this);
backstackDelegate = new BackstackDelegate(null /* delayed init */);
backstackDelegate.onCreate(savedInstanceState, //
getLastCustomNonConfigurationInstance(), //
HistoryBuilder.single(TasksKey.create()));
backstackDelegate.registerForLifecycleCallbacks(this);
backstackHolder.setBackstack(backstackDelegate.getBackstack());
super.onCreate(savedInstanceState);
MainScopeListener mainScopeListener = (MainScopeListener) getSupportFragmentManager().findFragmentByTag("MAIN_SCOPE_LISTENER");
if(mainScopeListener == null) {
mainScopeListener = new MainScopeListener();
getSupportFragmentManager().beginTransaction().add(mainScopeListener, "MAIN_SCOPE_LISTENER").commit();
}
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
this.fragmentStateChanger = new FragmentStateChanger(getSupportFragmentManager(), R.id.root);
mainView.onCreate();
}
示例5: onCreate
import com.zhuinden.simplestack.BackstackDelegate; //导入依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.demo_activity);
backstackDelegate = new BackstackDelegate(null);
backstackDelegate.onCreate(savedInstanceState, getLastCustomNonConfigurationInstance(), HistoryBuilder.single(FirstKey.create()));
}
示例6: 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);
}
示例7: getSystemService
import com.zhuinden.simplestack.BackstackDelegate; //导入依赖的package包/类
@Override
public Object getSystemService(String name) {
if(multistack != null) {
BackstackDelegate stack = multistack.get(name);
if(stack != null) {
return stack;
}
}
return super.getSystemService(name);
}
示例8: add
import com.zhuinden.simplestack.BackstackDelegate; //导入依赖的package包/类
public BackstackDelegate add(String identifier, BackstackDelegate backstackDelegate) {
if(selectedStack == null) {
selectedStack = identifier;
}
backstackDelegates.put(identifier, backstackDelegate);
backstackDelegate.setPersistenceTag(identifier);
return backstackDelegate;
}
示例9: onRetainCustomNonConfigurationInstance
import com.zhuinden.simplestack.BackstackDelegate; //导入依赖的package包/类
public Object onRetainCustomNonConfigurationInstance() {
Multistack.NonConfigurationInstance nonConfigurationInstance = new NonConfigurationInstance();
for(Map.Entry<String, BackstackDelegate> entry : backstackDelegates.entrySet()) {
nonConfigurationInstance.putNonConfigInstance(entry.getKey(), entry.getValue().onRetainCustomNonConfigurationInstance());
}
return nonConfigurationInstance;
}
示例10: setStateChanger
import com.zhuinden.simplestack.BackstackDelegate; //导入依赖的package包/类
public void setStateChanger(StateChanger stateChanger) {
this.stateChanger = stateChanger;
for(Map.Entry<String, BackstackDelegate> entry : backstackDelegates.entrySet()) {
if(!entry.getKey().equals(selectedStack)) {
entry.getValue().onPause(); // FIXME maybe this should be exposed better.
} else {
entry.getValue().setStateChanger(stateChanger);
}
}
}
示例11: onPostResume
import com.zhuinden.simplestack.BackstackDelegate; //导入依赖的package包/类
public void onPostResume() {
isPaused = false;
for(Map.Entry<String, BackstackDelegate> entry : backstackDelegates.entrySet()) {
if(!entry.getKey().equals(selectedStack)) {
entry.getValue().onPause(); // FIXME maybe this should be exposed better.
} else {
entry.getValue().onPostResume();
}
}
}
示例12: persistViewToState
import com.zhuinden.simplestack.BackstackDelegate; //导入依赖的package包/类
public void persistViewToState(View view) {
if(view != null) {
Key key = Backstack.getKey(view.getContext());
BackstackDelegate backstackDelegate = key.selectDelegate(view.getContext());
backstackDelegate.persistViewToState(view);
}
}
示例13: 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);
}
示例14: getDelegate
import com.zhuinden.simplestack.BackstackDelegate; //导入依赖的package包/类
public static BackstackDelegate getDelegate(Context context) {
// noinspection ResourceType
return (BackstackDelegate) context.getSystemService(DELEGATE_TAG);
}
示例15: 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);
}