Updating the styles of action bar
Pointing to a new action bar button style in framework and
adding indirection in various places.
Also made the tap target of the toggle switch bigger.
Bug: 130377115
Test: manual
Change-Id: Ic0cc2303f2a123f2ab8c87495faa2cdd568e3bb1
diff --git a/res/layout/action_bar.xml b/res/layout/action_bar.xml
index 6629ef2..f3d3d91 100644
--- a/res/layout/action_bar.xml
+++ b/res/layout/action_bar.xml
@@ -44,7 +44,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
- app:layout_constraintGuide_begin="@dimen/action_bar_margin"/>
+ app:layout_constraintGuide_begin="@*android:dimen/action_bar_margin_start"/>
<TextView
android:id="@+id/title"
diff --git a/res/layout/action_bar_quick_settings.xml b/res/layout/action_bar_quick_settings.xml
index 292c130..193b199 100644
--- a/res/layout/action_bar_quick_settings.xml
+++ b/res/layout/action_bar_quick_settings.xml
@@ -19,8 +19,7 @@
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:paddingEnd="@dimen/action_bar_with_buttons_padding_end">
+ android:layout_height="match_parent">
<FrameLayout
android:id="@+id/action_bar_icon_container"
@@ -45,7 +44,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
- app:layout_constraintGuide_begin="@dimen/action_bar_margin"/>
+ app:layout_constraintGuide_begin="@*android:dimen/action_bar_margin_start"/>
<TextView
android:id="@+id/title"
@@ -60,14 +59,12 @@
<Button
android:id="@+id/user_switcher_btn"
- style="@style/ActionBarIconButton"
+ style="@*android:style/ActionBarButton"
android:layout_width="wrap_content"
android:layout_height="0dp"
- android:layout_marginStart="@dimen/action_bar_button_margin_start"
- android:drawablePadding="@dimen/action_bar_icon_button_drawable_padding"
android:drawableStart="@drawable/ic_user"
- android:paddingEnd="@dimen/action_bar_icon_button_padding_end"
- android:paddingStart="@dimen/action_bar_icon_button_padding_start"
+ android:drawableTint="?android:attr/textColorPrimary"
+ android:textColor="?android:attr/textColorPrimary"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/full_settings_btn"
app:layout_constraintHorizontal_bias="1.0"
@@ -77,15 +74,14 @@
<Button
android:id="@+id/full_settings_btn"
- style="@style/ActionBarIconButton"
+ style="@*android:style/ActionBarButton"
android:layout_width="wrap_content"
android:layout_height="0dp"
- android:layout_marginStart="@dimen/action_bar_button_margin_start"
- android:drawablePadding="@dimen/action_bar_icon_button_drawable_padding"
+ android:layout_marginHorizontal="@*android:dimen/action_bar_button_margin"
android:drawableStart="@drawable/ic_settings_gear"
- android:paddingEnd="@dimen/action_bar_icon_button_padding_end"
- android:paddingStart="@dimen/action_bar_icon_button_padding_start"
android:text="@string/more_settings_label"
+ android:drawableTint="?android:attr/textColorPrimary"
+ android:textColor="?android:attr/textColorPrimary"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/user_switcher_btn"
diff --git a/res/layout/action_bar_with_button.xml b/res/layout/action_bar_with_button.xml
index 9fb6a1a..96864be 100644
--- a/res/layout/action_bar_with_button.xml
+++ b/res/layout/action_bar_with_button.xml
@@ -19,8 +19,7 @@
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:paddingEnd="@dimen/action_bar_with_buttons_padding_end">
+ android:layout_height="match_parent">
<FrameLayout
android:id="@+id/action_bar_icon_container"
@@ -45,7 +44,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
- app:layout_constraintGuide_begin="@dimen/action_bar_margin"/>
+ app:layout_constraintGuide_begin="@*android:dimen/action_bar_margin_start"/>
<TextView
android:id="@+id/title"
@@ -60,12 +59,9 @@
<Button
android:id="@+id/action_button2"
- style="@style/ActionBarButton"
+ style="@*android:style/ActionBarButton"
android:layout_width="wrap_content"
android:layout_height="0dp"
- android:layout_marginStart="@dimen/action_bar_button_margin_start"
- android:paddingEnd="@dimen/action_bar_button_padding_end"
- android:paddingStart="@dimen/action_bar_button_padding_start"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/action_button1"
@@ -76,12 +72,10 @@
<Button
android:id="@+id/action_button1"
- style="@style/ActionBarButton"
+ style="@*android:style/ActionBarButton"
android:layout_width="wrap_content"
android:layout_height="0dp"
- android:layout_marginStart="@dimen/action_bar_button_margin_start"
- android:paddingEnd="@dimen/action_bar_button_padding_end"
- android:paddingStart="@dimen/action_bar_button_padding_start"
+ android:layout_marginHorizontal="@*android:dimen/action_bar_button_margin"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/action_button2"
diff --git a/res/layout/action_bar_with_toggle.xml b/res/layout/action_bar_with_toggle.xml
index dba1434..9abf424 100644
--- a/res/layout/action_bar_with_toggle.xml
+++ b/res/layout/action_bar_with_toggle.xml
@@ -44,7 +44,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
- app:layout_constraintGuide_begin="@dimen/action_bar_margin"/>
+ app:layout_constraintGuide_begin="@*android:dimen/action_bar_margin_start"/>
<TextView
android:id="@+id/title"
@@ -57,21 +57,19 @@
app:layout_constraintStart_toEndOf="@+id/start_margin"
app:layout_constraintTop_toTopOf="parent"/>
- <androidx.constraintlayout.widget.Guideline
- android:id="@+id/end_margin"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- app:layout_constraintGuide_end="@dimen/action_bar_margin"/>
-
- <Switch
- android:id="@+id/toggle_switch"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:background="@null"
+ <FrameLayout
+ android:layout_width="@*android:dimen/action_bar_margin_end"
+ android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintStart_toEndOf="@+id/end_margin"
- app:layout_constraintTop_toTopOf="parent"/>
-
+ app:layout_constraintTop_toTopOf="parent">
+ <Switch
+ android:id="@+id/toggle_switch"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:layout_gravity="center"
+ android:paddingStart="@*android:/dimen/action_bar_toggle_internal_padding"
+ android:paddingEnd="@*android:/dimen/action_bar_toggle_internal_padding"
+ android:background="@null"/>
+ </FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/res/layout/choose_lock_password.xml b/res/layout/choose_lock_password.xml
index 4da068b..aaebd69 100644
--- a/res/layout/choose_lock_password.xml
+++ b/res/layout/choose_lock_password.xml
@@ -25,7 +25,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:layout_marginHorizontal="@dimen/action_bar_margin"
+ android:layout_marginHorizontal="@*android:dimen/action_bar_margin"
android:orientation="horizontal">
<FrameLayout
diff --git a/res/layout/choose_lock_pattern.xml b/res/layout/choose_lock_pattern.xml
index 639496c..3bb77a1 100644
--- a/res/layout/choose_lock_pattern.xml
+++ b/res/layout/choose_lock_pattern.xml
@@ -25,7 +25,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:layout_marginHorizontal="@dimen/action_bar_margin"
+ android:layout_marginHorizontal="@*android:dimen/action_bar_margin"
android:orientation="horizontal"
android:paddingBottom="@dimen/action_bar_height"
android:paddingTop="@dimen/action_bar_height">
diff --git a/res/layout/choose_lock_pin.xml b/res/layout/choose_lock_pin.xml
index b0d12b0..8bc4e36 100644
--- a/res/layout/choose_lock_pin.xml
+++ b/res/layout/choose_lock_pin.xml
@@ -25,7 +25,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:layout_marginHorizontal="@dimen/action_bar_margin"
+ android:layout_marginHorizontal="@*android:dimen/action_bar_margin"
android:orientation="horizontal">
<!-- Start side: lock pattern -->
diff --git a/res/layout/confirm_lock_password.xml b/res/layout/confirm_lock_password.xml
index 5bec12c..5fc524d 100644
--- a/res/layout/confirm_lock_password.xml
+++ b/res/layout/confirm_lock_password.xml
@@ -33,7 +33,7 @@
android:id="@+id/password_entry"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginHorizontal="@dimen/action_bar_margin"
+ android:layout_marginHorizontal="@*android:dimen/action_bar_margin"
android:gravity="center"
android:inputType="textPassword"
android:maxLines="1"
diff --git a/res/layout/confirm_lock_pin.xml b/res/layout/confirm_lock_pin.xml
index 2c0be88..9853bdd 100644
--- a/res/layout/confirm_lock_pin.xml
+++ b/res/layout/confirm_lock_pin.xml
@@ -25,7 +25,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:layout_marginHorizontal="@dimen/action_bar_margin"
+ android:layout_marginHorizontal="@*android:dimen/action_bar_margin"
android:orientation="horizontal">
<!-- Start side: lock PIN -->
diff --git a/res/layout/quick_settings.xml b/res/layout/quick_settings.xml
index e07e516..0087a97 100644
--- a/res/layout/quick_settings.xml
+++ b/res/layout/quick_settings.xml
@@ -19,8 +19,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:layout_marginEnd="@dimen/action_bar_margin"
- android:layout_marginStart="@dimen/action_bar_margin">
+ android:layout_marginHorizontal="@*android:dimen/action_bar_margin">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/list"
diff --git a/res/layout/settings_fragment.xml b/res/layout/settings_fragment.xml
index 6f25822..3567112 100644
--- a/res/layout/settings_fragment.xml
+++ b/res/layout/settings_fragment.xml
@@ -20,8 +20,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:layout_marginEnd="@dimen/action_bar_margin"
- android:layout_marginStart="@dimen/action_bar_margin"
+ android:layout_marginHorizontal="@*android:dimen/action_bar_margin"
tools:ignore="NewApi">
<FrameLayout
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index aee9bd3..11198a1 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -28,14 +28,6 @@
<!-- Action Bar -->
<dimen name="action_bar_height">@*android:dimen/car_app_bar_height</dimen>
- <dimen name="action_bar_margin">@*android:dimen/car_margin</dimen>
- <dimen name="action_bar_with_buttons_padding_end">@*android:dimen/car_keyline_1</dimen>
- <dimen name="action_bar_button_margin_start">@*android:dimen/car_padding_4</dimen>
- <dimen name="action_bar_button_padding_start">@*android:dimen/car_padding_3</dimen>
- <dimen name="action_bar_button_padding_end">@*android:dimen/car_padding_3</dimen>
- <dimen name="action_bar_icon_button_padding_start">@*android:dimen/car_padding_2</dimen>
- <dimen name="action_bar_icon_button_padding_end">@*android:dimen/car_padding_2</dimen>
- <dimen name="action_bar_icon_button_drawable_padding">@*android:dimen/car_padding_2</dimen>
<!-- Suggestions -->
<dimen name="suggestions_top_bottom_margin">@*android:dimen/car_padding_4</dimen>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index a686e10..99aaba4 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -16,31 +16,6 @@
-->
<resources>
- <style name="ActionBarButton" parent="@android:style/Widget.DeviceDefault.Button.Borderless">
- <item name="android:textAppearance">@style/ActionBarButtonTextAppearance</item>
- <item name="android:maxEms">@integer/button_max_ems</item>
- <item name="android:minWidth">@dimen/button_min_width</item>
- <item name="android:background">@drawable/button_ripple_bg</item>
- </style>
-
- <style name="ActionBarIconButton" parent="ActionBarButton">
- <item name="android:textAppearance">@style/ActionBarIconButtonTextAppearance</item>
- <item name="android:drawableTint">?android:attr/textColorPrimary</item>
- </style>
-
- <style name="ActionBarButtonTextAppearance"
- parent="@*android:style/TextAppearance.DeviceDefault.Widget.Button.Borderless.Colored">
- <item name="android:fadingEdgeLength">@dimen/button_fading_edge_length</item>
- <item name="android:ellipsize">none</item>
- <item name="android:requiresFadingEdge">horizontal</item>
- <item name="android:singleLine">true</item>
- <item name="android:textAllCaps">false</item>
- </style>
-
- <style name="ActionBarIconButtonTextAppearance" parent="ActionBarButtonTextAppearance">
- <item name="android:textColor">?android:attr/textColorPrimary</item>
- </style>
-
<style name="PreferenceButtonTextAppearance"
parent="@*android:style/TextAppearance.DeviceDefault.Widget.Button.Borderless.Colored">
<item name="android:fadingEdgeLength">@dimen/button_fading_edge_length</item>