diff options
Diffstat (limited to 'subsonic-android')
-rw-r--r-- | subsonic-android/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java | 21 | ||||
-rw-r--r-- | subsonic-android/src/github/daneren2005/dsub/fragments/SubsonicFragment.java | 9 |
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;
}
|