[Android] Fix grid/list switch in VideoGridFragment

Nicolas Pomepuy git at videolan.org
Mon Nov 18 17:34:20 CET 2019


vlc-android | branch: 3.2.x | Nicolas Pomepuy <nicolas.pomepuy at gmail.com> | Mon Nov 18 12:36:20 2019 +0100| [50ed6077ab8beec95c101b10350a2a103df3135c] | committer: Nicolas Pomepuy

Fix grid/list switch in VideoGridFragment

> https://code.videolan.org/videolan/vlc-android/commit/50ed6077ab8beec95c101b10350a2a103df3135c
---

 vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.kt | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.kt b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.kt
index e1f3844da..5264960de 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.kt
@@ -22,7 +22,6 @@ package org.videolan.vlc.gui.video
 
 import android.annotation.TargetApi
 import android.content.Intent
-import android.content.res.Configuration
 import android.os.Build
 import android.os.Bundle
 import android.os.Handler
@@ -127,8 +126,8 @@ class VideoGridFragment : MediaBrowserFragment<VideosViewModel>(), SwipeRefreshL
         menu.findItem(R.id.ml_menu_last_playlist).isVisible = true
         menu.findItem(R.id.ml_menu_video_group).isVisible = viewModel.group == null && viewModel.folder == null
         val displayInCards = Settings.getInstance(requireActivity()).getBoolean("video_display_in_cards", true)
-        menu.findItem(R.id.ml_menu_display_grid).isVisible = displayInCards
-        menu.findItem(R.id.ml_menu_display_list).isVisible = !displayInCards
+        menu.findItem(R.id.ml_menu_display_grid).isVisible = !displayInCards
+        menu.findItem(R.id.ml_menu_display_list).isVisible = displayInCards
     }
 
     override fun onOptionsItemSelected(item: MenuItem): Boolean {
@@ -215,7 +214,7 @@ class VideoGridFragment : MediaBrowserFragment<VideosViewModel>(), SwipeRefreshL
         val res = resources
         if (gridItemDecoration == null)
             gridItemDecoration = ItemOffsetDecoration(resources, R.dimen.left_right_1610_margin, R.dimen.top_bottom_1610_margin)
-        val listMode = res.getBoolean(R.bool.list_mode) || res.configuration.orientation == Configuration.ORIENTATION_PORTRAIT && Settings.getInstance(requireContext()).getBoolean(FORCE_LIST_PORTRAIT, false)
+        val listMode = !Settings.getInstance(requireContext()).getBoolean("video_display_in_cards", true)
 
         // Select between grid or list
         binding.videoGrid.removeItemDecoration(gridItemDecoration!!)



More information about the Android mailing list