diff options
author | Stephen Bird <sbird@cyngn.com> | 2015-08-05 17:51:56 -0700 |
---|---|---|
committer | Stephen Bird <sbird@cyngn.com> | 2015-08-05 17:53:20 -0700 |
commit | d86bee2ab7b08ea2eaec91b251b0d94548de0af0 (patch) | |
tree | 410efb088036b067ba3704f15af68b74cee7ab7a | |
parent | 076be8f13725a8af01c12cee6c9172c12eb6a6bd (diff) | |
download | android_packages_apps_CMFileManager-d86bee2ab7b08ea2eaec91b251b0d94548de0af0.tar.gz android_packages_apps_CMFileManager-d86bee2ab7b08ea2eaec91b251b0d94548de0af0.tar.bz2 android_packages_apps_CMFileManager-d86bee2ab7b08ea2eaec91b251b0d94548de0af0.zip |
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
-rw-r--r-- | src/com/cyanogenmod/filemanager/util/DialogHelper.java | 15 |
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 a78c81fb..d357d1b3 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; } |