Review
This commit is contained in:
parent
9f40195d76
commit
96d6aff021
3 changed files with 20 additions and 28 deletions
|
@ -27,8 +27,6 @@ import net.osmand.router.TurnType;
|
|||
import net.osmand.util.Algorithms;
|
||||
import net.osmand.util.MapUtils;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
|
@ -665,29 +663,26 @@ public class VoiceRouter {
|
|||
}
|
||||
|
||||
private String getSpeakableExitRef(String exit) {
|
||||
boolean showStartDialog = settings.EXIT_NUMBER_NAMES_SHOWED.get();
|
||||
if (showStartDialog) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (exit != null) {
|
||||
exit = exit.replace('-', ' ');
|
||||
exit = exit.replace(':', ' ');
|
||||
// Add spaces between digits and letters for better pronunciation
|
||||
int length = exit.length();
|
||||
for (int i = 0; i < length; i++) {
|
||||
if (i + 1 < length && Character.isDigit(exit.charAt(i)) && Character.isLetter(exit.charAt(i + 1))) {
|
||||
sb.append(exit.charAt(i));
|
||||
sb.append(' ');
|
||||
} else {
|
||||
sb.append(exit.charAt(i));
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (exit != null) {
|
||||
exit = exit.replace('-', ' ');
|
||||
exit = exit.replace(':', ' ');
|
||||
// Add spaces between digits and letters for better pronunciation
|
||||
int length = exit.length();
|
||||
for (int i = 0; i < length; i++) {
|
||||
if (i + 1 < length && Character.isDigit(exit.charAt(i)) && Character.isLetter(exit.charAt(i + 1))) {
|
||||
sb.append(exit.charAt(i));
|
||||
sb.append(' ');
|
||||
} else {
|
||||
sb.append(exit.charAt(i));
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
return StringUtils.EMPTY;
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private int getIntRef(String stringRef) {
|
||||
int intRef = Algorithms.findFirstNumberEndIndex(stringRef);
|
||||
if (intRef > 0) {
|
||||
|
@ -707,7 +702,7 @@ public class VoiceRouter {
|
|||
boolean isPlay = true;
|
||||
ExitInfo exitInfo = next.getExitInfo();
|
||||
if (tParam != null) {
|
||||
if (exitInfo != null && !Algorithms.isEmpty(exitInfo.getRef())) {
|
||||
if (exitInfo != null && !Algorithms.isEmpty(exitInfo.getRef()) && !settings.SPEAK_EXIT_NUMBER_NAMES.get()) {
|
||||
String stringRef = getSpeakableExitRef(exitInfo.getRef());
|
||||
p.takeExit(tParam, dist, stringRef, getIntRef(exitInfo.getRef()), getSpeakableExitName(next, exitInfo, true));
|
||||
} else {
|
||||
|
@ -782,7 +777,7 @@ public class VoiceRouter {
|
|||
ExitInfo exitInfo = next.getExitInfo();
|
||||
boolean isplay = true;
|
||||
if (tParam != null) {
|
||||
if (exitInfo != null && !Algorithms.isEmpty(exitInfo.getRef())) {
|
||||
if (exitInfo != null && !Algorithms.isEmpty(exitInfo.getRef()) && !settings.SPEAK_EXIT_NUMBER_NAMES.get()) {
|
||||
String stringRef = getSpeakableExitRef(exitInfo.getRef());
|
||||
p.takeExit(tParam, stringRef, getIntRef(exitInfo.getRef()), getSpeakableExitName(next, exitInfo, !suppressDest));
|
||||
} else {
|
||||
|
|
|
@ -1355,10 +1355,10 @@ public class OsmandSettings {
|
|||
public final OsmandPreference<Boolean> SPEAK_SPEED_LIMIT = new BooleanPreference(this, "speak_speed_limit", false).makeProfile().cache();
|
||||
public final OsmandPreference<Boolean> SPEAK_SPEED_CAMERA = new BooleanPreference(this, "speak_cameras", false).makeProfile().cache();
|
||||
public final OsmandPreference<Boolean> SPEAK_TUNNELS = new BooleanPreference(this, "speak_tunnels", false).makeProfile().cache();
|
||||
public final OsmandPreference<Boolean> SPEAK_EXIT_NUMBER_NAMES = new BooleanPreference(this, "exit_number_names", true).makeProfile().cache();
|
||||
|
||||
public final OsmandPreference<Boolean> SPEED_CAMERAS_UNINSTALLED = new BooleanPreference(this, "speed_cameras_uninstalled", false).makeGlobal().makeShared();
|
||||
public final OsmandPreference<Boolean> SPEED_CAMERAS_ALERT_SHOWED = new BooleanPreference(this, "speed_cameras_alert_showed", false).makeGlobal().makeShared();
|
||||
public final OsmandPreference<Boolean> EXIT_NUMBER_NAMES_SHOWED = new BooleanPreference(this, "exit_number_names", false).makeGlobal().makeShared();
|
||||
|
||||
public Set<String> getForbiddenTypes() {
|
||||
Set<String> typeNames = new HashSet<>();
|
||||
|
|
|
@ -69,16 +69,13 @@ public class VoiceAnnouncesFragment extends BaseSettingsFragment implements OnPr
|
|||
protected void updateToolbar() {
|
||||
super.updateToolbar();
|
||||
View view = getView();
|
||||
final boolean nightMode = !settings.isLightContentForMode(getSelectedAppMode());
|
||||
int iconColor = getResources().getColor(nightMode ? R.color.icon_color_default_dark : R.color.icon_color_default_light);
|
||||
ImageView profileIcon = (ImageView) view.findViewById(R.id.profile_icon);
|
||||
profileIcon.setImageResource(R.drawable.ic_action_help_online);
|
||||
profileIcon.setColorFilter(iconColor);
|
||||
ImageView profileIcon = view.findViewById(R.id.profile_icon);
|
||||
profileIcon.setImageDrawable(app.getUIUtilities().getIcon(R.drawable.ic_action_help_online, isNightMode() ? R.color.icon_color_default_dark : R.color.icon_color_default_light));
|
||||
profileIcon.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (getContext() != null) {
|
||||
WikipediaDialogFragment.showFullArticle(getContext(), Uri.parse(OSMAND_VOICE_NAVIGATION_URL), nightMode);
|
||||
WikipediaDialogFragment.showFullArticle(getContext(), Uri.parse(OSMAND_VOICE_NAVIGATION_URL), isNightMode());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue