Last active
June 2, 2017 13:05
-
-
Save amitkma/22dfe0cdb95be271707f28caa5474393 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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