diff options
author | Matthew Wong <wongma@protonmail.ch> | 2015-07-28 11:48:42 -0400 |
---|---|---|
committer | Matthew Wong <wongma@protonmail.ch> | 2015-08-14 17:36:45 -0400 |
commit | 485b621b042041fb92f9b1c0765ef2edd83745f4 (patch) | |
tree | 323b6538f2524cea88b5c104ab1d455da82dd1a3 /app/src/main/java | |
parent | 690155391ce169f2c9b48558732a12e5d0e91c36 (diff) |
Change dialog appearance, smaller (wraps content)
Diffstat (limited to 'app/src/main/java')
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/AutofillService.java | 25 |
1 files changed, 12 insertions, 13 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) { |