diff options
Diffstat (limited to 'app/src/main/java/com/zeapo/pwdstore/autofill/AutofillFragment.java')
| -rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/autofill/AutofillFragment.java | 9 |
1 files changed, 4 insertions, 5 deletions
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 474c3e35..0ad28a31 100644 --- a/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillFragment.java +++ b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillFragment.java @@ -39,7 +39,7 @@ public class AutofillFragment extends DialogFragment { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); // this fragment is only created from the settings page (AutofillPreferenceActivity) // need to interact with the recyclerAdapter which is a member of activity - AutofillPreferenceActivity callingActivity = (AutofillPreferenceActivity) getActivity(); + final AutofillPreferenceActivity callingActivity = (AutofillPreferenceActivity) getActivity(); LayoutInflater inflater = callingActivity.getLayoutInflater(); final View view = inflater.inflate(R.layout.fragment_autofill, null); @@ -137,10 +137,10 @@ public class AutofillFragment extends DialogFragment { builder.setNeutralButton(R.string.autofill_apps_delete, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { - if (((AutofillPreferenceActivity) getActivity()).recyclerAdapter != null + if (callingActivity.recyclerAdapter != null && packageName != null && !packageName.equals("")) { editor.remove(packageName); - ((AutofillPreferenceActivity) getActivity()).recyclerAdapter.removeWebsite(packageName); + callingActivity.recyclerAdapter.removeWebsite(packageName); editor.apply(); } } @@ -181,8 +181,7 @@ public class AutofillFragment extends DialogFragment { return; } String oldPackageName = getArguments().getString("packageName", ""); - int position = callingActivity.recyclerAdapter.getPosition(packageName); - if (!oldPackageName.equals(packageName) && position != -1) { + if (!oldPackageName.equals(packageName) && prefs.getAll().containsKey(packageName)) { webURL.setError("URL already exists"); return; } |
