Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make pebble integration optional #20240

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
1 change: 1 addition & 0 deletions OsmAnd/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -905,6 +905,7 @@ You need to activate the sensor so OsmAnd can find it.</string>
• Default-speed adjustable forecast for elevation-dependent walking/hiking/running trip times\n\n
• Fixed audio output and volume slider behavior\n\n
</string>
<string name="pebble_voice">Send Pebble Voice notifications</string>
<string name="speak_gps_signal_status">Announce GPS signal loss and recovery</string>
<string name="speak_route_recalculation">Announce route recalculation</string>
<string name="map_center_widget">Coordinates: Map center</string>
Expand Down
5 changes: 5 additions & 0 deletions OsmAnd/res/xml/voice_announces.xml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@
android:layout="@layout/preference_switch"
android:title="@string/speak_route_deviation" />

<SwitchPreferenceCompat
android:key="pebble_voice"
android:layout="@layout/preference_switch"
android:title="@string/pebble_voice" />

<Preference
android:key="speed_limit_divider"
android:layout="@layout/simple_divider_item"
Expand Down
4 changes: 4 additions & 0 deletions OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ public void setMuteForMode(ApplicationMode mode, boolean mute) {
settings.VOICE_MUTE.setModeValue(mode, mute);
}

public boolean pebbleVoiceEnabled() {
return settings.PEBBLE_VOICE.get();
}

public boolean isMute() {
return settings.VOICE_MUTE.get();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3111,6 +3111,8 @@ public CommonPreference<Boolean> getCustomRoutingBooleanProperty(String attrName

public final OsmandPreference<Boolean> USE_OSM_LIVE_FOR_PUBLIC_TRANSPORT = new BooleanPreference(this, "enable_osmc_public_transport", false).makeProfile();

public final OsmandPreference<Boolean> PEBBLE_VOICE = new BooleanPreference(this, "pebble_voice", true).makeProfile().cache();

public final OsmandPreference<Boolean> VOICE_MUTE = new BooleanPreference(this, "voice_mute", false).makeProfile().cache();

// for background service
Expand Down
4 changes: 3 additions & 1 deletion OsmAnd/src/net/osmand/plus/voice/JsTtsCommandPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,9 @@ public synchronized List<String> playCommands(@NonNull CommandBuilder builder) {
for (String s : execute) {
bld.append(s).append(' ');
}
sendAlertToPebble(bld.toString());
if (voiceRouter.pebbleVoiceEnabled()) {
sendAlertToPebble(bld.toString());
}
if (mTts != null && !voiceRouter.isMute() && speechAllowed) {
if (ttsRequests++ == 0) {
requestAudioFocus();
Expand Down