Here in this class there are two this Keyword one is used as context another one is used as interface
how these two are understandable for the methods that what they are?
public class LoginActivity extends Activity implements LoginaView, View.OnClickListener {
private ProgressBar progressBar;
private EditText username;
private EditText password;
private LoginPresenter presenter;
/**
* LoginActivity Overriden Methods
* */
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
progressBar = (ProgressBar) findViewById(R.id.progress);
username = (EditText) findViewById(R.id.username);
password = (EditText) findViewById(R.id.password);
findViewById(R.id.button).setOnClickListener(this);
presenter = new LoginPresenterImpl(this,new LoginInteractorImpl());
}
@Override protected void onDestroy() {
presenter.onDestroy();
super.onDestroy();
}
/**
* View.OnClickListener Overriden Methods
* */
@Override public void onClick(View v) {
presenter.validateCredentials(username.getText().toString(), password.getText().toString());
}
/**
* LoginaView Overriden Methods
* */
@Override public void showProgress() {
progressBar.setVisibility(View.VISIBLE);
}
@Override public void hideProgress() {
progressBar.setVisibility(View.GONE);
}
@Override public void setUsernameError() {
username.setError(getString(R.string.username_error));
}
@Override public void setPasswordError() {
password.setError(getString(R.string.password_error));
}
@Override
public void setOnUserNamePassWrong() {
Toast.makeText(getBaseContext(),getString(R.string.username_or_pass_wrong),Toast.LENGTH_LONG).show();
}
@Override public void navigateToHome() {
startActivity(new Intent(this, MainActivity.class));
finish();}}
how come it is sent as context and also as interface too?