diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2015-08-31 17:01:06 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-08-31 17:01:06 +0000 |
commit | 03412672d141629593561031e331739c28bc7476 (patch) | |
tree | 6b163d6744129faae3ff6b1a58ca4adfeb2bc969 /src | |
parent | 3afcff56c44c593fc0b2e04bcfbfaac759ec56ff (diff) | |
parent | 6670d16341f2311925765511c54afab196a0d2bd (diff) | |
download | android_packages_wallpapers_LivePicker-03412672d141629593561031e331739c28bc7476.tar.gz android_packages_wallpapers_LivePicker-03412672d141629593561031e331739c28bc7476.tar.bz2 android_packages_wallpapers_LivePicker-03412672d141629593561031e331739c28bc7476.zip |
Merge "Moving the set wallpaper button to the top to match the default launcher style"
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java | 36 |
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 |