@@ -12,7 +12,7 @@ import androidx.compose.animation.fadeOut
12
12
import androidx.compose.animation.slideInVertically
13
13
import androidx.compose.animation.slideOutVertically
14
14
import androidx.compose.foundation.layout.Box
15
- import androidx.compose.foundation.layout.BoxScope
15
+ import androidx.compose.foundation.layout.Column
16
16
import androidx.compose.foundation.layout.Row
17
17
import androidx.compose.foundation.layout.RowScope
18
18
import androidx.compose.foundation.layout.Spacer
@@ -39,6 +39,7 @@ import androidx.compose.material3.Icon
39
39
import androidx.compose.material3.IconButton
40
40
import androidx.compose.material3.LocalMinimumInteractiveComponentSize
41
41
import androidx.compose.material3.MaterialTheme.colorScheme
42
+ import androidx.compose.material3.MaterialTheme.typography
42
43
import androidx.compose.material3.Scaffold
43
44
import androidx.compose.material3.Text
44
45
import androidx.compose.material3.surfaceColorAtElevation
@@ -64,6 +65,7 @@ import androidx.compose.ui.res.stringResource
64
65
import androidx.compose.ui.text.font.FontWeight
65
66
import androidx.compose.ui.text.style.TextOverflow
66
67
import androidx.compose.ui.unit.dp
68
+ import androidx.compose.ui.unit.sp
67
69
import com.dede.android_eggs.cat_editor.CaptureControllerDelegate.Companion.rememberCaptureControllerDelegate
68
70
import com.dede.android_eggs.cat_editor.CatEditorRecords.Companion.rememberCatEditorRecords
69
71
import com.dede.android_eggs.navigation.EasterEggsDestination
@@ -75,6 +77,7 @@ import com.dede.basic.utils.ShareCatUtils
75
77
import com.google.accompanist.permissions.ExperimentalPermissionsApi
76
78
import kotlinx.coroutines.launch
77
79
import androidx.appcompat.R as AppCompatR
80
+ import com.dede.android_eggs.resources.R as StringR
78
81
79
82
object CatEditorScreen : EasterEggsDestination {
80
83
override val route: String = " cat_editor"
@@ -89,7 +92,7 @@ fun CatEditorScreen() {
89
92
90
93
val catSeedState = rememberSaveable { mutableLongStateOf(Utilities .randomSeed()) }
91
94
var catSeed by catSeedState
92
- val catName = stringResource(R .string.default_cat_name, catSeed % 1000 )
95
+ val catName = stringResource(R .string.default_cat_name, catSeed) // full seed name
93
96
94
97
val colorPaletteState = remember { mutableStateOf(false ) }
95
98
@@ -188,10 +191,7 @@ fun CatEditorScreen() {
188
191
}
189
192
}
190
193
val inputCatButton: @Composable () -> Unit = {
191
- IconButton (onClick = {
192
- moreOptionsPopVisible = false
193
- inputSeedDialogState.value = true
194
- }) {
194
+ IconButton (onClick = { inputSeedDialogState.value = true }) {
195
195
Icon (imageVector = Icons .Rounded .Cat , contentDescription = null )
196
196
}
197
197
}
@@ -231,12 +231,25 @@ fun CatEditorScreen() {
231
231
}
232
232
},
233
233
title = {
234
- Text (
235
- text = catName,// "Cat Editor",
236
- maxLines = 1 ,
237
- overflow = TextOverflow .Ellipsis ,
238
- fontWeight = FontWeight .Medium
239
- )
234
+ Column (
235
+ horizontalAlignment = Alignment .CenterHorizontally
236
+ ) {
237
+ Text (
238
+ text = stringResource(StringR .string.cat_editor),
239
+ maxLines = 1 ,
240
+ overflow = TextOverflow .Ellipsis ,
241
+ fontWeight = FontWeight .Medium
242
+ )
243
+ Text (
244
+ text = stringResource(R .string.label_cat_seed, catSeed),
245
+ maxLines = 1 ,
246
+ overflow = TextOverflow .Ellipsis ,
247
+ style = typography.labelSmall.copy(
248
+ fontSize = 9 .sp,
249
+ fontWeight = FontWeight .Normal
250
+ ),
251
+ )
252
+ }
240
253
},
241
254
)
242
255
},
@@ -291,6 +304,7 @@ fun CatEditorScreen() {
291
304
292
305
if (bottomButtonCount < menuButtonList.size) {
293
306
MoreOptionsPopup (
307
+ modifier = Modifier .align(Alignment .BottomEnd ),
294
308
visible = moreOptionsPopVisible,
295
309
) {
296
310
for (i in bottomButtonCount.. < menuButtonList.size) {
@@ -384,6 +398,10 @@ private fun BottomOptionsBar(
384
398
// Add 'more options' button
385
399
iconButtonCount = count - 1
386
400
moreOptionsVisible = true
401
+ } else {
402
+ // Show all options
403
+ iconButtonCount = totalOptionsCount
404
+ moreOptionsVisible = false
387
405
}
388
406
}
389
407
) {
@@ -406,14 +424,15 @@ private fun BottomOptionsBar(
406
424
}
407
425
408
426
@Composable
409
- private fun BoxScope.MoreOptionsPopup (
427
+ private fun MoreOptionsPopup (
428
+ modifier : Modifier = Modifier ,
410
429
visible : Boolean ,
411
- content : @Composable RowScope .() -> Unit
430
+ content : @Composable() ( RowScope .() -> Unit )
412
431
) {
413
432
AnimatedVisibility (
414
433
visible = visible,
415
434
modifier = Modifier
416
- .align( Alignment . BottomEnd )
435
+ .then(modifier )
417
436
.padding(vertical = 12 .dp, horizontal = 14 .dp),
418
437
label = " More Options Visibility" ,
419
438
enter = fadeIn(animationSpec = tween(220 )) +
0 commit comments