Skip to content

Instantly share code, notes, and snippets.

@digitalbuddha
Last active August 29, 2015 14:11
Show Gist options
  • Save digitalbuddha/c2f65a69ba839f261bac to your computer and use it in GitHub Desktop.
Save digitalbuddha/c2f65a69ba839f261bac to your computer and use it in GitHub Desktop.
public class SampleActivity Extends BaseActivity
@Inject ScreenOnePresenter firstScreen
@Inject ScreenTwoPresenter secondScreen
@Inject SampleActivityModel model
onCreate()
{
//put anything in model that needs to be shared between views
//things that normally get passed in intent between activities
firstScreen.inflateView()
}
@Onclick(R.id.button)
public void goToNextScreen()
{
secondScreen.inflateView()
}
Public class ScreenOnePresenter implements Presenter
{
@Inject Endpoints endpoints;
@Inject Activity activity;
@Inject Store store;
@Inject SampleActivityModel model;
@InjectView(R.id.view)
View view;
@InjectView(R.id.button_save)
Button saveButton;
inflateView()
{
ButterKnife.inject(this, activity);
inflate the corresponding layout.
assignClickActions()
bindData()
}
private void bindData()
{
//get data from store and model
//bind to views
}
}
Interface Presenter
{
inflateView();
bindData();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment