diff options
author | James Lemieux <jplemieux@google.com> | 2015-11-19 14:08:21 -0800 |
---|---|---|
committer | James Lemieux <jplemieux@google.com> | 2015-11-19 14:56:45 -0800 |
commit | 739e1ed7f36f113cd8e98b1fcf17416e4065ece8 (patch) | |
tree | 0ee0608ca3c8e072134b0f4c7d89402ed73e4b50 /res | |
parent | ad9d3e6d8317065bc4cade1947cee1b25388c4b8 (diff) | |
download | android_packages_apps_DeskClock-739e1ed7f36f113cd8e98b1fcf17416e4065ece8.tar.gz android_packages_apps_DeskClock-739e1ed7f36f113cd8e98b1fcf17416e4065ece8.tar.bz2 android_packages_apps_DeskClock-739e1ed7f36f113cd8e98b1fcf17416e4065ece8.zip |
Fix fab disappearing on rotation when no timers exist
Bug: 25779786
The issue here is that TimerSetupView actually customizes the fab.
These customizations include setting it invisible. It was a poor design
to share the fab with this view. So, the fix is that the view now holds
its own fab-like button that it is free to manipulate without fear of
altering the app-wide fab state unintentionally.
Change-Id: Ie83b03c98db4f77e0be912b122b6f74c2c7e6c8a
Diffstat (limited to 'res')
-rw-r--r-- | res/layout-land/time_setup_view.xml | 6 | ||||
-rw-r--r-- | res/layout/desk_clock.xml | 17 | ||||
-rw-r--r-- | res/layout/time_setup_view.xml | 2 | ||||
-rw-r--r-- | res/layout/timer_cancel_button.xml | 40 | ||||
-rw-r--r-- | res/layout/timer_setup_buttons.xml | 67 |
5 files changed, 79 insertions, 53 deletions
diff --git a/res/layout-land/time_setup_view.xml b/res/layout-land/time_setup_view.xml index 26b7aed67..b5e68e1e7 100644 --- a/res/layout-land/time_setup_view.xml +++ b/res/layout-land/time_setup_view.xml @@ -20,6 +20,7 @@ <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" + android:baselineAligned="false" android:orientation="horizontal"> <!-- This nested ltr layout cannot be combined with the parent because @@ -32,8 +33,7 @@ android:layout_marginBottom="@dimen/footer_button_size" android:layoutDirection="ltr" android:gravity="center" - android:orientation="vertical" - > + android:orientation="vertical"> <com.android.deskclock.timer.TimerView android:id="@+id/timer_time_text" @@ -88,6 +88,6 @@ </LinearLayout> - <include layout="@layout/timer_cancel_button" /> + <include layout="@layout/timer_setup_buttons" /> </FrameLayout>
\ No newline at end of file diff --git a/res/layout/desk_clock.xml b/res/layout/desk_clock.xml index f8ccea18e..d25a578a0 100644 --- a/res/layout/desk_clock.xml +++ b/res/layout/desk_clock.xml @@ -57,6 +57,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="bottom" + android:baselineAligned="false" android:orientation="horizontal" app:layout_behavior="com.android.deskclock.widget.toast.LinearLayoutWithSnackbarBehavior"> @@ -68,9 +69,9 @@ <ImageButton android:id="@+id/left_button" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:layout_gravity="center_horizontal" + android:layout_width="@dimen/design_fab_size_normal" + android:layout_height="@dimen/design_fab_size_normal" + android:layout_gravity="center" android:contentDescription="@null" android:scaleType="center" /> @@ -100,14 +101,12 @@ <ImageButton android:id="@+id/right_button" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:layout_gravity="center_horizontal" + android:layout_width="@dimen/design_fab_size_normal" + android:layout_height="@dimen/design_fab_size_normal" + android:layout_gravity="center" android:contentDescription="@null" android:scaleType="center" /> </FrameLayout> - </LinearLayout> - -</android.support.design.widget.CoordinatorLayout> +</android.support.design.widget.CoordinatorLayout>
\ No newline at end of file diff --git a/res/layout/time_setup_view.xml b/res/layout/time_setup_view.xml index 9c8461b72..7d7bb2c31 100644 --- a/res/layout/time_setup_view.xml +++ b/res/layout/time_setup_view.xml @@ -66,6 +66,6 @@ android:id="@+id/fourth" layout="@layout/three_keys_view" /> - <include layout="@layout/timer_cancel_button" /> + <include layout="@layout/timer_setup_buttons" /> </LinearLayout> diff --git a/res/layout/timer_cancel_button.xml b/res/layout/timer_cancel_button.xml deleted file mode 100644 index 9e33fcb82..000000000 --- a/res/layout/timer_cancel_button.xml +++ /dev/null @@ -1,40 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2014 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/footer_button_size" - android:layout_gravity="bottom" - android:orientation="horizontal"> - - <ImageButton - android:id="@+id/timer_cancel" - android:layout_width="0dp" - android:layout_height="match_parent" - android:layout_weight="1" - android:contentDescription="@string/timer_cancel" - android:paddingEnd="20dp" - android:scaleType="center" - android:src="@drawable/ic_cancel" - android:textSize="@dimen/button_font_size" /> - - <Space - android:layout_width="0dp" - android:layout_height="match_parent" - android:layout_weight="2" /> - -</LinearLayout> diff --git a/res/layout/timer_setup_buttons.xml b/res/layout/timer_setup_buttons.xml new file mode 100644 index 000000000..f0132f263 --- /dev/null +++ b/res/layout/timer_setup_buttons.xml @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2014 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" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_gravity="bottom" + android:orientation="horizontal"> + + <FrameLayout + android:layout_width="0dp" + android:layout_height="match_parent" + android:layout_gravity="start|center_vertical" + android:layout_weight="1"> + + <ImageButton + android:id="@+id/timer_cancel" + android:layout_width="@dimen/design_fab_size_normal" + android:layout_height="@dimen/design_fab_size_normal" + android:layout_gravity="center" + android:contentDescription="@string/timer_cancel" + android:scaleType="center" + android:src="@drawable/ic_cancel" /> + + </FrameLayout> + + <FrameLayout + android:layout_width="0dp" + android:layout_height="match_parent" + android:layout_gravity="start|center_vertical" + android:layout_weight="1"> + + <android.support.design.widget.FloatingActionButton + android:id="@+id/timer_create" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:layout_margin="@dimen/fab_margin" + android:contentDescription="@string/timer_start" + android:src="@drawable/ic_start_white_24dp" + android:visibility="invisible" + app:borderWidth="0dp" + app:elevation="@dimen/fab_elevation" /> + + </FrameLayout> + + <Space + android:layout_width="0dp" + android:layout_height="match_parent" + android:layout_weight="1" /> + +</LinearLayout> |