couple tweaks here and there
This commit is contained in:
parent
219cb6fcdc
commit
662660de0a
7 changed files with 25 additions and 52 deletions
|
@ -83,29 +83,15 @@ class MainActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListener {
|
|||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
return when (item.itemId) {
|
||||
R.id.sort -> {
|
||||
showSortingDialog()
|
||||
true
|
||||
}
|
||||
R.id.toggle_shuffle -> {
|
||||
toggleShuffle()
|
||||
true
|
||||
}
|
||||
R.id.toggle_song_repetition -> {
|
||||
toggleSongRepetition()
|
||||
true
|
||||
}
|
||||
R.id.settings -> {
|
||||
launchSettings()
|
||||
true
|
||||
}
|
||||
R.id.about -> {
|
||||
launchAbout()
|
||||
true
|
||||
}
|
||||
else -> super.onOptionsItemSelected(item)
|
||||
when (item.itemId) {
|
||||
R.id.sort -> showSortingDialog()
|
||||
R.id.toggle_shuffle -> toggleShuffle()
|
||||
R.id.toggle_song_repetition -> toggleSongRepetition()
|
||||
R.id.settings -> launchSettings()
|
||||
R.id.about -> launchAbout()
|
||||
else -> return super.onOptionsItemSelected(item)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<String>, grantResults: IntArray) {
|
||||
|
|
|
@ -91,7 +91,7 @@ class WidgetConfigureActivity : AppCompatActivity() {
|
|||
}
|
||||
|
||||
fun pickBackgroundColor() {
|
||||
val dialog = AmbilWarnaDialog(this, mBgColorWithoutTransparency, object : AmbilWarnaDialog.OnAmbilWarnaListener {
|
||||
AmbilWarnaDialog(this, mBgColorWithoutTransparency, object : AmbilWarnaDialog.OnAmbilWarnaListener {
|
||||
override fun onCancel(dialog: AmbilWarnaDialog) {
|
||||
}
|
||||
|
||||
|
@ -99,13 +99,11 @@ class WidgetConfigureActivity : AppCompatActivity() {
|
|||
mBgColorWithoutTransparency = color
|
||||
updateBackgroundColor()
|
||||
}
|
||||
})
|
||||
|
||||
dialog.show()
|
||||
}).show()
|
||||
}
|
||||
|
||||
fun pickTextColor() {
|
||||
val dialog = AmbilWarnaDialog(this, mTextColor, object : AmbilWarnaDialog.OnAmbilWarnaListener {
|
||||
AmbilWarnaDialog(this, mTextColor, object : AmbilWarnaDialog.OnAmbilWarnaListener {
|
||||
override fun onCancel(dialog: AmbilWarnaDialog) {
|
||||
}
|
||||
|
||||
|
@ -113,9 +111,7 @@ class WidgetConfigureActivity : AppCompatActivity() {
|
|||
mTextColor = color
|
||||
updateTextColor()
|
||||
}
|
||||
})
|
||||
|
||||
dialog.show()
|
||||
}).show()
|
||||
}
|
||||
|
||||
private fun storeWidgetColors() {
|
||||
|
|
|
@ -48,21 +48,13 @@ class SongAdapter(val activity: SimpleActivity, var songs: ArrayList<Song>, val
|
|||
|
||||
val multiSelectorMode = object : ModalMultiSelectorCallback(multiSelector) {
|
||||
override fun onActionItemClicked(mode: ActionMode, item: MenuItem): Boolean {
|
||||
return when (item.itemId) {
|
||||
R.id.cab_properties -> {
|
||||
showProperties()
|
||||
true
|
||||
}
|
||||
R.id.cab_rename -> {
|
||||
displayEditDialog()
|
||||
true
|
||||
}
|
||||
R.id.cab_delete -> {
|
||||
askConfirmDelete()
|
||||
true
|
||||
}
|
||||
else -> false
|
||||
when (item.itemId) {
|
||||
R.id.cab_properties -> showProperties()
|
||||
R.id.cab_rename -> displayEditDialog()
|
||||
R.id.cab_delete -> askConfirmDelete()
|
||||
else -> return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onCreateActionMode(actionMode: ActionMode?, menu: Menu?): Boolean {
|
||||
|
|
|
@ -22,8 +22,6 @@ val SET_EQUALIZER = PATH + "SET_EQUALIZER"
|
|||
|
||||
// shared preferences
|
||||
val PREFS_KEY = "Music Player"
|
||||
val IS_FIRST_RUN = "is_first_run"
|
||||
val IS_DARK_THEME = "is_dark_theme"
|
||||
val SHUFFLE = "shuffle"
|
||||
val NUMERIC_PROGRESS = "numeric_progress"
|
||||
val SORTING = "track_sorting"
|
||||
|
|
|
@ -215,7 +215,6 @@ class MyWidgetProvider : AppWidgetProvider() {
|
|||
mBus!!.register(this)
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun unregisterBus() {
|
||||
|
@ -223,6 +222,5 @@ class MyWidgetProvider : AppWidgetProvider() {
|
|||
mBus!!.unregister(this)
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import com.simplemobiletools.musicplayer.helpers.SORT_BY_TITLE
|
|||
import com.simplemobiletools.musicplayer.helpers.SORT_DESCENDING
|
||||
import java.io.Serializable
|
||||
|
||||
class Song(val id: Long, var title: String, var artist: String, var path: String, val duration: Int) : Serializable, Comparable<Song> {
|
||||
data class Song(val id: Long, var title: String, var artist: String, var path: String, val duration: Int) : Serializable, Comparable<Song> {
|
||||
companion object {
|
||||
private const val serialVersionUID = 6717978793256842245L
|
||||
var sorting: Int = 0
|
||||
|
@ -35,8 +35,6 @@ class Song(val id: Long, var title: String, var artist: String, var path: String
|
|||
return res
|
||||
}
|
||||
|
||||
override fun toString() = "Song {id=$id, title=$title, artist=$artist, path=$path, duration=$duration}"
|
||||
|
||||
override fun equals(o: Any?): Boolean {
|
||||
return if (this === o)
|
||||
true
|
||||
|
|
|
@ -269,7 +269,12 @@ class MusicService : Service(), MediaPlayer.OnPreparedListener, MediaPlayer.OnEr
|
|||
val rawArt = mediaMetadataRetriever.embeddedPicture
|
||||
if (rawArt != null) {
|
||||
val options = BitmapFactory.Options()
|
||||
return BitmapFactory.decodeByteArray(rawArt, 0, rawArt.size, options)
|
||||
try {
|
||||
val bitmap = BitmapFactory.decodeByteArray(rawArt, 0, rawArt.size, options)
|
||||
if (bitmap != null)
|
||||
return bitmap
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue