From 1d9e3b50a5e186e1f2b068739dfd66c3c3f8c8aa Mon Sep 17 00:00:00 2001 From: Matthew Wong Date: Thu, 31 Dec 2015 04:28:42 -0500 Subject: Delete option for websites --- .../com/zeapo/pwdstore/autofill/AutofillFragment.java | 17 +++++++++++++++-- app/src/main/res/layout/fragment_autofill.xml | 2 +- app/src/main/res/values/strings.xml | 2 +- 3 files changed, 17 insertions(+), 4 deletions(-) (limited to 'app/src/main') diff --git a/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillFragment.java b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillFragment.java index dfe4f3c0..1ebf4828 100644 --- a/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillFragment.java +++ b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillFragment.java @@ -46,8 +46,8 @@ public class AutofillFragment extends DialogFragment { builder.setView(view); - String packageName = getArguments().getString("packageName"); - String appName = getArguments().getString("appName"); + final String packageName = getArguments().getString("packageName"); + final String appName = getArguments().getString("appName"); isWeb = getArguments().getBoolean("isWeb"); // set the dialog icon and title or webName editText @@ -132,6 +132,19 @@ public class AutofillFragment extends DialogFragment { } }); builder.setNegativeButton(R.string.dialog_cancel, null); + final SharedPreferences.Editor editor = prefs.edit(); + if (isWeb) { + builder.setNeutralButton(R.string.autofill_apps_delete, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + if (packageName != null && !packageName.equals("")) { + editor.remove(packageName); + ((AutofillPreferenceActivity) getActivity()).recyclerAdapter.removeWebsite(packageName); + editor.apply(); + } + } + }); + } return builder.create(); } diff --git a/app/src/main/res/layout/fragment_autofill.xml b/app/src/main/res/layout/fragment_autofill.xml index 1f6aeba2..dd9f8419 100644 --- a/app/src/main/res/layout/fragment_autofill.xml +++ b/app/src/main/res/layout/fragment_autofill.xml @@ -18,7 +18,7 @@ android:id="@+id/webURL" android:layout_width="match_parent" android:layout_height="wrap_content" - android:hint="@string/autofill_webURL_hint" + android:hint="URL" android:inputType="textUri"/> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 499ae910..d19d545b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -171,5 +171,5 @@ Match with… Match with Never match - URL + Delete -- cgit v1.2.3