all: fix sloppy code
Fix some dumb and sloppy code that I made in the rush to complete 2.2.0.
This commit is contained in:
parent
245e0f5dc1
commit
4a326cc4ff
4 changed files with 11 additions and 18 deletions
|
@ -1,11 +1,12 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
## dev [v2.2.1 or v2.3.0]
|
## dev [v2.2.1 or v2.3.0]
|
||||||
|
- Updated chinese translations [courtesy of cccClyde]
|
||||||
|
|
||||||
## v2.2.0
|
## v2.2.0
|
||||||
#### What's New:
|
#### What's New:
|
||||||
- Added arabic translations [courtesy of hasanpasha]
|
- Added Arabic translations [Courtesy of hasanpasha]
|
||||||
- Better russian translations [courtesy of lisiczka43]
|
- Improved Russian translations [Courtesy of lisiczka43]
|
||||||
- Added option to reload the music library
|
- Added option to reload the music library
|
||||||
|
|
||||||
#### What's Improved:
|
#### What's Improved:
|
||||||
|
@ -18,9 +19,10 @@ artist they are grouped up in
|
||||||
|
|
||||||
#### What's Fixed:
|
#### What's Fixed:
|
||||||
- Fixed crash on some devices configured to use French or Czech translations
|
- Fixed crash on some devices configured to use French or Czech translations
|
||||||
- Malformed indicies should now be corrected when the playback state is restored
|
- Malformed indices should now be corrected when the playback state is restored
|
||||||
- Fixed issue where track numbers would not be shown in the native language's numeric format
|
- Fixed issue where track numbers would not be shown in the native language's numeric format
|
||||||
- Fixed issue where the preference view would apply the M3 switches inconsistently
|
- Fixed issue where the preference view would apply the M3 switches inconsistently
|
||||||
|
- Fixed issue where the now playing indicator on the playback screen would use an internal name
|
||||||
|
|
||||||
#### Dev/Meta:
|
#### Dev/Meta:
|
||||||
- Removed 1.4.X compat
|
- Removed 1.4.X compat
|
||||||
|
|
|
@ -72,7 +72,6 @@ import java.lang.Exception
|
||||||
*
|
*
|
||||||
* @author OxygenCobalt
|
* @author OxygenCobalt
|
||||||
*/
|
*/
|
||||||
@Suppress("InlinedApi")
|
|
||||||
class MusicLoader {
|
class MusicLoader {
|
||||||
data class Library(
|
data class Library(
|
||||||
val genres: List<Genre>,
|
val genres: List<Genre>,
|
||||||
|
@ -107,6 +106,7 @@ class MusicLoader {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("InlinedApi")
|
||||||
private fun loadSongs(context: Context): List<Song> {
|
private fun loadSongs(context: Context): List<Song> {
|
||||||
var songs = mutableListOf<Song>()
|
var songs = mutableListOf<Song>()
|
||||||
val blacklistDatabase = ExcludedDatabase.getInstance(context)
|
val blacklistDatabase = ExcludedDatabase.getInstance(context)
|
||||||
|
@ -285,7 +285,7 @@ class MusicLoader {
|
||||||
private fun readGenres(context: Context, songs: List<Song>): List<Genre> {
|
private fun readGenres(context: Context, songs: List<Song>): List<Genre> {
|
||||||
val genres = mutableListOf<Genre>()
|
val genres = mutableListOf<Genre>()
|
||||||
|
|
||||||
val genreCursor = context.contentResolver.query(
|
val genreCursor = context.applicationContext.contentResolver.query(
|
||||||
MediaStore.Audio.Genres.EXTERNAL_CONTENT_URI,
|
MediaStore.Audio.Genres.EXTERNAL_CONTENT_URI,
|
||||||
arrayOf(
|
arrayOf(
|
||||||
MediaStore.Audio.Genres._ID,
|
MediaStore.Audio.Genres._ID,
|
||||||
|
@ -338,7 +338,7 @@ class MusicLoader {
|
||||||
val genreSongs = mutableListOf<Song>()
|
val genreSongs = mutableListOf<Song>()
|
||||||
|
|
||||||
// Don't even bother blacklisting here as useless iterations are less expensive than IO
|
// Don't even bother blacklisting here as useless iterations are less expensive than IO
|
||||||
val songCursor = context.contentResolver.query(
|
val songCursor = context.applicationContext.contentResolver.query(
|
||||||
MediaStore.Audio.Genres.Members.getContentUri("external", genreId),
|
MediaStore.Audio.Genres.Members.getContentUri("external", genreId),
|
||||||
arrayOf(MediaStore.Audio.Genres.Members._ID),
|
arrayOf(MediaStore.Audio.Genres.Members._ID),
|
||||||
null, null, null
|
null, null, null
|
||||||
|
@ -356,7 +356,7 @@ class MusicLoader {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Some genres might be empty due to MediaStore empty.
|
// Some genres might be empty due to MediaStore insanity.
|
||||||
// If that is the case, we drop them.
|
// If that is the case, we drop them.
|
||||||
return genreSongs.ifEmpty { null }
|
return genreSongs.ifEmpty { null }
|
||||||
}
|
}
|
||||||
|
|
|
@ -519,8 +519,6 @@ class PlaybackStateManager private constructor() {
|
||||||
|
|
||||||
val database = PlaybackStateDatabase.getInstance(context)
|
val database = PlaybackStateDatabase.getInstance(context)
|
||||||
|
|
||||||
logD("$mPlaybackMode")
|
|
||||||
|
|
||||||
database.writeState(
|
database.writeState(
|
||||||
PlaybackStateDatabase.SavedState(
|
PlaybackStateDatabase.SavedState(
|
||||||
mSong, mPosition, mParent, mIndex,
|
mSong, mPosition, mParent, mIndex,
|
||||||
|
@ -595,14 +593,6 @@ class PlaybackStateManager private constructor() {
|
||||||
|
|
||||||
private fun unpackQueue(queue: MutableList<Song>) {
|
private fun unpackQueue(queue: MutableList<Song>) {
|
||||||
mQueue = queue
|
mQueue = queue
|
||||||
|
|
||||||
// Sanity check: Ensure that the
|
|
||||||
mSong?.let { song ->
|
|
||||||
while (mQueue.getOrNull(mIndex) != song) {
|
|
||||||
mIndex--
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pushQueueUpdate()
|
pushQueueUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -633,6 +623,7 @@ class PlaybackStateManager private constructor() {
|
||||||
if (correctedIndex > -1) {
|
if (correctedIndex > -1) {
|
||||||
logD("Correcting malformed index to $correctedIndex")
|
logD("Correcting malformed index to $correctedIndex")
|
||||||
mIndex = correctedIndex
|
mIndex = correctedIndex
|
||||||
|
pushQueueUpdate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -177,7 +177,7 @@
|
||||||
</plurals>
|
</plurals>
|
||||||
|
|
||||||
<plurals name="fmt_album_count">
|
<plurals name="fmt_album_count">
|
||||||
<item quantity="zero">ألبومات d%</item>
|
<item quantity="zero">%d ألبومات</item>
|
||||||
<item quantity="one">%d البوم</item>
|
<item quantity="one">%d البوم</item>
|
||||||
<item quantity="two">%d ألبومات</item>
|
<item quantity="two">%d ألبومات</item>
|
||||||
<item quantity="few">%d ألبومات</item>
|
<item quantity="few">%d ألبومات</item>
|
||||||
|
|
Loading…
Reference in a new issue