use of com.zhuinden.simplestack.SimpleStateChanger in project simple-stack by Zhuinden.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = ActivityMainBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
binding.navigation.setOnNavigationItemSelectedListener(item -> {
Backstack backstack = Navigator.getBackstack(this);
switch(item.getItemId()) {
case R.id.navigation_home:
backstack.setHistory(History.of(HomeKey.create()), StateChange.REPLACE);
return true;
case R.id.navigation_dashboard:
backstack.setHistory(History.of(DashboardKey.create()), StateChange.REPLACE);
return true;
case R.id.navigation_notifications:
backstack.setHistory(History.of(NotificationKey.create()), StateChange.REPLACE);
return true;
}
return false;
});
fragmentStateChanger = new DefaultFragmentStateChanger(getSupportFragmentManager(), R.id.container);
Navigator.configure().setStateChanger(new SimpleStateChanger(this)).install(this, binding.container, History.single(HomeKey.create()));
}
use of com.zhuinden.simplestack.SimpleStateChanger in project simple-stack by Zhuinden.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
fragmentStateChanger = new SharedElementFragmentStateChanger(getSupportFragmentManager(), R.id.container);
Navigator.configure().setStateChanger(new SimpleStateChanger(this)).install(this, findViewById(R.id.container), History.of(KittenGridKey.create()));
}
use of com.zhuinden.simplestack.SimpleStateChanger in project simple-stack by Zhuinden.
the class MainActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
fragmentStateChanger = new DefaultFragmentStateChanger(getSupportFragmentManager(), R.id.container);
Navigator.configure().setStateChanger(new SimpleStateChanger(this)).setScopedServices(new DefaultServiceProvider()).install(this, findViewById(R.id.container), History.of(WordListKey.create()));
}
Aggregations