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
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
13 changed files with 15 additions and 39 deletions

View file

@ -94,7 +94,7 @@ dependencies {
implementation "com.google.android.exoplayer:exoplayer-core:2.14.2" implementation "com.google.android.exoplayer:exoplayer-core:2.14.2"
// Image loading // Image loading
implementation 'io.coil-kt:coil:1.3.0' implementation 'io.coil-kt:coil:1.3.1'
// Material // Material
implementation "com.google.android.material:material:1.4.0" implementation "com.google.android.material:material:1.4.0"
@ -102,7 +102,7 @@ dependencies {
// --- DEBUG --- // --- DEBUG ---
// Lint // Lint
ktlint 'com.pinterest:ktlint:0.41.0' ktlint 'com.pinterest:ktlint:0.42.0'
// Memory Leak checking // Memory Leak checking
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.7' debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.7'

View file

@ -1,5 +1,6 @@
package org.oxycblt.auxio.music package org.oxycblt.auxio.music
import android.annotation.SuppressLint
import android.content.ContentResolver import android.content.ContentResolver
import android.content.Context import android.content.Context
import android.net.Uri import android.net.Uri
@ -90,6 +91,9 @@ class MusicStore private constructor() {
cur?.use { cursor -> cur?.use { cursor ->
cursor.moveToFirst() cursor.moveToFirst()
// Make studio shut up about "invalid ranges" that don't exist
@SuppressLint("Range")
val fileName = cursor.getString(cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME)) val fileName = cursor.getString(cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME))
return songs.find { it.fileName == fileName } return songs.find { it.fileName == fileName }

View file

@ -3,7 +3,6 @@ package org.oxycblt.auxio.playback.system
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.app.NotificationChannel import android.app.NotificationChannel
import android.app.NotificationManager import android.app.NotificationManager
import android.app.PendingIntent
import android.content.Context import android.content.Context
import android.os.Build import android.os.Build
import android.support.v4.media.session.MediaSessionCompat import android.support.v4.media.session.MediaSessionCompat
@ -29,10 +28,6 @@ class PlaybackNotification private constructor(
context: Context, context: Context,
mediaToken: MediaSessionCompat.Token mediaToken: MediaSessionCompat.Token
) : NotificationCompat.Builder(context, CHANNEL_ID), PlaybackStateManager.Callback { ) : 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 { init {
setSmallIcon(R.drawable.ic_song) setSmallIcon(R.drawable.ic_song)
setCategory(NotificationCompat.CATEGORY_SERVICE) setCategory(NotificationCompat.CATEGORY_SERVICE)

View file

@ -97,7 +97,7 @@ class SettingsManager private constructor(context: Context) :
val rewindWithPrev: Boolean val rewindWithPrev: Boolean
get() = sharedPrefs.getBoolean(KEY_PREV_REWIND, true) 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 val pauseOnLoop: Boolean
get() = sharedPrefs.getBoolean(KEY_LOOP_PAUSE, false) get() = sharedPrefs.getBoolean(KEY_LOOP_PAUSE, false)

View file

@ -1,5 +1,6 @@
package org.oxycblt.auxio.settings.blacklist package org.oxycblt.auxio.settings.blacklist
import android.annotation.SuppressLint
import android.view.ViewGroup import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import org.oxycblt.auxio.databinding.ItemBlacklistEntryBinding import org.oxycblt.auxio.databinding.ItemBlacklistEntryBinding
@ -24,9 +25,10 @@ class BlacklistEntryAdapter(
holder.bind(paths[position]) holder.bind(paths[position])
} }
@SuppressLint("NotifyDataSetChanged")
fun submitList(newPaths: MutableList<String>) { fun submitList(newPaths: MutableList<String>) {
paths = newPaths paths = newPaths
notifyDataSetChanged() notifyDataSetChanged() // TODO: Consider using remote/addition
} }
inner class ViewHolder( inner class ViewHolder(

View file

@ -1,11 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:alpha="0.3"
android:tint="?attr/colorPrimary"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M12 3v10.55C11.41 13.21 10.73 13 10 13c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4V7h4V3h-6z" />
</vector>

View file

@ -4,7 +4,6 @@
android:id="@android:id/background" android:id="@android:id/background"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?android:attr/colorBackground"
android:orientation="vertical" android:orientation="vertical"
android:theme="@style/Theme.Widget"> android:theme="@style/Theme.Widget">
@ -13,12 +12,12 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/colorSurface"
android:scaleType="centerCrop" android:scaleType="centerCrop"
tools:ignore="contentDescription" tools:ignore="contentDescription"
tools:src="@drawable/ic_song" /> tools:src="@drawable/ic_song" />
<android.widget.LinearLayout <android.widget.LinearLayout
android:id="@+id/widget_meta"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom" android:layout_gravity="bottom"

View file

@ -3,11 +3,9 @@
android:id="@android:id/background" android:id="@android:id/background"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?android:attr/colorBackground"
android:theme="@style/Theme.Widget"> android:theme="@style/Theme.Widget">
<android.widget.ImageView <android.widget.ImageView
android:id="@+id/widget_icon"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:alpha="0.3" android:alpha="0.3"
@ -16,7 +14,6 @@
android:src="@drawable/ic_song" /> android:src="@drawable/ic_song" />
<android.widget.TextView <android.widget.TextView
android:id="@+id/widget_msg"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"

View file

@ -4,7 +4,6 @@
android:id="@android:id/background" android:id="@android:id/background"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?android:attr/colorBackground"
android:orientation="vertical" android:orientation="vertical"
android:theme="@style/Theme.Widget"> android:theme="@style/Theme.Widget">
@ -13,12 +12,12 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/colorSurface"
android:scaleType="centerCrop" android:scaleType="centerCrop"
tools:ignore="contentDescription" tools:ignore="contentDescription"
tools:src="@drawable/ic_song" /> tools:src="@drawable/ic_song" />
<android.widget.LinearLayout <android.widget.LinearLayout
android:id="@+id/widget_meta"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom" android:layout_gravity="bottom"

View file

@ -34,7 +34,7 @@
<string name="label_queue">Cola</string> <string name="label_queue">Cola</string>
<string name="label_queue_add">Agregar a la cola</string> <string name="label_queue_add">Agregar a la cola</string>
<string name="label_queue_added">Agregada a la cola</string> <string name="label_queue_added">Agregada a la cola</string>
<string name="label_next_user_queue">A continuación...</string> <string name="label_next_user_queue">A continuación</string>
<string name="label_go_artist">Ir al artista</string> <string name="label_go_artist">Ir al artista</string>
<string name="label_go_album">Ir al álbum</string> <string name="label_go_album">Ir al álbum</string>
@ -103,7 +103,7 @@
<string name="error_bad_dir">Este directorio no es compatible</string> <string name="error_bad_dir">Este directorio no es compatible</string>
<!-- Hint Namespace | EditText Hints --> <!-- Hint Namespace | EditText Hints -->
<string name="hint_search_library">Busca en tu biblioteca...</string> <string name="hint_search_library">Busca en tu biblioteca</string>
<!-- Description Namespace | Accessibility Strings --> <!-- Description Namespace | Accessibility Strings -->
<string name="description_sort_button">Cambiar el orden de clasificación</string> <string name="description_sort_button">Cambiar el orden de clasificación</string>

View file

@ -5,9 +5,6 @@
<item name="colorSecondary">?android:attr/colorAccent</item> <item name="colorSecondary">?android:attr/colorAccent</item>
<item name="colorControlNormal">?android:attr/colorControlNormal</item> <item name="colorControlNormal">?android:attr/colorControlNormal</item>
<item name="colorControlHighlight">?android:attr/colorControlHighlight</item> <item name="colorControlHighlight">?android:attr/colorControlHighlight</item>
<item name="colorSurface">?android:attr/colorBackground</item>
<item name="colorSurface">@color/surface_color</item>
<item name="android:windowBackground">?attr/colorSurface</item>
<item name="android:colorBackground">?attr/colorSurface</item>
</style> </style>
</resources> </resources>

View file

@ -4,11 +4,6 @@
<color name="surface_night">#ff151515</color> <color name="surface_night">#ff151515</color>
<color name="surface_black">#ff000000</color> <color name="surface_black">#ff000000</color>
<color name="text_primary_day">#ff000000</color>
<color name="text_secondary_day">#ff323232</color>
<color name="text_primary_night">#ffffffff</color>
<color name="text_secondary_night">#ffbebebe</color>
<color name="surface_color">@color/surface_day</color> <color name="surface_color">@color/surface_day</color>
<color name="selection_color">#cbcbcb</color> <color name="selection_color">#cbcbcb</color>
<color name="control_color">#202020</color> <color name="control_color">#202020</color>

View file

@ -12,7 +12,6 @@
<!-- Height Namespace | Height for UI elements --> <!-- Height Namespace | Height for UI elements -->
<dimen name="height_compact_progress">2dp</dimen> <dimen name="height_compact_progress">2dp</dimen>
<dimen name="height_minimal_btn">28dp</dimen>
<!-- Width Namespace | Width for UI elements --> <!-- Width Namespace | Width for UI elements -->
<dimen name="width_track_number">32dp</dimen> <dimen name="width_track_number">32dp</dimen>