Fix song selection bug
Fix a bug where if a song is selected while shuffling it would not move that song to the beginning of the queue.
This commit is contained in:
parent
6a273ab34d
commit
118172b7c8
4 changed files with 12 additions and 15 deletions
|
@ -352,7 +352,7 @@ class PlaybackStateManager private constructor() {
|
|||
* @param to The destination index.
|
||||
*/
|
||||
fun moveQueueItems(from: Int, to: Int): Boolean {
|
||||
if (from > mUserQueue.size || from < 0 || to > mUserQueue.size || to < 0) {
|
||||
if (from > mQueue.size || from < 0 || to > mQueue.size || to < 0) {
|
||||
logE("Indices were out of bounds, did not move queue item")
|
||||
|
||||
return false
|
||||
|
|
|
@ -13,6 +13,7 @@ import androidx.recyclerview.widget.RecyclerView
|
|||
import coil.Coil
|
||||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
import com.afollestad.materialdialogs.customview.customView
|
||||
import com.afollestad.materialdialogs.utils.invalidateDividers
|
||||
import org.oxycblt.auxio.BuildConfig
|
||||
import org.oxycblt.auxio.R
|
||||
import org.oxycblt.auxio.logD
|
||||
|
@ -29,6 +30,7 @@ import org.oxycblt.auxio.ui.Accent
|
|||
@Suppress("UNUSED")
|
||||
class SettingsListFragment : PreferenceFragmentCompat() {
|
||||
private val playbackModel: PlaybackViewModel by activityViewModels()
|
||||
val settingsManager = SettingsManager.getInstance()
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
@ -93,7 +95,7 @@ class SettingsListFragment : PreferenceFragmentCompat() {
|
|||
}
|
||||
|
||||
SettingsManager.Keys.KEY_LIBRARY_DISPLAY_MODE -> {
|
||||
setIcon(SettingsManager.getInstance().libraryDisplayMode.iconRes)
|
||||
setIcon(settingsManager.libraryDisplayMode.iconRes)
|
||||
|
||||
onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, value ->
|
||||
setIcon(DisplayMode.valueOfOrFallback(value as String).iconRes)
|
||||
|
@ -150,7 +152,7 @@ class SettingsListFragment : PreferenceFragmentCompat() {
|
|||
val recycler = RecyclerView(requireContext()).apply {
|
||||
adapter = AccentAdapter {
|
||||
if (it != Accent.get()) {
|
||||
SettingsManager.getInstance().accent = it
|
||||
settingsManager.accent = it
|
||||
|
||||
requireActivity().recreate()
|
||||
}
|
||||
|
@ -158,6 +160,10 @@ class SettingsListFragment : PreferenceFragmentCompat() {
|
|||
this@show.dismiss()
|
||||
}
|
||||
|
||||
layoutManager = LinearLayoutManager(
|
||||
requireContext(), LinearLayoutManager.HORIZONTAL, false
|
||||
)
|
||||
|
||||
post {
|
||||
// Combine the width of the recyclerview with the width of an item in order
|
||||
// to center the currently selected accent.
|
||||
|
@ -169,15 +175,11 @@ class SettingsListFragment : PreferenceFragmentCompat() {
|
|||
(width / 2) - childWidth
|
||||
)
|
||||
}
|
||||
|
||||
layoutManager = LinearLayoutManager(
|
||||
requireContext()
|
||||
).also { it.orientation = LinearLayoutManager.HORIZONTAL }
|
||||
}
|
||||
|
||||
customView(view = recycler)
|
||||
|
||||
view.invalidateDividers(showTop = false, showBottom = false)
|
||||
invalidateDividers(showTop = false, showBottom = false)
|
||||
|
||||
negativeButton(android.R.string.cancel)
|
||||
|
||||
|
|
|
@ -47,15 +47,10 @@
|
|||
<string name="setting_theme_auto">Automatică</string>
|
||||
<string name="setting_theme_day">Clar</string>
|
||||
<string name="setting_theme_night">Întunecat</string>
|
||||
<string name="setting_accent">Accent</string>
|
||||
<string name="setting_accent_unknown">Unknown Accent</string>
|
||||
<string name="setting_accent">Culoare accentuată</string>
|
||||
|
||||
<string name="setting_color_notif">Colorează notificarea</string>
|
||||
<string name="setting_quality_covers">Ignoră coperțile Media Store</string>
|
||||
<string name="setting_quality_covers_desc">Increases the quality of the album covers, but results in longer loading times and higher memory usage</string>
|
||||
<string name="setting_use_alt_action">Use alternate notification action</string>
|
||||
<string name="setting_use_alt_loop">Prefer repeat mode action</string>
|
||||
<string name="setting_use_alt_shuffle">Prefer shuffle action</string>
|
||||
|
||||
<string name="setting_audio">Audio</string>
|
||||
<string name="setting_audio_focus">Concentrare audio</string>
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
<string name="label_sort">Sort</string>
|
||||
<string name="label_sort_none">Default</string>
|
||||
<string name="label_sort_alpha_down">Ascending</string>
|
||||
<string name="label_sort_alpha_up">Decending</string>
|
||||
<string name="label_sort_alpha_up">Descending</string>
|
||||
|
||||
<string name="label_play">Play</string>
|
||||
<string name="label_shuffle">Shuffle</string>
|
||||
|
|
Loading…
Reference in a new issue