mirror of
https://github.com/google-ai-edge/gallery.git
synced 2025-07-06 06:30:30 -04:00
Minor ux improvements
This commit is contained in:
parent
705b16f062
commit
3341286efa
1 changed files with 9 additions and 1 deletions
|
@ -67,6 +67,7 @@ import androidx.compose.runtime.mutableIntStateOf
|
|||
import androidx.compose.runtime.mutableStateMapOf
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.runtime.snapshots.SnapshotStateMap
|
||||
import androidx.compose.ui.Alignment
|
||||
|
@ -86,6 +87,8 @@ import com.google.aiedge.gallery.R
|
|||
import com.google.aiedge.gallery.data.Model
|
||||
import com.google.aiedge.gallery.ui.common.chat.MessageBubbleShape
|
||||
import com.google.aiedge.gallery.ui.theme.customColors
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.delay
|
||||
|
||||
private val promptTemplateTypes: List<PromptTemplateType> = PromptTemplateType.entries
|
||||
private val TAB_TITLES = PromptTemplateType.entries.map { it.label }
|
||||
|
@ -101,6 +104,7 @@ fun PromptTemplatesPanel(
|
|||
onSend: (fullPrompt: String) -> Unit,
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
val scope = rememberCoroutineScope()
|
||||
val uiState by viewModel.uiState.collectAsState()
|
||||
val selectedPromptTemplateType = uiState.selectedPromptTemplateType
|
||||
val inProgress = uiState.inProgress
|
||||
|
@ -381,8 +385,12 @@ fun PromptTemplatesPanel(
|
|||
.fillMaxWidth()
|
||||
.clickable {
|
||||
curTextInputContent = prompt
|
||||
scope.launch {
|
||||
// Give it sometime to show the click effect.
|
||||
delay(200)
|
||||
showExamplePromptBottomSheet = false
|
||||
}
|
||||
}
|
||||
.padding(horizontal = 16.dp, vertical = 8.dp),
|
||||
) {
|
||||
Row(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue