Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Login activity ui
package com.myapp.ui.home;
public class LoginActivity extends BaseActivity implements LoginContract.LoginView {
// field declaration
private LoginPresenter presenter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// other instantiation
PreferenceService preferenceService = new PreferenceServiceImpl(this);
NetworkManager networkManager = new NetworkManager(this);
DatabaseRealm databaseRealm = new DatabaseRealm();
Repository<Login> loginRepository = new LoginRepositoryImpl(databaseRealm);
presenter = new LoginPresenter(APIManager.getInstance(), preferenceService,
networkManager, loginRepository);
presenter.attachView(this);
}
@OnClick(R.id.login_btn)
public void onLoginClicked() {
presenter.onUserLogin(mobileNoEditText.getText().toString(), passwordEditText.getText().toString());
}
@Override
public void showProgress() {
}
@Override
public void hideProgress() {
}
@Override
public void showUnauthorizedError() {
}
@Override
public void showEmpty() {
}
@Override
public void showError(String errorMessage) {
}
@Override
public void showMessageLayout(boolean show) {
}
@Override
public void onLoginSuccess() {
Toast.makeText(this, "Login success. TODO Redir to Homepage", Toast.LENGTH_LONG).show();
}
@Override
public void onLoginFailed(String message) {
Toast.makeText(this, "Login failed: " + message, Toast.LENGTH_LONG).show();
}
@Override
protected void onDestroy() {
presenter.detachView(this);
super.onDestroy();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment