Created landscape layout for number grid
This commit is contained in:
parent
a76fa47768
commit
742d5f3b1e
@ -161,9 +161,8 @@ public class NumberGridTimePickerDialog extends BaseTimePickerDialog implements
|
||||
// } else if (currentHalfDay == HALF_DAY_2) {
|
||||
// currentHalfDay = HALF_DAY_1;
|
||||
// }
|
||||
updateAmPmDisplay(halfDay);
|
||||
updateHalfDay(halfDay);
|
||||
mTimePicker.setAmOrPm(halfDay);
|
||||
updateHalfDayTogglesState(halfDay);
|
||||
}
|
||||
}
|
||||
|
||||
@ -396,7 +395,6 @@ public class NumberGridTimePickerDialog extends BaseTimePickerDialog implements
|
||||
separatorView.setLayoutParams(paramsSeparator);
|
||||
} else {
|
||||
mAmPmTextView.setVisibility(View.VISIBLE);
|
||||
updateAmPmDisplay(mInitialHourOfDay < 12? AM : PM);
|
||||
mAmPmHitspace.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@ -407,7 +405,7 @@ public class NumberGridTimePickerDialog extends BaseTimePickerDialog implements
|
||||
} else if (amOrPm == PM){
|
||||
amOrPm = AM;
|
||||
}
|
||||
updateAmPmDisplay(amOrPm);
|
||||
updateHalfDay(amOrPm);
|
||||
mTimePicker.setAmOrPm(amOrPm);
|
||||
}
|
||||
});
|
||||
@ -491,7 +489,9 @@ public class NumberGridTimePickerDialog extends BaseTimePickerDialog implements
|
||||
// mThemeDark? android.R.attr.textColorPrimaryInverse : android.R.attr.textColorPrimary);
|
||||
mHalfDayToggleUnselectedColor = ContextCompat.getColor(getContext(),
|
||||
mThemeDark? R.color.text_color_primary_dark : R.color.text_color_primary_light);
|
||||
updateHalfDayTogglesState(mTimePicker.getIsCurrentlyAmOrPm());
|
||||
|
||||
// Update the half day at the end when the state colors have been initialized
|
||||
updateHalfDay(mInitialHourOfDay < 12? AM : PM);
|
||||
return view;
|
||||
}
|
||||
|
||||
@ -511,6 +511,11 @@ public class NumberGridTimePickerDialog extends BaseTimePickerDialog implements
|
||||
// mHapticFeedbackController.tryVibrate();
|
||||
}
|
||||
|
||||
private void updateHalfDay(int halfDay) {
|
||||
updateAmPmDisplay(halfDay);
|
||||
updateHalfDayTogglesState(halfDay);
|
||||
}
|
||||
|
||||
private void updateAmPmDisplay(int amOrPm) {
|
||||
if (amOrPm == AM) {
|
||||
mAmPmTextView.setText(mAmText);
|
||||
@ -579,8 +584,7 @@ public class NumberGridTimePickerDialog extends BaseTimePickerDialog implements
|
||||
setMinute(newValue);
|
||||
mTimePicker.setContentDescription(mMinutePickerDescription + ": " + newValue);
|
||||
} else if (pickerIndex == AMPM_INDEX) {
|
||||
updateAmPmDisplay(newValue);
|
||||
updateHalfDayTogglesState(newValue);
|
||||
updateHalfDay(newValue);
|
||||
} else if (pickerIndex == ENABLE_PICKER_INDEX) {
|
||||
if (!isTypedTimeFullyLegal()) {
|
||||
mTypedTimes.clear();
|
||||
|
||||
@ -0,0 +1,92 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dialog_height"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/time_display_background"
|
||||
android:layout_width="@dimen/left_side_width"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@android:color/white" >
|
||||
<include
|
||||
layout="@layout/time_header_label"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/header_height"
|
||||
android:layout_gravity="center" />
|
||||
</FrameLayout>
|
||||
|
||||
<com.philliphsu.clock2.editalarm.GridSelectorLayout
|
||||
android:id="@+id/time_picker"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginTop="@dimen/bottom_sheet_vertical_space"
|
||||
android:layout_marginStart="@dimen/bottom_sheet_edge_margin"
|
||||
android:paddingEnd="@dimen/anchored_fab_vertical_space"
|
||||
android:layout_marginBottom="@dimen/bottom_sheet_vertical_space"/>
|
||||
|
||||
<View
|
||||
android:id="@+id/divider"
|
||||
style="@style/Divider.Vertical"/>
|
||||
|
||||
<!--TODO: Be wary of this vertical LL with weighted children.-->
|
||||
<LinearLayout
|
||||
android:id="@+id/half_day_toggles"
|
||||
android:layout_width="@dimen/half_day_button_bar_height"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/half_day_toggle_1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:background="?android:attr/selectableItemBackground">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center"
|
||||
style="@style/TextAppearance.AppCompat.Button"/>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/half_day_toggle_2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:background="?android:attr/selectableItemBackground">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center"
|
||||
style="@style/TextAppearance.AppCompat.Button"/>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- app:borderWidth="0dp"
|
||||
Remove the stroke that is otherwise visible when long pressed -->
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/fab"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_done_24dp"
|
||||
app:layout_anchor="@id/divider"
|
||||
app:layout_anchorGravity="center_vertical"/>
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
31
app/src/main/res/layout-land/dialog_time_picker_numpad.xml
Normal file
31
app/src/main/res/layout-land/dialog_time_picker_numpad.xml
Normal file
@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- TOneverDO: Use LinearLayout as root container when the
|
||||
dialog is a DialogFragment (or a subclass of), or else LWM
|
||||
doesn't work. -->
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/input_time"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/numeric_keypad_output_box_height"
|
||||
android:gravity="center"
|
||||
android:textSize="@dimen/text_size_display_3"
|
||||
android:fontFamily="sans-serif"
|
||||
style="@style/TextAppearance.AppCompat"/>
|
||||
|
||||
<!--<View style="@style/FocusGrabber"
|
||||
android:id="@+id/focus_grabber"/>-->
|
||||
|
||||
<com.philliphsu.clock2.editalarm.NumpadTimePicker
|
||||
android:id="@+id/number_grid"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/numeric_keypad_height"
|
||||
android:layout_below="@id/input_time"
|
||||
android:layout_marginTop="@dimen/bottom_sheet_vertical_space"
|
||||
android:layout_marginStart="@dimen/bottom_sheet_edge_margin"
|
||||
android:layout_marginEnd="@dimen/bottom_sheet_edge_margin"/>
|
||||
|
||||
</RelativeLayout>
|
||||
@ -3,13 +3,12 @@
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<!-- TOneverDO: Use vertical LinearLayout as long as
|
||||
GridLayout has no fixed width -->
|
||||
<RelativeLayout
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/time_display_background"
|
||||
@ -27,21 +26,19 @@
|
||||
android:id="@+id/time_picker"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/number_grid_height"
|
||||
android:layout_below="@id/time_display_background"
|
||||
android:layout_marginTop="@dimen/bottom_sheet_vertical_space"
|
||||
android:layout_marginStart="@dimen/bottom_sheet_edge_margin"
|
||||
android:layout_marginEnd="@dimen/bottom_sheet_edge_margin"
|
||||
android:paddingBottom="@dimen/anchored_fab_vertical_space"/>
|
||||
|
||||
<View
|
||||
android:id="@+id/divider"
|
||||
style="@style/Divider.Horizontal"
|
||||
android:layout_below="@id/time_picker"/>
|
||||
style="@style/Divider.Horizontal"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/half_day_toggles"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/half_day_button_bar_height"
|
||||
android:layout_below="@id/divider"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<FrameLayout
|
||||
@ -78,7 +75,7 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<!-- app:borderWidth="0dp"
|
||||
Remove the stroke that is otherwise visible when long pressed -->
|
||||
|
||||
23
app/src/main/res/values-land/aosp_datetimepicker_dimens.xml
Normal file
23
app/src/main/res/values-land/aosp_datetimepicker_dimens.xml
Normal file
@ -0,0 +1,23 @@
|
||||
<?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.
|
||||
-->
|
||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<dimen name="dialog_height">252dp</dimen> <!-- number_grid_height + + 16dp top margin + 16dp bottom margin -->
|
||||
<dimen name="left_side_width">250dip</dimen>
|
||||
|
||||
</resources>
|
||||
22
app/src/main/res/values-land/dimens.xml
Normal file
22
app/src/main/res/values-land/dimens.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<resources>
|
||||
<dimen name="grid_element_text_size">24sp</dimen>
|
||||
|
||||
<!-- NumpadTimePickerDialog -->
|
||||
<dimen name="numpad_height">300dp</dimen> <!-- TODO: Deprecated -->
|
||||
<dimen name="numeric_keypad_cell_height">64dp</dimen>
|
||||
<dimen name="numeric_keypad_output_box_height">80dp</dimen>
|
||||
<dimen name="numeric_keypad_height">344dp</dimen> <!-- 4 * (numeric_keypad_cell_height) + 88dp pre-21 FAB height -->
|
||||
<dimen name="numeric_keypad_backspace_height">88dp</dimen> <!-- Same as pre-21 FAB height -->
|
||||
<dimen name="numeric_keypad_fab_bottom_margin">0dp</dimen> <!-- 88dp height already big enough -->
|
||||
|
||||
<!-- NumberGridTimePickerDialog -->
|
||||
<!--TODO: We don't actually use this. -->
|
||||
<dimen name="number_grid_height">220dp</dimen> <!-- 5 * (number_grid_minute_cell_height) -->
|
||||
<dimen name="number_grid_hour_cell_height">55dp</dimen> <!-- 4 * 55 == 5 * (number_grid_minute_cell_height) -->
|
||||
<dimen name="number_grid_minute_cell_height">44dp</dimen>
|
||||
<!--TODO: Change the height suffix to size or dimen, because this is used as a width in landscape and a height in portrait. -->
|
||||
<dimen name="half_day_button_bar_height">64dp</dimen>
|
||||
<dimen name="number_grid_24_hour_item_primary_text_size">30sp</dimen>
|
||||
<dimen name="number_grid_minute_text_size">20sp</dimen>
|
||||
|
||||
</resources>
|
||||
@ -12,9 +12,8 @@
|
||||
<dimen name="app_bar_height">180dp</dimen>
|
||||
<dimen name="text_margin">16dp</dimen>
|
||||
|
||||
<dimen name="grid_element_text_size">28sp</dimen>
|
||||
<dimen name="grid_element_text_size">34sp</dimen>
|
||||
<dimen name="grid_element_touch_target">40dp</dimen>
|
||||
<dimen name="half_day_text_size">17sp</dimen>
|
||||
|
||||
<!-- NumpadTimePickerDialog -->
|
||||
<dimen name="numpad_height">300dp</dimen> <!-- TODO: Deprecated -->
|
||||
@ -26,7 +25,7 @@
|
||||
|
||||
<!-- NumberGridTimePickerDialog -->
|
||||
<dimen name="number_grid_height">308dp</dimen> <!-- 5 * (number_grid_minute_cell_height) + half-FAB height bottom padding -->
|
||||
<dimen name="number_grid_hour_cell_height">70dp</dimen> <!-- 4 * 70 + 28 = 308 -->
|
||||
<dimen name="number_grid_hour_cell_height">70dp</dimen> <!-- 4 * 70 == 5 * (number_grid_minute_cell_height) -->
|
||||
<dimen name="number_grid_minute_cell_height">56dp</dimen>
|
||||
<dimen name="half_day_button_bar_height">48dp</dimen>
|
||||
<dimen name="number_grid_24_hour_item_primary_text_size">30sp</dimen>
|
||||
|
||||
@ -43,7 +43,7 @@
|
||||
|
||||
<!-- TODO: Rename to GridLayout[Text/Button/TextView]? -->
|
||||
<style name="GridLayoutNumpadButton" parent="GridLayoutNumpadElement">
|
||||
<item name="android:textSize">@dimen/text_size_display_1</item>
|
||||
<item name="android:textSize">@dimen/grid_element_text_size</item>
|
||||
<item name="android:fontFamily">sans-serif-light</item>
|
||||
<item name="android:textColor">?android:attr/textColorPrimary</item>
|
||||
</style>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user