summaryrefslogtreecommitdiffstats
path: root/src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2015-08-31 16:51:34 -0700
committerSunny Goyal <sunnygoyal@google.com>2015-08-31 17:28:09 -0700
commit702996867bf80dd6652a46303cc06568e6f78369 (patch)
treec124e34ce19a20146288d6fd93104d448f7dd5c8 /src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java
parent03412672d141629593561031e331739c28bc7476 (diff)
downloadandroid_packages_wallpapers_LivePicker-702996867bf80dd6652a46303cc06568e6f78369.tar.gz
android_packages_wallpapers_LivePicker-702996867bf80dd6652a46303cc06568e6f78369.tar.bz2
android_packages_wallpapers_LivePicker-702996867bf80dd6652a46303cc06568e6f78369.zip
Updating the LiveWallpaperPicker UI
> Using the settings theme > Removing GirdLayout usage, using ListView with appropriate padding > Removing trampoline activity when starting wallpaper preview Change-Id: Iea12a8c1c6d6cdc0682add07e1b9565827da71c8
Diffstat (limited to 'src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java')
-rw-r--r--src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java37
1 files changed, 17 insertions, 20 deletions
diff --git a/src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java b/src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java
index 31fff0f..2f32e36 100644
--- a/src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java
+++ b/src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java
@@ -34,6 +34,7 @@ import android.os.RemoteException;
import android.os.IBinder;
import android.os.ParcelFileDescriptor;
import android.os.Bundle;
+import android.service.wallpaper.WallpaperService;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
@@ -46,9 +47,7 @@ import android.util.Log;
import android.widget.TextView;
public class LiveWallpaperPreview extends Activity {
- static final String EXTRA_LIVE_WALLPAPER_INTENT = "android.live_wallpaper.intent";
- static final String EXTRA_LIVE_WALLPAPER_SETTINGS = "android.live_wallpaper.settings";
- static final String EXTRA_LIVE_WALLPAPER_PACKAGE = "android.live_wallpaper.package";
+ static final String EXTRA_LIVE_WALLPAPER_INFO = "android.live_wallpaper.info";
private static final String LOG_TAG = "LiveWallpaperPreview";
@@ -58,40 +57,38 @@ public class LiveWallpaperPreview extends Activity {
private String mSettings;
private String mPackageName;
private Intent mWallpaperIntent;
+
private View mView;
private Dialog mDialog;
- static void showPreview(Activity activity, int code, Intent intent, WallpaperInfo info) {
- if (info == null) {
- Log.w(LOG_TAG, "Failure showing preview", new Throwable());
- return;
- }
- Intent preview = new Intent(activity, LiveWallpaperPreview.class);
- preview.putExtra(EXTRA_LIVE_WALLPAPER_INTENT, intent);
- preview.putExtra(EXTRA_LIVE_WALLPAPER_SETTINGS, info.getSettingsActivity());
- preview.putExtra(EXTRA_LIVE_WALLPAPER_PACKAGE, info.getPackageName());
- activity.startActivityForResult(preview, code);
- }
-
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ init();
+ }
+ protected void init() {
Bundle extras = getIntent().getExtras();
- mWallpaperIntent = (Intent) extras.get(EXTRA_LIVE_WALLPAPER_INTENT);
- if (mWallpaperIntent == null) {
+ WallpaperInfo info = extras.getParcelable(EXTRA_LIVE_WALLPAPER_INFO);
+ if (info == null) {
setResult(RESULT_CANCELED);
finish();
}
+ initUI(info);
+ }
+
+ protected void initUI(WallpaperInfo info) {
+ mSettings = info.getSettingsActivity();
+ mPackageName = info.getPackageName();
+ mWallpaperIntent = new Intent(WallpaperService.SERVICE_INTERFACE)
+ .setClassName(info.getPackageName(), info.getServiceName());
+
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);
mWallpaperManager = WallpaperManager.getInstance(this);
-
mWallpaperConnection = new WallpaperConnection(mWallpaperIntent);
}