From a22cd874fdbb92a0648d98be2ceef868d2650ad9 Mon Sep 17 00:00:00 2001 From: Matthew Wong Date: Sat, 7 Nov 2015 17:21:50 -0500 Subject: Smaller dialog size --- .../java/com/zeapo/pwdstore/autofill/AutofillService.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'app') diff --git a/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.java b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.java index 040065af..6d7c84ed 100644 --- a/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.java +++ b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.java @@ -17,6 +17,7 @@ import android.preference.PreferenceManager; import android.support.v4.content.ContextCompat; import android.support.v7.app.AlertDialog; import android.util.Log; +import android.util.TypedValue; import android.view.WindowManager; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; @@ -66,7 +67,6 @@ public class AutofillService extends AccessibilityService { settings = PreferenceManager.getDefaultSharedPreferences(this); } - // TODO change search/search results (just use first result) @Override public void onAccessibilityEvent(AccessibilityEvent event) { if (ContextCompat.checkSelfPermission(this, Manifest.permission.SYSTEM_ALERT_WINDOW) @@ -285,9 +285,13 @@ public class AutofillService extends AccessibilityService { dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT); dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE); dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); - // TODO size dialog - dialog.getWindow().setLayout(WindowManager.LayoutParams.WRAP_CONTENT - , WindowManager.LayoutParams.WRAP_CONTENT); + // arbitrary non-annoying size + int height = 160; + if (items.size() > 1) { + height += 48; + } + dialog.getWindow().setLayout((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 240, getResources().getDisplayMetrics()) + , (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, height, getResources().getDisplayMetrics())); dialog.show(); } -- cgit v1.2.3