[Android] Refactor force_play_all preference to force_play_all_video
Nicolas Pomepuy
git at videolan.org
Tue Aug 30 06:07:33 UTC 2022
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Tue Aug 30 07:53:39 2022 +0200| [a209f12cbee68bb7930a05ff54c5b7965af9acf4] | committer: Nicolas Pomepuy
Refactor force_play_all preference to force_play_all_video
> https://code.videolan.org/videolan/vlc-android/commit/a209f12cbee68bb7930a05ff54c5b7965af9acf4
---
.../java/org/videolan/vlc/gui/preferences/PreferencesUIUITest.kt | 3 +--
.../television/src/main/java/org/videolan/television/ui/TvUtil.kt | 4 ++--
.../java/org/videolan/television/ui/browser/MediaBrowserTvFragment.kt | 4 ++--
.../main/java/org/videolan/television/ui/preferences/PreferencesUi.kt | 2 +-
application/tools/src/main/java/org/videolan/tools/Settings.kt | 2 +-
application/vlc-android/res/xml/preferences_ui.xml | 2 +-
.../src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt | 2 +-
.../src/org/videolan/vlc/viewmodels/mobile/VideosViewModel.kt | 4 ++--
8 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/application/app/src/androidTest/java/org/videolan/vlc/gui/preferences/PreferencesUIUITest.kt b/application/app/src/androidTest/java/org/videolan/vlc/gui/preferences/PreferencesUIUITest.kt
index 03ad4c891..1fa60917f 100644
--- a/application/app/src/androidTest/java/org/videolan/vlc/gui/preferences/PreferencesUIUITest.kt
+++ b/application/app/src/androidTest/java/org/videolan/vlc/gui/preferences/PreferencesUIUITest.kt
@@ -10,7 +10,6 @@ import org.videolan.tools.*
import org.videolan.vlc.BuildConfig
import org.videolan.vlc.PreferenceMatchers.withKey
import org.videolan.vlc.R
-import org.videolan.vlc.gui.helpers.UiTools
import org.videolan.vlc.onPreferenceRow
import org.videolan.vlc.util.*
@@ -104,7 +103,7 @@ class PreferencesUIUITest: BasePreferenceUITest() {
@Test
fun checkVideoPlaylistMode() {
- val key = FORCE_PLAY_ALL
+ val key = FORCE_PLAY_ALL_VIDEO
checkToggleWorks(key, settings)
}
diff --git a/application/television/src/main/java/org/videolan/television/ui/TvUtil.kt b/application/television/src/main/java/org/videolan/television/ui/TvUtil.kt
index 706956b00..d0a37689e 100644
--- a/application/television/src/main/java/org/videolan/television/ui/TvUtil.kt
+++ b/application/television/src/main/java/org/videolan/television/ui/TvUtil.kt
@@ -46,7 +46,7 @@ import org.videolan.television.ui.audioplayer.AudioPlayerActivity
import org.videolan.television.ui.browser.TVActivity
import org.videolan.television.ui.browser.VerticalGridActivity
import org.videolan.television.ui.details.MediaListActivity
-import org.videolan.tools.FORCE_PLAY_ALL
+import org.videolan.tools.FORCE_PLAY_ALL_VIDEO
import org.videolan.tools.HttpImageLoader
import org.videolan.tools.Settings
import org.videolan.tools.getposition
@@ -204,7 +204,7 @@ object TvUtil {
}
else -> {
model.run {
- if (!Settings.getInstance(activity).getBoolean(FORCE_PLAY_ALL, false)) {
+ if (!Settings.getInstance(activity).getBoolean(FORCE_PLAY_ALL_VIDEO, false)) {
MediaUtils.openMedia(activity, item)
} else {
val list = (dataset.getList().filterIsInstance<MediaWrapper>()).filter { it.type != MediaWrapper.TYPE_DIR }
diff --git a/application/television/src/main/java/org/videolan/television/ui/browser/MediaBrowserTvFragment.kt b/application/television/src/main/java/org/videolan/television/ui/browser/MediaBrowserTvFragment.kt
index f23ef56c8..bb86a12ca 100644
--- a/application/television/src/main/java/org/videolan/television/ui/browser/MediaBrowserTvFragment.kt
+++ b/application/television/src/main/java/org/videolan/television/ui/browser/MediaBrowserTvFragment.kt
@@ -15,7 +15,7 @@ import org.videolan.television.ui.TvItemAdapter
import org.videolan.television.ui.TvUtil
import org.videolan.television.viewmodel.MediaBrowserViewModel
import org.videolan.television.viewmodel.getMediaBrowserModel
-import org.videolan.tools.FORCE_PLAY_ALL
+import org.videolan.tools.FORCE_PLAY_ALL_VIDEO
import org.videolan.tools.Settings
import org.videolan.vlc.R
import org.videolan.vlc.gui.view.EmptyLoadingState
@@ -97,7 +97,7 @@ class MediaBrowserTvFragment : BaseBrowserTvFragment<MediaLibraryItem>() {
override fun onClick(v: View, position: Int, item: MediaLibraryItem) {
lifecycleScope.launchWhenStarted {
- if ((viewModel as MediaBrowserViewModel).category == CATEGORY_VIDEOS && !Settings.getInstance(requireContext()).getBoolean(FORCE_PLAY_ALL, true)) {
+ if ((viewModel as MediaBrowserViewModel).category == CATEGORY_VIDEOS && !Settings.getInstance(requireContext()).getBoolean(FORCE_PLAY_ALL_VIDEO, true)) {
TvUtil.playMedia(requireActivity(), item as MediaWrapper)
} else {
TvUtil.openMediaFromPaged(requireActivity(), item, viewModel.provider as MedialibraryProvider<out MediaLibraryItem>)
diff --git a/application/television/src/main/java/org/videolan/television/ui/preferences/PreferencesUi.kt b/application/television/src/main/java/org/videolan/television/ui/preferences/PreferencesUi.kt
index 9e6aeb0b0..bb2303d0c 100644
--- a/application/television/src/main/java/org/videolan/television/ui/preferences/PreferencesUi.kt
+++ b/application/television/src/main/java/org/videolan/television/ui/preferences/PreferencesUi.kt
@@ -53,7 +53,7 @@ class PreferencesUi : BasePreferenceFragment(), SharedPreferences.OnSharedPrefer
override fun onCreate(savedInstanceState: Bundle?) {
Settings.getInstance(activity).run {
- if (!contains(FORCE_PLAY_ALL)) putSingle(FORCE_PLAY_ALL, true)
+ if (!contains(FORCE_PLAY_ALL_VIDEO)) putSingle(FORCE_PLAY_ALL_VIDEO, true)
}
super.onCreate(savedInstanceState)
findPreference<Preference>("ui_audio_category")?.isVisible = false
diff --git a/application/tools/src/main/java/org/videolan/tools/Settings.kt b/application/tools/src/main/java/org/videolan/tools/Settings.kt
index 6529e49b3..f49cca005 100644
--- a/application/tools/src/main/java/org/videolan/tools/Settings.kt
+++ b/application/tools/src/main/java/org/videolan/tools/Settings.kt
@@ -109,7 +109,7 @@ const val PREF_TIPS_SHOWN = "video_player_tips_shown"
const val PREF_WIDGETS_TIPS_SHOWN = "widgets_tips_shown"
const val PREF_TV_UI = "tv_ui"
-const val FORCE_PLAY_ALL = "force_play_all"
+const val FORCE_PLAY_ALL_VIDEO = "force_play_all_video"
const val FORCE_PLAY_ALL_AUDIO = "force_play_all_audio"
const val SCREEN_ORIENTATION = "screen_orientation"
diff --git a/application/vlc-android/res/xml/preferences_ui.xml b/application/vlc-android/res/xml/preferences_ui.xml
index dcd3db1db..979f2eaf8 100644
--- a/application/vlc-android/res/xml/preferences_ui.xml
+++ b/application/vlc-android/res/xml/preferences_ui.xml
@@ -61,7 +61,7 @@
<CheckBoxPreference
app:singleLineTitle="false"
android:defaultValue="false"
- android:key="force_play_all"
+ android:key="force_play_all_video"
android:summary="@string/force_play_all_summary"
android:title="@string/force_play_all_title"/>
<CheckBoxPreference
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt b/application/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt
index 2377f8f21..36383671b 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt
@@ -526,7 +526,7 @@ abstract class BaseBrowserFragment : MediaBrowserFragment<BrowserModel>(), IRefr
mediaWrapper.removeFlags(MediaWrapper.MEDIA_FORCE_AUDIO)
if (mediaWrapper.type == MediaWrapper.TYPE_DIR) browse(mediaWrapper, true)
else {
- val forcePlayType = if (mediaWrapper.type == MediaWrapper.TYPE_VIDEO) FORCE_PLAY_ALL else FORCE_PLAY_ALL_AUDIO
+ val forcePlayType = if (mediaWrapper.type == MediaWrapper.TYPE_VIDEO) FORCE_PLAY_ALL_VIDEO else FORCE_PLAY_ALL_AUDIO
if (!Settings.getInstance(requireContext()).getBoolean(forcePlayType, false)) {
lifecycleScope.launch {
MediaUtils.openMedia(requireContext(), getMediaWithMeta(item))
diff --git a/application/vlc-android/src/org/videolan/vlc/viewmodels/mobile/VideosViewModel.kt b/application/vlc-android/src/org/videolan/vlc/viewmodels/mobile/VideosViewModel.kt
index 7c47f165f..1760b8f60 100644
--- a/application/vlc-android/src/org/videolan/vlc/viewmodels/mobile/VideosViewModel.kt
+++ b/application/vlc-android/src/org/videolan/vlc/viewmodels/mobile/VideosViewModel.kt
@@ -32,7 +32,7 @@ import org.videolan.medialibrary.interfaces.media.Folder
import org.videolan.medialibrary.interfaces.media.MediaWrapper
import org.videolan.medialibrary.interfaces.media.VideoGroup
import org.videolan.medialibrary.media.MediaLibraryItem
-import org.videolan.tools.FORCE_PLAY_ALL
+import org.videolan.tools.FORCE_PLAY_ALL_VIDEO
import org.videolan.tools.Settings
import org.videolan.tools.isStarted
import org.videolan.vlc.gui.helpers.UiTools
@@ -134,7 +134,7 @@ class VideosViewModel(context: Context, type: VideoGroupingType, val folder: Fol
}
mw.removeFlags(MediaWrapper.MEDIA_FORCE_AUDIO)
val settings = Settings.getInstance(context)
- if (!fromStart && (settings.getBoolean(FORCE_PLAY_ALL, false) || forceAll)) {
+ if (!fromStart && (settings.getBoolean(FORCE_PLAY_ALL_VIDEO, false) || forceAll)) {
when(val prov = provider) {
is VideosProvider -> MediaUtils.playAll(context, prov, position, false)
is FoldersProvider -> MediaUtils.playAllTracks(context, prov, position, false)
More information about the Android
mailing list