summaryrefslogtreecommitdiffstats
path: root/src/com/android/wallpaper
diff options
context:
space:
mode:
authorRomain Guy <romainguy@android.com>2009-11-09 13:16:39 -0800
committerRomain Guy <romainguy@android.com>2009-11-09 13:16:39 -0800
commit90e5569f45c3acda115ac5128248e0911ceaabcf (patch)
tree2a5c3213a62dd2bf4306848e89a585438aee791b /src/com/android/wallpaper
parent860eccdfd57bc0bc762f3e45147dafc1dfdbb915 (diff)
downloadandroid_packages_wallpapers_LivePicker-90e5569f45c3acda115ac5128248e0911ceaabcf.zip
android_packages_wallpapers_LivePicker-90e5569f45c3acda115ac5128248e0911ceaabcf.tar.gz
android_packages_wallpapers_LivePicker-90e5569f45c3acda115ac5128248e0911ceaabcf.tar.bz2
Improve live wallpaper picker: animations, loading message, etc.
Diffstat (limited to 'src/com/android/wallpaper')
-rw-r--r--src/com/android/wallpaper/livepicker/LiveWallpaperListActivity.java1
-rw-r--r--src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java45
2 files changed, 41 insertions, 5 deletions
diff --git a/src/com/android/wallpaper/livepicker/LiveWallpaperListActivity.java b/src/com/android/wallpaper/livepicker/LiveWallpaperListActivity.java
index 0a680fe..99a22fe 100644
--- a/src/com/android/wallpaper/livepicker/LiveWallpaperListActivity.java
+++ b/src/com/android/wallpaper/livepicker/LiveWallpaperListActivity.java
@@ -74,6 +74,7 @@ public class LiveWallpaperListActivity extends ListActivity implements AdapterVi
getListView().setOnItemClickListener(this);
}
+ // TODO: THIS SHOULD HAPPEN IN AN ASYNCTASK
private void findLiveWallpapers() {
List<ResolveInfo> list = mPackageManager.queryIntentServices(
new Intent(WallpaperService.SERVICE_INTERFACE),
diff --git a/src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java b/src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java
index 7cd446f..0e1c034 100644
--- a/src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java
+++ b/src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java
@@ -19,6 +19,7 @@ package com.android.wallpaper.livepicker;
import android.app.Activity;
import android.app.WallpaperManager;
import android.app.WallpaperInfo;
+import android.app.Dialog;
import android.service.wallpaper.IWallpaperConnection;
import android.service.wallpaper.IWallpaperService;
import android.service.wallpaper.IWallpaperEngine;
@@ -33,7 +34,11 @@ import android.os.ParcelFileDescriptor;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
+import android.view.ViewGroup;
+import android.view.Window;
+import android.view.LayoutInflater;
import android.util.Log;
+import android.widget.TextView;
public class LiveWallpaperPreview extends Activity {
static final String EXTRA_LIVE_WALLPAPER_INTENT = "android.live_wallpaper.intent";
@@ -49,6 +54,7 @@ public class LiveWallpaperPreview extends Activity {
private String mPackageName;
private Intent mWallpaperIntent;
private View mView;
+ private Dialog mDialog;
static void showPreview(Activity activity, int code, Intent intent, WallpaperInfo info) {
Intent preview = new Intent(activity, LiveWallpaperPreview.class);
@@ -132,14 +138,43 @@ public class LiveWallpaperPreview extends Activity {
@Override
public void onAttachedToWindow() {
super.onAttachedToWindow();
- if (!mWallpaperConnection.connect()) {
- mWallpaperConnection = null;
- }
+
+ showLoading();
+
+ mView.post(new Runnable() {
+ public void run() {
+ if (!mWallpaperConnection.connect()) {
+ mWallpaperConnection = null;
+ }
+ }
+ });
+ }
+
+ private void showLoading() {
+ LayoutInflater inflater = LayoutInflater.from(this);
+ TextView content = (TextView) inflater.inflate(R.layout.live_wallpaper_loading, null);
+
+ mDialog = new Dialog(this, android.R.style.Theme_Black);
+
+ Window window = mDialog.getWindow();
+ WindowManager.LayoutParams lp = window.getAttributes();
+
+ lp.width = WindowManager.LayoutParams.FILL_PARENT;
+ lp.height = WindowManager.LayoutParams.FILL_PARENT;
+ window.setType(WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA);
+
+ mDialog.setContentView(content, new ViewGroup.LayoutParams(
+ ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT
+ ));
+ mDialog.show();
}
@Override
public void onDetachedFromWindow() {
super.onDetachedFromWindow();
+
+ if (mDialog != null) mDialog.dismiss();
+
if (mWallpaperConnection != null) {
mWallpaperConnection.disconnect();
}
@@ -190,8 +225,8 @@ public class LiveWallpaperPreview extends Activity {
final View view = mView;
final View root = view.getRootView();
mService.attach(this, view.getWindowToken(),
- WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA,
- true, root.getWidth(), view.getHeight());
+ WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA_OVERLAY,
+ true, root.getWidth(), root.getHeight());
} catch (RemoteException e) {
Log.w(LOG_TAG, "Failed attaching wallpaper; clearing", e);
}