Fixed queue reset when a song is clicked in Playing queue fragment

This commit is contained in:
Prathamesh More 2022-06-18 11:32:33 +05:30
parent 2f818ce65f
commit 7a82883f57
5 changed files with 11 additions and 17 deletions

View file

@ -136,7 +136,6 @@ const val ARTIST_DETAIL_SONG_SORT_ORDER = "artist_detail_song_sort_order"
const val LYRICS_OPTIONS = "lyrics_tab_position"
const val CHOOSE_EQUALIZER = "choose_equalizer"
const val EQUALIZER = "equalizer"
const val TOGGLE_SHUFFLE = "toggle_shuffle"
const val SONG_GRID_STYLE = "song_grid_style"
const val PAUSE_ON_ZERO_VOLUME = "pause_on_zero_volume"
const val FILTER_SONG = "filter_song"

View file

@ -42,7 +42,7 @@ class PlayingQueueAdapter(
activity: FragmentActivity,
dataSet: MutableList<Song>,
private var current: Int,
itemLayoutRes: Int
itemLayoutRes: Int,
) : SongAdapter(
activity, dataSet, itemLayoutRes, null
), DraggableItemAdapter<PlayingQueueAdapter.ViewHolder>,
@ -153,6 +153,14 @@ class PlayingQueueAdapter(
dragView?.isVisible = true
}
override fun onClick(v: View?) {
if (isInQuickSelectMode) {
toggleChecked(layoutPosition)
} else {
MusicPlayerRemote.playSongAt(layoutPosition)
}
}
override fun onSongMenuItemClick(item: MenuItem): Boolean {
when (item.itemId) {
R.id.action_remove_from_playing_queue -> {
@ -209,7 +217,7 @@ class PlayingQueueAdapter(
internal class SwipedResultActionRemoveItem(
private val adapter: PlayingQueueAdapter,
private val position: Int,
private val activity: FragmentActivity
private val activity: FragmentActivity,
) : SwipeResultActionRemoveItem() {
private var songToRemove: Song? = null

View file

@ -171,9 +171,6 @@ object MusicPlayerRemote : KoinComponent {
return musicService?.playingQueue?.size ?: -1
}
/**
* Async
*/
fun playSongAt(position: Int) {
musicService?.playSongAt(position)
}

View file

@ -115,7 +115,7 @@ object PreferenceUtil {
putString(SAF_SDCARD_URI, value)
}
val autoDownloadImagesPolicy
private val autoDownloadImagesPolicy
get() = sharedPreferences.getStringOrDefault(
AUTO_DOWNLOAD_IMAGES_POLICY,
"only_wifi"
@ -242,8 +242,6 @@ object PreferenceUtil {
val isScreenOnEnabled get() = sharedPreferences.getBoolean(KEEP_SCREEN_ON, false)
val isShuffleModeOn get() = sharedPreferences.getBoolean(TOGGLE_SHUFFLE, false)
val isSongInfo get() = sharedPreferences.getBoolean(EXTRA_SONG_INFO, false)
val isPauseOnZeroVolume get() = sharedPreferences.getBoolean(PAUSE_ON_ZERO_VOLUME, false)

View file

@ -56,14 +56,6 @@
android:title="@string/pref_title_toggle_toggle_headset"
app:icon="@drawable/ic_play_arrow" />
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATESwitchPreference
android:defaultValue="false"
android:key="toggle_shuffle"
android:layout="@layout/list_item_view_switch"
android:summary="@string/pref_summary_toggle_shuffle"
android:title="@string/pref_title_toggle_toggle_shuffle"
app:icon="@drawable/ic_shuffle" />
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATESwitchPreference
android:defaultValue="false"
android:key="bluetooth_playback"