From 8bd9615e6bae352c461653703af725e1c325ab0c Mon Sep 17 00:00:00 2001 From: Han Yin Date: Fri, 29 Aug 2025 17:15:15 -0700 Subject: [PATCH] UI: hide the stubbing actions in Conversation screen --- .../java/com/example/llama/MainActivity.kt | 10 ++--- .../ui/scaffold/bottombar/BottomBarConfig.kt | 6 +-- .../bottombar/ConversationBottomBar.kt | 42 +++++++++++-------- 3 files changed, 32 insertions(+), 26 deletions(-) diff --git a/examples/llama.android/app/src/main/java/com/example/llama/MainActivity.kt b/examples/llama.android/app/src/main/java/com/example/llama/MainActivity.kt index 43d3d7a683..fc0e08e5bc 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/MainActivity.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/MainActivity.kt @@ -290,11 +290,11 @@ fun AppContent( val modelThinkingOrSpeaking = engineState is State.ProcessingUserPrompt || engineState is State.Generating - val showStubMessage = { - handleScaffoldEvent(ScaffoldEvent.ShowSnackbar( - message = "Stub for now, let me know if you want it done :)" - )) - } + val showStubMessage = null // { +// handleScaffoldEvent(ScaffoldEvent.ShowSnackbar( +// message = "Stub for now, let me know if you want it done :)" +// )) +// } ScaffoldConfig( topBarConfig = TopBarConfig.Performance( diff --git a/examples/llama.android/app/src/main/java/com/example/llama/ui/scaffold/bottombar/BottomBarConfig.kt b/examples/llama.android/app/src/main/java/com/example/llama/ui/scaffold/bottombar/BottomBarConfig.kt index bf69463af7..7331ec929c 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/ui/scaffold/bottombar/BottomBarConfig.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/ui/scaffold/bottombar/BottomBarConfig.kt @@ -102,8 +102,8 @@ sealed class BottomBarConfig { val onSendClick: () -> Unit, val showModelCard: Boolean, val onToggleModelCard: (Boolean) -> Unit, - val onAttachPhotoClick: () -> Unit, - val onAttachFileClick: () -> Unit, - val onAudioInputClick: () -> Unit, + val onAttachPhotoClick: (() -> Unit)?, + val onAttachFileClick: (() -> Unit)?, + val onAudioInputClick: (() -> Unit)?, ) : BottomBarConfig() } diff --git a/examples/llama.android/app/src/main/java/com/example/llama/ui/scaffold/bottombar/ConversationBottomBar.kt b/examples/llama.android/app/src/main/java/com/example/llama/ui/scaffold/bottombar/ConversationBottomBar.kt index 95b1937256..bb13e8e835 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/ui/scaffold/bottombar/ConversationBottomBar.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/ui/scaffold/bottombar/ConversationBottomBar.kt @@ -41,9 +41,9 @@ fun ConversationBottomBar( onSendClick: () -> Unit, showModelCard: Boolean, onToggleModelCard: (Boolean) -> Unit, - onAttachPhotoClick: () -> Unit, - onAttachFileClick: () -> Unit, - onAudioInputClick: () -> Unit, + onAttachPhotoClick: (() -> Unit)?, + onAttachFileClick: (() -> Unit)?, + onAudioInputClick: (() -> Unit)?, ) { val placeholder = if (isReady) "Message ${APP_NAME}..." else "Please wait for ${APP_NAME} to finish" @@ -86,25 +86,31 @@ fun ConversationBottomBar( BottomAppBar( actions = { - IconButton(onClick = onAttachPhotoClick) { - Icon( - imageVector = Icons.Outlined.AddPhotoAlternate, - contentDescription = "Attach a photo", - ) + onAttachPhotoClick?.let { + IconButton(onClick = it) { + Icon( + imageVector = Icons.Outlined.AddPhotoAlternate, + contentDescription = "Attach a photo", + ) + } } - IconButton(onClick = onAttachFileClick) { - Icon( - imageVector = Icons.Outlined.AttachFile, - contentDescription = "Attach a file", - ) + onAttachFileClick?.let { + IconButton(onClick = it) { + Icon( + imageVector = Icons.Outlined.AttachFile, + contentDescription = "Attach a file", + ) + } } - IconButton(onClick = onAudioInputClick) { - Icon( - imageVector = Icons.Default.Mic, - contentDescription = "Input with voice", - ) + onAudioInputClick?.let { + IconButton(onClick = it) { + Icon( + imageVector = Icons.Default.Mic, + contentDescription = "Input with voice", + ) + } } IconButton(onClick = { onToggleModelCard(!showModelCard) } ) {