Minor improvements
Fix some more blacklist UI issues alongside some problems with formatting/audio focus.
This commit is contained in:
@@ -34,7 +34,9 @@ class BlacklistDatabase(context: Context) : SQLiteOpenHelper(context, DB_NAME, n
|
||||
* @return Whether this file has been added to the database or not.
|
||||
*/
|
||||
fun addPath(file: File): Boolean {
|
||||
val path = file.mediaStorePath
|
||||
assertBackgroundThread()
|
||||
|
||||
val path = file.canonicalPathSafe
|
||||
|
||||
logD("Adding path $path to blacklist")
|
||||
|
||||
@@ -58,12 +60,16 @@ class BlacklistDatabase(context: Context) : SQLiteOpenHelper(context, DB_NAME, n
|
||||
* Remove a [File] from this blacklist.
|
||||
*/
|
||||
fun removePath(file: File) {
|
||||
assertBackgroundThread()
|
||||
|
||||
writableDatabase.execute {
|
||||
delete(TABLE_NAME, "$COLUMN_PATH=?", arrayOf(file.mediaStorePath))
|
||||
delete(TABLE_NAME, "$COLUMN_PATH=?", arrayOf(file.canonicalPathSafe))
|
||||
}
|
||||
}
|
||||
|
||||
fun getPaths(): List<String> {
|
||||
assertBackgroundThread()
|
||||
|
||||
val paths = mutableListOf<String>()
|
||||
|
||||
readableDatabase.queryAll(TABLE_NAME) { cursor ->
|
||||
@@ -83,7 +89,7 @@ class BlacklistDatabase(context: Context) : SQLiteOpenHelper(context, DB_NAME, n
|
||||
return exists ?: false
|
||||
}
|
||||
|
||||
private val File.mediaStorePath: String get() {
|
||||
private val File.canonicalPathSafe: String get() {
|
||||
return try {
|
||||
canonicalPath
|
||||
} catch (e: IOException) {
|
||||
|
||||
@@ -464,7 +464,6 @@ class PlaybackStateManager private constructor() {
|
||||
* Generate a new shuffled queue.
|
||||
* @param keepSong Whether the current song should be kept as the queue is shuffled
|
||||
* @param useLastSong Whether to use the last song in the queue instead of the current one
|
||||
* @return A new shuffled queue
|
||||
*/
|
||||
private fun genShuffle(keepSong: Boolean, useLastSong: Boolean) {
|
||||
val lastSong = if (useLastSong) mQueue[0] else mSong
|
||||
|
||||
@@ -71,8 +71,11 @@ class AudioReactor(
|
||||
}
|
||||
|
||||
private fun onLossTransient() {
|
||||
pauseWasTransient = true
|
||||
playbackManager.setPlaying(false)
|
||||
// Since this loss is only temporary, mark it as such if we had to pause playback.
|
||||
if (playbackManager.isPlaying) {
|
||||
pauseWasTransient = true
|
||||
playbackManager.setPlaying(false)
|
||||
}
|
||||
}
|
||||
|
||||
private fun onLossPermanent() {
|
||||
|
||||
@@ -70,7 +70,7 @@ class SettingsManager private constructor(context: Context) :
|
||||
get() = sharedPrefs.getBoolean(Keys.KEY_USE_ALT_NOTIFICATION_ACTION, false)
|
||||
|
||||
/** What to display on the library. */
|
||||
val libraryDisplayMode: org.oxycblt.auxio.recycler.DisplayMode
|
||||
val libraryDisplayMode: DisplayMode
|
||||
get() = DisplayMode.valueOfOrFallback(
|
||||
sharedPrefs.getString(
|
||||
Keys.KEY_LIBRARY_DISPLAY_MODE,
|
||||
@@ -264,7 +264,7 @@ class SettingsManager private constructor(context: Context) :
|
||||
interface Callback {
|
||||
fun onColorizeNotifUpdate(doColorize: Boolean) {}
|
||||
fun onNotifActionUpdate(useAltAction: Boolean) {}
|
||||
fun onLibDisplayModeUpdate(displayMode: org.oxycblt.auxio.recycler.DisplayMode) {}
|
||||
fun onLibDisplayModeUpdate(displayMode: DisplayMode) {}
|
||||
fun onShowCoverUpdate(showCovers: Boolean) {}
|
||||
fun onQualityCoverUpdate(doQualityCovers: Boolean) {}
|
||||
}
|
||||
|
||||
@@ -8,9 +8,6 @@ class BlacklistViewModel : ViewModel() {
|
||||
private val mPaths = MutableLiveData(mutableListOf<String>())
|
||||
val paths: LiveData<MutableList<String>> get() = mPaths
|
||||
|
||||
var modified = false
|
||||
private set
|
||||
|
||||
fun addPath(path: String) {
|
||||
if (mPaths.value!!.contains(path)) {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user