diff options
| author | Matthew Wong <wongma@protonmail.ch> | 2015-08-11 18:32:16 -0400 |
|---|---|---|
| committer | Matthew Wong <wongma@protonmail.ch> | 2015-08-14 17:36:51 -0400 |
| commit | b75190fcd7926c3994f8191996661c19b7b12466 (patch) | |
| tree | 55cb027f2902113d77c4826cac7f53d618000a0d /app/src/main/java/com/zeapo/pwdstore/autofill/AutofillRecyclerAdapter.java | |
| parent | d42c526b648030ee251d9136b8d924395b74bb9c (diff) | |
| download | HardenedPass-b75190fcd7926c3994f8191996661c19b7b12466.tar.gz HardenedPass-b75190fcd7926c3994f8191996661c19b7b12466.zip | |
Add 'automatically match by default' setting; respect it & per-app settings when creating autofill dialog
Diffstat (limited to 'app/src/main/java/com/zeapo/pwdstore/autofill/AutofillRecyclerAdapter.java')
| -rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/autofill/AutofillRecyclerAdapter.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillRecyclerAdapter.java b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillRecyclerAdapter.java index 1b5e63b7..bd2835e5 100644 --- a/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillRecyclerAdapter.java +++ b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillRecyclerAdapter.java @@ -4,6 +4,7 @@ import android.content.Context; import android.content.SharedPreferences; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; +import android.preference.PreferenceManager; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; @@ -59,9 +60,13 @@ public class AutofillRecyclerAdapter extends RecyclerView.Adapter<AutofillRecycl public void onBindViewHolder(AutofillRecyclerAdapter.ViewHolder holder, int position) { ApplicationInfo app = apps.get(position); holder.name.setText(pm.getApplicationLabel(app)); + + // it shouldn't be possible for prefs.getString to not find the app...use defValue anyway + SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(activity); + String defValue = settings.getBoolean("autofill_default", true) ? "first" : "never"; SharedPreferences prefs = activity.getApplicationContext().getSharedPreferences("autofill", Context.MODE_PRIVATE); - String preference = prefs.getString(app.packageName, "first"); + String preference = prefs.getString(app.packageName, defValue); switch (preference) { case "first": holder.secondary.setText("Automatically match with password"); |
