[Android] Remove useless audio item size calculation
Nicolas Pomepuy
git at videolan.org
Thu Dec 23 09:45:07 UTC 2021
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Fri Oct 29 11:00:25 2021 +0200| [32915c821e0d6fe19ae18e4d3407809790af386e] | committer: Nicolas Pomepuy
Remove useless audio item size calculation
> https://code.videolan.org/videolan/vlc-android/commit/32915c821e0d6fe19ae18e4d3407809790af386e
---
.../src/org/videolan/vlc/gui/audio/AudioBrowserFragment.kt | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.kt b/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.kt
index e974e655f..1ae2fbffb 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.kt
@@ -158,14 +158,12 @@ class AudioBrowserFragment : BaseAudioBrowser<AudioBrowserViewModel>() {
override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig)
- val itemSize = RecyclerSectionItemGridDecoration.getItemSize(requireActivity().getScreenWidth(), nbColumns, spacing)
for (i in 0 until MODE_TOTAL) {
if (i >= lists.size || i >= adapters.size) continue
if (lists[i].layoutManager is GridLayoutManager) {
val gridLayoutManager = lists[i].layoutManager as GridLayoutManager
gridLayoutManager.spanCount = nbColumns
lists[i].layoutManager = gridLayoutManager
- adapters[i].cardSize = itemSize
adapters[i].notifyItemRangeChanged(gridLayoutManager.findFirstVisibleItemPosition(), gridLayoutManager.findLastVisibleItemPosition() - gridLayoutManager.findFirstVisibleItemPosition())
}
}
@@ -184,11 +182,9 @@ class AudioBrowserFragment : BaseAudioBrowser<AudioBrowserViewModel>() {
viewModel = getViewModel()
currentTab = viewModel.currentTab
- val itemSize = RecyclerSectionItemGridDecoration.getItemSize(requireActivity().getScreenWidth(), nbColumns, spacing)
-
- artistsAdapter = AudioBrowserAdapter(MediaLibraryItem.TYPE_ARTIST, this, cardSize = if (viewModel.providersInCard[0]) itemSize else -1)
- albumsAdapter = AudioBrowserAdapter(MediaLibraryItem.TYPE_ALBUM, this, cardSize = if (viewModel.providersInCard[1]) itemSize else -1)
- songsAdapter = AudioBrowserAdapter(MediaLibraryItem.TYPE_MEDIA, this, cardSize = if (viewModel.providersInCard[2]) itemSize else -1)
+ artistsAdapter = AudioBrowserAdapter(MediaLibraryItem.TYPE_ARTIST, this)
+ albumsAdapter = AudioBrowserAdapter(MediaLibraryItem.TYPE_ALBUM, this)
+ songsAdapter = AudioBrowserAdapter(MediaLibraryItem.TYPE_MEDIA, this)
genresAdapter = AudioBrowserAdapter(MediaLibraryItem.TYPE_GENRE, this)
adapters = arrayOf(artistsAdapter, albumsAdapter, songsAdapter, genresAdapter)
setupProvider()
More information about the Android
mailing list