From e6c6e1749deaa800b8da021b2e29fbd295a656cc Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Sat, 11 May 2013 15:25:17 -0700 Subject: Fix > 2 nested DirectoryFragments not working --- subsonic-android/res/layout/select_album.xml | 52 ++++++++++++---------- .../dsub/fragments/SelectDirectoryFragment.java | 21 ++++++++- 2 files changed, 48 insertions(+), 25 deletions(-) diff --git a/subsonic-android/res/layout/select_album.xml b/subsonic-android/res/layout/select_album.xml index 0bf5367f..4fddf330 100644 --- a/subsonic-android/res/layout/select_album.xml +++ b/subsonic-android/res/layout/select_album.xml @@ -1,32 +1,36 @@ - + android:layout_width="match_parent" + android:layout_height="match_parent"> - + android:layout_height="fill_parent"> - + - + - + - \ No newline at end of file + + + \ No newline at end of file diff --git a/subsonic-android/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java b/subsonic-android/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java index 209e22b2..1d7c0073 100644 --- a/subsonic-android/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java +++ b/subsonic-android/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java @@ -72,6 +72,9 @@ 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); + if(!primaryFragment) { + ((ViewGroup)rootView).getChildAt(0).setVisibility(View.GONE); + } entryList = (DragSortListView) rootView.findViewById(R.id.select_album_entries); footer = LayoutInflater.from(context).inflate(R.layout.select_album_footer, entryList, false); @@ -106,7 +109,11 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter albumListType = args.getString(Constants.INTENT_EXTRA_NAME_ALBUM_LIST_TYPE); albumListSize = args.getInt(Constants.INTENT_EXTRA_NAME_ALBUM_LIST_SIZE, 0); } - load(false); + if(primaryFragment) { + load(false); + } else { + invalidated = true; + } return rootView; } @@ -233,6 +240,18 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter } } } + + @Override + public void setPrimaryFragment(boolean primary) { + super.setPrimaryFragment(primary); + if(rootView != null) { + if(primary) { + ((ViewGroup)rootView).getChildAt(0).setVisibility(View.VISIBLE); + } else { + ((ViewGroup)rootView).getChildAt(0).setVisibility(View.GONE); + } + } + } @Override protected void refresh(boolean refresh) { -- cgit v1.2.3