From 813b308a36e81b0ade03c076c4e59e473ba7d3c6 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Tue, 2 Jul 2013 07:09:26 -0700 Subject: Fix orientation change with new id system --- .../daneren2005/dsub/fragments/SelectDirectoryFragment.java | 12 ++++++++++++ .../src/github/daneren2005/dsub/util/Constants.java | 1 + 2 files changed, 13 insertions(+) (limited to 'subsonic-android/src/github') diff --git a/subsonic-android/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java b/subsonic-android/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java index 1626768e..4d9ebafd 100644 --- a/subsonic-android/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java +++ b/subsonic-android/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java @@ -71,6 +71,18 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter @Override public void onCreate(Bundle bundle) { super.onCreate(bundle); + if(bundle != null) { + int tmp = bundle.getInt(Constants.FRAGMENT_ID, -1); + if(tmp > 0) { + rootId = tmp; + } + } + } + + @Override + public void onSaveInstanceState(Bundle outState) { + super.onSaveInstanceState(outState); + outState.putInt(Constants.FRAGMENT_ID, rootId); } @Override diff --git a/subsonic-android/src/github/daneren2005/dsub/util/Constants.java b/subsonic-android/src/github/daneren2005/dsub/util/Constants.java index a5168a9a..550749b9 100644 --- a/subsonic-android/src/github/daneren2005/dsub/util/Constants.java +++ b/subsonic-android/src/github/daneren2005/dsub/util/Constants.java @@ -129,6 +129,7 @@ public final class Constants { public static final String MAIN_BACK_STACK_SIZE = "backStackIdsSize"; public static final String MAIN_BACK_STACK_TABS = "backStackTabs"; public static final String MAIN_BACK_STACK_POSITION = "backStackPosition"; + public static final String FRAGMENT_ID = "fragmentId"; // Name of the preferences file. public static final String PREFERENCES_FILE_NAME = "github.daneren2005.dsub_preferences"; -- cgit v1.2.3