[android] Modify TTS support message and link to guide in voice settings
Signed-off-by: Gonzalo Pesquero <gpesquero@yahoo.es>
This commit is contained in:
parent
cde002cc63
commit
816697c927
6 changed files with 105 additions and 85 deletions
|
@ -0,0 +1,49 @@
|
|||
package app.organicmaps.settings;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceViewHolder;
|
||||
|
||||
public class CustomPreference extends Preference
|
||||
{
|
||||
private int mTextViewId;
|
||||
private OnBindTextViewListener mOnBindTextViewListener = null;
|
||||
|
||||
public CustomPreference(Context ctx, AttributeSet attrs, int defStyle)
|
||||
{
|
||||
super(ctx, attrs, defStyle);
|
||||
}
|
||||
|
||||
public CustomPreference(Context ctx, AttributeSet attrs)
|
||||
{
|
||||
super(ctx, attrs);
|
||||
}
|
||||
|
||||
public interface OnBindTextViewListener
|
||||
{
|
||||
void onBindTextView(TextView textView);
|
||||
}
|
||||
|
||||
public void setOnBindTextViewListener(int textViewId, OnBindTextViewListener listener)
|
||||
{
|
||||
mTextViewId = textViewId;
|
||||
mOnBindTextViewListener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull PreferenceViewHolder holder)
|
||||
{
|
||||
super.onBindViewHolder(holder);
|
||||
|
||||
if (mOnBindTextViewListener != null)
|
||||
{
|
||||
TextView textViewSummary = (TextView) holder.findViewById(mTextViewId);
|
||||
mOnBindTextViewListener.onBindTextView(textViewSummary);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,16 +2,18 @@ package app.organicmaps.settings;
|
|||
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.speech.tts.TextToSpeech;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableString;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.text.style.ClickableSpan;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.preference.ListPreference;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.SeekBarPreference;
|
||||
|
@ -45,10 +47,10 @@ public class VoiceInstructionsSettingsFragment extends BaseXmlSettingsFragment
|
|||
private SeekBarPreference mTtsVolume;
|
||||
@NonNull
|
||||
@SuppressWarnings("NotNullFieldNotInitialized")
|
||||
private Preference mTtsLangInfo;
|
||||
private Preference mTtsVoiceTest;
|
||||
@NonNull
|
||||
@SuppressWarnings("NotNullFieldNotInitialized")
|
||||
private Preference mTtsVoiceTest;
|
||||
private CustomPreference mTtsPrefSupport;
|
||||
|
||||
private List<String> mTtsTestStringArray;
|
||||
private int mTestStringIndex;
|
||||
|
@ -65,12 +67,10 @@ public class VoiceInstructionsSettingsFragment extends BaseXmlSettingsFragment
|
|||
TtsPlayer.setEnabled(false);
|
||||
mTtsPrefLanguages.setEnabled(false);
|
||||
mTtsVolume.setEnabled(false);
|
||||
mTtsLangInfo.setSummary(R.string.prefs_languages_information_off);
|
||||
mTtsVoiceTest.setEnabled(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
mTtsLangInfo.setSummary(R.string.prefs_languages_information);
|
||||
mTtsVolume.setEnabled(true);
|
||||
mTtsVoiceTest.setEnabled(true);
|
||||
|
||||
|
@ -114,7 +114,6 @@ public class VoiceInstructionsSettingsFragment extends BaseXmlSettingsFragment
|
|||
|
||||
mTtsPrefEnabled = getPreference(getString(R.string.pref_tts_enabled));
|
||||
mTtsPrefLanguages = getPreference(getString(R.string.pref_tts_language));
|
||||
mTtsLangInfo = getPreference(getString(R.string.pref_tts_info));
|
||||
mTtsVoiceTest = getPreference(getString(R.string.pref_tts_test_voice));
|
||||
mTtsVoiceTest.setOnPreferenceClickListener(pref -> {
|
||||
if (mTtsTestStringArray == null)
|
||||
|
@ -129,7 +128,7 @@ public class VoiceInstructionsSettingsFragment extends BaseXmlSettingsFragment
|
|||
});
|
||||
|
||||
initVolume();
|
||||
initTtsLangInfoLink();
|
||||
initTtsSupportInfo();
|
||||
updateTts();
|
||||
}
|
||||
|
||||
|
@ -191,15 +190,12 @@ public class VoiceInstructionsSettingsFragment extends BaseXmlSettingsFragment
|
|||
mTtsPrefLanguages.setSummary(null);
|
||||
mTtsVolume.setEnabled(false);
|
||||
mTtsVoiceTest.setEnabled(false);
|
||||
mTtsLangInfo.setSummary(R.string.prefs_languages_information_off);
|
||||
|
||||
enableListeners(true);
|
||||
return;
|
||||
}
|
||||
|
||||
final boolean enabled = TtsPlayer.isEnabled();
|
||||
mTtsLangInfo.setSummary(enabled ? R.string.prefs_languages_information
|
||||
: R.string.prefs_languages_information_off);
|
||||
|
||||
final CharSequence[] entries = new CharSequence[languages.size()];
|
||||
final CharSequence[] values = new CharSequence[languages.size()];
|
||||
|
@ -263,21 +259,35 @@ public class VoiceInstructionsSettingsFragment extends BaseXmlSettingsFragment
|
|||
TtsPlayer.INSTANCE.setVolume(volume);
|
||||
}
|
||||
|
||||
private void initTtsLangInfoLink()
|
||||
private void initTtsSupportInfo()
|
||||
{
|
||||
final Preference ttsLangInfoLink = getPreference(getString(R.string.pref_tts_info_link));
|
||||
final String ttsLinkText = getString(R.string.prefs_languages_information_off_link);
|
||||
final Spannable link = new SpannableString(ttsLinkText + "↗");
|
||||
// Set link color.
|
||||
link.setSpan(new ForegroundColorSpan(ContextCompat.getColor(requireContext(),
|
||||
UiUtils.getStyledResourceId(requireContext(), androidx.appcompat.R.attr.colorAccent))),
|
||||
0, ttsLinkText.length(), 0);
|
||||
ttsLangInfoLink.setSummary(link);
|
||||
// Init TTS Support link.
|
||||
mTtsPrefSupport = getPreference(getString(R.string.pref_tts_support));
|
||||
|
||||
final String ttsInfoUrl = requireActivity().getString(R.string.tts_info_link);
|
||||
ttsLangInfoLink.setOnPreferenceClickListener(preference -> {
|
||||
Utils.openUrl(requireContext(), ttsInfoUrl);
|
||||
return false;
|
||||
mTtsPrefSupport.setOnBindTextViewListener(android.R.id.summary, textView -> {
|
||||
|
||||
textView.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
|
||||
String ttsSupportGuideLink = getString(R.string.pref_tts_faq_link);
|
||||
String summaryText = String.format(getString(R.string.pref_tts_support_info),
|
||||
ttsSupportGuideLink);
|
||||
|
||||
Spannable summarySpan = new SpannableString(summaryText);
|
||||
|
||||
summarySpan.setSpan(new ClickableSpan() {
|
||||
@Override
|
||||
public void onClick(@NonNull View widget) {
|
||||
|
||||
final String ttsFaqUrl = requireActivity().getString(R.string.tts_faq_url);
|
||||
|
||||
Utils.openUri(requireContext(), Uri.parse(ttsFaqUrl));
|
||||
}
|
||||
},
|
||||
summaryText.indexOf(ttsSupportGuideLink),
|
||||
summaryText.indexOf(ttsSupportGuideLink) + ttsSupportGuideLink.length(),
|
||||
0);
|
||||
|
||||
textView.setText(summarySpan, TextView.BufferType.SPANNABLE);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,11 +21,8 @@
|
|||
<string name="pref_tts_language" translatable="false">TtsLanguage</string>
|
||||
<string name="pref_tts_volume" translatable="false">TtsVolume</string>
|
||||
<string name="pref_tts_test_voice" translatable="false">TtsTestVoice</string>
|
||||
<string name="pref_tts_info" translatable="false">TtsInfo</string>
|
||||
<string name="pref_tts_info_link" translatable="false">TtsInfoLink</string>
|
||||
<string name="pref_tts_support" translatable="false">TtsSupport</string>
|
||||
<string name="pref_speed_cameras" translatable="false">SpeedCameras</string>
|
||||
<!-- TODO: Move to another domain. -->
|
||||
<string name="tts_info_link" translatable="false">https://mapsme.zendesk.com/hc/en-us/articles/208628985-How-can-I-check-TTS-settings-on-my-Android-device-</string>
|
||||
<string name="pref_autodownload" translatable="false">AutoDownloadMap</string>
|
||||
<string name="pref_3d" translatable="false">3D</string>
|
||||
<string name="pref_3d_buildings" translatable="false">3DBuildings</string>
|
||||
|
@ -63,4 +60,8 @@
|
|||
<string name="auto_enum_value" translatable="false">AUTO</string>
|
||||
<string name="placepage_behavior" translatable="false">com.google.android.material.bottomsheet.BottomSheetBehavior</string>
|
||||
<string name="car_notification_channel_name" translatable="false">CAR_NOTIFICATION_CHANNEL</string>
|
||||
|
||||
<!-- URLs -->
|
||||
<string name="tts_faq_url" translatable="false">https://organicmaps.app/faq/tts</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -238,6 +238,10 @@
|
|||
<string name="pref_tts_playing_test_voice">Check the volume or system Text-To-Speech settings if you don\'t hear the voice now.</string>
|
||||
<!-- Settings «Route» category: «Tts unavailable» subtitle -->
|
||||
<string name="pref_tts_unavailable">Not Available</string>
|
||||
<!-- Text with TTS support information in the 'Voice Instructions' settings menu. -->
|
||||
<string name="pref_tts_support_info">Organic Maps uses system TTS (Text-To-Speech) for voice instructions. For support on TTS installation or troubleshooting, please check the %s.</string>
|
||||
<!-- Link string used at the end of the <pref_tts_support_info> string. -->
|
||||
<string name="pref_tts_faq_link">TTS FAQs (Frequently Asked Questions)</string>
|
||||
<string name="pref_map_auto_zoom">Auto zoom</string>
|
||||
<string name="duration_disabled">Off</string>
|
||||
<string name="duration_1_hour">1 hour</string>
|
||||
|
@ -597,7 +601,6 @@
|
|||
<string name="feedback_general">General Feedback</string>
|
||||
<string name="prefs_languages_information">We use system TTS for voice instructions. Many Android devices use Google TTS, you can download or update it from Google Play (https://play.google.com/store/apps/details?id=com.google.android.tts)</string>
|
||||
<string name="prefs_languages_information_off">For some languages, you will need to install a speech synthesizer or an additional language pack from the app store (Google Play, Galaxy Store, App Gallery, FDroid).\nOpen your device\'s settings → Language and input → Speech → Text to speech output.\nHere you can manage settings for speech synthesis (for example, download language pack for offline use) and select another text-to-speech engine.</string>
|
||||
<string name="prefs_languages_information_off_link">For more information please check this guide.</string>
|
||||
<string name="transliteration_title">Transliteration into Latin alphabet</string>
|
||||
<string name="learn_more">Learn more</string>
|
||||
<!-- Subway exits for public transport marks on the map -->
|
||||
|
|
|
@ -12,16 +12,7 @@
|
|||
<Preference
|
||||
android:key="@string/pref_tts_test_voice"
|
||||
android:title="@string/pref_tts_test_voice_title" />
|
||||
<Preference
|
||||
android:enabled="false"
|
||||
android:key="@string/pref_tts_info"
|
||||
android:persistent="false"
|
||||
android:selectable="false"
|
||||
android:summary="@string/prefs_languages_information" />
|
||||
<Preference
|
||||
android:enabled="true"
|
||||
android:key="@string/pref_tts_info_link"
|
||||
android:persistent="false"
|
||||
android:selectable="true"
|
||||
android:summary="@string/prefs_languages_information_off_link" />
|
||||
<app.organicmaps.settings.CustomPreference
|
||||
android:key="@string/pref_tts_support"
|
||||
android:summary="@string/pref_tts_support_info" />
|
||||
</androidx.preference.PreferenceScreen>
|
||||
|
|
|
@ -5651,6 +5651,16 @@
|
|||
zh-Hans = 其他
|
||||
zh-Hant = 其他
|
||||
|
||||
[pref_tts_support_info]
|
||||
comment = Text with TTS support information in the 'Voice Instructions' settings menu.
|
||||
tags = android
|
||||
en = Organic Maps uses system TTS (Text-To-Speech) for voice instructions. For support on TTS installation or troubleshooting, please check the %s.
|
||||
|
||||
[pref_tts_faq_link]
|
||||
comment = Link string used at the end of the <pref_tts_support_info> string.
|
||||
tags = android
|
||||
en = TTS FAQs (Frequently Asked Questions)
|
||||
|
||||
[pref_track_record_title]
|
||||
comment = Settings «Map» category: «Record track» title
|
||||
tags = ios
|
||||
|
@ -19313,50 +19323,6 @@
|
|||
zh-Hans = 对于某些语言,您需要从应用商店(Google Play Market、Galaxy Store)中安装其他语音合成器或语言包。\n打开您的设备的设置 → 语言和输入法 → 语音 → 文字转语音 (TTS) 输出。\n您可以在这里管理语音合成的设置(例如,下载语言包供离线使用)和选择其他文字转语音引擎。
|
||||
zh-Hant = 對於某些語言,您將需要從 App 商店 (Google Play 商店, Galaxy Store) 安裝其他語音合成器或額外的語言套件。\n開啟您裝置的設定 → 語言與輸入 → 語音 → 文字轉換語音輸出。\n在這裡,您可以管理語音合成器的設定(例如,下載語言套件以供離線使用),並選取其他文字轉換語音引擎。
|
||||
|
||||
[prefs_languages_information_off_link]
|
||||
tags = android
|
||||
en = For more information please check this guide.
|
||||
af = Sien hierdie gids vir meer inligting
|
||||
ar = لمزيد من المعلومات الرجاء مراجعة هذا الدليل.
|
||||
az = Əlavə məlumat üçün bu təlimatı nəzərdən keçirin.
|
||||
be = Больш падрабязная інфармацыя знаходзіцца ў гэтым кіраўніцтве.
|
||||
bg = За повече информация вижте това ръководство.
|
||||
ca = Per a més informació, vegeu aquesta guia.
|
||||
cs = Více informací najdete v tomto návodu.
|
||||
da = Se denne vejledning for flere oplysninger.
|
||||
de = Weitere Informationen finden Sie in dieser Anleitung.
|
||||
el = Για περισσότερες πληροφορίες δείτε αυτό τον οδηγό.
|
||||
es = Para obtener más información, consulte esta guía.
|
||||
et = Lisainfo saamiseks palun vaadake seda juhist.
|
||||
eu = Informazio gehiago lortzeko, ikusi gida hau.
|
||||
fa = برای اطلاعات بیشتر لطفا این راهنما را بررسی کنید.
|
||||
fi = Lisätietoja saat tästä oppaasta.
|
||||
fr = Pour plus d’informations, veuillez consulter ce guide.
|
||||
he = למידע נוסף ניתן לקרוא את המדריך הזה.
|
||||
hu = További tájékoztatást találhat még ebben az útmutatóban.
|
||||
id = Untuk informasi selengkapnya, bacalah panduan ini.
|
||||
it = Per maggiori informazioni, consulta questa guida.
|
||||
ja = 詳細については、このガイドをご確認ください。
|
||||
ko = 자세한 내용을 보려면 이 가이드를 확인하세요.
|
||||
lt = Jei norite išsamesnės informacijos, pažvelkite į šią instrukciją
|
||||
mr = अधिक माहितीसाठी कृपया ही मार्गदर्शिका पहा.
|
||||
nb = Les denne veiledningen for mer informasjon.
|
||||
nl = Gelieve deze handleiding te lezen voor meer informatie.
|
||||
pl = Aby uzyskać więcej informacji, spójrz na ten poradnik.
|
||||
pt = Para obter mais informações, consulte este guia.
|
||||
pt-BR = Para obter mais informações, consulte este guia.
|
||||
ro = Consultă acest ghid pentru informații suplimentare.
|
||||
ru = Более подробная информация — в этом руководстве.
|
||||
sk = Viac informácií nájdete v tomto návode.
|
||||
sv = Kolla in den här guiden för mer information.
|
||||
sw = Kwa maelezo zaidi tafadhali tazama mwongozo huu.
|
||||
th = สำหรับข้อมูลเพิ่มเติม กรุณาเข้าชมคำแนะนำนี้
|
||||
tr = Daha fazla bilgi için lütfen bu kılavuzu inceleyin.
|
||||
uk = Додаткову інформацію див. у цьому керівництві.
|
||||
vi = Để biết thêm thông tin, vui lòng kiểm tra bài hướng dẫn này.
|
||||
zh-Hans = 如需了解更多信息,请查阅此指南。
|
||||
zh-Hant = 如需更多資訊,請參閱本指南。
|
||||
|
||||
[transliteration_title]
|
||||
tags = android,ios
|
||||
en = Transliteration into Latin alphabet
|
||||
|
|
Reference in a new issue