summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJorim Jaggi <jjaggi@google.com>2016-08-10 12:09:28 +0200
committerJorim Jaggi <jjaggi@google.com>2016-08-11 15:58:17 +0200
commite230815d84309f0f4c8db576eb5e6bf467867ef7 (patch)
tree9559e6ca2e99d5071b497c3235982d8b774efd08
parent1fd4c6ea0673321971aa408623212939a56d0789 (diff)
downloadandroid_packages_wallpapers_LivePicker-e230815d84309f0f4c8db576eb5e6bf467867ef7.tar.gz
android_packages_wallpapers_LivePicker-e230815d84309f0f4c8db576eb5e6bf467867ef7.tar.bz2
android_packages_wallpapers_LivePicker-e230815d84309f0f4c8db576eb5e6bf467867ef7.zip
Use proper action bar item background
Bug: 22007160 Change-Id: I6b99f818b71addbccce09225e20932339fd88449
-rw-r--r--res/layout/set_wallpaper_action.xml24
-rw-r--r--res/menu/menu_preview.xml3
-rw-r--r--res/values/styles.xml1
-rw-r--r--src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java2
4 files changed, 28 insertions, 2 deletions
diff --git a/res/layout/set_wallpaper_action.xml b/res/layout/set_wallpaper_action.xml
new file mode 100644
index 0000000..02f4fcd
--- /dev/null
+++ b/res/layout/set_wallpaper_action.xml
@@ -0,0 +1,24 @@
+<!--
+ ~ Copyright (C) 2016 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
+ -->
+
+<Button
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ style="?android:attr/actionButtonStyle"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:text="@string/set_live_wallpaper"
+ android:textAppearance="?android:attr/actionMenuTextAppearance"
+ android:background="?android:attr/selectableItemBackgroundBorderless"/> \ No newline at end of file
diff --git a/res/menu/menu_preview.xml b/res/menu/menu_preview.xml
index 8ab2fb3..471e506 100644
--- a/res/menu/menu_preview.xml
+++ b/res/menu/menu_preview.xml
@@ -25,6 +25,7 @@
<item
android:id="@+id/set_wallpaper"
android:title="@string/set_live_wallpaper"
- android:showAsAction="always|withText" />
+ android:showAsAction="always|withText"
+ android:actionLayout="@layout/set_wallpaper_action"/>
</menu>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index ff942e2..c3dc2b3 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -36,7 +36,6 @@
<item name="colorAccent">@*android:color/accent_device_default_dark</item>
<item name="android:windowDisablePreview">true</item>
-
</style>
<style name="TranslucentToolbarStyle" parent="@style/Widget.AppCompat.Toolbar">
diff --git a/src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java b/src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java
index bebb422..f5bfce9 100644
--- a/src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java
+++ b/src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java
@@ -247,6 +247,8 @@ public class LiveWallpaperPreview extends Activity {
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_preview, menu);
menu.findItem(R.id.configure).setVisible(mSettings != null);
+ menu.findItem(R.id.set_wallpaper).getActionView().setOnClickListener(
+ this::setLiveWallpaper);
return super.onCreateOptionsMenu(menu);
}