11package org.schabi.newpipe.ui.components.items
22
3+ import androidx.compose.foundation.layout.size
34import androidx.compose.foundation.lazy.LazyColumn
45import androidx.compose.foundation.lazy.grid.GridCells
56import androidx.compose.foundation.lazy.grid.GridItemSpan
@@ -28,6 +29,7 @@ import org.schabi.newpipe.R
2829import org.schabi.newpipe.info_list.ItemViewMode
2930import org.schabi.newpipe.ktx.findFragmentActivity
3031import org.schabi.newpipe.ui.components.common.LazyColumnThemedScrollbar
32+ import org.schabi.newpipe.ui.components.common.LoadingIndicator
3133import org.schabi.newpipe.ui.components.common.defaultThemedScrollbarSettings
3234import org.schabi.newpipe.ui.components.items.playlist.PlaylistListItem
3335import org.schabi.newpipe.ui.components.items.stream.StreamCardItem
@@ -85,12 +87,12 @@ fun ItemList(
8587 LazyVerticalGridScrollbar (state = state, settings = defaultThemedScrollbarSettings()) {
8688 val windowSizeClass = currentWindowAdaptiveInfo().windowSizeClass
8789 val isCompact = windowSizeClass.windowWidthSizeClass == WindowWidthSizeClass .COMPACT
88- val minSize = if (isCompact) 150 .dp else 250 .dp
90+ val minWidth = if (isCompact) 150 .dp else 250 .dp
8991
9092 LazyVerticalGrid (
9193 modifier = nestedScrollModifier,
9294 state = state,
93- columns = GridCells .Adaptive (minSize )
95+ columns = GridCells .Adaptive (minWidth )
9496 ) {
9597 item(span = { GridItemSpan (maxLineSpan) }) {
9698 header()
@@ -106,6 +108,8 @@ fun ItemList(
106108 item, showProgress, isSelected, isCompact, onClick, onLongClick,
107109 onDismissPopup
108110 )
111+ } else if (item == null ) { // Placeholder
112+ LoadingIndicator (Modifier .size(minWidth, if (isCompact) 100 .dp else 150 .dp))
109113 }
110114 }
111115 }
@@ -137,6 +141,8 @@ fun ItemList(
137141 }
138142 } else if (item is Playlist ) {
139143 PlaylistListItem (item, onClick)
144+ } else if (item == null ) { // Placeholder
145+ LoadingIndicator ()
140146 }
141147 }
142148 }
0 commit comments