diff options
-rw-r--r-- | res/layout/set_wallpaper_action.xml | 24 | ||||
-rw-r--r-- | res/menu/menu_preview.xml | 3 | ||||
-rw-r--r-- | res/values/styles.xml | 1 | ||||
-rw-r--r-- | src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java | 2 |
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); } |