Commit ddf949ac authored by James Kung's avatar James Kung
Browse files

Layout for smaller devices e.g. Nexus S

Bug:
Change-Id: I210fbab377f49ec58bfa811d76e3dc5172fede63
parent 9901acdd
......@@ -27,6 +27,8 @@
android:background="@color/white"
android:orientation="vertical" >
<include layout="@layout/date_picker_header_view" />
<include layout="@layout/date_picker_selected_date" />
<View
......
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2013 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="@dimen/date_picker_dialog_height"
android:gravity="center"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="@dimen/date_picker_width"
android:layout_height="@dimen/date_picker_dialog_height"
android:layout_gravity="center"
android:background="@color/white"
android:orientation="vertical" >
<include layout="@layout/date_picker_header_view" />
<include layout="@layout/date_picker_selected_date" />
<View
android:layout_width="match_parent"
android:layout_height="1dip"
android:background="@color/line_background" />
<include layout="@layout/date_picker_done_button" />
</LinearLayout>
<View
android:layout_width="1dip"
android:layout_height="match_parent"
android:background="@color/line_background" />
<FrameLayout
android:layout_width="@dimen/pager_width"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="@color/calendar_pager" >
<ViewAnimator
android:id="@+id/animator"
android:layout_width="@dimen/pager_width"
android:layout_height="@dimen/pager_height"
android:background="@color/calendar_pager"
android:gravity="center" />
</FrameLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2013 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="@dimen/date_picker_width"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:background="@color/calendar_pager" >
<include layout="@layout/date_picker_header_view" />
<include layout="@layout/date_picker_selected_date"
android:id="@+id/date_picker_selected_date_layout" />
<ViewAnimator
android:id="@+id/animator"
android:layout_width="@dimen/pager_width"
android:layout_height="@dimen/pager_height"
android:gravity="center"
android:background="@color/calendar_pager" />
<View
android:layout_width="match_parent"
android:layout_height="1dip"
android:background="@color/line_background" />
<include layout="@layout/date_picker_done_button"
android:id="@+id/date_picker_done_button" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2013 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/date_picker_header"
android:layout_width="match_parent"
android:layout_height="@dimen/date_picker_header_height"
android:background="@color/calendar_header"
android:gravity="center"
android:includeFontPadding="false"
android:textColor="@color/white"
android:textSize="@dimen/date_picker_header_text_size" />
......@@ -14,73 +14,56 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/day_picker_selected_date_layout"
android:layout_width="match_parent"
android:layout_height="@dimen/selected_date_layout_height"
android:layout_gravity="center"
android:background="@color/white"
android:gravity="center"
android:orientation="vertical" >
<TextView
android:id="@+id/date_picker_header"
android:layout_width="match_parent"
android:layout_height="@dimen/date_picker_header_height"
android:background="@color/calendar_header"
android:gravity="center"
android:includeFontPadding="false"
android:textColor="@color/white"
android:textSize="@dimen/date_picker_header_text_size" />
<LinearLayout
android:id="@+id/date_picker_month_and_day"
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical" >
android:layout_height="wrap_content"
android:layout_gravity="center"
android:clickable="true"
android:orientation="vertical"
android:textColor="@color/date_picker_selector" >
<LinearLayout
android:id="@+id/date_picker_month_and_day"
<TextView
android:id="@+id/date_picker_month"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:clickable="true"
android:orientation="vertical"
android:textColor="@color/date_picker_selector" >
<TextView
android:id="@+id/date_picker_month"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:duplicateParentState="true"
android:gravity="center_horizontal|bottom"
android:includeFontPadding="false"
android:textColor="@color/date_picker_selector"
android:textSize="@dimen/selected_date_month_size" />
<TextView
android:id="@+id/date_picker_day"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="-10dip"
android:layout_marginTop="-10dip"
android:duplicateParentState="true"
android:gravity="center"
android:includeFontPadding="false"
android:textColor="@color/date_picker_selector"
android:textSize="@dimen/selected_date_day_size" />
</LinearLayout>
android:duplicateParentState="true"
android:gravity="center_horizontal|bottom"
android:includeFontPadding="false"
android:textColor="@color/date_picker_selector"
android:textSize="@dimen/selected_date_month_size" />
<TextView
android:id="@+id/date_picker_year"
android:id="@+id/date_picker_day"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center_horizontal|top"
android:layout_marginBottom="-10dip"
android:layout_marginTop="-10dip"
android:duplicateParentState="true"
android:gravity="center"
android:includeFontPadding="false"
android:textColor="@color/date_picker_selector"
android:textSize="@dimen/selected_date_year_size" />
android:textSize="@dimen/selected_date_day_size" />
</LinearLayout>
<TextView
android:id="@+id/date_picker_year"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center_horizontal|top"
android:includeFontPadding="false"
android:textColor="@color/date_picker_selector"
android:textSize="@dimen/selected_date_year_size" />
</LinearLayout>
\ No newline at end of file
......@@ -23,4 +23,9 @@
<dimen name="dialog_height">200dip</dimen>
<dimen name="left_side_width">250dip</dimen>
<dimen name="date_picker_dialog_height">282dip</dimen>
<dimen name="selected_date_layout_height">210dp</dimen>
<dimen name="selected_date_year_size">30dp</dimen>
<dimen name="selected_date_day_size">100dp</dimen>
<dimen name="selected_date_month_size">30dp</dimen>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 2013, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->
<resources
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"
xmlns:android="http://schemas.android.com/apk/res/android" >
<dimen name="selected_date_layout_height">210dp</dimen>
<dimen name="selected_date_year_size">30dp</dimen>
<dimen name="selected_date_day_size">100dp</dimen>
<dimen name="selected_date_month_size">30dp</dimen>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 2013, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->
<resources
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"
xmlns:android="http://schemas.android.com/apk/res/android" >
<dimen name="selected_date_layout_height">210dp</dimen>
<dimen name="selected_date_year_size">30dp</dimen>
<dimen name="selected_date_day_size">100dp</dimen>
<dimen name="selected_date_month_size">30dp</dimen>
</resources>
\ No newline at end of file
......@@ -43,7 +43,7 @@
<dimen name="pager_height">270dp</dimen>
<dimen name="pager_width">270dp</dimen>
<dimen name="date_picker_width">270dp</dimen>
<dimen name="selected_date_layout_height">240dp</dimen>
<dimen name="selected_date_layout_height">155dp</dimen>
<dimen name="done_button_height">42dp</dimen>
<dimen name="date_picker_header_height">30dp</dimen>
<dimen name="month_list_item_header_height">50dp</dimen>
......@@ -52,7 +52,7 @@
<dimen name="day_number_select_circle_radius">16dp</dimen>
<dimen name="month_select_circle_radius">24dp</dimen>
<dimen name="selected_date_year_size">30dp</dimen>
<dimen name="selected_date_day_size">100dp</dimen>
<dimen name="selected_date_day_size">75dp</dimen>
<dimen name="selected_date_month_size">30dp</dimen>
<dimen name="date_picker_header_text_size">14dp</dimen>
<dimen name="month_label_size">16sp</dimen>
......
......@@ -242,8 +242,10 @@ public class DatePickerDialog extends DialogFragment implements
}
private void updateDisplay() {
mDayOfWeekView.setText(mCalendar.getDisplayName(Calendar.DAY_OF_WEEK, Calendar.LONG,
Locale.getDefault()).toUpperCase(Locale.getDefault()));
if (mDayOfWeekView != null) {
mDayOfWeekView.setText(mCalendar.getDisplayName(Calendar.DAY_OF_WEEK, Calendar.LONG,
Locale.getDefault()).toUpperCase(Locale.getDefault()));
}
mSelectedMonthTextView.setText(mCalendar.getDisplayName(Calendar.MONTH, Calendar.SHORT,
Locale.getDefault()).toUpperCase(Locale.getDefault()));
mSelectedDayTextView.setText(DAY_FORMAT.format(mCalendar.getTime()));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment