all: cleanup code

Cleanup unused resources and fix some code issues here and there.
This commit is contained in:
OxygenCobalt
2021-08-03 09:39:14 -06:00
parent d3e738b973
commit 8551e90884
13 changed files with 15 additions and 39 deletions
@@ -1,5 +1,6 @@
package org.oxycblt.auxio.music
import android.annotation.SuppressLint
import android.content.ContentResolver
import android.content.Context
import android.net.Uri
@@ -90,6 +91,9 @@ class MusicStore private constructor() {
cur?.use { cursor ->
cursor.moveToFirst()
// Make studio shut up about "invalid ranges" that don't exist
@SuppressLint("Range")
val fileName = cursor.getString(cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME))
return songs.find { it.fileName == fileName }
@@ -3,7 +3,6 @@ package org.oxycblt.auxio.playback.system
import android.annotation.SuppressLint
import android.app.NotificationChannel
import android.app.NotificationManager
import android.app.PendingIntent
import android.content.Context
import android.os.Build
import android.support.v4.media.session.MediaSessionCompat
@@ -29,10 +28,6 @@ class PlaybackNotification private constructor(
context: Context,
mediaToken: MediaSessionCompat.Token
) : NotificationCompat.Builder(context, CHANNEL_ID), PlaybackStateManager.Callback {
private val pendingIntentFlags = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
PendingIntent.FLAG_IMMUTABLE
else 0
init {
setSmallIcon(R.drawable.ic_song)
setCategory(NotificationCompat.CATEGORY_SERVICE)
@@ -97,7 +97,7 @@ class SettingsManager private constructor(context: Context) :
val rewindWithPrev: Boolean
get() = sharedPrefs.getBoolean(KEY_PREV_REWIND, true)
/** Whether [LoopMode.TRACK] should pause when the track repeats */
/** Whether [org.oxycblt.auxio.playback.state.LoopMode.TRACK] should pause when the track repeats */
val pauseOnLoop: Boolean
get() = sharedPrefs.getBoolean(KEY_LOOP_PAUSE, false)
@@ -1,5 +1,6 @@
package org.oxycblt.auxio.settings.blacklist
import android.annotation.SuppressLint
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import org.oxycblt.auxio.databinding.ItemBlacklistEntryBinding
@@ -24,9 +25,10 @@ class BlacklistEntryAdapter(
holder.bind(paths[position])
}
@SuppressLint("NotifyDataSetChanged")
fun submitList(newPaths: MutableList<String>) {
paths = newPaths
notifyDataSetChanged()
notifyDataSetChanged() // TODO: Consider using remote/addition
}
inner class ViewHolder(