Merge pull request #3995 from ByteHamster/fast-scroll

Added fast scrolling to all episode lists
This commit is contained in:
H. Lehmann 2020-04-03 10:24:35 +02:00 committed by GitHub
commit cc45c78aa8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 50 additions and 43 deletions

View File

@ -4,9 +4,11 @@ import android.content.Context;
import android.content.SharedPreferences;
import android.util.AttributeSet;
import android.view.View;
import androidx.appcompat.view.ContextThemeWrapper;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.yqritc.recyclerviewflexibledivider.HorizontalDividerItemDecoration;
import de.danoeh.antennapod.R;
import io.reactivex.annotations.Nullable;
public class EpisodeItemListRecyclerView extends RecyclerView {
@ -17,17 +19,17 @@ public class EpisodeItemListRecyclerView extends RecyclerView {
private LinearLayoutManager layoutManager;
public EpisodeItemListRecyclerView(Context context) {
super(context);
super(new ContextThemeWrapper(context, R.style.FastScrollRecyclerView));
setup();
}
public EpisodeItemListRecyclerView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
super(new ContextThemeWrapper(context, R.style.FastScrollRecyclerView), attrs);
setup();
}
public EpisodeItemListRecyclerView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
super(new ContextThemeWrapper(context, R.style.FastScrollRecyclerView), attrs, defStyleAttr);
setup();
}

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#33666666"/>
<padding
android:top="10dp"
android:left="10dp"
android:right="10dp"
android:bottom="10dp"/>
</shape>

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_pressed="true"
android:drawable="@drawable/scrollbar_line"/>
<item
android:drawable="@drawable/scrollbar_line"/>
</selector>

View File

@ -1,11 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<padding
android:paddingLeft="22dp"
android:paddingRight="22dp" />
<solid android:color="#99666666" />
</shape>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/scrollbar_thumb_pressed"/>
<item android:drawable="@drawable/scrollbar_thumb_default"/>
</selector>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<size android:height="24dp" android:width="24dp"/>
</shape>
</item>
<item android:gravity="end">
<shape android:shape="rectangle">
<solid android:color="#99666666"/>
<size android:height="4dp" android:width="4dp"/>
</shape>
</item>
</layer-list>

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_pressed="true"
android:drawable="@drawable/scrollbar_thumb"/>
<item
android:drawable="@drawable/scrollbar_thumb"/>
</selector>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<size android:height="24dp" android:width="24dp"/>
</shape>
</item>
<item android:gravity="end">
<shape android:shape="rectangle">
<solid android:color="@color/antennapod_blue"/>
<size android:height="4dp" android:width="4dp"/>
</shape>
</item>
</layer-list>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@android:color/transparent"/>
</selector>

View File

@ -309,4 +309,13 @@
<item name="android:progressDrawable">@drawable/progress_bar_horizontal_trueblack</item>
</style>
<style name="FastScrollRecyclerView" parent="android:Widget">
<item name="android:scrollbars">none</item>
<item name="fastScrollEnabled">true</item>
<item name="fastScrollHorizontalThumbDrawable">@drawable/scrollbar_thumb</item>
<item name="fastScrollHorizontalTrackDrawable">@drawable/scrollbar_track</item>
<item name="fastScrollVerticalThumbDrawable">@drawable/scrollbar_thumb</item>
<item name="fastScrollVerticalTrackDrawable">@drawable/scrollbar_track</item>
</style>
</resources>