diff --git a/app/src/main/kotlin/org/mifos/mobile/cn/ui/mifos/passcode/PasscodeActivity.kt b/app/src/main/kotlin/org/mifos/mobile/cn/ui/mifos/passcode/PasscodeActivity.kt index 90098f95..f04d00e1 100644 --- a/app/src/main/kotlin/org/mifos/mobile/cn/ui/mifos/passcode/PasscodeActivity.kt +++ b/app/src/main/kotlin/org/mifos/mobile/cn/ui/mifos/passcode/PasscodeActivity.kt @@ -1,12 +1,15 @@ package org.mifos.mobile.cn.ui.mifos.passcode +import android.content.DialogInterface import android.content.Intent import android.view.View +import android.widget.Toast import com.mifos.mobile.passcode.MifosPassCodeActivity import com.mifos.mobile.passcode.utils.EncryptionUtil import org.mifos.mobile.cn.R import org.mifos.mobile.cn.ui.mifos.DashboardActivity import org.mifos.mobile.cn.ui.mifos.login.LoginActivity +import org.mifos.mobile.cn.ui.utils.MaterialDialog import org.mifos.mobile.cn.ui.utils.Toaster @@ -22,10 +25,21 @@ class PasscodeActivity : MifosPassCodeActivity(){ } override fun startLoginActivity() { - val intentLogin = Intent(this, LoginActivity::class.java) - intentLogin.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK - startActivity(intentLogin) - finish() + MaterialDialog.Builder().init(this) + .setMessage(R.string.login_using_password_confirmation) + .setPositiveButton(getString(R.string.logout), + DialogInterface.OnClickListener { dialog, which -> + val intent = Intent(this, LoginActivity::class.java) + intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK + startActivity(intent) + finish() + //Show successful logout Toast. + Toast.makeText(applicationContext, "Logged Out Successfully", Toast.LENGTH_SHORT).show() + }) + .setNegativeButton(getString(R.string.cancel), + DialogInterface.OnClickListener { dialog, which -> dialog.dismiss() }) + .createMaterialDialog() + .show() } override fun showToaster(view: View, msg: Int) { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6c055bf3..fd45a34e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -26,6 +26,8 @@ %1$s cannot be less than %2$d characters %1$s cannot contain spaces Error logging in + Are you sure you want to login using Password? +