use of com.example.mortar.screen.ChatListScreen in project simple-stack by Zhuinden.
the class MortarDemoActivity method handleStateChange.
@Override
public void handleStateChange(StateChange stateChange, Callback completionCallback) {
BaseKey newScreen = stateChange.topNewState();
String title = newScreen.title();
ActionBarOwner.MenuAction menu = new ActionBarOwner.MenuAction("Friends", new Action() {
@Override
public void run() throws Exception {
Navigator.getBackstack(MortarDemoActivity.this).goTo(FriendListScreen.create());
}
});
actionBarOwner.setConfig(new ActionBarOwner.Config(false, !(newScreen instanceof ChatListScreen), title, menu));
completionCallback.stateChangeComplete();
}
use of com.example.mortar.screen.ChatListScreen in project mortar by square.
the class MortarDemoActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
GsonParceler parceler = new GsonParceler(new Gson());
@SuppressWarnings("deprecation") FlowDelegate.NonConfigurationInstance nonConfig = (FlowDelegate.NonConfigurationInstance) getLastNonConfigurationInstance();
MortarScope parentScope = MortarScope.getScope(getApplication());
String scopeName = getLocalClassName() + "-task-" + getTaskId();
activityScope = parentScope.findChild(scopeName);
if (activityScope == null) {
activityScope = parentScope.buildChild().withService(BundleServiceRunner.SERVICE_NAME, new BundleServiceRunner()).build(scopeName);
}
ObjectGraphService.inject(this, this);
getBundleServiceRunner(activityScope).onCreate(savedInstanceState);
actionBarOwner.takeView(this);
setContentView(R.layout.root_layout);
container = (PathContainerView) findViewById(R.id.container);
containerAsHandlesBack = (HandlesBack) container;
flowDelegate = FlowDelegate.onCreate(nonConfig, getIntent(), savedInstanceState, parceler, History.single(new ChatListScreen()), this);
}
use of com.example.mortar.screen.ChatListScreen in project mortar by square.
the class MortarDemoActivity method dispatch.
@Override
public void dispatch(Flow.Traversal traversal, Flow.TraversalCallback callback) {
Path newScreen = traversal.destination.top();
String title = newScreen.getClass().getSimpleName();
ActionBarOwner.MenuAction menu = new ActionBarOwner.MenuAction("Friends", new Action0() {
@Override
public void call() {
Flow.get(MortarDemoActivity.this).set(new FriendListScreen());
}
});
actionBarOwner.setConfig(new ActionBarOwner.Config(false, !(newScreen instanceof ChatListScreen), title, menu));
container.dispatch(traversal, callback);
}
Aggregations