Resolve fast-scroll resource issues
Accidentally forgot to move the resources from the fast scroll library, so here it is.
This commit is contained in:
parent
02fed16c31
commit
ffd3275ca5
6 changed files with 65 additions and 10 deletions
|
@ -53,6 +53,9 @@ afterEvaluate {
|
|||
dependencies {
|
||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||
|
||||
// FIXME: A good chunk of the dependencies I use are implicit,
|
||||
// I may want to explicitly declare them to avoid any annoying build issues in the future.
|
||||
|
||||
// Kotlin
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
|
@ -98,10 +101,11 @@ dependencies {
|
|||
implementation 'com.google.android.material:material:1.3.0'
|
||||
|
||||
// Dialogs
|
||||
// TODO: Eliminate these, don't want their bloat.
|
||||
implementation 'com.afollestad.material-dialogs:core:3.3.0'
|
||||
implementation 'com.afollestad.material-dialogs:files:3.3.0'
|
||||
|
||||
// --- DEV ---
|
||||
// --- DEBUG ---
|
||||
|
||||
// Lint
|
||||
ktlint "com.pinterest:ktlint:0.40.0"
|
||||
|
|
|
@ -20,8 +20,9 @@ import org.oxycblt.auxio.ui.inflater
|
|||
/**
|
||||
* The companion thumb for [FastScrollView]. This does not need any setup, instead pass it as an
|
||||
* argument to [FastScrollView.setup].
|
||||
* This code is fundamentally an adaptation of Reddit's IndicatorFastScroll, targeted towards
|
||||
* Auxio specifically. Check them out here: https://github.com/reddit/IndicatorFastScroll/
|
||||
* This code is fundamentally an adaptation of Reddit's IndicatorFastScroll, albeit specialized
|
||||
* towards Auxio. The original library is here: https://github.com/reddit/IndicatorFastScroll/
|
||||
* TODO: Merge this view and FastScrollView? They are effectively reliant on eachother
|
||||
* @author OxygenCobalt
|
||||
*/
|
||||
class FastScrollThumb @JvmOverloads constructor(
|
||||
|
@ -70,7 +71,7 @@ class FastScrollThumb @JvmOverloads constructor(
|
|||
|
||||
/**
|
||||
* Make the thumb jump to a new position and update its text to the given [indicator].
|
||||
* This is not meant for use outside of the main [FastScrollView] code, don't use it.
|
||||
* This is not meant for use outside of the main [FastScrollView] code. Do not use it.
|
||||
*/
|
||||
fun jumpTo(indicator: FastScrollView.Indicator, centerY: Int) {
|
||||
binding.thumbText.text = indicator.char.toString()
|
||||
|
|
|
@ -24,8 +24,8 @@ import kotlin.math.min
|
|||
/**
|
||||
* A view that allows for quick scrolling through a [RecyclerView] with many items. Unlike other
|
||||
* fast-scrollers, this one displays indicators instead of simply a scroll bar.
|
||||
* This code is fundamentally an adaptation of Reddit's IndicatorFastScroll, targeted towards
|
||||
* Auxio specifically. Check them out here: https://github.com/reddit/IndicatorFastScroll/
|
||||
* This code is fundamentally an adaptation of Reddit's IndicatorFastScroll, albeit specialized
|
||||
* towards Auxio. The original library is here: https://github.com/reddit/IndicatorFastScroll/
|
||||
* @author OxygenCobalt
|
||||
*/
|
||||
class FastScrollView @JvmOverloads constructor(
|
||||
|
@ -172,6 +172,7 @@ class FastScrollView @JvmOverloads constructor(
|
|||
}
|
||||
|
||||
if (touchY in (indicatorText.top until indicatorText.bottom)) {
|
||||
// Try to roughly caculate which indicator the user is currently touching [Since the
|
||||
val textHeight = indicatorText.height / indicators.size
|
||||
val indicatorIndex = min(
|
||||
(touchY - indicatorText.top) / textHeight, indicators.lastIndex
|
||||
|
|
46
app/src/main/res/animator/animator_thumb.xml
Normal file
46
app/src/main/res/animator/animator_thumb.xml
Normal file
|
@ -0,0 +1,46 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Animator from IndicatorFastScroll (https://github.com/reddit/IndicatorFastScroll) -->
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_activated="true">
|
||||
<set>
|
||||
<objectAnimator
|
||||
android:duration="@android:integer/config_shortAnimTime"
|
||||
android:propertyName="scaleX"
|
||||
android:valueTo="1"
|
||||
android:valueType="floatType" />
|
||||
|
||||
<objectAnimator
|
||||
android:duration="@android:integer/config_shortAnimTime"
|
||||
android:propertyName="scaleY"
|
||||
android:valueTo="1"
|
||||
android:valueType="floatType" />
|
||||
|
||||
<objectAnimator
|
||||
android:duration="@android:integer/config_shortAnimTime"
|
||||
android:propertyName="alpha"
|
||||
android:valueTo="1"
|
||||
android:valueType="floatType" />
|
||||
</set>
|
||||
</item>
|
||||
<item>
|
||||
<set>
|
||||
<objectAnimator
|
||||
android:duration="@android:integer/config_shortAnimTime"
|
||||
android:propertyName="scaleX"
|
||||
android:valueTo="0"
|
||||
android:valueType="floatType" />
|
||||
|
||||
<objectAnimator
|
||||
android:duration="@android:integer/config_shortAnimTime"
|
||||
android:propertyName="scaleY"
|
||||
android:valueTo="0"
|
||||
android:valueType="floatType" />
|
||||
|
||||
<objectAnimator
|
||||
android:duration="@android:integer/config_shortAnimTime"
|
||||
android:propertyName="alpha"
|
||||
android:valueTo="0"
|
||||
android:valueType="floatType" />
|
||||
</set>
|
||||
</item>
|
||||
</selector>
|
|
@ -1,19 +1,20 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Animator from IndicatorFastScroll (https://github.com/reddit/IndicatorFastScroll) -->
|
||||
<layout>
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:layout_height="match_parent"
|
||||
tools:layout_width="@dimen/fast_scroller_thumb_size"
|
||||
tools:layout_width="@dimen/size_scroll_thumb"
|
||||
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/thumb_layout"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:background="@drawable/thumb_circle"
|
||||
android:elevation="@dimen/fast_scroller_thumb_elevation"
|
||||
android:stateListAnimator="@animator/fast_scroll_thumb"
|
||||
android:background="@drawable/ui_circular_button"
|
||||
android:elevation="@dimen/elevation_small"
|
||||
android:stateListAnimator="@animator/animator_thumb"
|
||||
app:layout_constraintDimensionRatio="W,1:1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent">
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
|
||||
<dimen name="size_play_pause">70dp</dimen>
|
||||
<dimen name="size_play_pause_compact">36dp</dimen>
|
||||
<dimen name="size_scroll_thumb">32dp</dimen>
|
||||
<dimen name="size_clear">32dp</dimen>
|
||||
|
||||
<dimen name="size_app_icon">60dp</dimen>
|
||||
|
@ -55,6 +56,7 @@
|
|||
<dimen name="text_size_toolbar_header">20sp</dimen>
|
||||
|
||||
<!-- Misc -->
|
||||
<dimen name="elevation_small">2dp</dimen>
|
||||
<dimen name="elevation_normal">4dp</dimen>
|
||||
<dimen name="offset_thumb">4dp</dimen>
|
||||
</resources>
|
Loading…
Reference in a new issue