Update edit launcher title to use case oneliner
Use the current case's oneliner text as the title for the remote input intent. This ensures consistency with the CaseListScreen's display when no oneliner is present, showing a "…" placeholder. This improves the user experience by making the system input picker's title match what the user just selected.
This commit is contained in:
@@ -93,12 +93,15 @@ fun CaseDetailScreen(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val launchEdit: () -> Unit = {
|
val launchEdit: () -> Unit = {
|
||||||
|
// Mirror CaseListScreen's "…" placeholder when no oneliner exists yet,
|
||||||
|
// so the system input picker shows the same title the user just tapped.
|
||||||
|
val currentTitle = case?.oneliner?.displayText() ?: "…"
|
||||||
val languageExtras = Bundle().apply {
|
val languageExtras = Bundle().apply {
|
||||||
putString(RecognizerIntent.EXTRA_LANGUAGE, VOICE_INPUT_LANGUAGE)
|
putString(RecognizerIntent.EXTRA_LANGUAGE, VOICE_INPUT_LANGUAGE)
|
||||||
putString(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, VOICE_INPUT_LANGUAGE)
|
putString(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, VOICE_INPUT_LANGUAGE)
|
||||||
}
|
}
|
||||||
val remoteInput = RemoteInput.Builder(ONELINER_INPUT_KEY)
|
val remoteInput = RemoteInput.Builder(ONELINER_INPUT_KEY)
|
||||||
.setLabel("OneLiner")
|
.setLabel(currentTitle)
|
||||||
.setAllowFreeFormInput(true)
|
.setAllowFreeFormInput(true)
|
||||||
.addExtras(languageExtras)
|
.addExtras(languageExtras)
|
||||||
.build()
|
.build()
|
||||||
@@ -107,7 +110,7 @@ fun CaseDetailScreen(
|
|||||||
putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, VOICE_INPUT_LANGUAGE)
|
putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, VOICE_INPUT_LANGUAGE)
|
||||||
}
|
}
|
||||||
RemoteInputIntentHelper.putRemoteInputsExtra(intent, listOf(remoteInput))
|
RemoteInputIntentHelper.putRemoteInputsExtra(intent, listOf(remoteInput))
|
||||||
RemoteInputIntentHelper.putTitleExtra(intent, "OneLiner")
|
RemoteInputIntentHelper.putTitleExtra(intent, currentTitle)
|
||||||
editLauncher.launch(intent)
|
editLauncher.launch(intent)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user