Skip to content

Instantly share code, notes, and snippets.

@amitkma
Last active June 2, 2017 13:05
Show Gist options
  • Save amitkma/22dfe0cdb95be271707f28caa5474393 to your computer and use it in GitHub Desktop.
Save amitkma/22dfe0cdb95be271707f28caa5474393 to your computer and use it in GitHub Desktop.
public class MainActivity extends AppCompatActivity implements MainContract.View, View.OnClickListener {
// Contract Presenter
private MainContract.Presenter mPresenter;
......
// Other fields
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// initialization of ui elements and other fields
......
......
}
/**
* BEGIN
* Implemented methods from MainContract.View interface
*/
// Setup contract presenter here.
@Override
public void setPresenter(MainContract.Presenter presenter) {
mPresenter = presenter;
}
// Show loading progress dialog.
@Override
public void showProgress() {
mProgressDialog = new ProgressDialog(this);
mProgressDialog.setCancelable(false);
mProgressDialog.setMessage("Loading");
mProgressDialog.show();
}
// Hide loading progress dialog.
@Override
public void hideProgress() {
if (mProgressDialog != null) {
mProgressDialog.dismiss();
mProgressDialog = null;
}
}
// Displays all the notes which are saved in note list.
@Override
public void updateView(List<Note> items) {
mMainAdapter.updateData(items);
}
/**
* END
*/
.....
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment