Bug 1245692 - Make CalendarView use full width of dialog r=sebastian
authorAndrzej Hunt <ahunt@mozilla.com>
Fri, 27 May 2016 10:29:04 -0700
changeset 339351 bf1bb13cc6249d9c807f79e775e0361f2ea2f1bd
parent 339350 7789534d886d40bcf5f241c6b33278f3103d2070
child 339352 6666bf0ccb50f6a59f2ce4f6ff5d68dd1f38b762
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssebastian
bugs1245692
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1245692 - Make CalendarView use full width of dialog r=sebastian Squashing CalendarView makes it look bad and hard to use - by allowing it to expand to the dialog width we get a usable CalendarView. Note that this breaks on Android 4.x. On these devices CalendarView is implemented using a ListView, which for some reason isn't given any space during layouting - this results in the actual days in the month being hidden (we do however see the weekday titles / month title). MozReview-Commit-ID: wHNx1xG3JK
mobile/android/base/java/org/mozilla/gecko/widget/DateTimePicker.java
mobile/android/base/resources/layout/datetime_picker.xml
--- a/mobile/android/base/java/org/mozilla/gecko/widget/DateTimePicker.java
+++ b/mobile/android/base/java/org/mozilla/gecko/widget/DateTimePicker.java
@@ -317,18 +317,16 @@ public class DateTimePicker extends Fram
 
         // If we're displaying a date, the screen is wide enough
         // (and if we're using an SDK where the calendar view exists)
         // then display a calendar.
         if (mState == PickersState.DATE || mState == PickersState.DATETIME) {
             mCalendar = new CalendarView(context);
             mCalendar.setVisibility(GONE);
 
-            LayoutParams layoutParams = new LayoutParams(250, 280);
-            mCalendar.setLayoutParams(layoutParams);
             mCalendar.setFocusable(true);
             mCalendar.setFocusableInTouchMode(true);
             mCalendar.setMaxDate(mMaxDate.getTimeInMillis());
             mCalendar.setMinDate(mMinDate.getTimeInMillis());
             mCalendar.setDate(mTempDate.getTimeInMillis(), false, false);
 
             mCalendar.setOnDateChangeListener(new CalendarView.OnDateChangeListener() {
                 @Override
--- a/mobile/android/base/resources/layout/datetime_picker.xml
+++ b/mobile/android/base/resources/layout/datetime_picker.xml
@@ -20,17 +20,17 @@
 <!-- Layout of date picker-->
 
 <!-- Warning: everything within the "pickers" layout is removed and re-ordered
      depending on the date format selected by the user.
 -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/datetime_picker"
-    android:layout_width="wrap_content"
+    android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:layout_gravity="center_horizontal"
     android:orientation="vertical"
     android:gravity="center">
 
     <LinearLayout android:id="@+id/date_spinners"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"