Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,7 @@ fun AgentChatScreen(
Text(
stringResource(R.string.introducing),
style = MaterialTheme.typography.headlineSmall,
textAlign = TextAlign.Center,
)
Text(
stringResource(R.string.agent_skills),
Expand All @@ -530,13 +531,15 @@ fun AgentChatScreen(
Brush.linearGradient(colors = listOf(Color(0xFF85B1F8), Color(0xFF3174F1))),
),
modifier = Modifier.padding(top = 12.dp, bottom = 16.dp),
textAlign = TextAlign.Center,
)
Text(
AnnotatedString.fromHtml(
stringResource(
R.string.agent_skills_intro,
AgentSkillsURLs.REPOSITORY,
AgentSkillsURLs.DISCUSSIONS,
stringResource(R.string.agent_skills),
)
),
style =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ fun MainUi(

// Text and voice Input.
Row(
modifier = Modifier.padding(horizontal = 16.dp),
modifier = Modifier.fillMaxWidth().padding(horizontal = 16.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(8.dp),
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ fun ConfigDialog(
initialValues: Map<String, Any>,
onDismissed: () -> Unit,
onOk: (values: Map<String, Any>, oldSystemPrompt: String, newSystemPrompt: String) -> Unit,
okBtnLabel: String = "OK",
okBtnLabel: String = stringResource(R.string.ok),
subtitle: String = "",
showCancel: Boolean = true,
showSystemPromptEditorTab: Boolean = false,
Expand Down Expand Up @@ -224,46 +224,43 @@ fun ConfigDialog(
)
}

// Button row.
Row(
horizontalArrangement =
if (showSystemPromptEditorTab && selectedTabIndex == 1) {
Arrangement.SpaceBetween
} else {
Arrangement.End
},
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier.padding(top = 8.dp),
) {
// Restore default button to restore system prompt.
if (showSystemPromptEditorTab && selectedTabIndex == 1) {
// Button row(s).
if (showSystemPromptEditorTab && selectedTabIndex == 1) {
Row(
modifier = Modifier.fillMaxWidth().padding(top = 8.dp),
horizontalArrangement = Arrangement.Start,
verticalAlignment = Alignment.CenterVertically,
) {
// Restore default button to restore system prompt.
OutlinedButton(
onClick = { systemPrompt = defaultSystemPrompt },
contentPadding = SMALL_BUTTON_CONTENT_PADDING,
) {
Text(stringResource(R.string.restore_default))
}
}
}

Row(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.End,
verticalAlignment = Alignment.CenterVertically,
) {
// Cancel button.
if (showCancel) {
TextButton(onClick = { onDismissed() }) { Text("Cancel") }
}
Row(
modifier = Modifier.fillMaxWidth().padding(top = 8.dp),
horizontalArrangement = Arrangement.End,
verticalAlignment = Alignment.CenterVertically,
) {
// Cancel button.
if (showCancel) {
TextButton(onClick = { onDismissed() }) { Text(stringResource(R.string.cancel)) }
}

// Ok button
Button(
onClick = {
Log.d(TAG, "Values from dialog: $values")
onOk(values.toMap(), savedSystemPrompt, systemPrompt)
}
) {
Text(okBtnLabel)
Spacer(modifier = Modifier.width(8.dp))

// Ok button
Button(
onClick = {
Log.d(TAG, "Values from dialog: $values")
onOk(values.toMap(), savedSystemPrompt, systemPrompt)
}
) {
Text(okBtnLabel)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ fun ModelPageAppBar(
modelConfigs.removeIf { it.key == ConfigKeys.ENABLE_SPECULATIVE_DECODING }
}
ConfigDialog(
title = "Configurations",
title = stringResource(R.string.config_dialog_title),
configs = modelConfigs,
initialValues = model.configValues,
onDismissed = { showConfigDialog = false },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ package com.google.ai.edge.gallery.ui.common.chat
// import androidx.compose.ui.tooling.preview.Preview
// import com.google.ai.edge.gallery.ui.theme.GalleryTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.res.stringResource
import com.google.ai.edge.gallery.R
import com.google.ai.edge.gallery.data.Config
import com.google.ai.edge.gallery.data.ConfigKeys
import com.google.ai.edge.gallery.data.NumberSliderConfig
Expand Down Expand Up @@ -67,8 +69,8 @@ fun BenchmarkConfigDialog(
onBenchmarkClicked: (ChatMessage, warmUpIterations: Int, benchmarkIterations: Int) -> Unit,
) {
ConfigDialog(
title = "Benchmark configs",
okBtnLabel = "Start",
title = stringResource(R.string.benchmark_config_dialog_title),
okBtnLabel = stringResource(R.string.start),
configs = BENCHMARK_CONFIGS,
initialValues = BENCHMARK_CONFIGS_INITIAL_VALUES,
onDismissed = onDismissed,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,13 @@ fun TextAndVoiceInput(
)
}

AnimatedContent(targetState = textInputMode) { showTextInput ->
AnimatedContent(targetState = textInputMode, modifier = Modifier.weight(1f)) { showTextInput ->
// Text field.
if (showTextInput) {
val cdPromptInput = stringResource(R.string.cd_prompt_input_text_field)
Row(
modifier =
Modifier.weight(1f)
Modifier.fillMaxWidth()
.clip(RoundedCornerShape(28.dp))
.background(MaterialTheme.colorScheme.surface)
.border(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1125,7 +1125,7 @@ private fun TaskCard(
contentAlignment = Alignment.Center,
) {
Text(
"New",
stringResource(R.string.new_badge),
color = MaterialTheme.customColors.newFeatureTextColor,
style = MaterialTheme.typography.labelLarge,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,13 @@ fun MobileActionsChallengeDialog(
Column(modifier = Modifier.padding(16.dp)) {
Text(text = "🏆", modifier = Modifier.fillMaxWidth(), textAlign = TextAlign.Center)
Text(
text = stringResource(R.string.mobile_actions_challenge_title),
modifier = Modifier.fillMaxWidth(),
text =
stringResource(
R.string.mobile_actions_challenge_title,
stringResource(R.string.mobile_actions_title),
),
style = MaterialTheme.typography.titleLarge,
textAlign = TextAlign.Center,
fontSize = 16.sp,
fontWeight = FontWeight.Bold,
Expand All @@ -68,7 +73,11 @@ fun MobileActionsChallengeDialog(
)
Spacer(modifier = Modifier.height(16.dp))
Text(
text = stringResource(R.string.mobile_actions_challenge_description),
text =
stringResource(
R.string.mobile_actions_challenge_description,
stringResource(R.string.mobile_actions_title),
),
style = MaterialTheme.typography.bodyMedium,
)
Spacer(modifier = Modifier.height(24.dp))
Expand Down
32 changes: 21 additions & 11 deletions Android/src/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@
<string name="aicore_image_limit_message" translatable="true">The current model can only support 1 image per chat. To ask about another image, create a new chat.</string>
<string name="model_not_support_image_message" translatable="true">The current model does not support image input.</string>
<string name="model_not_support_audio_message" translatable="true">The current model does not support audio input.</string>
<string name="aichat_initializing_title" translatable="true">Initializing model</string>
<!-- TODO(b/534771669): Re-enable translation after shorter translation is provided. -->
<!-- Status indicator when initializing model. [CHAR_LIMIT=25] -->
<string name="aichat_initializing_title" translatable="false">Initializing model</string>
<string name="aichat_initializing_content" translatable="true">Sit tight, this can take up to 1 minute</string>
<string name="app_intro" translatable="true">Explore a world of amazing on-device models from</string>
<string name="app_name" translatable="true">Google AI Edge Gallery</string>
<string name="app_name_first_part" translatable="true">Google AI</string>
<string name="app_name_second_part" translatable="true">Edge Gallery</string>
<string name="app_name" translatable="false">Google AI Edge Gallery</string>
<string name="app_name_first_part" translatable="false">Google AI</string>
<string name="app_name_second_part" translatable="false">Edge Gallery</string>
<string name="askimage_emptystate_title" translatable="true">Ask Image</string>
<string name="askimage_emptystate_content" translatable="true">To get started, tap the + below to add an image (max 10 images per chat) and type a prompt to ask a question about it!</string>
<string name="askimage_emptystate_content_aicore" translatable="true">To get started, tap the + below to add an image (max 1 image per chat) and type a prompt to ask a question about it!</string>
Expand Down Expand Up @@ -80,6 +82,9 @@
<string name="color" translatable="true">Color</string>
<string name="config_dialog_tab_model_configs" translatable="true">Model configs</string>
<string name="config_dialog_tab_system_prompt" translatable="true">System prompt</string>
<string name="config_dialog_title" translatable="true">Configurations</string>
<string name="benchmark_config_dialog_title" translatable="true">Benchmark configs</string>
<string name="start" translatable="true">Start</string>
<string name="continue_button_label" translatable="true">Continue</string>
<string name="conversation_history" translatable="true">Conversation History</string>
<string name="copy" translatable="true">Copy</string>
Expand Down Expand Up @@ -116,7 +121,9 @@
<string name="generate_and_copy" translatable="true">Generate and copy</string>
<string name="grant_permissions" translatable="true">Grant permissions</string>
<string name="grant_record_audio_permission" translatable="true">Grant record audio permission</string>
<string name="hold_down_to_talk" translatable="true">Hold to talk</string>
<!-- TODO(b/534771669): Re-enable translation after shorter translation is provided. -->
<!-- Instruction label on the voice recording button. [CHAR_LIMIT=20] -->
<string name="hold_down_to_talk" translatable="false">Hold to talk</string>
<string name="input_history" translatable="true">Input history</string>
<string name="instructions" translatable="true">Instructions</string>
<string name="introducing" translatable="true">Introducing</string>
Expand Down Expand Up @@ -170,7 +177,9 @@
<string name="reset" translatable="true">Reset</string>
<string name="reset_note" translatable="true">Tapping \"Reset\" will reset LiteRT-LM engine only. The game progress won\'t be affected.</string>
<string name="resetting_engine" translatable="true">Resetting engine...</string>
<string name="restore_default" translatable="true">Restore default</string>
<!-- TODO(b/534771669): Re-enable translation after shorter translation is provided. -->
<!-- Button label to restore default model configurations. [CHAR_LIMIT=20] -->
<string name="restore_default" translatable="false">Restore default</string>
<string name="reinitializing_description" translatable="true">The game progress won\'t be affected</string>
<string name="run" translatable="true">Run</string>
<string name="running" translatable="true">Running...</string>
Expand Down Expand Up @@ -220,7 +229,7 @@
<string name="set_timer_message" translatable="true">Setting the timer for %1$d seconds.</string>
<string name="add_calendar_event_message" translatable="true">Adding \"Team meeting (10AM-11AM)\" to your calendar.</string>
<string name="take_picture_message" translatable="true">Opening the camera app.</string>
<string name="mobile_actions_title" translatable="true">Mobile Actions</string>
<string name="mobile_actions_title" translatable="false">Mobile Actions</string>
<string name="mobile_actions_description" translatable="true">Control your device with simple commands</string>
<string name="mobile_actions_supported_actions" translatable="true">Supported sample actions:</string>
<string name="mobile_actions_tab_model_response" translatable="true">Model response</string>
Expand Down Expand Up @@ -253,9 +262,9 @@
<string name="prompt_template_label_open_wifi_settings" translatable="true">Open WIFI settings</string>

<!-- Strings for MobileActionsChallengeDialog -->
<string name="mobile_actions_challenge_title" translatable="true">Mobile Actions Finetune Challenge</string>
<string name="mobile_actions_challenge_title" translatable="true">%s Finetune Challenge</string>
<string name="mobile_actions_challenge_subtitle" translatable="true">Build it to play it!</string>
<string name="mobile_actions_challenge_description" translatable="true">This demo is locked. To unlock the Mobile Actions agent, you need to compile the model yourself using our open-source recipe.</string>
<string name="mobile_actions_challenge_description" translatable="true">This demo is locked. To unlock the %s agent, you need to compile the model yourself using our open-source recipe.</string>
<string name="mobile_actions_challenge_instructions_title" translatable="true">Instructions:</string>
<string name="mobile_actions_challenge_instruction_1" translatable="true">1. <![CDATA[<b>On your computer</b>]]>, open <![CDATA[<a href="https://ai.google.dev/gemma/docs/mobile-actions">this guide</a>]]></string>
<string name="mobile_actions_challenge_instruction_2" translatable="true">2. Follow the instructions to fine tune the model and convert it to .litertlm format.</string>
Expand Down Expand Up @@ -284,7 +293,7 @@
<string name="add_skill_dialog_title_from_local_import" translatable="true">Import local skill</string>
<string name="add_skill_dialog_subtitle_from_local_import" translatable="true">Please first \"adb push\" the whole skill directory to /sdcard/Download</string>
<string name="add_skill_manual_input_sheet_title" translatable="true">Create a skill</string>
<string name="agent_skills" translatable="true">Agent Skills</string>
<string name="agent_skills" translatable="false">Agent Skills</string>
<string name="disclaimer_dialog_content" translatable="true">Third-party skills are not authored or endorsed by Google. Google is not responsible for their contents, security, or data handling practices.\n\nPlease exercise caution before providing sensitive information, such as personal identification, tokens, or API keys.\n\nAny use of an Agent Skill is subject to the applicable terms for that Skill.</string>
<string name="disclaimer_dialog_title" translatable="true">Add third-party skill</string>
<string name="disclaimer_dialog_agree" translatable="true">Agree</string>
Expand Down Expand Up @@ -563,7 +572,7 @@
<!-- Title of dialog warning that a skill is disabled. %s is the skill name. [CHAR_LIMIT=NONE] -->
<string name="disabled_skill_dialog_title" translatable="true">The \'%s\' skill is currently disabled</string>
<!-- Introductory text for Agent Skills screen. Contains HTML links. [CHAR_LIMIT=NONE] -->
<string name="agent_skills_intro" translatable="true">Use specialized, high-order reasoning by loading different skills or <![CDATA[<a href="%1$s">creating your own</a>]]>. Explore community contributed skills on <![CDATA[<a href="%2$s">GitHub discussions</a>]]>.\n\nTry tapping a sample prompt below to see Agent Skills in action!</string>
<string name="agent_skills_intro" translatable="true">Use specialized, high-order reasoning by loading different skills or <![CDATA[<a href="%1$s">creating your own</a>]]>. Explore community contributed skills on <![CDATA[<a href="%2$s">GitHub discussions</a>]]>.\n\nTry tapping a sample prompt below to see %3$s in action!</string>

<!-- Config Labels -->
<!-- Label for the 'Max tokens' option in the model configuration dialog. [CHAR_LIMIT=NONE] -->
Expand Down Expand Up @@ -641,4 +650,5 @@
<string name="config_label_font_size" translatable="true">Font size</string>
<!-- Label for the 'Max character count' option in the model configuration dialog. [CHAR_LIMIT=NONE] -->
<string name="config_label_max_char_count" translatable="true">Max character count</string>
<string name="new_badge" translatable="true" description="Badge label indicating a new feature. [CHAR_LIMIT=5]">New</string>
</resources>
Loading