Minor improvements
Fix some more blacklist UI issues alongside some problems with formatting/audio focus.
This commit is contained in:
parent
632e39f2e2
commit
787212ee59
8 changed files with 39 additions and 31 deletions
|
|
@ -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.
|
* @return Whether this file has been added to the database or not.
|
||||||
*/
|
*/
|
||||||
fun addPath(file: File): Boolean {
|
fun addPath(file: File): Boolean {
|
||||||
val path = file.mediaStorePath
|
assertBackgroundThread()
|
||||||
|
|
||||||
|
val path = file.canonicalPathSafe
|
||||||
|
|
||||||
logD("Adding path $path to blacklist")
|
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.
|
* Remove a [File] from this blacklist.
|
||||||
*/
|
*/
|
||||||
fun removePath(file: File) {
|
fun removePath(file: File) {
|
||||||
|
assertBackgroundThread()
|
||||||
|
|
||||||
writableDatabase.execute {
|
writableDatabase.execute {
|
||||||
delete(TABLE_NAME, "$COLUMN_PATH=?", arrayOf(file.mediaStorePath))
|
delete(TABLE_NAME, "$COLUMN_PATH=?", arrayOf(file.canonicalPathSafe))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getPaths(): List<String> {
|
fun getPaths(): List<String> {
|
||||||
|
assertBackgroundThread()
|
||||||
|
|
||||||
val paths = mutableListOf<String>()
|
val paths = mutableListOf<String>()
|
||||||
|
|
||||||
readableDatabase.queryAll(TABLE_NAME) { cursor ->
|
readableDatabase.queryAll(TABLE_NAME) { cursor ->
|
||||||
|
|
@ -83,7 +89,7 @@ class BlacklistDatabase(context: Context) : SQLiteOpenHelper(context, DB_NAME, n
|
||||||
return exists ?: false
|
return exists ?: false
|
||||||
}
|
}
|
||||||
|
|
||||||
private val File.mediaStorePath: String get() {
|
private val File.canonicalPathSafe: String get() {
|
||||||
return try {
|
return try {
|
||||||
canonicalPath
|
canonicalPath
|
||||||
} catch (e: IOException) {
|
} catch (e: IOException) {
|
||||||
|
|
|
||||||
|
|
@ -464,7 +464,6 @@ class PlaybackStateManager private constructor() {
|
||||||
* Generate a new shuffled queue.
|
* Generate a new shuffled queue.
|
||||||
* @param keepSong Whether the current song should be kept as the queue is shuffled
|
* @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
|
* @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) {
|
private fun genShuffle(keepSong: Boolean, useLastSong: Boolean) {
|
||||||
val lastSong = if (useLastSong) mQueue[0] else mSong
|
val lastSong = if (useLastSong) mQueue[0] else mSong
|
||||||
|
|
|
||||||
|
|
@ -71,8 +71,11 @@ class AudioReactor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onLossTransient() {
|
private fun onLossTransient() {
|
||||||
pauseWasTransient = true
|
// Since this loss is only temporary, mark it as such if we had to pause playback.
|
||||||
playbackManager.setPlaying(false)
|
if (playbackManager.isPlaying) {
|
||||||
|
pauseWasTransient = true
|
||||||
|
playbackManager.setPlaying(false)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onLossPermanent() {
|
private fun onLossPermanent() {
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ class SettingsManager private constructor(context: Context) :
|
||||||
get() = sharedPrefs.getBoolean(Keys.KEY_USE_ALT_NOTIFICATION_ACTION, false)
|
get() = sharedPrefs.getBoolean(Keys.KEY_USE_ALT_NOTIFICATION_ACTION, false)
|
||||||
|
|
||||||
/** What to display on the library. */
|
/** What to display on the library. */
|
||||||
val libraryDisplayMode: org.oxycblt.auxio.recycler.DisplayMode
|
val libraryDisplayMode: DisplayMode
|
||||||
get() = DisplayMode.valueOfOrFallback(
|
get() = DisplayMode.valueOfOrFallback(
|
||||||
sharedPrefs.getString(
|
sharedPrefs.getString(
|
||||||
Keys.KEY_LIBRARY_DISPLAY_MODE,
|
Keys.KEY_LIBRARY_DISPLAY_MODE,
|
||||||
|
|
@ -264,7 +264,7 @@ class SettingsManager private constructor(context: Context) :
|
||||||
interface Callback {
|
interface Callback {
|
||||||
fun onColorizeNotifUpdate(doColorize: Boolean) {}
|
fun onColorizeNotifUpdate(doColorize: Boolean) {}
|
||||||
fun onNotifActionUpdate(useAltAction: Boolean) {}
|
fun onNotifActionUpdate(useAltAction: Boolean) {}
|
||||||
fun onLibDisplayModeUpdate(displayMode: org.oxycblt.auxio.recycler.DisplayMode) {}
|
fun onLibDisplayModeUpdate(displayMode: DisplayMode) {}
|
||||||
fun onShowCoverUpdate(showCovers: Boolean) {}
|
fun onShowCoverUpdate(showCovers: Boolean) {}
|
||||||
fun onQualityCoverUpdate(doQualityCovers: Boolean) {}
|
fun onQualityCoverUpdate(doQualityCovers: Boolean) {}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,6 @@ class BlacklistViewModel : ViewModel() {
|
||||||
private val mPaths = MutableLiveData(mutableListOf<String>())
|
private val mPaths = MutableLiveData(mutableListOf<String>())
|
||||||
val paths: LiveData<MutableList<String>> get() = mPaths
|
val paths: LiveData<MutableList<String>> get() = mPaths
|
||||||
|
|
||||||
var modified = false
|
|
||||||
private set
|
|
||||||
|
|
||||||
fun addPath(path: String) {
|
fun addPath(path: String) {
|
||||||
if (mPaths.value!!.contains(path)) {
|
if (mPaths.value!!.contains(path)) {
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -1,25 +1,26 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<layout xmlns:tools="http://schemas.android.com/tools"
|
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@color/background"
|
android:background="@color/background"
|
||||||
android:theme="@style/Theme.Neutral"
|
android:orientation="vertical"
|
||||||
android:paddingBottom="@dimen/margin_medium"
|
android:paddingBottom="@dimen/margin_medium"
|
||||||
android:orientation="vertical">
|
android:theme="@style/Theme.Neutral">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/blacklist_header"
|
android:id="@+id/blacklist_header"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:fontFamily="@font/inter_exbold"
|
android:fontFamily="@font/inter_exbold"
|
||||||
android:textColor="?attr/colorPrimary"
|
android:textAlignment="viewStart"
|
||||||
android:text="@string/setting_content_blacklist"
|
|
||||||
android:textSize="@dimen/text_size_toolbar_header"
|
|
||||||
android:padding="@dimen/padding_medium"
|
android:padding="@dimen/padding_medium"
|
||||||
|
android:text="@string/setting_content_blacklist"
|
||||||
|
android:textColor="?attr/colorPrimary"
|
||||||
|
android:textSize="@dimen/text_size_toolbar_header"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
|
@ -28,19 +29,19 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:overScrollMode="never"
|
android:overScrollMode="never"
|
||||||
tools:itemCount="1"
|
|
||||||
tools:listitem="@layout/item_blacklist_entry"
|
|
||||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/blacklist_header" />
|
app:layout_constraintTop_toBottomOf="@+id/blacklist_header"
|
||||||
|
tools:itemCount="1"
|
||||||
|
tools:listitem="@layout/item_blacklist_entry" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/blacklist_empty_text"
|
android:id="@+id/blacklist_empty_text"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:fontFamily="@font/inter_semibold"
|
android:fontFamily="@font/inter_semibold"
|
||||||
android:textAlignment="center"
|
android:padding="@dimen/padding_medium"
|
||||||
android:padding="16dp"
|
|
||||||
android:text="@string/label_empty_blacklist"
|
android:text="@string/label_empty_blacklist"
|
||||||
|
android:textAlignment="center"
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||||
android:textColor="?android:attr/textColorSecondary"
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/blacklist_recycler" />
|
app:layout_constraintTop_toBottomOf="@+id/blacklist_recycler" />
|
||||||
|
|
@ -65,8 +66,8 @@
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/blacklist_add"
|
android:id="@+id/blacklist_add"
|
||||||
style="@style/Widget.Button.Dialog"
|
style="@style/Widget.Button.Dialog"
|
||||||
android:layout_marginTop="@dimen/margin_medium"
|
|
||||||
android:layout_marginStart="@dimen/margin_medium"
|
android:layout_marginStart="@dimen/margin_medium"
|
||||||
|
android:layout_marginTop="@dimen/margin_medium"
|
||||||
android:text="@string/label_add"
|
android:text="@string/label_add"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/blacklist_empty_text" />
|
app:layout_constraintTop_toBottomOf="@+id/blacklist_empty_text" />
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,8 @@
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:animateLayoutChanges="true"
|
android:animateLayoutChanges="true"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:padding="@dimen/padding_small"
|
android:orientation="vertical"
|
||||||
android:orientation="vertical">
|
android:padding="@dimen/padding_small">
|
||||||
|
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
android:id="@+id/loading_circle"
|
android:id="@+id/loading_circle"
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,8 @@
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout style="@style/ItemSurroundings"
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
style="@style/ItemSurroundings"
|
||||||
android:clickable="false"
|
android:clickable="false"
|
||||||
android:focusable="false">
|
android:focusable="false">
|
||||||
|
|
||||||
|
|
@ -11,7 +12,10 @@
|
||||||
android:id="@+id/blacklist_title"
|
android:id="@+id/blacklist_title"
|
||||||
style="@style/ItemText.Primary"
|
style="@style/ItemText.Primary"
|
||||||
android:layout_marginStart="0dp"
|
android:layout_marginStart="0dp"
|
||||||
|
android:layout_marginEnd="@dimen/margin_medium"
|
||||||
|
android:maxLines="@null"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/blacklist_clear"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
tools:text="/storage/emulated/0/directory" />
|
tools:text="/storage/emulated/0/directory" />
|
||||||
|
|
@ -21,13 +25,11 @@
|
||||||
style="@style/Widget.Button.Unbounded"
|
style="@style/Widget.Button.Unbounded"
|
||||||
android:layout_width="@dimen/size_clear"
|
android:layout_width="@dimen/size_clear"
|
||||||
android:layout_height="@dimen/size_clear"
|
android:layout_height="@dimen/size_clear"
|
||||||
android:src="@drawable/ic_clear"
|
|
||||||
android:contentDescription="@string/description_blacklist_delete"
|
android:contentDescription="@string/description_blacklist_delete"
|
||||||
|
android:src="@drawable/ic_clear"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
|
||||||
</layout>
|
</layout>
|
||||||
Loading…
Reference in a new issue