diff options
Diffstat (limited to 'app/src/main')
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/autofill/AutofillFragment.java | 8 | ||||
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/autofill/AutofillPreferenceActivity.java | 15 |
2 files changed, 13 insertions, 10 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 e708c19d..5d342f4a 100644 --- a/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillFragment.java +++ b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillFragment.java @@ -98,11 +98,11 @@ public class AutofillFragment extends DialogFragment { editor.putString(packageName, path); } editor.apply(); - int position = getArguments().getInt("position"); - callingActivity.recyclerAdapter.notifyItemChanged(position); - if (getArguments().getBoolean("finish")) { - callingActivity.finish(); + // if recyclerAdapter has not loaded yet, there is no need to notifyItemChanged + if (callingActivity.recyclerAdapter != null) { + int position = callingActivity.recyclerAdapter.getPosition(packageName); + callingActivity.recyclerAdapter.notifyItemChanged(position); } } }); diff --git a/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillPreferenceActivity.java b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillPreferenceActivity.java index 16867bcd..adfce0b1 100644 --- a/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillPreferenceActivity.java +++ b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillPreferenceActivity.java @@ -32,7 +32,7 @@ public class AutofillPreferenceActivity extends AppCompatActivity { private PackageManager pm; - private boolean recreate; + private boolean recreate; // flag for action on up press; origin autofill dialog? different act @Override public void onCreate(Bundle savedInstanceState) { @@ -49,6 +49,14 @@ public class AutofillPreferenceActivity extends AppCompatActivity { new populateTask().execute(); + recreate = false; + Bundle extras = getIntent().getExtras(); + if (extras != null) { + recreate = true; + + showDialog(extras.getString("packageName"), extras.getString("appName")); + } + setTitle("Autofill Apps"); } @@ -79,13 +87,9 @@ public class AutofillPreferenceActivity extends AppCompatActivity { findViewById(R.id.progress_bar).setVisibility(View.GONE); recyclerView.setAdapter(recyclerAdapter); - - recreate = false; Bundle extras = getIntent().getExtras(); if (extras != null) { - recreate = true; recyclerView.scrollToPosition(recyclerAdapter.getPosition(extras.getString("packageName"))); - showDialog(extras.getString("packageName"), extras.getString("appName")); } } } @@ -139,7 +143,6 @@ public class AutofillPreferenceActivity extends AppCompatActivity { Bundle args = new Bundle(); args.putString("packageName", packageName); args.putString("appName", appName); - args.putInt("position", recyclerAdapter.getPosition(packageName)); df.setArguments(args); df.show(getFragmentManager(), "autofill_dialog"); } |