Bug 1245692 - Force height for CalendarView on pre-lollipop r?sebastian draft
authorAndrzej Hunt <ahunt@mozilla.com>
Wed, 01 Jun 2016 14:50:11 -0700
changeset 374122 2e98079a9efaa315155008f54b50edf719a08930
parent 374121 9abe269749ce7a3e5c27b8d8c8c219393a67312c
child 522559 9a58ed5d2a99bb4047ae64fc5d477760dc0092b5
push id19938
push userahunt@mozilla.com
push dateWed, 01 Jun 2016 21:55:05 +0000
reviewerssebastian
bugs1245692
milestone49.0a1
Bug 1245692 - Force height for CalendarView on pre-lollipop r?sebastian By default CalendarView doesn't receive sufficient height on pre-lollipop devices, in fact the entire dialog won't even appear unless we manually assign height. This is slightly hacky, but necessary to ensure correct layouting. (We previously assigned both height and width to the CalendarView, however that results in all kinds of odd behaviour - this change is necessary only to have acceptable behaviour on older devices.) MozReview-Commit-ID: H7wzHsrOJy4
mobile/android/base/java/org/mozilla/gecko/widget/DateTimePicker.java
--- a/mobile/android/base/java/org/mozilla/gecko/widget/DateTimePicker.java
+++ b/mobile/android/base/java/org/mozilla/gecko/widget/DateTimePicker.java
@@ -16,16 +16,17 @@
 
 package org.mozilla.gecko.widget;
 
 import java.text.SimpleDateFormat;
 import java.util.Arrays;
 import java.util.Calendar;
 import java.util.Locale;
 
+import org.mozilla.gecko.AppConstants;
 import org.mozilla.gecko.AppConstants.Versions;
 import org.mozilla.gecko.R;
 
 import android.content.Context;
 import android.text.format.DateFormat;
 import android.text.format.DateUtils;
 import android.util.DisplayMetrics;
 import android.util.Log;
@@ -334,16 +335,20 @@ public class DateTimePicker extends Fram
                     CalendarView view, int year, int month, int monthDay) {
                     mTempDate.set(year, month, monthDay);
                     setDate(mTempDate);
                     notifyDateChanged();
                 }
             });
 
             mPickers.addView(mCalendar);
+
+            if (Versions.preLollipop) {
+                mCalendar.getLayoutParams().height = 400;
+            }
         } else {
             // If the screen is more wide than high, we are displaying day and
             // time spinners, and if there is no calendar displayed, we should
             // display the fields in one row.
             if (mScreenWidth > mScreenHeight && mState == PickersState.DATETIME) {
                 mPickers.setOrientation(LinearLayout.HORIZONTAL);
             }
             mCalendar = null;