diff options
Diffstat (limited to 'app/src/main')
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/AutofillService.java | 25 | ||||
-rw-r--r-- | app/src/main/res/layout/autofill_layout.xml | 12 |
2 files changed, 12 insertions, 25 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/AutofillService.java b/app/src/main/java/com/zeapo/pwdstore/AutofillService.java index 1636702a..5093dac3 100644 --- a/app/src/main/java/com/zeapo/pwdstore/AutofillService.java +++ b/app/src/main/java/com/zeapo/pwdstore/AutofillService.java @@ -5,6 +5,7 @@ import android.app.PendingIntent; import android.content.ClipData; import android.content.ClipboardManager; import android.content.Context; +import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.ApplicationInfo; @@ -14,11 +15,9 @@ import android.os.Bundle; import android.preference.PreferenceManager; import android.support.v7.app.AlertDialog; import android.util.Log; -import android.view.View; import android.view.WindowManager; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; -import android.widget.Button; import android.widget.Toast; import com.zeapo.pwdstore.utils.PasswordItem; @@ -96,24 +95,24 @@ public class AutofillService extends AccessibilityService { } if (dialog == null) { - AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.Theme_AppCompat_Light_Dialog_Alert); + AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.Theme_AppCompat_Dialog); builder.setNegativeButton("Cancel", null); - builder.setView(R.layout.autofill_layout); + builder.setPositiveButton("Fill", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + decryptAndVerify(); + } + }); dialog = builder.create(); - dialog.setTitle("Fill with Password Store"); + dialog.setIcon(R.drawable.ic_launcher); + dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT); dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE); dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); } + dialog.setTitle(items.get(0).getName()); dialog.show(); - ((Button) dialog.findViewById(R.id.button)).setText(items.get(0).getName()); - dialog.findViewById(R.id.button).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - decryptAndVerify(); - dialog.dismiss(); - } - }); + dialog.getWindow().setLayout(WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT); } private ArrayList<PasswordItem> recursiveFilter(String filter, File dir) { diff --git a/app/src/main/res/layout/autofill_layout.xml b/app/src/main/res/layout/autofill_layout.xml deleted file mode 100644 index 0108160d..00000000 --- a/app/src/main/res/layout/autofill_layout.xml +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:orientation="vertical" - android:layout_width="match_parent" - android:layout_height="match_parent"> - - <Button - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:id="@+id/button" - android:layout_gravity="center"/> -</LinearLayout>
\ No newline at end of file |