From 194bcfcd0501436f7b2e5c3c0c82370f888aa5f3 Mon Sep 17 00:00:00 2001 From: OxygenCobalt Date: Thu, 25 Mar 2021 09:24:40 -0600 Subject: [PATCH] Fix more fast-scroll issues Fix two more fast scrolling issues: - Fixed size of the view would cut off larger fonts - Thumb would briefly show when the view would initially start This custom view was a mistake, but anything for less kbs. --- app/build.gradle | 2 +- .../main/java/org/oxycblt/auxio/songs/FastScrollView.kt | 9 +++++++++ app/src/main/res/layout/view_fast_scroll.xml | 3 ++- app/src/main/res/values/dimens.xml | 2 +- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index e27d82931..b3edbe698 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -105,7 +105,7 @@ dependencies { implementation "com.google.android.material:material:1.3.0" // Dialogs - // TODO: Eliminate these, don't want their bloat. + // TODO: Eliminate these, would eliminate ~100kb from the app size implementation "com.afollestad.material-dialogs:core:3.3.0" implementation "com.afollestad.material-dialogs:files:3.3.0" diff --git a/app/src/main/java/org/oxycblt/auxio/songs/FastScrollView.kt b/app/src/main/java/org/oxycblt/auxio/songs/FastScrollView.kt index 3356eb438..3aa98ed8d 100644 --- a/app/src/main/java/org/oxycblt/auxio/songs/FastScrollView.kt +++ b/app/src/main/java/org/oxycblt/auxio/songs/FastScrollView.kt @@ -9,6 +9,7 @@ import android.view.MotionEvent import android.view.View import androidx.constraintlayout.widget.ConstraintLayout import androidx.core.view.isVisible +import androidx.core.view.postDelayed import androidx.dynamicanimation.animation.DynamicAnimation import androidx.dynamicanimation.animation.SpringAnimation import androidx.dynamicanimation.animation.SpringForce @@ -71,6 +72,14 @@ class FastScrollView @JvmOverloads constructor( it.dampingRatio = SpringForce.DAMPING_RATIO_NO_BOUNCY } } + + // Prevent the disappear animation from being displayed on startup by making the thumb + // invisible, it will be made visible once the animation ends + binding.scrollThumb.visibility = View.INVISIBLE + + postDelayed(200) { + binding.scrollThumb.visibility = View.VISIBLE + } } /** diff --git a/app/src/main/res/layout/view_fast_scroll.xml b/app/src/main/res/layout/view_fast_scroll.xml index bd1a614a7..f938c8724 100644 --- a/app/src/main/res/layout/view_fast_scroll.xml +++ b/app/src/main/res/layout/view_fast_scroll.xml @@ -32,7 +32,7 @@ 32dp 1dp - 18dp + 20dp 64dp