Unverified Commit 93cb3c20 authored by Emily Kager's avatar Emily Kager Committed by GitHub
Browse files

For #8423 - Adds delete login confirmation dialog (#9014)

parent 2563346f
......@@ -5,6 +5,7 @@
package org.mozilla.fenix.settings.logins
import android.content.Context
import android.content.DialogInterface
import android.os.Bundle
import android.text.InputType
import android.view.Menu
......@@ -13,6 +14,7 @@ import android.view.MenuItem
import android.view.View
import android.view.WindowManager
import androidx.annotation.StringRes
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.content.res.AppCompatResources.getDrawable
import androidx.fragment.app.Fragment
import androidx.lifecycle.lifecycleScope
......@@ -84,7 +86,7 @@ class SavedLoginSiteInfoFragment : Fragment(R.layout.fragment_saved_login_site_i
override fun onOptionsItemSelected(item: MenuItem): Boolean = when (item.itemId) {
R.id.delete_login_button -> {
deleteLogin()
displayDeleteLoginDialog()
true
}
else -> false
......@@ -145,6 +147,22 @@ class SavedLoginSiteInfoFragment : Fragment(R.layout.fragment_saved_login_site_i
showToolbar(args.savedLoginItem.url)
}
private fun displayDeleteLoginDialog() {
activity?.let { activity ->
AlertDialog.Builder(activity).apply {
setMessage(R.string.login_deletion_confirmation)
setNegativeButton(android.R.string.cancel) { dialog: DialogInterface, _ ->
dialog.cancel()
}
setPositiveButton(R.string.dialog_delete_positive) { dialog: DialogInterface, _ ->
deleteLogin()
dialog.dismiss()
}
create()
}.show()
}
}
/**
* Click listener for a textview's copy button.
* @param value Value to be copied
......
......@@ -1257,4 +1257,8 @@
<string name="certificate_info_verified_by">Verified By: %1$s </string>
<!-- Login overflow menu delete button -->
<string name="login_menu_delete_button">Delete</string>
<!-- Message in delete confirmation dialog for logins -->
<string name="login_deletion_confirmation">Are you sure you want to delete this login?</string>
<!-- Positive action of a dialog asking to delete -->
<string name="dialog_delete_positive">Delete</string>
</resources>
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