Commit d18e8230 authored by fauzi's avatar fauzi

add finish

parent d8799225
......@@ -52,8 +52,7 @@ public class LoginState extends BottomSheetDialogFragment {
SharedPreferences sharedPreferences;
Utils utils;
ProgressBar bar;
AlertDialog.Builder builder;
View view;
ProgressDialog dialog;
public LoginState(Context context, MainViewModels mainViewModels) {
......@@ -70,7 +69,7 @@ public class LoginState extends BottomSheetDialogFragment {
dialog = new ProgressDialog(context);
// inflating layout
View view = View.inflate(getContext(), R.layout.login_form, null);
view = View.inflate(getContext(), R.layout.login_form, null);
// bindUI
loginLayout = view.findViewById(R.id.LoginLayout);
......@@ -127,7 +126,6 @@ public class LoginState extends BottomSheetDialogFragment {
* nonaktifkan semua form */
bar.setVisibility(View.VISIBLE);
loginButton.setText("");
sheetDialog.setCancelable(false);
username.setEnabled(false);
password.setEnabled(false);
......@@ -147,6 +145,8 @@ public class LoginState extends BottomSheetDialogFragment {
if (usersModelsDataResponse.getStatusData()) {
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putBoolean(SplashScreen.SESSION, true);
sheetDialog.dismiss();
if(editor.commit()){
startActivity(new Intent(context, MainActivity.class));
}
......@@ -192,6 +192,7 @@ public class LoginState extends BottomSheetDialogFragment {
password.setEnabled(true);
loginButton.setEnabled(true);
closeBtn.setEnabled(true);
}
} else {
bar.setVisibility(View.VISIBLE);
......
......@@ -534,4 +534,10 @@ public class MainActivity extends AppCompatActivity {
binding.pbLoading.setVisibility(View.GONE);
}
}
@Override
public void onBackPressed() {
super.onBackPressed();
finish();
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment