[android] Explain why the TTS button doesn't work when no engine installed

Signed-off-by: Harry Bond <me@hbond.xyz>
This commit is contained in:
Harry Bond
2025-08-23 18:13:57 +01:00
committed by Konstantin Pastbin
parent eaeae8f31d
commit a338a18590
3 changed files with 6 additions and 1 deletions

View File

@@ -3,6 +3,7 @@ package app.organicmaps.widget.menu;
import android.location.Location;
import android.util.Pair;
import android.view.View;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
@@ -10,6 +11,7 @@ import app.organicmaps.MwmApplication;
import app.organicmaps.R;
import app.organicmaps.sdk.routing.RoutingInfo;
import app.organicmaps.sdk.sound.TtsPlayer;
import app.organicmaps.sdk.util.Config;
import app.organicmaps.sdk.util.StringUtils;
import app.organicmaps.util.Graphics;
import app.organicmaps.util.ThemeUtils;
@@ -125,6 +127,8 @@ public class NavMenu
private void onTtsClicked()
{
if (!TtsPlayer.isReady())
Toast.makeText(mActivity, R.string.pref_tts_no_system_tts_short, Toast.LENGTH_SHORT).show();
TtsPlayer.setEnabled(!TtsPlayer.isEnabled());
refreshTts();
}

View File

@@ -941,4 +941,5 @@
<!-- Title of the bottom sheet when sharing the track -->
<string name="share_track">Share Track</string>
<string name="delete_track_dialog_title">Delete %s?</string>
<string name="pref_tts_no_system_tts_short">No text-to-speech engine found, check the app settings</string>
</resources>

View File

@@ -220,7 +220,7 @@ public enum TtsPlayer
}
}
private static boolean isReady()
public static boolean isReady()
{
return (INSTANCE.mTts != null && !INSTANCE.mUnavailable && !INSTANCE.mInitializing);
}