summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--AndroidManifest.xml2
-rw-r--r--res/layout/live_wallpaper_loading.xml24
-rw-r--r--res/values/strings.xml2
-rw-r--r--res/values/styles.xml6
-rw-r--r--src/com/android/wallpaper/livepicker/LiveWallpaperListActivity.java1
-rw-r--r--src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java45
6 files changed, 74 insertions, 6 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index c5d8528..97be05b 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -45,7 +45,7 @@
<activity android:name="LiveWallpaperPreview"
android:icon="@drawable/ic_launcher_appwidget"
android:label="@string/live_wallpaper_preview_title"
- android:theme="@android:style/Theme.Wallpaper.NoTitleBar"
+ android:theme="@style/Preview"
android:screenOrientation="nosensor" />
</application>
diff --git a/res/layout/live_wallpaper_loading.xml b/res/layout/live_wallpaper_loading.xml
new file mode 100644
index 0000000..7dd375e
--- /dev/null
+++ b/res/layout/live_wallpaper_loading.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+ 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.
+-->
+
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+
+ android:gravity="center"
+
+ android:text="@string/live_wallpaper_loading"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 3df82f1..332f068 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -37,5 +37,7 @@
<string name="set_live_wallpaper">Set wallpaper</string>
<!-- Label, title and author of the live wallpaper -->
<string name="wallpaper_title_and_author"><xliff:g id="title" example="Galaxy">%1$s</xliff:g> by <xliff:g id="author" example="Google">%2$s</xliff:g></string>
+ <!-- Message, tells the user the selected live wallpaper is loading. -->
+ <string name="live_wallpaper_loading">Loading live wallpaper...</string>
</resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 82b1707..a55fbdb 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -27,4 +27,10 @@
<item name="android:textColor">#FFFFFFFF</item>
<item name="android:gravity">left</item>
</style>
+
+ <style name="Preview" parent="@android:style/Theme.NoTitleBar">
+ <item name="android:windowBackground">@android:color/transparent</item>
+ <item name="android:colorBackgroundCacheHint">@null</item>
+ <item name="android:windowAnimationStyle">@android:style/Animation.Activity</item>
+ </style>
</resources>
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);
}