@@ -111,12 +111,6 @@ fun AssetPreviewScreen(
111111 SelectorBottomBar (
112112 selectedList = selectedList,
113113 assetInfo = assets[pageState.currentPage],
114- onSelectedClick = { asset ->
115- val selectedIndex = assets.indexOfFirst { it.id == asset.id }
116- scope.launch {
117- pageState.animateScrollToPage(selectedIndex)
118- }
119- }
120114 ) {
121115 navigateUp()
122116 if (selectedList.isEmpty()) selectedList.add(it)
@@ -126,9 +120,36 @@ fun AssetPreviewScreen(
126120 Box (
127121 modifier = Modifier
128122 .padding(it)
129- .background(Color .Black )
123+ .background(Color .Black ),
124+ contentAlignment = Alignment .BottomCenter
130125 ) {
131126 AssetPreview (assets = assets, pagerState = pageState)
127+
128+ if (selectedList.isNotEmpty()) {
129+ val assetInfo = assets[pageState.currentPage]
130+ LazyRow (
131+ modifier = Modifier
132+ .fillMaxWidth()
133+ .background(Color .Black .copy(alpha = 0.8F ))
134+ .padding(horizontal = 2 .dp, vertical = 2 .dp)
135+ ) {
136+ itemsIndexed(selectedList) { _, resource ->
137+ SelectedAssetImageItem (
138+ assetInfo = resource,
139+ isSelected = resource.id == assetInfo.id,
140+ resourceType = resource.resourceType,
141+ durationString = resource.formatDuration(),
142+ modifier = Modifier .size(64 .dp),
143+ onClick = { asset ->
144+ val selectedIndex = assets.indexOfFirst { item -> item.id == asset.id }
145+ scope.launch {
146+ pageState.animateScrollToPage(selectedIndex)
147+ }
148+ }
149+ )
150+ }
151+ }
152+ }
132153 }
133154 }
134155}
@@ -138,57 +159,35 @@ fun AssetPreviewScreen(
138159fun SelectorBottomBar (
139160 assetInfo : AssetInfo ,
140161 selectedList : SnapshotStateList <AssetInfo >,
141- onSelectedClick : (AssetInfo ) -> Unit ,
142162 onClick : (AssetInfo ) -> Unit ,
143163) {
144- Column {
145- if (selectedList.isNotEmpty()) {
146- LazyRow (
147- modifier = Modifier
148- .fillMaxWidth()
149- .background( Color . Black .copy(alpha = 0.8F ))
150- .padding(horizontal = 2 .dp, vertical = 2 .dp)
151- ) {
152- itemsIndexed(selectedList ) { _, resource ->
153- SelectedAssetImageItem (
154- assetInfo = resource ,
155- isSelected = resource.id == assetInfo.id ,
156- resourceType = resource.resourceType ,
157- modifier = Modifier .size( 64 .dp) ,
158- onClick = onSelectedClick
159- )
160- }
161- }
164+ Row (
165+ modifier = Modifier
166+ .fillMaxWidth()
167+ .background(color = Color . Black .copy(alpha = 0.9F ))
168+ .padding(horizontal = 10 .dp, vertical = 8 .dp),
169+ horizontalArrangement = Arrangement . SpaceBetween ,
170+ verticalAlignment = Alignment . CenterVertically
171+ ) {
172+ Row (verticalAlignment = Alignment . CenterVertically ) {
173+ AssetImageIndicator (
174+ assetInfo = assetInfo ,
175+ selected = selectedList.any { it == assetInfo } ,
176+ assetSelected = selectedList ,
177+ fontSize = 14 .sp ,
178+ size = 22 .dp
179+ )
180+ Spacer (modifier = Modifier .width( 6 .dp))
181+ Text (text = stringResource( R .string.text_asset_select), color = Color . White , fontSize = 14 .sp)
162182 }
163-
164- Row (
165- modifier = Modifier
166- .fillMaxWidth()
167- .background(color = Color .Black .copy(alpha = 0.9F ))
168- .padding(horizontal = 10 .dp, vertical = 8 .dp),
169- horizontalArrangement = Arrangement .SpaceBetween ,
170- verticalAlignment = Alignment .CenterVertically
183+ Button (
184+ modifier = Modifier .defaultMinSize(minHeight = 1 .dp, minWidth = 1 .dp),
185+ shape = RoundedCornerShape (5 .dp),
186+ enabled = true ,
187+ contentPadding = PaddingValues (horizontal = 20 .dp, vertical = 6 .dp),
188+ onClick = { onClick(assetInfo) }
171189 ) {
172- Row (verticalAlignment = Alignment .CenterVertically ) {
173- AssetImageIndicator (
174- assetInfo = assetInfo,
175- selected = selectedList.any { it == assetInfo },
176- assetSelected = selectedList,
177- fontSize = 14 .sp,
178- size = 22 .dp
179- )
180- Spacer (modifier = Modifier .width(6 .dp))
181- Text (text = stringResource(R .string.text_asset_select), color = Color .White , fontSize = 14 .sp)
182- }
183- Button (
184- modifier = Modifier .defaultMinSize(minHeight = 1 .dp, minWidth = 1 .dp),
185- shape = RoundedCornerShape (5 .dp),
186- enabled = true ,
187- contentPadding = PaddingValues (horizontal = 20 .dp, vertical = 6 .dp),
188- onClick = { onClick(assetInfo) }
189- ) {
190- Text (stringResource(R .string.text_done), color = Color .White , fontSize = 15 .sp)
191- }
190+ Text (stringResource(R .string.text_done), color = Color .White , fontSize = 15 .sp)
192191 }
193192 }
194193}
@@ -246,14 +245,16 @@ fun VideoPreview(uriString: String) {
246245 }
247246 }
248247
249- AndroidView (factory = {
250- PlayerView (it).apply {
251- this .player = player
252- setShowPreviousButton(false )
253- setShowNextButton(false )
254- setShowFastForwardButton(false )
255- setShowRewindButton(false )
256- setShowSubtitleButton(false )
257- }
258- })
248+ AndroidView (
249+ modifier = Modifier .fillMaxSize(),
250+ factory = {
251+ PlayerView (it).apply {
252+ this .player = player
253+ setShowPreviousButton(false )
254+ setShowNextButton(false )
255+ setShowFastForwardButton(false )
256+ setShowRewindButton(false )
257+ setShowSubtitleButton(false )
258+ }
259+ })
259260}
0 commit comments