summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKunhung Li <kunhungli@google.com>2019-02-27 11:17:41 +0800
committerKunhung Li <kunhungli@google.com>2019-03-18 10:18:40 +0800
commit7c5d350dec0565894b621267bd1c18e7402f6e5e (patch)
tree89578f67233c3d64435a8f72a4a5531865960cf9
parentf74466ed9c1ad498711a1bf6291cbf0d61783bb4 (diff)
downloadandroid_packages_wallpapers_LivePicker-7c5d350dec0565894b621267bd1c18e7402f6e5e.tar.gz
android_packages_wallpapers_LivePicker-7c5d350dec0565894b621267bd1c18e7402f6e5e.tar.bz2
android_packages_wallpapers_LivePicker-7c5d350dec0565894b621267bd1c18e7402f6e5e.zip
Apply Google material button style
1.Apply using Google MaterialButton to correct button inner padding to meet up with desired style. 2.Apply device font style to material button. Bug: 126466572 Test: Manual test Change-Id: I3b80eca87447ad3a8c26c0f75541dd6cc876e7aa
-rw-r--r--res/drawable/btn_outlined_material.xml22
-rw-r--r--res/drawable/btn_outlined_mtrl_shape.xml33
-rw-r--r--res/layout/live_wallpaper_preview.xml7
-rw-r--r--res/layout/page_info.xml8
-rw-r--r--res/layout/page_settings.xml4
-rw-r--r--res/values/styles.xml31
6 files changed, 29 insertions, 76 deletions
diff --git a/res/drawable/btn_outlined_material.xml b/res/drawable/btn_outlined_material.xml
deleted file mode 100644
index 7e26ea5..0000000
--- a/res/drawable/btn_outlined_material.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2019 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.
--->
-
-<ripple xmlns:android="http://schemas.android.com/apk/res/android"
- android:color="?android:attr/colorControlHighlight">
- <item android:id="@android:id/mask"
- android:drawable="@*android:drawable/btn_default_mtrl_shape"/>
- <item android:drawable="@drawable/btn_outlined_mtrl_shape"/>
-</ripple>
diff --git a/res/drawable/btn_outlined_mtrl_shape.xml b/res/drawable/btn_outlined_mtrl_shape.xml
deleted file mode 100644
index bc6cff2..0000000
--- a/res/drawable/btn_outlined_mtrl_shape.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2019 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.
--->
-
-<!-- Used as the canonical button shape. -->
-
-<inset xmlns:android="http://schemas.android.com/apk/res/android"
- android:insetLeft="@*android:dimen/button_inset_horizontal_material"
- android:insetTop="@*android:dimen/button_inset_vertical_material"
- android:insetRight="@*android:dimen/button_inset_horizontal_material"
- android:insetBottom="@*android:dimen/button_inset_vertical_material">
- <shape android:shape="rectangle">
- <corners android:radius="?android:attr/buttonCornerRadius"/>
- <padding android:bottom="@*android:dimen/button_padding_vertical_material"
- android:left="@*android:dimen/button_padding_horizontal_material"
- android:right="@*android:dimen/button_padding_horizontal_material"
- android:top="@*android:dimen/button_padding_vertical_material"/>
- <stroke android:width="@dimen/btn_outlined_stroke"
- android:color="@*android:color/primary_device_default_light"/>
- </shape>
-</inset>
diff --git a/res/layout/live_wallpaper_preview.xml b/res/layout/live_wallpaper_preview.xml
index 05ac0c9..d2370c7 100644
--- a/res/layout/live_wallpaper_preview.xml
+++ b/res/layout/live_wallpaper_preview.xml
@@ -52,11 +52,8 @@
android:id="@+id/tablayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- app:tabTextAppearance="@style/LivePicker.TextAppearance.Tab.NoAllCaps"
- app:tabIndicatorColor="?android:attr/textColorPrimary"
- app:tabGravity="fill"
- app:tabMaxWidth="0dp"
- android:visibility="gone"/>
+ style="@style/TabLayoutStyle"
+ android:visibility="gone" />
<com.android.wallpaper.livepicker.widget.ConstraintViewPager
android:id="@+id/viewpager"
diff --git a/res/layout/page_info.xml b/res/layout/page_info.xml
index 33a11bf..d1ae01b 100644
--- a/res/layout/page_info.xml
+++ b/res/layout/page_info.xml
@@ -61,11 +61,11 @@
android:layout_marginTop="@dimen/preview_attribution_pane_explore_top_margin"
android:orientation="horizontal">
- <Button
+ <com.google.android.material.button.MaterialButton
android:id="@+id/preview_attribution_pane_explore_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- style="@style/LivePicker.Button.Outlined"
+ style="@style/OutlinedButtonStyle"
android:text="@string/explore_further"
android:visibility="gone"/>
@@ -76,11 +76,11 @@
android:layout_weight="1"
android:visibility="gone"/>
- <Button
+ <com.google.android.material.button.MaterialButton
android:id="@+id/preview_attribution_pane_set_wallpaper_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- style="@style/LivePicker.Button.Colored"
+ style="@style/UnelevatedButtonStyle"
android:text="@string/set_live_wallpaper"/>
</LinearLayout>
diff --git a/res/layout/page_settings.xml b/res/layout/page_settings.xml
index bc8c2ff..be02216 100644
--- a/res/layout/page_settings.xml
+++ b/res/layout/page_settings.xml
@@ -25,12 +25,12 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
- <Button
+ <com.google.android.material.button.MaterialButton
android:id="@+id/preview_attribution_pane_set_wallpaper_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/preview_attribution_pane_explore_top_margin"
- style="@style/LivePicker.Button.Colored"
+ style="@style/UnelevatedButtonStyle"
android:text="@string/set_live_wallpaper"/>
</LinearLayout>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 8020103..bbce466 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -19,9 +19,9 @@
<resources>
- <style name="LivePickerTheme" parent="@android:style/Theme.DeviceDefault.Settings" />
+ <style name="LivePickerTheme" parent="@android:style/Theme.DeviceDefault.Settings"/>
- <style name="Preview" parent="@style/Theme.AppCompat.NoActionBar">
+ <style name="Preview" parent="@style/Theme.MaterialComponents.NoActionBar">
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowDisablePreview">true</item>
@@ -33,6 +33,8 @@
<item name="android:colorAccent">@*android:color/accent_device_default_light</item>
<item name="colorAccent">@*android:color/accent_device_default_light</item>
+ <item name="colorOnPrimary">@*android:color/primary_device_default_light</item>
+
<item name="android:buttonCornerRadius">@dimen/btn_corner_radius</item>
</style>
@@ -41,22 +43,31 @@
<item name="android:theme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item>
</style>
- <style name="LivePicker.TextAppearance.Tab.NoAllCaps"
- parent="@android:style/TextAppearance.DeviceDefault.Widget.TabWidget">
+ <style name="TabLayoutStyle" parent="@style/Widget.Design.TabLayout">
+ <item name="tabTextAppearance">@style/LivePicker.TextAppearance.Tab.NoAllCaps</item>
+ <item name="tabIndicatorColor">?android:attr/textColorPrimary</item>
+ <item name="tabGravity">fill</item>
+ <item name="tabMaxWidth">0dp</item>
+ </style>
+
+ <style name="LivePicker.TextAppearance.Tab.NoAllCaps" parent="@android:style/TextAppearance.DeviceDefault.Widget.TabWidget">
<item name="android:textAllCaps">false</item>
</style>
<style name="AlertDialogStyle" parent="@android:style/Theme.DeviceDefault.Light.Dialog.Alert"/>
- <style name="LivePicker.Button.Colored"
- parent="@android:style/Widget.DeviceDefault.Button.Colored">
+ <style name="UnelevatedButtonStyle" parent="@android:style/Widget.DeviceDefault.Button.Colored">
+ <item name="android:textAppearance">@android:style/TextAppearance.DeviceDefault.Widget.Button</item>
<item name="android:textColor">?android:textColorPrimary</item>
<item name="android:textAllCaps">false</item>
- <item name="android:stateListAnimator">@null</item>
+ <item name="backgroundTint">?android:colorAccent</item>
+ <item name="rippleColor">@color/mtrl_btn_ripple_color</item>
</style>
- <style name="LivePicker.Button.Outlined" parent="@style/LivePicker.Button.Colored">
- <item name="android:background">@drawable/btn_outlined_material</item>
+ <style name="OutlinedButtonStyle" parent="@style/Widget.MaterialComponents.Button.OutlinedButton">
+ <item name="android:textAppearance">@android:style/TextAppearance.DeviceDefault.Widget.Button</item>
+ <item name="android:textColor">?android:textColorPrimary</item>
+ <item name="android:textAllCaps">false</item>
+ <item name="strokeColor">@*android:color/primary_device_default_light</item>
</style>
-
</resources>