diff options
author | Scott Jackson <daneren2005@gmail.com> | 2013-05-15 19:06:59 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2013-05-15 19:06:59 -0700 |
commit | 982cf6db8ef021fe233194f112f97748ffea1de9 (patch) | |
tree | 3b89b0b81a6bb4a93144429a9a3dcb270461b993 | |
parent | 40a18dcc63106292d714705fcb88e2713f17e5a7 (diff) | |
download | dsub-982cf6db8ef021fe233194f112f97748ffea1de9.tar.gz dsub-982cf6db8ef021fe233194f112f97748ffea1de9.tar.bz2 dsub-982cf6db8ef021fe233194f112f97748ffea1de9.zip |
Just use native tag instead of hacky solution of setSupportTag
-rw-r--r-- | subsonic-android/src/github/daneren2005/dsub/activity/SubsonicActivity.java | 16 | ||||
-rw-r--r-- | subsonic-android/src/github/daneren2005/dsub/fragments/SubsonicFragment.java | 3 |
2 files changed, 7 insertions, 12 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/activity/SubsonicActivity.java b/subsonic-android/src/github/daneren2005/dsub/activity/SubsonicActivity.java index 2a0c793e..8a454f15 100644 --- a/subsonic-android/src/github/daneren2005/dsub/activity/SubsonicActivity.java +++ b/subsonic-android/src/github/daneren2005/dsub/activity/SubsonicActivity.java @@ -97,14 +97,14 @@ public class SubsonicActivity extends SherlockFragmentActivity implements OnItem public void onSaveInstanceState(Bundle savedInstanceState) {
super.onSaveInstanceState(savedInstanceState);
if(viewPager == null) {
- int[] ids = new int[backStack.size() + 1];
- ids[0] = currentFragment.getSupportTag();
+ String[] ids = new String[backStack.size() + 1];
+ ids[0] = currentFragment.getTag();
int i = 1;
for(SubsonicFragment frag: backStack) {
- ids[i] = frag.getSupportTag();
+ ids[i] = frag.getTag();
i++;
}
- savedInstanceState.putIntArray(Constants.MAIN_BACK_STACK, ids);
+ savedInstanceState.putStringArray(Constants.MAIN_BACK_STACK, ids);
savedInstanceState.putInt(Constants.MAIN_BACK_STACK_SIZE, backStack.size() + 1);
} else {
pagerAdapter.onSaveInstanceState(savedInstanceState);
@@ -115,15 +115,13 @@ public class SubsonicActivity extends SherlockFragmentActivity implements OnItem if(viewPager == null) {
super.onRestoreInstanceState(savedInstanceState);
int size = savedInstanceState.getInt(Constants.MAIN_BACK_STACK_SIZE);
- int[] ids = savedInstanceState.getIntArray(Constants.MAIN_BACK_STACK);
+ String[] ids = savedInstanceState.getStringArray(Constants.MAIN_BACK_STACK);
FragmentManager fm = getSupportFragmentManager();
- currentFragment = (SubsonicFragment)fm.findFragmentByTag(ids[0] + "");
- currentFragment.setSupportTag(ids[0]);
+ currentFragment = (SubsonicFragment)fm.findFragmentByTag(ids[0]);
currentFragment.setPrimaryFragment(true);
invalidateOptionsMenu();
for(int i = 1; i < size; i++) {
- SubsonicFragment frag = (SubsonicFragment)fm.findFragmentByTag(ids[i] + "");
- frag.setSupportTag(ids[i]);
+ SubsonicFragment frag = (SubsonicFragment)fm.findFragmentByTag(ids[i]);
backStack.add(frag);
}
recreateSpinner();
diff --git a/subsonic-android/src/github/daneren2005/dsub/fragments/SubsonicFragment.java b/subsonic-android/src/github/daneren2005/dsub/fragments/SubsonicFragment.java index c3389cc9..35a272eb 100644 --- a/subsonic-android/src/github/daneren2005/dsub/fragments/SubsonicFragment.java +++ b/subsonic-android/src/github/daneren2005/dsub/fragments/SubsonicFragment.java @@ -273,9 +273,6 @@ public class SubsonicFragment extends SherlockFragment { context.replaceFragment(fragment, id, fragment.getSupportTag());
}
- public void setSupportTag(int tag) {
- this.tag = tag;
- }
public int getSupportTag() {
return tag;
}
|