Commit 0b3468ba authored by Nicolas Pomepuy's avatar Nicolas Pomepuy Committed by Geoffrey Métais
Browse files

Move video group setting to main UI

Fixes #1029
parent 77299ec1
......@@ -86,6 +86,23 @@
android:visible="false"/>
</menu>
</item>
<item
android:orderInCategory="2"
android:title="@string/video_min_group_length_title"
android:id="@+id/ml_menu_video_group"
vlc:showAsAction="never"
android:visible="false">
<menu>
<item
android:orderInCategory="2"
android:id="@+id/video_min_group_length_disable"
android:title="@string/video_min_group_length_disable" />
<item
android:orderInCategory="2"
android:id="@+id/video_min_group_length_folder"
android:title="@string/video_min_group_length_folder" />
</menu>
</item>
<item
android:orderInCategory="3"
android:id="@+id/ml_menu_refresh"
......
......@@ -261,22 +261,6 @@
<item>4</item>
</string-array>
<string-array name="video_min_group_length_list" translatable="false">
<item>@string/video_min_group_length_disable</item>
<item>@string/video_min_group_length_folder</item>
<!--<item>@string/video_min_group_length_first</item>-->
<!--<item>@string/video_min_group_length_short</item>-->
<!--<item>@string/video_min_group_length_long</item>-->
</string-array>
<string-array name="video_min_group_length_values" translatable="false">
<item>-1</item>
<item>0</item>
<!--<item>1</item>-->
<!--<item>6</item>-->
<!--<item>9</item>-->
</string-array>
<string-array name="subtitles_encoding_list" tools:ignore="TypographyDashes">
<item>Default (Windows-1252)</item>
<item>Universal (UTF-8)</item>
......
......@@ -313,7 +313,6 @@
<string name="video_prefs_category">Video</string>
<string name="video_min_group_length_title">Group videos</string>
<string name="video_min_group_length_summary">Videos are grouped if their first letters are the same.</string>
<string name="video_min_group_length_disable">Disable</string>
<string name="video_min_group_length_folder">Group by folder</string>
<string name="video_min_group_length_first">First letter only</string>
......
......@@ -44,15 +44,6 @@
android:title="@string/video"
android:key="ui_video_category">
<ListPreference
android:defaultValue="-1"
android:entries="@array/video_min_group_length_list"
android:entryValues="@array/video_min_group_length_values"
android:key="video_min_group_length"
android:persistent="true"
android:summary="@string/video_min_group_length_summary"
android:title="@string/video_min_group_length_title"/>
<CheckBoxPreference
app:singleLineTitle="false"
android:defaultValue="true"
......
......@@ -49,6 +49,7 @@ import org.videolan.vlc.R
import org.videolan.vlc.gui.AudioPlayerContainerActivity
import org.videolan.vlc.gui.ContentActivity
import org.videolan.vlc.gui.InfoActivity
import org.videolan.vlc.gui.MainActivity
import org.videolan.vlc.gui.helpers.SparseBooleanArrayParcelable
import org.videolan.vlc.gui.helpers.UiTools
import org.videolan.vlc.gui.helpers.UiTools.snackerConfirm
......@@ -56,10 +57,7 @@ import org.videolan.vlc.gui.helpers.hf.StoragePermissionsDelegate.Companion.getW
import org.videolan.vlc.gui.view.SwipeRefreshLayout
import org.videolan.vlc.interfaces.Filterable
import org.videolan.vlc.media.MediaUtils
import org.videolan.vlc.util.AndroidDevices
import org.videolan.vlc.util.FileUtils
import org.videolan.vlc.util.TAG_ITEM
import org.videolan.vlc.util.Util
import org.videolan.vlc.util.*
import org.videolan.vlc.viewmodels.MedialibraryViewModel
import org.videolan.vlc.viewmodels.SortableModel
import java.lang.Runnable
......@@ -287,6 +285,16 @@ abstract class MediaBrowserFragment<T : SortableModel> : Fragment(), ActionMode.
sortBy(AbstractMedialibrary.SORT_FILESIZE) //TODO
return super.onOptionsItemSelected(item)
}
R.id.video_min_group_length_disable -> {
Settings.getInstance(requireActivity()).edit().putString("video_min_group_length", "-1").apply()
(activity as MainActivity).forceLoadVideoFragment()
return true
}
R.id.video_min_group_length_folder -> {
Settings.getInstance(requireActivity()).edit().putString("video_min_group_length", "0").apply()
(activity as MainActivity).forceLoadVideoFragment()
return true
}
else -> return super.onOptionsItemSelected(item)
}
}
......
......@@ -97,6 +97,7 @@ class FoldersFragment : MediaBrowserFragment<FoldersViewModel>(), CtxActionRecei
override fun onPrepareOptionsMenu(menu: Menu) {
super.onPrepareOptionsMenu(menu)
menu.findItem(R.id.ml_menu_last_playlist)?.isVisible = true
menu.findItem(R.id.ml_menu_video_group).isVisible = true
}
override fun onOptionsItemSelected(item: MenuItem) = when (item.itemId) {
......
......@@ -154,6 +154,10 @@ class Navigator: NavigationView.OnNavigationItemSelectedListener, LifecycleObser
showFragment(fragment, id, tag)
}
override fun forceLoadVideoFragment() {
showFragment(R.id.nav_video)
}
private fun showFragment(fragment: Fragment, id: Int, tag: String = getTag(id)) {
val fm = activity.supportFragmentManager
if (currentFragment is BaseBrowserFragment) fm.popBackStackImmediate("root", FragmentManager.POP_BACK_STACK_INCLUSIVE)
......@@ -352,4 +356,5 @@ interface INavigator {
fun displayExtensionItems(extensionId: Int, title: String, items: List<VLCExtensionItem>, showParams: Boolean, refresh: Boolean)
fun reloadPreferences()
fun closeDrawer()
fun forceLoadVideoFragment()
}
\ No newline at end of file
......@@ -121,6 +121,7 @@ class VideoGridFragment : MediaBrowserFragment<VideosViewModel>(), SwipeRefreshL
override fun onPrepareOptionsMenu(menu: Menu) {
super.onPrepareOptionsMenu(menu)
menu.findItem(R.id.ml_menu_last_playlist).isVisible = true
menu.findItem(R.id.ml_menu_video_group).isVisible = true
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment