diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index d45583c9..b3600c53 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -45,7 +45,7 @@
android:value="com.zeapo.pwdstore.PasswordStore" />
-
@@ -54,7 +54,7 @@
android:resource="@xml/autofill_config" />
-
+
diff --git a/app/src/main/java/com/zeapo/pwdstore/AutofillActivity.java b/app/src/main/java/com/zeapo/pwdstore/AutofillActivity.java
deleted file mode 100644
index 2a1227b9..00000000
--- a/app/src/main/java/com/zeapo/pwdstore/AutofillActivity.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.zeapo.pwdstore;
-
-import android.app.PendingIntent;
-import android.content.Intent;
-import android.content.IntentSender;
-import android.os.Bundle;
-import android.support.v7.app.AppCompatActivity;
-import android.util.Log;
-
-// blank activity started by service for calling startIntentSenderForResult
-public class AutofillActivity extends AppCompatActivity {
- public static final int REQUEST_CODE_DECRYPT_AND_VERIFY = 9913;
- private boolean bound = false;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- Intent intent = getIntent();
- PendingIntent pi = intent.getExtras().getParcelable("pending_intent");
- try {
- startIntentSenderForResult(pi.getIntentSender()
- , REQUEST_CODE_DECRYPT_AND_VERIFY, null, 0, 0, 0);
- } catch (IntentSender.SendIntentException e) {
- Log.e(AutofillService.Constants.TAG, "SendIntentException", e);
- }
- }
-
- @Override
- protected void onActivityResult(int requestCode, int resultCode, Intent data) {
- finish(); // go back to the password field app
- if (resultCode == RESULT_OK) {
- AutofillService.setUnlockOK(); // report the result to service
- }
- }
-}
diff --git a/app/src/main/java/com/zeapo/pwdstore/UserPreference.java b/app/src/main/java/com/zeapo/pwdstore/UserPreference.java
index 9a5c83d4..e2a9e5a7 100644
--- a/app/src/main/java/com/zeapo/pwdstore/UserPreference.java
+++ b/app/src/main/java/com/zeapo/pwdstore/UserPreference.java
@@ -17,6 +17,7 @@ import android.widget.Toast;
import com.google.common.base.Function;
import com.google.common.base.Joiner;
import com.google.common.collect.Iterables;
+import com.zeapo.pwdstore.autofill.AutofillActivity;
import com.zeapo.pwdstore.crypto.PgpHandler;
import com.zeapo.pwdstore.git.GitActivity;
import com.zeapo.pwdstore.utils.PasswordRepository;
@@ -182,6 +183,15 @@ public class UserPreference extends AppCompatActivity {
findPreference("pref_select_external").setOnPreferenceChangeListener(resetRepo);
findPreference("git_external").setOnPreferenceChangeListener(resetRepo);
+
+ findPreference("autofill_apps").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
+ @Override
+ public boolean onPreferenceClick(Preference preference) {
+ Intent intent = new Intent(callingActivity, AutofillActivity.class);
+ startActivity(intent);
+ return false;
+ }
+ });
}
@Override
diff --git a/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillActivity.java b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillActivity.java
new file mode 100644
index 00000000..5d8fac5e
--- /dev/null
+++ b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillActivity.java
@@ -0,0 +1,84 @@
+package com.zeapo.pwdstore.autofill;
+
+import android.app.PendingIntent;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentSender;
+import android.content.SharedPreferences;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageManager;
+import android.os.Bundle;
+import android.support.v7.app.AppCompatActivity;
+import android.support.v7.widget.LinearLayoutManager;
+import android.support.v7.widget.RecyclerView;
+import android.util.Log;
+
+import com.zeapo.pwdstore.R;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+// blank activity started by service for calling startIntentSenderForResult
+public class AutofillActivity extends AppCompatActivity {
+ public static final int REQUEST_CODE_DECRYPT_AND_VERIFY = 9913;
+ private boolean bound = false;
+
+ private RecyclerView recyclerView;
+ private AutofillRecyclerAdapter recyclerAdapter;
+ private RecyclerView.LayoutManager layoutManager;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ Intent intent = getIntent();
+ Bundle extras = intent.getExtras();
+ // if called by service just for startIntentSenderForResult
+ if (extras != null) {
+ try {
+ PendingIntent pi = intent.getExtras().getParcelable("pending_intent");
+ if (pi == null) {
+ return;
+ }
+ startIntentSenderForResult(pi.getIntentSender()
+ , REQUEST_CODE_DECRYPT_AND_VERIFY, null, 0, 0, 0);
+ } catch (IntentSender.SendIntentException e) {
+ Log.e(AutofillService.Constants.TAG, "SendIntentException", e);
+ }
+ return;
+ }
+ // otherwise if called from settings
+ final PackageManager pm = getPackageManager();
+ List allApps = pm.getInstalledApplications(0);
+
+ SharedPreferences prefs
+ = getSharedPreferences("autofill", Context.MODE_PRIVATE);
+ Map prefApps = prefs.getAll();
+ ArrayList apps = new ArrayList<>();
+ for (ApplicationInfo applicationInfo : allApps) {
+ if (prefApps.containsKey(applicationInfo.packageName)) {
+ apps.add(applicationInfo);
+ }
+ }
+
+ setContentView(R.layout.autofill_recycler_view);
+ recyclerView = (RecyclerView) findViewById(R.id.autofill_recycler);
+
+ layoutManager = new LinearLayoutManager(this);
+ recyclerView.setLayoutManager(layoutManager);
+
+ recyclerAdapter = new AutofillRecyclerAdapter(apps, pm);
+ recyclerView.setAdapter(recyclerAdapter);
+
+ setTitle("Autofill Apps");
+
+ }
+
+ @Override
+ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+ finish(); // go back to the password field app
+ if (resultCode == RESULT_OK) {
+ AutofillService.setUnlockOK(); // report the result to service
+ }
+ }
+}
diff --git a/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillRecyclerAdapter.java b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillRecyclerAdapter.java
new file mode 100644
index 00000000..b59223bd
--- /dev/null
+++ b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillRecyclerAdapter.java
@@ -0,0 +1,62 @@
+package com.zeapo.pwdstore.autofill;
+
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageManager;
+import android.support.v7.widget.RecyclerView;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.zeapo.pwdstore.R;
+
+import java.util.ArrayList;
+
+public class AutofillRecyclerAdapter extends RecyclerView.Adapter {
+ private ArrayList apps;
+ private PackageManager pm;
+
+ public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
+ public View view;
+ public TextView name;
+ public ImageView icon;
+
+ public ViewHolder(View view) {
+ super(view);
+ this.view = view;
+ name = (TextView) view.findViewById(R.id.app_name);
+ icon = (ImageView) view.findViewById(R.id.app_icon);
+ view.setOnClickListener(this);
+ }
+
+ @Override
+ public void onClick(View v) {
+
+ }
+ }
+
+ public AutofillRecyclerAdapter(ArrayList apps, PackageManager pm) {
+ this.apps = apps;
+ this.pm = pm;
+ }
+
+ @Override
+ public AutofillRecyclerAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
+ View v = LayoutInflater.from(parent.getContext())
+ .inflate(R.layout.autofill_row_layout, parent, false);
+ return new ViewHolder(v);
+ }
+
+ @Override
+ public void onBindViewHolder(AutofillRecyclerAdapter.ViewHolder holder, int position) {
+ ApplicationInfo app = apps.get(position);
+ holder.name.setText(pm.getApplicationLabel(app));
+ holder.icon.setImageDrawable(pm.getApplicationIcon(app));
+ }
+
+ @Override
+ public int getItemCount() {
+ return apps.size();
+ }
+}
diff --git a/app/src/main/java/com/zeapo/pwdstore/AutofillService.java b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.java
similarity index 97%
rename from app/src/main/java/com/zeapo/pwdstore/AutofillService.java
rename to app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.java
index 887e100e..6188ef6d 100644
--- a/app/src/main/java/com/zeapo/pwdstore/AutofillService.java
+++ b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.java
@@ -1,4 +1,4 @@
-package com.zeapo.pwdstore;
+package com.zeapo.pwdstore.autofill;
import android.accessibilityservice.AccessibilityService;
import android.app.PendingIntent;
@@ -20,6 +20,8 @@ import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.Toast;
+import com.zeapo.pwdstore.R;
+import com.zeapo.pwdstore.UserPreference;
import com.zeapo.pwdstore.utils.PasswordItem;
import com.zeapo.pwdstore.utils.PasswordRepository;
@@ -107,6 +109,12 @@ public class AutofillService extends AccessibilityService {
decryptAndVerify();
}
});
+ builder.setNeutralButton("Match", new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+
+ }
+ });
dialog = builder.create();
dialog.setIcon(R.drawable.ic_launcher);
dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
diff --git a/app/src/main/res/layout/autofill_recycler_view.xml b/app/src/main/res/layout/autofill_recycler_view.xml
new file mode 100644
index 00000000..27afa77d
--- /dev/null
+++ b/app/src/main/res/layout/autofill_recycler_view.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/autofill_row_layout.xml b/app/src/main/res/layout/autofill_row_layout.xml
new file mode 100644
index 00000000..3f94a8ad
--- /dev/null
+++ b/app/src/main/res/layout/autofill_row_layout.xml
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/xml/preference.xml b/app/src/main/res/xml/preference.xml
index e4071c96..3a8c4fdf 100644
--- a/app/src/main/res/xml/preference.xml
+++ b/app/src/main/res/xml/preference.xml
@@ -70,6 +70,14 @@
android:summary="@string/pref_recursive_filter_hint"
android:title="@string/pref_recursive_filter" />
+
+
+
+
+