summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Lesinski <adamlesinski@google.com>2010-12-13 15:43:03 -0800
committerAdam Lesinski <adamlesinski@google.com>2010-12-13 15:45:20 -0800
commitbe7ef35368513dcc35f563e407a9a55f9afe81bd (patch)
treedfe49bd586ee9f73d190f151e7cdef7198fba2b4
parent4488979450b3399b76db136461693024afbd6812 (diff)
downloadandroid_packages_wallpapers_LivePicker-be7ef35368513dcc35f563e407a9a55f9afe81bd.zip
android_packages_wallpapers_LivePicker-be7ef35368513dcc35f563e407a9a55f9afe81bd.tar.gz
android_packages_wallpapers_LivePicker-be7ef35368513dcc35f563e407a9a55f9afe81bd.tar.bz2
Fixed an issue with fragment display on a phone
-A class name change was not reflected in the xml -Rotation of the screen caused a crash Change-Id: I483baf8b93c333e349ff1d4e5c6219abcbfad56c
-rw-r--r--res/layout/live_wallpaper_base.xml2
-rw-r--r--src/com/android/wallpaper/livepicker/LiveWallpaperActivity.java20
2 files changed, 20 insertions, 2 deletions
diff --git a/res/layout/live_wallpaper_base.xml b/res/layout/live_wallpaper_base.xml
index 41cbdf1..bb4c960 100644
--- a/res/layout/live_wallpaper_base.xml
+++ b/res/layout/live_wallpaper_base.xml
@@ -17,7 +17,7 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
- <fragment class="com.android.wallpaper.livepicker.LiveWallpaperListActivity$WallpaperDialog"
+ <fragment class="com.android.wallpaper.livepicker.LiveWallpaperActivity$WallpaperDialog"
android:id="@+id/live_wallpaper_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
diff --git a/src/com/android/wallpaper/livepicker/LiveWallpaperActivity.java b/src/com/android/wallpaper/livepicker/LiveWallpaperActivity.java
index 130dcfa..d8de4e1 100644
--- a/src/com/android/wallpaper/livepicker/LiveWallpaperActivity.java
+++ b/src/com/android/wallpaper/livepicker/LiveWallpaperActivity.java
@@ -62,7 +62,10 @@ public class LiveWallpaperActivity extends Activity {
public static class WallpaperDialog extends DialogFragment implements
AdapterView.OnItemClickListener{
+ private static final String EMBEDDED_KEY = "com.android.wallpaper.livepicker."
+ + "LiveWallpaperActivity$WallpaperDialog.EMBEDDED_KEY";
private LiveWallpaperListAdapter mAdapter;
+ private boolean mEmbedded;
public static WallpaperDialog newInstance() {
WallpaperDialog dialog = new WallpaperDialog();
@@ -71,6 +74,21 @@ public class LiveWallpaperActivity extends Activity {
}
@Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ if (savedInstanceState != null && savedInstanceState.containsKey(EMBEDDED_KEY)) {
+ mEmbedded = savedInstanceState.getBoolean(EMBEDDED_KEY);
+ } else {
+ mEmbedded = isInLayout();
+ }
+ }
+
+ @Override
+ public void onSaveInstanceState(Bundle outState) {
+ outState.putBoolean(EMBEDDED_KEY, mEmbedded);
+ }
+
+ @Override
public void onDismiss(DialogInterface dialog) {
/* On orientation changes, the dialog is effectively "dismissed" so this is called
* when the activity is no longer associated with this dying dialog fragment. We
@@ -102,7 +120,7 @@ public class LiveWallpaperActivity extends Activity {
* generate a view to display. Otherwise, a dialog will be created in
* onCreateDialog()
*/
- if (isInLayout()) {
+ if (mEmbedded) {
return generateView(inflater, container);
}
return null;