1
1
package org.schabi.newpipe.ui.components.items
2
2
3
+ import androidx.compose.foundation.layout.height
4
+ import androidx.compose.foundation.layout.size
3
5
import androidx.compose.foundation.lazy.LazyColumn
4
6
import androidx.compose.foundation.lazy.grid.GridCells
5
7
import androidx.compose.foundation.lazy.grid.GridItemSpan
@@ -28,6 +30,7 @@ import org.schabi.newpipe.R
28
30
import org.schabi.newpipe.info_list.ItemViewMode
29
31
import org.schabi.newpipe.ktx.findFragmentActivity
30
32
import org.schabi.newpipe.ui.components.common.LazyColumnThemedScrollbar
33
+ import org.schabi.newpipe.ui.components.common.LoadingIndicator
31
34
import org.schabi.newpipe.ui.components.common.defaultThemedScrollbarSettings
32
35
import org.schabi.newpipe.ui.components.items.playlist.PlaylistListItem
33
36
import org.schabi.newpipe.ui.components.items.stream.StreamCardItem
@@ -85,12 +88,12 @@ fun ItemList(
85
88
LazyVerticalGridScrollbar (state = state, settings = defaultThemedScrollbarSettings()) {
86
89
val windowSizeClass = currentWindowAdaptiveInfo().windowSizeClass
87
90
val isCompact = windowSizeClass.windowWidthSizeClass == WindowWidthSizeClass .COMPACT
88
- val minSize = if (isCompact) 150 .dp else 250 .dp
91
+ val minWidth = if (isCompact) 150 .dp else 250 .dp
89
92
90
93
LazyVerticalGrid (
91
94
modifier = nestedScrollModifier,
92
95
state = state,
93
- columns = GridCells .Adaptive (minSize )
96
+ columns = GridCells .Adaptive (minWidth )
94
97
) {
95
98
item(span = { GridItemSpan (maxLineSpan) }) {
96
99
header()
@@ -106,6 +109,8 @@ fun ItemList(
106
109
item, showProgress, isSelected, isCompact, onClick, onLongClick,
107
110
onDismissPopup
108
111
)
112
+ } else if (item == null ) { // Placeholder
113
+ LoadingIndicator (Modifier .size(minWidth, if (isCompact) 150 .dp else 200 .dp))
109
114
}
110
115
}
111
116
}
@@ -137,6 +142,8 @@ fun ItemList(
137
142
}
138
143
} else if (item is Playlist ) {
139
144
PlaylistListItem (item, onClick)
145
+ } else if (item == null ) { // Placeholder
146
+ LoadingIndicator (Modifier .height(80 .dp))
140
147
}
141
148
}
142
149
}
0 commit comments