summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2015-08-28 17:43:21 -0700
committerSunny Goyal <sunnygoyal@google.com>2015-08-28 17:56:49 -0700
commit6670d16341f2311925765511c54afab196a0d2bd (patch)
tree6b163d6744129faae3ff6b1a58ca4adfeb2bc969 /src
parent82b6117c08cd386116cf02ec49ee8aa6fa246941 (diff)
downloadandroid_packages_wallpapers_LivePicker-6670d16341f2311925765511c54afab196a0d2bd.zip
android_packages_wallpapers_LivePicker-6670d16341f2311925765511c54afab196a0d2bd.tar.gz
android_packages_wallpapers_LivePicker-6670d16341f2311925765511c54afab196a0d2bd.tar.bz2
Moving the set wallpaper button to the top to match the default launcher style
Using a cog image instead of the Settings... button Change-Id: Ia106ff1bd978ab67fd8405e2cd66cf701d29e7a4
Diffstat (limited to 'src')
-rw-r--r--src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java36
1 files changed, 24 insertions, 12 deletions
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