diff options
5 files changed, 34 insertions, 6 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java b/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java index e190e4c1..92d9deed 100644 --- a/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java +++ b/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java @@ -699,7 +699,7 @@ public class SubsonicActivity extends AppCompatActivity implements OnItemSelecte currentFragment.setPrimaryFragment(true); supportInvalidateOptionsMenu(); - if(secondaryContainer == null) { + if(secondaryContainer == null || oldFragment.isAlwaysFullscreen()) { FragmentTransaction trans = getSupportFragmentManager().beginTransaction(); trans.setCustomAnimations(R.anim.enter_from_right, R.anim.exit_to_left, R.anim.enter_from_left, R.anim.exit_to_right); trans.hide(oldFragment); @@ -761,7 +761,7 @@ public class SubsonicActivity extends AppCompatActivity implements OnItemSelecte currentFragment.setPrimaryFragment(true, false); supportInvalidateOptionsMenu(); - if(secondaryContainer == null) { + if(secondaryContainer == null || currentFragment.isAlwaysFullscreen()) { FragmentTransaction trans = getSupportFragmentManager().beginTransaction(); trans.setCustomAnimations(R.anim.enter_from_left, R.anim.exit_to_right, R.anim.enter_from_right, R.anim.exit_to_left); trans.remove(oldFrag); @@ -775,7 +775,7 @@ public class SubsonicActivity extends AppCompatActivity implements OnItemSelecte trans.remove(oldFrag); // Only switch places if there is a backstack, otherwise primary container is correct - if(backStack.size() > 0) { + if(backStack.size() > 0 && !backStack.get(backStack.size() - 1).isAlwaysFullscreen()) { trans.setCustomAnimations(0, 0, 0, 0); // Add current left fragment to right side trans.remove(currentFragment); diff --git a/app/src/main/java/github/daneren2005/dsub/fragments/MainFragment.java b/app/src/main/java/github/daneren2005/dsub/fragments/MainFragment.java index 5d12c2df..5daf3d7a 100644 --- a/app/src/main/java/github/daneren2005/dsub/fragments/MainFragment.java +++ b/app/src/main/java/github/daneren2005/dsub/fragments/MainFragment.java @@ -41,6 +41,7 @@ public class MainFragment extends SelectRecyclerFragment<Integer> { pullToRefresh = false; serialize = false; backgroundUpdate = false; + alwaysFullscreen = true; } @Override diff --git a/app/src/main/java/github/daneren2005/dsub/fragments/SearchFragment.java b/app/src/main/java/github/daneren2005/dsub/fragments/SearchFragment.java index b19ededa..4b34abf2 100644 --- a/app/src/main/java/github/daneren2005/dsub/fragments/SearchFragment.java +++ b/app/src/main/java/github/daneren2005/dsub/fragments/SearchFragment.java @@ -90,6 +90,18 @@ public class SearchFragment extends SubsonicFragment implements SectionAdapter.O } @Override + public void setIsOnlyVisible(boolean isOnlyVisible) { + boolean update = this.isOnlyVisible != isOnlyVisible; + super.setIsOnlyVisible(isOnlyVisible); + if(update && adapter != null) { + RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager(); + if(layoutManager instanceof GridLayoutManager) { + ((GridLayoutManager) layoutManager).setSpanCount(getRecyclerColumnCount()); + } + } + } + + @Override public GridLayoutManager.SpanSizeLookup getSpanSizeLookup() { return new GridLayoutManager.SpanSizeLookup() { @Override diff --git a/app/src/main/java/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java b/app/src/main/java/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java index 9bffbdfd..ef5490d1 100644 --- a/app/src/main/java/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java +++ b/app/src/main/java/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java @@ -186,14 +186,13 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Section setupScrollList(recyclerView); if(largeAlbums) { - final int columns = context.getResources().getInteger(R.integer.Grid_Columns); - GridLayoutManager gridLayoutManager = new GridLayoutManager(context, columns); + GridLayoutManager gridLayoutManager = new GridLayoutManager(context, getRecyclerColumnCount()); gridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() { @Override public int getSpanSize(int position) { int viewType = entryGridAdapter.getItemViewType(position); if(viewType == EntryGridAdapter.VIEW_TYPE_SONG || viewType == EntryGridAdapter.VIEW_TYPE_HEADER || viewType == EntryInfiniteGridAdapter.VIEW_TYPE_LOADING) { - return columns; + return getRecyclerColumnCount(); } else { return 1; } @@ -226,6 +225,18 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Section } @Override + public void setIsOnlyVisible(boolean isOnlyVisible) { + boolean update = this.isOnlyVisible != isOnlyVisible; + super.setIsOnlyVisible(isOnlyVisible); + if(update && entryGridAdapter != null) { + RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager(); + if(layoutManager instanceof GridLayoutManager) { + ((GridLayoutManager) layoutManager).setSpanCount(getRecyclerColumnCount()); + } + } + } + + @Override public void onCreateOptionsMenu(Menu menu, MenuInflater menuInflater) { if(licenseValid == null) { menuInflater.inflate(R.menu.empty, menu); diff --git a/app/src/main/java/github/daneren2005/dsub/fragments/SubsonicFragment.java b/app/src/main/java/github/daneren2005/dsub/fragments/SubsonicFragment.java index 956597a4..aa6245e4 100644 --- a/app/src/main/java/github/daneren2005/dsub/fragments/SubsonicFragment.java +++ b/app/src/main/java/github/daneren2005/dsub/fragments/SubsonicFragment.java @@ -114,6 +114,7 @@ public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnR protected boolean primaryFragment = false; protected boolean secondaryFragment = false; protected boolean isOnlyVisible = true; + protected boolean alwaysFullscreen = false; protected boolean invalidated = false; protected static Random random = new Random(); protected GestureDetector gestureScanner; @@ -480,6 +481,9 @@ public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnR public void setIsOnlyVisible(boolean isOnlyVisible) { this.isOnlyVisible = isOnlyVisible; } + public boolean isAlwaysFullscreen() { + return alwaysFullscreen; + } public void invalidate() { if(primaryFragment) { |