aboutsummaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2015-05-22 17:56:12 -0700
committerScott Jackson <daneren2005@gmail.com>2015-05-22 17:56:12 -0700
commit096f97542c1f8b9baa6cc53fb2f6909f969e261f (patch)
tree847b5ae15d132812bcca64d5890298915653fad1 /app/src/main
parent6a0bf662a2fd846477695075b68f282020d66f6f (diff)
downloaddsub-096f97542c1f8b9baa6cc53fb2f6909f969e261f.tar.gz
dsub-096f97542c1f8b9baa6cc53fb2f6909f969e261f.tar.bz2
dsub-096f97542c1f8b9baa6cc53fb2f6909f969e261f.zip
Allow more fine tuned control over LayoutManager
Diffstat (limited to 'app/src/main')
-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;
}