diff options
author | Scott Jackson <daneren2005@gmail.com> | 2014-02-04 15:21:52 -0800 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2014-02-04 15:21:52 -0800 |
commit | 84692cae50a6984f6b52b7193b4dc2784bb0f58b (patch) | |
tree | 2ca99c96c8b6d5491779929ecd4187688ffc540d /src/github/daneren2005 | |
parent | 5168bdc1bb49ddf53f31a62978d634f1fbf9e89d (diff) | |
download | dsub-84692cae50a6984f6b52b7193b4dc2784bb0f58b.tar.gz dsub-84692cae50a6984f6b52b7193b4dc2784bb0f58b.tar.bz2 dsub-84692cae50a6984f6b52b7193b4dc2784bb0f58b.zip |
getNewId needs to give unique id even after restoring from Bundles
Diffstat (limited to 'src/github/daneren2005')
-rw-r--r-- | src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java | 1 | ||||
-rw-r--r-- | src/github/daneren2005/dsub/fragments/SubsonicFragment.java | 10 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java index e6b0e137..00bbd049 100644 --- a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java +++ b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java @@ -81,6 +81,7 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter int tmp = bundle.getInt(Constants.FRAGMENT_ID, -1);
if(tmp > 0) {
rootId = tmp;
+ maximizeIdGenerator(tmp);
}
entries = (List<MusicDirectory.Entry>) bundle.getSerializable(Constants.FRAGMENT_LIST);
restoredInstance = true;
diff --git a/src/github/daneren2005/dsub/fragments/SubsonicFragment.java b/src/github/daneren2005/dsub/fragments/SubsonicFragment.java index 07aed372..a9d62d0b 100644 --- a/src/github/daneren2005/dsub/fragments/SubsonicFragment.java +++ b/src/github/daneren2005/dsub/fragments/SubsonicFragment.java @@ -362,10 +362,6 @@ public class SubsonicFragment extends Fragment { }
protected int getNewId() {
- if(rootView != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
- return rootView.generateViewId();
- }
-
for (;;) {
final int result = nextGeneratedId.get();
// aapt-generated IDs have the high byte nonzero; clamp to the range under that.
@@ -376,6 +372,12 @@ public class SubsonicFragment extends Fragment { }
}
}
+ protected void maximizeIdGenerator(int id) {
+ final int result = nextGeneratedId.get();
+ if(id >= result) {
+ nextGeneratedId.set(id + 1);
+ }
+ }
public int getRootId() {
return rootView.getId();
}
|