diff options
author | Matthew Wong <wongma@protonmail.ch> | 2015-11-07 17:21:50 -0500 |
---|---|---|
committer | Matthew Wong <wongma@protonmail.ch> | 2015-11-07 20:17:45 -0500 |
commit | a22cd874fdbb92a0648d98be2ceef868d2650ad9 (patch) | |
tree | 769305b6657010516641b42fa20511d98271906a /app/src/main/java | |
parent | 8fa173e7d206c2ddff19890d96dbdb2edf6c9139 (diff) |
Smaller dialog size
Diffstat (limited to 'app/src/main/java')
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.java | 12 |
1 files changed, 8 insertions, 4 deletions
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(); } |