summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/drawable/ic_settings.xml26
-rw-r--r--res/drawable/ic_tick.xml26
-rw-r--r--res/layout/live_wallpaper_preview.xml43
-rw-r--r--res/menu/menu_preview.xml25
-rw-r--r--res/values/styles.xml31
-rw-r--r--src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java36
6 files changed, 136 insertions, 51 deletions
diff --git a/res/drawable/ic_settings.xml b/res/drawable/ic_settings.xml
new file mode 100644
index 0000000..a9a5708
--- /dev/null
+++ b/res/drawable/ic_settings.xml
@@ -0,0 +1,26 @@
+<!--
+Copyright (C) 2015 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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:height="24.0dp"
+ android:viewportHeight="24.0"
+ android:viewportWidth="24.0"
+ android:width="24.0dp" >
+
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M19.43 12.98c.04-.32.07-.64.07-.98s-.03-.66-.07-.98l2.11-1.65c.19-.15.24-.42.12-.64l-2-3.46c-.12-.22-.39-.3-.61-.22l-2.49 1c-.52-.4-1.08-.73-1.69-.98l-.38-2.65C14.46 2.18 14.25 2 14 2h-4c-.25 0-.46.18-.49.42l-.38 2.65c-.61.25-1.17.59-1.69.98l-2.49-1c-.23-.09-.49 0-.61.22l-2 3.46c-.13.22-.07.49.12.64l2.11 1.65c-.04.32-.07.65-.07.98s.03.66.07.98l-2.11 1.65c-.19.15-.24.42-.12.64l2 3.46c.12.22.39.3.61.22l2.49-1c.52.4 1.08.73 1.69.98l.38 2.65c.03.24.24.42.49.42h4c.25 0 .46-.18.49-.42l.38-2.65c.61-.25 1.17-.59 1.69-.98l2.49 1c.23.09.49 0 .61-.22l2-3.46c.12-.22.07-.49-.12-.64l-2.11-1.65zM12 15.5c-1.93 0-3.5-1.57-3.5-3.5s1.57-3.5 3.5-3.5 3.5 1.57 3.5 3.5-1.57 3.5-3.5 3.5z" />
+
+</vector>
diff --git a/res/drawable/ic_tick.xml b/res/drawable/ic_tick.xml
new file mode 100644
index 0000000..4389a16
--- /dev/null
+++ b/res/drawable/ic_tick.xml
@@ -0,0 +1,26 @@
+<!--
+Copyright (C) 2015 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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:height="24.0dp"
+ android:viewportHeight="24.0"
+ android:viewportWidth="24.0"
+ android:width="24.0dp" >
+
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z" />
+
+</vector>
diff --git a/res/layout/live_wallpaper_preview.xml b/res/layout/live_wallpaper_preview.xml
index 1fa7ec8..6dcb644 100644
--- a/res/layout/live_wallpaper_preview.xml
+++ b/res/layout/live_wallpaper_preview.xml
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2009 The Android Open Source Project
+<!--
+ Copyright (C) 2009 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.
@@ -13,36 +14,12 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<Button xmlns:android="http://schemas.android.com/apk/res/android"
+ style="@style/ActionBarSetWallpaperStyle"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
-
- android:layout_gravity="center_horizontal|bottom"
- android:background="#88000000"
- style="?android:attr/buttonBarStyle">
-
- <Button
- android:id="@+id/configure"
-
- android:layout_width="0dip"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:layout_gravity="center_vertical"
-
- android:text="@string/configure_wallpaper"
-
- android:onClick="configureLiveWallpaper"
- style="?android:attr/buttonBarButtonStyle" />
-
- <Button
- android:layout_width="0dip"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:layout_gravity="center_vertical"
-
- android:text="@string/wallpaper_instructions"
-
- android:onClick="setLiveWallpaper"
- style="?android:attr/buttonBarButtonStyle" />
-</LinearLayout>
+ android:layout_height="match_parent"
+ android:drawablePadding="8dp"
+ android:drawableStart="@drawable/ic_tick"
+ android:gravity="start|center_vertical"
+ android:onClick="setLiveWallpaper"
+ android:text="@string/wallpaper_instructions" />
diff --git a/res/menu/menu_preview.xml b/res/menu/menu_preview.xml
new file mode 100644
index 0000000..26adc2d
--- /dev/null
+++ b/res/menu/menu_preview.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 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.
+-->
+<menu xmlns:android="http://schemas.android.com/apk/res/android" >
+
+ <item
+ android:id="@+id/configure"
+ android:icon="@drawable/ic_settings"
+ android:showAsAction="ifRoom"
+ android:title="@string/configure_wallpaper"/>
+
+</menu>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 8684f16..b908235 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -18,6 +18,7 @@
-->
<resources>
+
<style name="WallpaperTitle">
<item name="android:textSize">20dip</item>
<item name="android:shadowColor">#FF000000</item>
@@ -27,15 +28,33 @@
<item name="android:textColor">#FFFFFFFF</item>
<item name="android:gravity">left</item>
</style>
-
- <style name="Preview" parent="android:Theme.Holo">
+
+ <style name="LivePickerTheme" parent="android:style/Theme.Holo">
<item name="android:windowNoTitle">true</item>
+ </style>
+
+ <style name="Preview" parent="@android:style/Theme.DeviceDefault">
+ <item name="android:actionBarStyle">@style/PreviewActionBar</item>
+ <item name="android:windowAnimationStyle">@android:style/Animation.Activity</item>
+ <item name="android:windowFullscreen">true</item>
+ <item name="android:windowActionBarOverlay">true</item>
+ <item name="android:windowTranslucentNavigation">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:colorBackgroundCacheHint">@null</item>
- <item name="android:windowAnimationStyle">@android:style/Animation.Activity</item>
</style>
- <style name="LivePickerTheme" parent="android:style/Theme.Holo">
- <item name="android:windowNoTitle">true</item>
+ <style name="PreviewActionBar" parent="@android:style/Widget.DeviceDefault.ActionBar">
+ <item name="android:displayOptions">showCustom</item>
+ <item name="android:background">#88000000</item>
+ <item name="android:contentInsetEnd">0dp</item>
+ <item name="android:contentInsetLeft">0dp</item>
+ <item name="android:contentInsetRight">0dp</item>
+ <item name="android:contentInsetStart">0dp</item>
</style>
-</resources>
+
+ <style name="ActionBarSetWallpaperStyle" parent="@android:style/Widget.DeviceDefault.ActionButton">
+ <item name="android:textColor">#ffffffff</item>
+ <item name="android:background">?android:attr/selectableItemBackgroundBorderless</item>
+ </style>
+
+</resources> \ No newline at end of file
diff --git a/src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java b/src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java
index 72ba27a..31fff0f 100644
--- a/src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java
+++ b/src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java
@@ -16,6 +16,7 @@
package com.android.wallpaper.livepicker;
+import android.app.ActionBar;
import android.app.Activity;
import android.app.WallpaperManager;
import android.app.WallpaperInfo;
@@ -33,6 +34,8 @@ import android.os.RemoteException;
import android.os.IBinder;
import android.os.ParcelFileDescriptor;
import android.os.Bundle;
+import android.view.Menu;
+import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.WindowManager;
@@ -81,20 +84,25 @@ public class LiveWallpaperPreview extends Activity {
finish();
}
- setContentView(R.layout.live_wallpaper_preview);
- mView = findViewById(R.id.configure);
+ final ActionBar actionBar = getActionBar();
+ actionBar.setCustomView(R.layout.live_wallpaper_preview);
+ mView = actionBar.getCustomView();
mSettings = extras.getString(EXTRA_LIVE_WALLPAPER_SETTINGS);
mPackageName = extras.getString(EXTRA_LIVE_WALLPAPER_PACKAGE);
- if (mSettings == null) {
- mView.setVisibility(View.GONE);
- }
-
mWallpaperManager = WallpaperManager.getInstance(this);
mWallpaperConnection = new WallpaperConnection(mWallpaperIntent);
}
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ if (mSettings != null) {
+ getMenuInflater().inflate(R.menu.menu_preview, menu);
+ }
+ return super.onCreateOptionsMenu(menu);
+ }
+
public void setLiveWallpaper(View v) {
try {
mWallpaperManager.getIWallpaperManager().setWallpaperComponent(
@@ -110,12 +118,16 @@ public class LiveWallpaperPreview extends Activity {
finish();
}
- @SuppressWarnings({"UnusedDeclaration"})
- public void configureLiveWallpaper(View v) {
- Intent intent = new Intent();
- intent.setComponent(new ComponentName(mPackageName, mSettings));
- intent.putExtra(WallpaperSettingsActivity.EXTRA_PREVIEW_MODE, true);
- startActivity(intent);
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ if (item.getItemId() == R.id.configure) {
+ Intent intent = new Intent();
+ intent.setComponent(new ComponentName(mPackageName, mSettings));
+ intent.putExtra(WallpaperSettingsActivity.EXTRA_PREVIEW_MODE, true);
+ startActivity(intent);
+ return true;
+ }
+ return super.onOptionsItemSelected(item);
}
@Override