mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-15 10:26:53 -04:00
Speech to text dialog displays custom app name
This commit is contained in:
parent
a66c6c02a7
commit
284f44b364
@ -87,6 +87,6 @@
|
|||||||
<string name="pref_extras">Extras</string>
|
<string name="pref_extras">Extras</string>
|
||||||
<string name="new_tab_snackbar">Article opened in new tab</string>
|
<string name="new_tab_snackbar">Article opened in new tab</string>
|
||||||
<string name="search_widget_text">Search Kiwix</string>
|
<string name="search_widget_text">Search Kiwix</string>
|
||||||
<string name="speech_prompt_text">Speak to search Kiwix</string>
|
<string name="speech_prompt_text">Speak to search %s</string>
|
||||||
<string name="speech_not_supported">Sorry! Your device does not support speech input</string>
|
<string name="speech_not_supported">Sorry! Your device does not support speech input</string>
|
||||||
</resources>
|
</resources>
|
@ -173,12 +173,13 @@ public class SearchActivity extends AppCompatActivity
|
|||||||
|
|
||||||
|
|
||||||
private void promptSpeechInput() {
|
private void promptSpeechInput() {
|
||||||
|
String appName = getResources().getString(R.string.app_name);
|
||||||
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
|
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
|
||||||
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
|
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
|
||||||
RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
|
RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
|
||||||
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault()); // TODO: choose selected lang on kiwix
|
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault()); // TODO: choose selected lang on kiwix
|
||||||
intent.putExtra(RecognizerIntent.EXTRA_PROMPT,
|
intent.putExtra(RecognizerIntent.EXTRA_PROMPT,
|
||||||
getString(R.string.speech_prompt_text));
|
String.format(getString(R.string.speech_prompt_text), appName));
|
||||||
try {
|
try {
|
||||||
startActivityForResult(intent, REQ_CODE_SPEECH_INPUT);
|
startActivityForResult(intent, REQ_CODE_SPEECH_INPUT);
|
||||||
} catch (ActivityNotFoundException a) {
|
} catch (ActivityNotFoundException a) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user