Fixed bug with LoginActivity (not finished MainActivity when LoginActivity is started)

This commit is contained in:
ChronosX88 2019-05-23 16:43:33 +04:00
parent 0fefada982
commit 6f844cb924
4 changed files with 11 additions and 0 deletions

View File

@ -55,6 +55,7 @@ interface CoreContracts {
interface IMainViewContract {
fun showSnackbar(message: String)
fun showProgressBar(state: Boolean)
fun finishActivity()
}
// -----ChatActivity-----

View File

@ -31,6 +31,7 @@ class MainPresenter(private val view: CoreContracts.IMainViewContract) : CoreCon
val intent = Intent(AppHelper.getContext(), LoginActivity::class.java)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
AppHelper.getContext().startActivity(intent)
view.finishActivity()
}
}
}

View File

@ -90,6 +90,9 @@ public class LoginActivity extends AppCompatActivity implements CoreContracts.IL
jidEditText.setError(null);
passwordEditText.setError(null);
jidInputLayout.setError(null);
passwordInputLayout.setError(null);
String jid = jidEditText.getText().toString();
String password = passwordEditText.getText().toString();
@ -161,6 +164,7 @@ public class LoginActivity extends AppCompatActivity implements CoreContracts.IL
case AuthenticationStatusEvent.CONNECT_AND_LOGIN_SUCCESSFUL: {
loadingScreen(false);
finish();
startActivity(new Intent(LoginActivity.this, MainActivity.class));
break;
}
case AuthenticationStatusEvent.INCORRECT_LOGIN_OR_PASSWORD: {

View File

@ -143,4 +143,9 @@ public class MainActivity extends AppCompatActivity implements CoreContracts.IMa
super.onStop();
presenter.onStop();
}
@Override
public void finishActivity() {
finish();
}
}