Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Applications
fenix
Commits
93cb3c20
Unverified
Commit
93cb3c20
authored
Mar 09, 2020
by
Emily Kager
Committed by
GitHub
Mar 09, 2020
Browse files
For #8423 - Adds delete login confirmation dialog (#9014)
parent
2563346f
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/org/mozilla/fenix/settings/logins/SavedLoginSiteInfoFragment.kt
View file @
93cb3c20
...
...
@@ -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
()
d
isplayD
eleteLogin
Dialog
()
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
...
...
app/src/main/res/values/strings.xml
View file @
93cb3c20
...
...
@@ -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>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment