Skip to content

Commit

Permalink
Fix: Add Confirmation Dialog in Passcode Activity (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
rchtgpt authored and luckyman20 committed Dec 26, 2019
1 parent 4ec1202 commit ca882ae
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -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


Expand All @@ -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) {
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
<string name="error_validation_minimum_chars">%1$s cannot be less than %2$d characters</string>
<string name="error_validation_cannot_contain_spaces">%1$s cannot contain spaces</string>
<string name="error_logging_in">Error logging in</string>
<string name="login_using_password_confirmation">Are you sure you want to login using Password?
</string>


<!--Dashboard Activity-->
Expand Down

0 comments on commit ca882ae

Please sign in to comment.