aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Bird <sbird@cyngn.com>2015-08-05 17:51:56 -0700
committerMichael Bestas <mikeioannina@cyanogenmod.org>2016-06-20 03:31:02 -0700
commit80077de4de4d18304fb9971d73dc53bb7ebf848c (patch)
tree7c80fb33c6b98a9527175667e934cf1e8d287258
parent2274d21b1f11e5bbc17dc82705da11be019e60ad (diff)
ListPopupWindow: set height of the list
We need to make sure that the list is the proper height so that it does not draw off the screen. Ideally, we would stop handling the orientation changes and allow the app to do the orientation changes as android apps do normally. This would require some significant changes to how our dialog system works and could cause other potential issues. Ticket: QRDL-882 Change-Id: I39176d56d8286ed93b71dbe4c770fe79f39ac753 (cherry picked from commit d86bee2ab7b08ea2eaec91b251b0d94548de0af0)
-rw-r--r--src/com/cyanogenmod/filemanager/util/DialogHelper.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/com/cyanogenmod/filemanager/util/DialogHelper.java b/src/com/cyanogenmod/filemanager/util/DialogHelper.java
index a78c81f..d357d1b 100644
--- a/src/com/cyanogenmod/filemanager/util/DialogHelper.java
+++ b/src/com/cyanogenmod/filemanager/util/DialogHelper.java
@@ -22,6 +22,7 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.text.InputFilter;
+import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
@@ -571,6 +572,20 @@ public final class DialogHelper {
popup.setContentWidth(context.getResources().getDimensionPixelSize(R.dimen.popup_width));
popup.setAnchorView(anchor);
popup.setModal(true);
+
+ // HACK: set the height to the size of the device screen width or height depending on
+ // which is smaller.
+ // Because we are handling the orientation change instead of letting
+ // android do its thing, this never redraws. If we remove the orientation
+ // change, then all the other popup dialogs break when rotating.
+ // This isn't perfect, but without some significant changes to this app we cannot
+ // properly do this.
+ // Get the screen size, determine what number is lower, use that for the height
+ DisplayMetrics dM = context.getResources().getDisplayMetrics();
+ float width = dM.widthPixels / dM.density;
+ float height = dM.heightPixels / dM.density;
+ popup.setHeight((int)Math.min(height, width));
+
return popup;
}