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
--- 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"