Remove rewind threshold setting

Remove the ability to customize the rewind threshhold, as I dont think its that useful in the long-term
This commit is contained in:
OxygenCobalt 2020-12-31 20:22:33 -07:00
parent 14fc47913e
commit bc1992de4e
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
8 changed files with 12 additions and 32 deletions

View file

@ -20,26 +20,26 @@ import org.oxycblt.auxio.music.Genre
import org.oxycblt.auxio.music.Song
import org.oxycblt.auxio.settings.SettingsManager
// TODO: Stop disk caching
// SettingsManager is lazy-initted to prevent it from being used before its initialized.
val settingsManager: SettingsManager by lazy {
SettingsManager.getInstance()
}
/**
* Create the custom [ImageLoader] used by Auxio, which doesn't cache album art to the disk by default.
* Create the custom [ImageLoader] used by Auxio, which automates some convienence things.
*/
fun createImageLoader(context: Context): ImageLoader {
Log.d("createImageLoader", "Creating image loader.")
val builder = ImageLoader.Builder(context)
.crossfade(true)
.placeholder(android.R.color.transparent)
// To save memory/improve speed, allow disc caching when if quality covers are enabled.
if (settingsManager.useQualityCovers) {
builder.diskCachePolicy(CachePolicy.ENABLED)
} else {
// Otherwise disable it since the covers are already cached, really.
builder.diskCachePolicy(CachePolicy.DISABLED)
}
@ -51,7 +51,7 @@ fun createImageLoader(context: Context): ImageLoader {
* **Do not use this on the UI elements, instead use the Binding Adapters.**
* @param context [Context] required
* @param song Song to load the cover for
* @param onDone What to do with the bitmap when the loading is finished. Bitmap will be null if loading failed/shouldnt occur.
* @param onDone What to do with the bitmap when the loading is finished. Bitmap will be null if loading failed/shouldn't occur.
*/
fun getBitmap(context: Context, song: Song, onDone: (Bitmap?) -> Unit) {
if (!settingsManager.showCovers) {
@ -223,7 +223,5 @@ fun ImageRequest.Builder.doCoverSetup(context: Context, data: BaseModel): ImageR
*/
private fun ImageView.getDefaultRequest(): ImageRequest.Builder {
return ImageRequest.Builder(context)
.crossfade(true)
.placeholder(android.R.color.transparent)
.target(this)
}

View file

@ -30,7 +30,8 @@ class MosaicFetcher(private val context: Context) : Fetcher<List<Uri>> {
): FetchResult {
val streams = mutableListOf<InputStream>()
// Load the streams.
// Load the streams, the lower-quality MediaStore covers are used simply because using
// the raw ones would make loading far too long. Its not that noticable either.
data.forEach {
val stream: InputStream? = context.contentResolver.openInputStream(it)

View file

@ -52,5 +52,6 @@ class QualityCoverFetcher(private val context: Context) : Fetcher<Song> {
)
}
// Group bitmaps by their album so that caching is more efficent
override fun key(data: Song): String = data.album.id.toString()
}

View file

@ -317,8 +317,8 @@ class PlaybackStateManager private constructor() {
* Go to the previous song, doing any checks that are needed.
*/
fun prev() {
// If enabled, rewind before skipping back if the position is past the threshold set.
if (settingsManager.rewindWithPrev && mPosition >= settingsManager.rewindThreshold) {
// If enabled, rewind before skipping back if the position is past 3 seconds [3000ms]
if (settingsManager.rewindWithPrev && mPosition >= 3000) {
seekTo(0)
} else {
// Only decrement the index if there's a song to move back to AND if we are not exiting

View file

@ -128,12 +128,6 @@ class SettingsManager private constructor(context: Context) :
val rewindWithPrev: Boolean
get() = sharedPrefs.getBoolean(Keys.KEY_PREV_REWIND, true)
/**
* The threshold at which to rewind when the back button is pressed.
*/
val rewindThreshold: Long
get() = (sharedPrefs.getInt(Keys.KEY_REWIND_THRESHOLD, 5) * 1000).toLong()
/**
* The current [SortMode] of the library.
*/
@ -236,7 +230,6 @@ class SettingsManager private constructor(context: Context) :
const val KEY_AT_END = "KEY_AT_END"
const val KEY_KEEP_SHUFFLE = "KEY_KEEP_SHUFFLE"
const val KEY_PREV_REWIND = "KEY_PREV_REWIND"
const val KEY_REWIND_THRESHOLD = "KEY_REWIND_THRESHOLD"
const val KEY_LIBRARY_SORT_MODE = "KEY_LIBRARY_SORT_MODE"
const val KEY_DEBUG_SAVE = "KEY_SAVE_STATE"

View file

@ -94,8 +94,6 @@
<string name="setting_behavior_rewind_prev">Rewind before skipping back</string>
<string name="setting_behavior_rewind_prev_desc">Rewind before skipping to the previous song</string>
<string name="setting_behavior_rewind_threshold">Rewind threshold</string>
<string name="setting_behavior_rewind_threshold_desc">Progress at which a rewind should occur (seconds)</string>
<!-- Debug Namespace | Debug labels -->
<string name="debug_title">Debug</string>

View file

@ -123,19 +123,8 @@
app:defaultValue="true"
app:iconSpaceReserved="false"
app:key="KEY_PREV_REWIND"
app:summary="@string/setting_behavior_rewind_prev_desc" />
<SeekBarPreference
android:defaultValue="@integer/rewind_threshold_default"
android:max="@integer/rewind_threshold_max"
android:title="@string/setting_behavior_rewind_threshold"
app:allowDividerBelow="false"
app:dependency="KEY_PREV_REWIND"
app:iconSpaceReserved="false"
app:key="KEY_REWIND_THRESHOLD"
app:min="@integer/rewind_threshold_min"
app:showSeekBarValue="true"
app:summary="@string/setting_behavior_rewind_threshold_desc" />
app:summary="@string/setting_behavior_rewind_prev_desc" />
</PreferenceCategory>

View file

@ -6,7 +6,7 @@ This FAQ will be continually updated as new changes and updates are made to Auxi
## What is Auxio?
Auxio is a reliable and customizable local music player that I built for myself, primarily.
Auxio is local music player for android that I built for myself, primarily. Its meant to be simplistic and straightfoward, however still customizable to ones wants.
## Where can I download Auxio?
@ -38,7 +38,7 @@ You will be able to set the accent to something less saturated when I implement
The APIs for changing system bar colors were only added in API Level 27 (Oreo MR1), meaning that edge-to-edge will not work below that version.
I could possibly extend edge-to-edge support to those versions, but it would take awhile.
I could possibly extend edge-to-edge support to earlier versions, but it would take awhile.
## Why doesnt edge-to-edge work when my phone is in landscape?