[Android] Videos: Ensure ItemDecoration is not duplicated

Geoffrey Métais git at videolan.org
Tue Jan 15 11:32:29 CET 2019


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Jan 15 11:31:43 2019 +0100| [340e952f40c88ba391706b1dc688abe2acbf8fdb] | committer: Geoffrey Métais

Videos: Ensure ItemDecoration is not duplicated

> https://code.videolan.org/videolan/vlc-android/commit/340e952f40c88ba391706b1dc688abe2acbf8fdb
---

 vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
index 38bde3c33..932e85d6e 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
@@ -191,6 +191,7 @@ public class VideoGridFragment extends MediaBrowserFragment<VideosModel> impleme
                 Settings.INSTANCE.getInstance(requireContext()).getBoolean("force_list_portrait", false));
 
         // Select between grid or list
+        mBinding.videoGrid.removeItemDecoration(mGridItemDecoration);
         if (!listMode) {
             final int thumbnailWidth = res.getDimensionPixelSize(R.dimen.grid_card_thumb_width);
             final int margin = mBinding.videoGrid.getPaddingStart() + mBinding.videoGrid.getPaddingEnd();
@@ -198,8 +199,6 @@ public class VideoGridFragment extends MediaBrowserFragment<VideosModel> impleme
             mBinding.videoGrid.setColumnWidth(columnWidth);
             mAdapter.setGridCardWidth(mBinding.videoGrid.getColumnWidth());
             mBinding.videoGrid.addItemDecoration(mGridItemDecoration);
-        } else {
-            mBinding.videoGrid.removeItemDecoration(mGridItemDecoration);
         }
         mBinding.videoGrid.setNumColumns(listMode ? 1 : -1);
         if (mAdapter.isListMode() != listMode) mAdapter.setListMode(listMode);



More information about the Android mailing list