aboutsummaryrefslogtreecommitdiff
path: root/subsonic-android/src
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2013-06-30 22:00:26 -0700
committerScott Jackson <daneren2005@gmail.com>2013-06-30 22:00:26 -0700
commit6b4a6a3ae038f2b46c9427427e892d72d83cd670 (patch)
treed9b2899ec77b5b2ff278754af792196d6c9a4988 /subsonic-android/src
parenta0e5b6d20d033c31592a66cb0f36741785e664be (diff)
downloaddsub-6b4a6a3ae038f2b46c9427427e892d72d83cd670.tar.gz
dsub-6b4a6a3ae038f2b46c9427427e892d72d83cd670.tar.bz2
dsub-6b4a6a3ae038f2b46c9427427e892d72d83cd670.zip
Give each SelectDirectoryFragment a unique id
Diffstat (limited to 'subsonic-android/src')
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java21
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/fragments/SubsonicFragment.java9
2 files changed, 26 insertions, 4 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java b/subsonic-android/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
index f4f7aa0a..cd20c0e2 100644
--- a/subsonic-android/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
+++ b/subsonic-android/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
@@ -42,10 +42,10 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
private static final String TAG = SelectDirectoryFragment.class.getSimpleName();
private DragSortListView entryList;
+ int rootId;
private View footer;
private View emptyView;
private boolean hideButtons = false;
- private Button moreButton;
private Boolean licenseValid;
private boolean showHeader = true;
private EntryAdapter entryAdapter;
@@ -61,6 +61,12 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
String albumListType;
String albumListExtra;
int albumListSize;
+
+
+ SelectDirectoryFragment() {
+ super();
+ rootId = getNewId();
+ }
@Override
public void onCreate(Bundle bundle) {
@@ -70,6 +76,7 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle) {
rootView = inflater.inflate(R.layout.select_album, container, false);
+ rootView.setId(rootId);
if(!primaryFragment) {
((ViewGroup)rootView).getChildAt(0).setVisibility(View.GONE);
}
@@ -93,7 +100,6 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
}
});
- moreButton = (Button) footer.findViewById(R.id.select_album_more);
emptyView = rootView.findViewById(R.id.select_album_empty);
registerForContextMenu(entryList);
@@ -238,6 +244,7 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
if (position >= 0) {
MusicDirectory.Entry entry = (MusicDirectory.Entry) parent.getItemAtPosition(position);
if (entry.isDirectory()) {
+ int fragId = rootId;
if(albumListType != null && entry.getParent() != null) {
SubsonicFragment parentFragment = new SelectDirectoryFragment();
Bundle args = new Bundle();
@@ -245,7 +252,8 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
args.putString(Constants.INTENT_EXTRA_NAME_NAME, entry.getArtist());
parentFragment.setArguments(args);
- replaceFragment(parentFragment, R.id.select_album_layout);
+ replaceFragment(parentFragment, fragId);
+ fragId = parentFragment.getRootId();
}
SubsonicFragment fragment = new SelectDirectoryFragment();
@@ -254,7 +262,7 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
args.putString(Constants.INTENT_EXTRA_NAME_NAME, entry.getTitle());
fragment.setArguments(args);
- replaceFragment(fragment, R.id.select_album_layout);
+ replaceFragment(fragment, fragId);
} else if (entry.isVideo()) {
playVideo(entry);
} else if(entry instanceof PodcastEpisode) {
@@ -292,6 +300,11 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
protected void refresh(boolean refresh) {
load(refresh);
}
+
+ @Override
+ public int getRootId() {
+ return rootId;
+ }
private void load(boolean refresh) {
entryList.setVisibility(View.INVISIBLE);
diff --git a/subsonic-android/src/github/daneren2005/dsub/fragments/SubsonicFragment.java b/subsonic-android/src/github/daneren2005/dsub/fragments/SubsonicFragment.java
index e9dc843c..3f6be234 100644
--- a/subsonic-android/src/github/daneren2005/dsub/fragments/SubsonicFragment.java
+++ b/subsonic-android/src/github/daneren2005/dsub/fragments/SubsonicFragment.java
@@ -76,6 +76,7 @@ import java.util.Random;
public class SubsonicFragment extends SherlockFragment {
private static final String TAG = SubsonicFragment.class.getSimpleName();
+ private static int internalID = Integer.MAX_VALUE;
private static int TAG_INC = 10;
private int tag;
@@ -281,6 +282,14 @@ public class SubsonicFragment extends SherlockFragment {
context.replaceFragment(fragment, id, fragment.getSupportTag());
}
+ protected int getNewId() {
+ internalID--;
+ return internalID;
+ }
+ public int getRootId() {
+ return rootView.getId();
+ }
+
public int getSupportTag() {
return tag;
}