summaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
authorMatthew Wong <wongma@protonmail.ch>2015-11-07 17:21:50 -0500
committerMatthew Wong <wongma@protonmail.ch>2015-11-07 20:17:45 -0500
commita22cd874fdbb92a0648d98be2ceef868d2650ad9 (patch)
tree769305b6657010516641b42fa20511d98271906a /app/src/main/java
parent8fa173e7d206c2ddff19890d96dbdb2edf6c9139 (diff)
Smaller dialog size
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.java12
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();
}