[Android] Albums: show artist doesn't stack activity history
Duncan McNamara
git at videolan.org
Wed Nov 16 09:09:52 UTC 2022
vlc-android | branch: master | Duncan McNamara <dcn.mcnamara at gmail.com> | Mon Nov 14 18:59:07 2022 +0100| [37efbd9b5ab0a69d01f1ebb88dafc3b2edef0338] | committer: Nicolas Pomepuy
Albums: show artist doesn't stack activity history
This is so that users can't loop from album to artist to album, etc.
> https://code.videolan.org/videolan/vlc-android/commit/37efbd9b5ab0a69d01f1ebb88dafc3b2edef0338
---
.../vlc-android/src/org/videolan/vlc/gui/HeaderMediaListActivity.kt | 3 +++
application/vlc-android/src/org/videolan/vlc/gui/SecondaryActivity.kt | 4 +++-
.../src/org/videolan/vlc/gui/audio/AudioAlbumsSongsFragment.kt | 3 +++
3 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/HeaderMediaListActivity.kt b/application/vlc-android/src/org/videolan/vlc/gui/HeaderMediaListActivity.kt
index 16c6dc20b4..f619f56dea 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/HeaderMediaListActivity.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/HeaderMediaListActivity.kt
@@ -161,6 +161,8 @@ open class HeaderMediaListActivity : AudioPlayerContainerActivity(), IEventsHand
val i = Intent(this at HeaderMediaListActivity, SecondaryActivity::class.java)
i.putExtra(SecondaryActivity.KEY_FRAGMENT, SecondaryActivity.ALBUMS_SONGS)
i.putExtra(AudioBrowserFragment.TAG_ITEM, artist)
+ i.putExtra(ARTIST_FROM_ALBUM, true)
+ i.flags = i.flags or Intent.FLAG_ACTIVITY_NO_HISTORY
startActivity(i)
}
}
@@ -520,6 +522,7 @@ open class HeaderMediaListActivity : AudioPlayerContainerActivity(), IEventsHand
companion object {
+ const val ARTIST_FROM_ALBUM = "ARTIST_FROM_ALBUM"
const val TAG = "VLC/PlaylistActivity"
}
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/SecondaryActivity.kt b/application/vlc-android/src/org/videolan/vlc/gui/SecondaryActivity.kt
index 544336f775..35277cceaf 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/SecondaryActivity.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/SecondaryActivity.kt
@@ -166,7 +166,9 @@ class SecondaryActivity : ContentActivity(), IDialogManager {
fragment = AudioAlbumsSongsFragment().apply {
arguments = bundleOf(
AudioBrowserFragment.TAG_ITEM to
- intent.parcelable(AudioBrowserFragment.TAG_ITEM)
+ intent.parcelable(AudioBrowserFragment.TAG_ITEM),
+ HeaderMediaListActivity.ARTIST_FROM_ALBUM to
+ intent.getBooleanExtra(HeaderMediaListActivity.ARTIST_FROM_ALBUM, false)
)
}
}
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioAlbumsSongsFragment.kt b/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioAlbumsSongsFragment.kt
index 6bc3bc88ce..04dda2bcc6 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioAlbumsSongsFragment.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioAlbumsSongsFragment.kt
@@ -69,6 +69,7 @@ class AudioAlbumsSongsFragment : BaseAudioBrowser<AlbumSongsViewModel>(), SwipeR
private lateinit var fastScroller: FastScroller
override val hasTabs = true
+ private var fromAlbums = false
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@@ -76,6 +77,7 @@ class AudioAlbumsSongsFragment : BaseAudioBrowser<AlbumSongsViewModel>(), SwipeR
val item = savedInstanceState?.parcelable(AudioBrowserFragment.TAG_ITEM)
?: arguments?.parcelable<MediaLibraryItem>(AudioBrowserFragment.TAG_ITEM)
viewModel = getViewModel(item!!)
+ fromAlbums = savedInstanceState?.getBoolean(HeaderMediaListActivity.ARTIST_FROM_ALBUM) ?: arguments?.getBoolean(HeaderMediaListActivity.ARTIST_FROM_ALBUM, false) ?: false
}
override fun getTitle(): String = viewModel.parent.title
@@ -214,6 +216,7 @@ class AudioAlbumsSongsFragment : BaseAudioBrowser<AlbumSongsViewModel>(), SwipeR
if (item is Album) {
val i = Intent(activity, HeaderMediaListActivity::class.java)
i.putExtra(AudioBrowserFragment.TAG_ITEM, item)
+ if (fromAlbums) i.flags = i.flags or Intent.FLAG_ACTIVITY_NO_HISTORY
startActivity(i)
} else {
if (inSearchMode()) UiTools.setKeyboardVisibility(v, false)
More information about the Android
mailing list