From 0993a30d5ceab6ee17b91e032560b3c9f8bc754d Mon Sep 17 00:00:00 2001 From: serso Date: Thu, 3 Mar 2016 17:12:14 +0100 Subject: [PATCH] Don't move dialog on tablets --- .../calculator/keyboard/FloatingKeyboardWindow.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/solovyev/android/calculator/keyboard/FloatingKeyboardWindow.java b/app/src/main/java/org/solovyev/android/calculator/keyboard/FloatingKeyboardWindow.java index 9b10da02..3a71f1c5 100644 --- a/app/src/main/java/org/solovyev/android/calculator/keyboard/FloatingKeyboardWindow.java +++ b/app/src/main/java/org/solovyev/android/calculator/keyboard/FloatingKeyboardWindow.java @@ -26,6 +26,7 @@ public class FloatingKeyboardWindow { private PopupWindow window; @Nullable private Dialog dialog; + private boolean tablet; public FloatingKeyboardWindow(@javax.annotation.Nullable PopupWindow.OnDismissListener dismissListener) { this.dismissListener = dismissListener; @@ -41,7 +42,9 @@ public class FloatingKeyboardWindow { } private void onDismissed() { - moveDialog(Gravity.CENTER); + if (!tablet) { + moveDialog(Gravity.CENTER); + } window = null; dialog = null; } @@ -53,9 +56,12 @@ public class FloatingKeyboardWindow { return; } this.dialog = dialog; - moveDialog(Gravity.TOP); - App.hideIme(editor); final Context context = editor.getContext(); + this.tablet = App.isTablet(context); + if (!tablet) { + moveDialog(Gravity.TOP); + } + App.hideIme(editor); final LinearLayout view = new LinearLayout(context); view.setOrientation(LinearLayout.VERTICAL);