Code Cleanup
This commit is contained in:
parent
4b4232ce6b
commit
b143419520
4 changed files with 4 additions and 16 deletions
|
@ -24,8 +24,6 @@ import code.name.monkey.retromusic.extensions.getInt
|
|||
import code.name.monkey.retromusic.extensions.getLong
|
||||
import code.name.monkey.retromusic.extensions.getString
|
||||
import code.name.monkey.retromusic.extensions.getStringOrNull
|
||||
import code.name.monkey.retromusic.model.AbsCustomPlaylist
|
||||
import code.name.monkey.retromusic.model.Playlist
|
||||
import code.name.monkey.retromusic.model.PlaylistSong
|
||||
import code.name.monkey.retromusic.model.Song
|
||||
|
||||
|
@ -35,17 +33,6 @@ import code.name.monkey.retromusic.model.Song
|
|||
|
||||
object PlaylistSongsLoader {
|
||||
|
||||
fun getPlaylistSongList(
|
||||
context: Context,
|
||||
playlist: Playlist
|
||||
): List<Song> {
|
||||
return if (playlist is AbsCustomPlaylist) {
|
||||
return playlist.songs()
|
||||
} else {
|
||||
getPlaylistSongList(context, playlist.id)
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun getPlaylistSongList(context: Context, playlistId: Long): List<Song> {
|
||||
val songs = mutableListOf<Song>()
|
||||
|
|
|
@ -88,7 +88,6 @@ class CalendarUtil {
|
|||
// Today + rest of this month + previous months until January
|
||||
var elapsed = elapsedMonth
|
||||
var month = calendar[Calendar.MONTH] - 1
|
||||
val year = calendar[Calendar.YEAR]
|
||||
while (month > Calendar.JANUARY) {
|
||||
elapsed += getDaysInMonth(month) * MS_PER_DAY
|
||||
month--
|
||||
|
|
|
@ -16,6 +16,7 @@ package code.name.monkey.retromusic.volume
|
|||
import android.content.Context
|
||||
import android.media.AudioManager
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.provider.Settings
|
||||
import androidx.core.content.getSystemService
|
||||
|
||||
|
@ -25,7 +26,7 @@ class AudioVolumeObserver(private val context: Context) {
|
|||
private var contentObserver: AudioVolumeContentObserver? = null
|
||||
|
||||
fun register(audioStreamType: Int, listener: OnAudioVolumeChangedListener) {
|
||||
val handler = Handler()
|
||||
val handler = Handler(Looper.getMainLooper())
|
||||
// with this handler AudioVolumeContentObserver#onChange()
|
||||
// will be executed in the main thread
|
||||
// To execute in another thread you can use a Looper
|
||||
|
|
|
@ -2,6 +2,7 @@ package code.name.monkey.appthemehelper
|
|||
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
|
||||
/**
|
||||
|
@ -30,6 +31,6 @@ open class ATHActivity : AppCompatActivity() {
|
|||
fun postRecreate() {
|
||||
// hack to prevent java.lang.RuntimeException: Performing pause of activity that is not resumed
|
||||
// makes sure recreate() is called right after and not in onResume()
|
||||
Handler().post { recreate() }
|
||||
Handler(Looper.getMainLooper()).post { recreate() }
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue