all: minor cleanup
Do some minor cleanup before the next release.
This commit is contained in:
parent
7b5c49a5b3
commit
3293637cfd
4 changed files with 24 additions and 7 deletions
|
@ -30,8 +30,11 @@ import org.oxycblt.auxio.coil.MusicKeyer
|
|||
import org.oxycblt.auxio.settings.SettingsManager
|
||||
|
||||
/**
|
||||
* TODO: Phase out databinding
|
||||
* TODO: Rework sealed classes to minimize whens and maximize overrides
|
||||
* TODO: Plan for a general UI rework
|
||||
* - Refactor fragment class
|
||||
* - Remove databinding and dedup layouts
|
||||
* - Rework RecyclerView management and item dragging
|
||||
* - Rework sealed classes to minimize whens and maximize overrides
|
||||
*/
|
||||
@Suppress("UNUSED")
|
||||
class AuxioApp : Application(), ImageLoaderFactory {
|
||||
|
|
|
@ -130,6 +130,8 @@ class MusicLoader {
|
|||
args += "$path%" // Append % so that the selector properly detects children
|
||||
}
|
||||
|
||||
// TODO: Move all references to contentResolver into a single variable so we can
|
||||
// avoid accidentally removing the applicationContext fix
|
||||
context.applicationContext.contentResolver.query(
|
||||
MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,
|
||||
arrayOf(
|
||||
|
@ -142,7 +144,7 @@ class MusicLoader {
|
|||
MediaStore.Audio.AudioColumns.ALBUM,
|
||||
MediaStore.Audio.AudioColumns.ALBUM_ID,
|
||||
MediaStore.Audio.AudioColumns.ARTIST,
|
||||
MediaStore.Audio.AudioColumns.ALBUM_ARTIST,
|
||||
AUDIO_COLUMN_ALBUM_ARTIST
|
||||
),
|
||||
selector, args.toTypedArray(), null
|
||||
)?.use { cursor ->
|
||||
|
@ -155,7 +157,7 @@ class MusicLoader {
|
|||
val albumIndex = cursor.getColumnIndexOrThrow(MediaStore.Audio.AudioColumns.ALBUM)
|
||||
val albumIdIndex = cursor.getColumnIndexOrThrow(MediaStore.Audio.AudioColumns.ALBUM_ID)
|
||||
val artistIndex = cursor.getColumnIndexOrThrow(MediaStore.Audio.AudioColumns.ARTIST)
|
||||
val albumArtistIndex = cursor.getColumnIndexOrThrow(MediaStore.Audio.AudioColumns.ALBUM_ARTIST)
|
||||
val albumArtistIndex = cursor.getColumnIndexOrThrow(AUDIO_COLUMN_ALBUM_ARTIST)
|
||||
|
||||
while (cursor.moveToNext()) {
|
||||
val id = cursor.getLong(idIndex)
|
||||
|
@ -412,6 +414,15 @@ class MusicLoader {
|
|||
}
|
||||
|
||||
companion object {
|
||||
/**
|
||||
* The album_artist MediaStore field has existed since at least API 21, but until API
|
||||
* 30 it was a proprietary extension for Google Play Music and was not documented.
|
||||
* Since this field probably works on all versions Auxio supports, we suppress the
|
||||
* warning about using a possibly-unsupported constant.
|
||||
*/
|
||||
@Suppress("InlinedApi")
|
||||
const val AUDIO_COLUMN_ALBUM_ARTIST = MediaStore.Audio.AudioColumns.ALBUM_ARTIST
|
||||
|
||||
/**
|
||||
* A complete array of all the hardcoded genre values for ID3(v2), contains standard genres and
|
||||
* winamp extensions.
|
||||
|
|
|
@ -21,7 +21,7 @@ import org.oxycblt.auxio.util.getDrawableSafe
|
|||
*
|
||||
* This view also enables use of an "indicator", which is a dot that can denote when a
|
||||
* button is active. This is useful for the shuffle/loop buttons, as at times highlighting
|
||||
* them is not enough to
|
||||
* them is not enough to differentiate them.
|
||||
*/
|
||||
class PlaybackButton @JvmOverloads constructor(
|
||||
context: Context,
|
||||
|
@ -73,6 +73,7 @@ class PlaybackButton @JvmOverloads constructor(
|
|||
}
|
||||
}
|
||||
|
||||
// Put the indicator right below the icon.
|
||||
val x = (measuredWidth - indicatorDrawable.intrinsicWidth) / 2
|
||||
val y = ((measuredHeight - iconSize) / 2) + iconSize
|
||||
|
||||
|
@ -81,9 +82,11 @@ class PlaybackButton @JvmOverloads constructor(
|
|||
)
|
||||
}
|
||||
|
||||
override fun onDrawForeground(canvas: Canvas) {
|
||||
super.onDrawForeground(canvas)
|
||||
override fun onDraw(canvas: Canvas) {
|
||||
super.onDraw(canvas)
|
||||
|
||||
// I would use onDrawForeground but apparently that isn't called by Lollipop devices.
|
||||
// This is not referenced in the documentation at all.
|
||||
if (hasIndicator && isActivated) {
|
||||
indicatorDrawable.draw(canvas)
|
||||
}
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 268 KiB After Width: | Height: | Size: 266 KiB |
Loading…
Reference in a new issue