aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/src/main/java/github/daneren2005/dsub/fragments/SelectRecyclerFragment.java41
1 files changed, 25 insertions, 16 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/fragments/SelectRecyclerFragment.java b/app/src/main/java/github/daneren2005/dsub/fragments/SelectRecyclerFragment.java
index 6fd56fd1..c19e9b28 100644
--- a/app/src/main/java/github/daneren2005/dsub/fragments/SelectRecyclerFragment.java
+++ b/app/src/main/java/github/daneren2005/dsub/fragments/SelectRecyclerFragment.java
@@ -153,26 +153,35 @@ public abstract class SelectRecyclerFragment<T> extends SubsonicFragment {
currentTask.execute();
}
- public void setupLayoutManager() {
+ private void setupLayoutManager() {
+ recyclerView.setLayoutManager(getLayoutManager());
+ }
+ public RecyclerView.LayoutManager getLayoutManager() {
if(largeCells) {
- final int columns = context.getResources().getInteger(R.integer.Grid_Columns);
- GridLayoutManager gridLayoutManager = new GridLayoutManager(context, columns);
-
- GridLayoutManager.SpanSizeLookup spanSizeLookup = getSpanSizeLookup();
- if(spanSizeLookup != null) {
- gridLayoutManager.setSpanSizeLookup(spanSizeLookup);
- }
- RecyclerView.ItemDecoration itemDecoration = getItemDecoration();
- if(itemDecoration != null) {
- recyclerView.addItemDecoration(itemDecoration);
- }
- recyclerView.setLayoutManager(gridLayoutManager);
+ return getGridLayoutManager();
} else {
- LinearLayoutManager layoutManager = new LinearLayoutManager(context);
- layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
- recyclerView.setLayoutManager(layoutManager);
+ return getLinearLayoutManager();
}
}
+ public GridLayoutManager getGridLayoutManager() {
+ final int columns = context.getResources().getInteger(R.integer.Grid_Columns);
+ GridLayoutManager gridLayoutManager = new GridLayoutManager(context, columns);
+
+ GridLayoutManager.SpanSizeLookup spanSizeLookup = getSpanSizeLookup();
+ if(spanSizeLookup != null) {
+ gridLayoutManager.setSpanSizeLookup(spanSizeLookup);
+ }
+ RecyclerView.ItemDecoration itemDecoration = getItemDecoration();
+ if(itemDecoration != null) {
+ recyclerView.addItemDecoration(itemDecoration);
+ }
+ return gridLayoutManager;
+ }
+ public LinearLayoutManager getLinearLayoutManager() {
+ LinearLayoutManager layoutManager = new LinearLayoutManager(context);
+ layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
+ return layoutManager;
+ }
public GridLayoutManager.SpanSizeLookup getSpanSizeLookup() {
return null;
}