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:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user