From f7a63ae9a7f5582d93d69807706e2f94f9f6a2ac Mon Sep 17 00:00:00 2001 From: Synced Synapse Date: Thu, 10 Jan 2019 18:40:58 +0000 Subject: [PATCH] Add fastscroll to lists with RecyclerView --- app/build.gradle | 1 + .../kore/ui/RecyclerViewCursorAdapter.java | 29 +++++++++++++++++-- .../ui/sections/audio/AlbumListFragment.java | 12 ++++---- .../ui/sections/audio/ArtistListFragment.java | 12 ++++---- .../audio/AudioGenresListFragment.java | 18 +++++++----- .../audio/MusicVideoListFragment.java | 9 +++--- .../ui/sections/audio/SongsListFragment.java | 8 +++-- .../ui/sections/video/MovieListFragment.java | 11 ++++--- .../video/TVShowEpisodeListFragment.java | 3 ++ .../ui/sections/video/TVShowListFragment.java | 11 ++++--- .../RecyclerViewEmptyViewSupport.java | 4 ++- .../layout/fragment_generic_media_list.xml | 3 +- app/src/main/res/values/attr.xml | 1 + app/src/main/res/values/colors.xml | 3 ++ app/src/main/res/values/dimens.xml | 7 +++-- app/src/main/res/values/styles.xml | 10 ++++++- app/src/main/res/values/themes.xml | 2 ++ 17 files changed, 103 insertions(+), 41 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 407f1cc..bdc9663 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -113,6 +113,7 @@ dependencies { implementation 'org.jmdns:jmdns:3.5.1' implementation 'at.blogc:expandabletextview:1.0.3' implementation 'com.sothree.slidinguppanel:library:3.3.1' + implementation 'com.simplecityapps:recyclerview-fastscroll:1.0.20' androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'com.android.support.test:rules:1.0.1' diff --git a/app/src/main/java/org/xbmc/kore/ui/RecyclerViewCursorAdapter.java b/app/src/main/java/org/xbmc/kore/ui/RecyclerViewCursorAdapter.java index e2b74f4..a32abc9 100644 --- a/app/src/main/java/org/xbmc/kore/ui/RecyclerViewCursorAdapter.java +++ b/app/src/main/java/org/xbmc/kore/ui/RecyclerViewCursorAdapter.java @@ -20,11 +20,15 @@ import android.database.Cursor; import android.support.v7.widget.RecyclerView; import android.view.View; -abstract public class RecyclerViewCursorAdapter extends RecyclerView.Adapter { +import com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView; - private boolean dataValid; +abstract public class RecyclerViewCursorAdapter + extends RecyclerView.Adapter + implements FastScrollRecyclerView.SectionedAdapter { + + protected boolean dataValid; private int rowIDColumn; - private Cursor cursor; + protected Cursor cursor; @Override public void onBindViewHolder(CursorViewHolder holder, int position) { @@ -59,6 +63,25 @@ abstract public class RecyclerViewCursorAdapter extends RecyclerView.AdapterA Recycler view using a grid layout that supports auto sizing and showing an empty view when the adapter * has no items. @@ -40,7 +42,7 @@ import android.view.View; * * Inspired by RecyclerView: Autofit grid */ -public class RecyclerViewEmptyViewSupport extends RecyclerView { +public class RecyclerViewEmptyViewSupport extends FastScrollRecyclerView { public final static int AUTO_FIT = -1; diff --git a/app/src/main/res/layout/fragment_generic_media_list.xml b/app/src/main/res/layout/fragment_generic_media_list.xml index f1390e5..f6f354a 100644 --- a/app/src/main/res/layout/fragment_generic_media_list.xml +++ b/app/src/main/res/layout/fragment_generic_media_list.xml @@ -15,8 +15,7 @@ limitations under the License. --> - diff --git a/app/src/main/res/values/attr.xml b/app/src/main/res/values/attr.xml index e9b741b..96bb230 100644 --- a/app/src/main/res/values/attr.xml +++ b/app/src/main/res/values/attr.xml @@ -44,6 +44,7 @@ + diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 473e2df..707f1be 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -63,6 +63,9 @@ #ff505050 #ffafafaf + #ff505050 + #ff606060 + @color/dark_content_background @color/light_content_background diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 3325859..ba33584 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -35,7 +35,7 @@ 24dp 32dp - 2dp + 4dp 2dp 2dp @@ -43,7 +43,10 @@ 14sp 16sp 20sp - 34sp + 32sp + + 80dp + 36sp 56dp diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index acf9ca8..1883aa6 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -55,14 +55,22 @@