First iteration: 3 items done
Rearrange items in the "Voice prompts" menu. Divide it into groups: "Announce", "User points", "Speed limit", 'Options", "Output". Rename current "Sped limit" switch to "Announce when exceeded"
This commit is contained in:
parent
25d0c52b9f
commit
4f35297d73
6 changed files with 150 additions and 66 deletions
|
@ -71,6 +71,7 @@
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<include
|
<include
|
||||||
|
android:id="@+id/toolbar_icon"
|
||||||
layout="@layout/profile_button_small"
|
layout="@layout/profile_button_small"
|
||||||
android:layout_width="@dimen/list_header_height"
|
android:layout_width="@dimen/list_header_height"
|
||||||
android:layout_height="@dimen/list_header_height"
|
android:layout_height="@dimen/list_header_height"
|
||||||
|
|
|
@ -12,6 +12,10 @@
|
||||||
|
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
<string name="output">Output</string>
|
||||||
|
<string name="user_points">User points</string>
|
||||||
|
<string name="announce_when_exceeded">Announce when exceeded</string>
|
||||||
|
<string name="exit_number">Exit number</string>
|
||||||
<string name="update_all_maps_added">Update all maps added to %1$s?</string>
|
<string name="update_all_maps_added">Update all maps added to %1$s?</string>
|
||||||
<string name="release_4_0_beta">
|
<string name="release_4_0_beta">
|
||||||
• OsmAnd Live updates moved to \"Downloads > Updates\"\n\n
|
• OsmAnd Live updates moved to \"Downloads > Updates\"\n\n
|
||||||
|
@ -2476,7 +2480,7 @@
|
||||||
<string name="traffic_warning_calming">Traffic calming</string>
|
<string name="traffic_warning_calming">Traffic calming</string>
|
||||||
<string name="traffic_warning_speed_camera">Speed camera</string>
|
<string name="traffic_warning_speed_camera">Speed camera</string>
|
||||||
<string name="traffic_warning">Traffic warning</string>
|
<string name="traffic_warning">Traffic warning</string>
|
||||||
<string name="speak_favorites">Favorites nearby</string>
|
<string name="speak_favorites">Nearby favorites</string>
|
||||||
<string name="speak_poi">Nearby POI</string>
|
<string name="speak_poi">Nearby POI</string>
|
||||||
<string name="way_alarms">Traffic warnings</string>
|
<string name="way_alarms">Traffic warnings</string>
|
||||||
<string name="background_service_is_enabled_question">OsmAnd background service still running. Stop it, too?</string>
|
<string name="background_service_is_enabled_question">OsmAnd background service still running. Stop it, too?</string>
|
||||||
|
|
|
@ -11,11 +11,41 @@
|
||||||
android:title="@string/voice_announces_info"
|
android:title="@string/voice_announces_info"
|
||||||
tools:icon="@drawable/ic_action_info_dark" />
|
tools:icon="@drawable/ic_action_info_dark" />
|
||||||
|
|
||||||
|
<net.osmand.plus.settings.preferences.ListPreferenceEx
|
||||||
|
android:key="voice_provider"
|
||||||
|
android:layout="@layout/preference_with_descr"
|
||||||
|
android:persistent="false"
|
||||||
|
android:title="@string/shared_string_languages"
|
||||||
|
tools:icon="@drawable/ic_action_volume_up" />
|
||||||
|
|
||||||
|
<Preference
|
||||||
|
android:layout="@layout/simple_divider_item"
|
||||||
|
android:selectable="false" />
|
||||||
|
|
||||||
|
<PreferenceCategory
|
||||||
|
android:key="language_and_output"
|
||||||
|
android:layout="@layout/preference_category_with_descr"
|
||||||
|
android:title="@string/accessibility_announce" />
|
||||||
|
|
||||||
|
<net.osmand.plus.settings.preferences.SwitchPreferenceEx
|
||||||
|
android:key="turn_screen_on_navigation_instructions"
|
||||||
|
android:layout="@layout/preference_with_descr"
|
||||||
|
android:title="@string/turn_screen_on_navigation_instructions" />
|
||||||
|
|
||||||
<SwitchPreferenceCompat
|
<SwitchPreferenceCompat
|
||||||
android:key="speak_street_names"
|
android:key="speak_street_names"
|
||||||
android:layout="@layout/preference_switch"
|
android:layout="@layout/preference_switch"
|
||||||
android:title="@string/speak_street_names" />
|
android:title="@string/speak_street_names" />
|
||||||
|
|
||||||
|
<SwitchPreferenceCompat
|
||||||
|
android:key="exit_number_names"
|
||||||
|
android:layout="@layout/preference_switch"
|
||||||
|
android:title="@string/exit_number" />
|
||||||
|
|
||||||
|
<Preference
|
||||||
|
android:layout="@layout/divider_half_item"
|
||||||
|
android:selectable="false" />
|
||||||
|
|
||||||
<SwitchPreferenceCompat
|
<SwitchPreferenceCompat
|
||||||
android:key="speak_traffic_warnings"
|
android:key="speak_traffic_warnings"
|
||||||
android:layout="@layout/preference_switch"
|
android:layout="@layout/preference_switch"
|
||||||
|
@ -26,42 +56,25 @@
|
||||||
android:layout="@layout/preference_switch"
|
android:layout="@layout/preference_switch"
|
||||||
android:title="@string/speak_pedestrian" />
|
android:title="@string/speak_pedestrian" />
|
||||||
|
|
||||||
<Preference
|
|
||||||
android:layout="@layout/simple_divider_item"
|
|
||||||
android:selectable="false" />
|
|
||||||
|
|
||||||
<SwitchPreferenceCompat
|
|
||||||
android:key="speak_speed_limit"
|
|
||||||
android:layout="@layout/preference_switch"
|
|
||||||
android:title="@string/speak_speed_limit" />
|
|
||||||
|
|
||||||
<net.osmand.plus.settings.preferences.ListPreferenceEx
|
|
||||||
android:key="speed_limit_exceed"
|
|
||||||
android:layout="@layout/preference_with_descr"
|
|
||||||
android:title="@string/speed_limit_exceed" />
|
|
||||||
|
|
||||||
<Preference
|
|
||||||
android:layout="@layout/simple_divider_item"
|
|
||||||
android:selectable="false" />
|
|
||||||
|
|
||||||
<SwitchPreferenceCompat
|
<SwitchPreferenceCompat
|
||||||
android:key="speak_cameras"
|
android:key="speak_cameras"
|
||||||
android:layout="@layout/preference_switch"
|
android:layout="@layout/preference_switch"
|
||||||
android:title="@string/speak_cameras" />
|
android:title="@string/speak_cameras" />
|
||||||
|
|
||||||
<Preference
|
|
||||||
android:key="speed_cameras_uninstalled"
|
|
||||||
android:layout="@layout/preference_permission"
|
|
||||||
android:persistent="false"
|
|
||||||
android:summary="@string/read_more"
|
|
||||||
android:title="@string/speed_cameras_alert"
|
|
||||||
tools:icon="@drawable/ic_action_alert" />
|
|
||||||
|
|
||||||
<SwitchPreferenceCompat
|
<SwitchPreferenceCompat
|
||||||
android:key="speak_tunnels"
|
android:key="speak_tunnels"
|
||||||
android:layout="@layout/preference_switch"
|
android:layout="@layout/preference_switch"
|
||||||
android:title="@string/show_tunnels" />
|
android:title="@string/show_tunnels" />
|
||||||
|
|
||||||
|
<Preference
|
||||||
|
android:layout="@layout/divider_half_item"
|
||||||
|
android:selectable="false" />
|
||||||
|
|
||||||
|
<PreferenceCategory
|
||||||
|
android:key="language_and_output"
|
||||||
|
android:layout="@layout/preference_category_with_descr"
|
||||||
|
android:title="@string/user_points" />
|
||||||
|
|
||||||
<SwitchPreferenceCompat
|
<SwitchPreferenceCompat
|
||||||
android:key="announce_wpt"
|
android:key="announce_wpt"
|
||||||
android:layout="@layout/preference_switch"
|
android:layout="@layout/preference_switch"
|
||||||
|
@ -77,10 +90,38 @@
|
||||||
android:layout="@layout/preference_switch"
|
android:layout="@layout/preference_switch"
|
||||||
android:title="@string/speak_poi" />
|
android:title="@string/speak_poi" />
|
||||||
|
|
||||||
|
<PreferenceCategory
|
||||||
|
android:key="language_and_output"
|
||||||
|
android:layout="@layout/preference_category_with_descr"
|
||||||
|
android:title="@string/speak_speed_limit" />
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:layout="@layout/simple_divider_item"
|
android:layout="@layout/simple_divider_item"
|
||||||
android:selectable="false" />
|
android:selectable="false" />
|
||||||
|
|
||||||
|
<SwitchPreferenceCompat
|
||||||
|
android:key="speak_speed_limit"
|
||||||
|
android:layout="@layout/preference_switch"
|
||||||
|
android:title="@string/announce_when_exceeded" />
|
||||||
|
|
||||||
|
<net.osmand.plus.settings.preferences.ListPreferenceEx
|
||||||
|
android:key="speed_limit_exceed"
|
||||||
|
android:layout="@layout/preference_with_descr"
|
||||||
|
android:title="@string/speed_limit_exceed" />
|
||||||
|
|
||||||
|
<Preference
|
||||||
|
android:layout="@layout/simple_divider_item"
|
||||||
|
android:selectable="false" />
|
||||||
|
|
||||||
|
<Preference
|
||||||
|
android:layout="@layout/simple_divider_item"
|
||||||
|
android:selectable="false" />
|
||||||
|
|
||||||
|
<PreferenceCategory
|
||||||
|
android:key="language_and_output"
|
||||||
|
android:layout="@layout/preference_category_with_descr"
|
||||||
|
android:title="@string/shared_string_options" />
|
||||||
|
|
||||||
<net.osmand.plus.settings.preferences.ListPreferenceEx
|
<net.osmand.plus.settings.preferences.ListPreferenceEx
|
||||||
android:key="keep_informing"
|
android:key="keep_informing"
|
||||||
android:layout="@layout/preference_with_descr"
|
android:layout="@layout/preference_with_descr"
|
||||||
|
@ -98,13 +139,6 @@
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:key="language_and_output"
|
android:key="language_and_output"
|
||||||
android:layout="@layout/preference_category_with_descr"
|
android:layout="@layout/preference_category_with_descr"
|
||||||
android:title="@string/language_and_output" />
|
android:title="@string/output" />
|
||||||
|
|
||||||
<net.osmand.plus.settings.preferences.ListPreferenceEx
|
|
||||||
android:key="voice_provider"
|
|
||||||
android:layout="@layout/preference_with_descr"
|
|
||||||
android:persistent="false"
|
|
||||||
android:title="@string/voice_provider"
|
|
||||||
tools:icon="@drawable/ic_action_volume_up" />
|
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
|
|
@ -27,6 +27,8 @@ import net.osmand.router.TurnType;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
import net.osmand.util.MapUtils;
|
import net.osmand.util.MapUtils;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -663,6 +665,8 @@ public class VoiceRouter {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getSpeakableExitRef(String exit) {
|
private String getSpeakableExitRef(String exit) {
|
||||||
|
boolean showStartDialog = settings.EXIT_NUMBER_NAMES_SHOWED.get();
|
||||||
|
if (showStartDialog) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
if (exit != null) {
|
if (exit != null) {
|
||||||
exit = exit.replace('-', ' ');
|
exit = exit.replace('-', ' ');
|
||||||
|
@ -680,6 +684,9 @@ public class VoiceRouter {
|
||||||
}
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
return StringUtils.EMPTY;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private int getIntRef(String stringRef) {
|
private int getIntRef(String stringRef) {
|
||||||
int intRef = Algorithms.findFirstNumberEndIndex(stringRef);
|
int intRef = Algorithms.findFirstNumberEndIndex(stringRef);
|
||||||
|
|
|
@ -1358,6 +1358,7 @@ public class OsmandSettings {
|
||||||
|
|
||||||
public final OsmandPreference<Boolean> SPEED_CAMERAS_UNINSTALLED = new BooleanPreference(this, "speed_cameras_uninstalled", false).makeGlobal().makeShared();
|
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> 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() {
|
public Set<String> getForbiddenTypes() {
|
||||||
Set<String> typeNames = new HashSet<>();
|
Set<String> typeNames = new HashSet<>();
|
||||||
|
|
|
@ -5,22 +5,26 @@ import android.content.Intent;
|
||||||
import android.graphics.drawable.ColorDrawable;
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.media.AudioManager;
|
import android.media.AudioManager;
|
||||||
|
import android.net.Uri;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.widget.ImageButton;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.appcompat.widget.SwitchCompat;
|
import androidx.appcompat.widget.SwitchCompat;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
|
import androidx.fragment.app.FragmentActivity;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.PreferenceViewHolder;
|
import androidx.preference.PreferenceViewHolder;
|
||||||
import androidx.preference.SwitchPreferenceCompat;
|
import androidx.preference.SwitchPreferenceCompat;
|
||||||
|
|
||||||
|
import com.google.android.material.appbar.AppBarLayout;
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.UiUtilities;
|
import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.Version;
|
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.dialogs.SpeedCamerasBottomSheet;
|
import net.osmand.plus.dialogs.SpeedCamerasBottomSheet;
|
||||||
import net.osmand.plus.download.DownloadActivity;
|
import net.osmand.plus.download.DownloadActivity;
|
||||||
|
@ -31,6 +35,8 @@ import net.osmand.plus.settings.backend.ApplicationMode;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
import net.osmand.plus.settings.bottomsheets.AnnouncementTimeBottomSheet;
|
import net.osmand.plus.settings.bottomsheets.AnnouncementTimeBottomSheet;
|
||||||
import net.osmand.plus.settings.preferences.ListPreferenceEx;
|
import net.osmand.plus.settings.preferences.ListPreferenceEx;
|
||||||
|
import net.osmand.plus.settings.preferences.SwitchPreferenceEx;
|
||||||
|
import net.osmand.plus.wikipedia.WikipediaDialogFragment;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ -43,11 +49,35 @@ public class VoiceAnnouncesFragment extends BaseSettingsFragment implements OnPr
|
||||||
|
|
||||||
private static final String MORE_VALUE = "MORE_VALUE";
|
private static final String MORE_VALUE = "MORE_VALUE";
|
||||||
|
|
||||||
|
private static final String OSMAND_VOICE_NAVIGATION_URL = "https://docs.osmand.net/en/main@latest/osmand/troubleshooting/navigation#voice-navigation";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void createToolbar(LayoutInflater inflater, View view) {
|
protected void createToolbar(LayoutInflater inflater, View view) {
|
||||||
super.createToolbar(inflater, view);
|
AppBarLayout appbar = view.findViewById(R.id.appbar);
|
||||||
|
View toolbar = UiUtilities.getInflater(getContext(), isNightMode()).inflate(R.layout.profile_preference_toolbar_with_switch, appbar, false);
|
||||||
|
|
||||||
view.findViewById(R.id.toolbar_switch_container).setOnClickListener(new View.OnClickListener() {
|
View iconToolbarContainer = toolbar.findViewById(R.id.toolbar_icon);
|
||||||
|
ImageView icon = iconToolbarContainer.findViewById(R.id.profile_icon);
|
||||||
|
icon.setImageResource(R.drawable.ic_action_help_online);
|
||||||
|
icon.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (getContext() != null) {
|
||||||
|
WikipediaDialogFragment.showFullArticle(getContext(), Uri.parse(OSMAND_VOICE_NAVIGATION_URL), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ImageButton backButton = toolbar.findViewById(R.id.close_button);
|
||||||
|
backButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
FragmentActivity fragmentActivity = getActivity();
|
||||||
|
if (fragmentActivity != null) {
|
||||||
|
fragmentActivity.onBackPressed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
toolbar.findViewById(R.id.toolbar_switch_container).setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
ApplicationMode selectedMode = getSelectedAppMode();
|
ApplicationMode selectedMode = getSelectedAppMode();
|
||||||
|
@ -59,6 +89,9 @@ public class VoiceAnnouncesFragment extends BaseSettingsFragment implements OnPr
|
||||||
updateMenu();
|
updateMenu();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
TextView toolbarTitle = toolbar.findViewById(R.id.toolbar_title);
|
||||||
|
toolbarTitle.setText(getString(R.string.voice_announces));
|
||||||
|
appbar.addView(toolbar);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -78,7 +111,7 @@ public class VoiceAnnouncesFragment extends BaseSettingsFragment implements OnPr
|
||||||
View switchContainer = view.findViewById(R.id.toolbar_switch_container);
|
View switchContainer = view.findViewById(R.id.toolbar_switch_container);
|
||||||
AndroidUtils.setBackground(switchContainer, new ColorDrawable(color));
|
AndroidUtils.setBackground(switchContainer, new ColorDrawable(color));
|
||||||
|
|
||||||
SwitchCompat switchView = (SwitchCompat) switchContainer.findViewById(R.id.switchWidget);
|
SwitchCompat switchView = switchContainer.findViewById(R.id.switchWidget);
|
||||||
switchView.setChecked(checked);
|
switchView.setChecked(checked);
|
||||||
UiUtilities.setupCompoundButton(switchView, isNightMode(), TOOLBAR);
|
UiUtilities.setupCompoundButton(switchView, isNightMode(), TOOLBAR);
|
||||||
|
|
||||||
|
@ -102,13 +135,13 @@ public class VoiceAnnouncesFragment extends BaseSettingsFragment implements OnPr
|
||||||
|
|
||||||
enableDisablePreferences(!settings.VOICE_MUTE.getModeValue(getSelectedAppMode()));
|
enableDisablePreferences(!settings.VOICE_MUTE.getModeValue(getSelectedAppMode()));
|
||||||
setupSpeakCamerasPref();
|
setupSpeakCamerasPref();
|
||||||
setupSpeedCamerasAlert();
|
setupTurnScreenOnNavigationInstructionsPref();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupSpeedLimitExceedPref() {
|
private void setupSpeedLimitExceedPref() {
|
||||||
//array size must be equal!
|
//array size must be equal!
|
||||||
Float[] valuesKmh = new Float[] {-10f, -7f, -5f, 0f, 5f, 7f, 10f, 15f, 20f};
|
Float[] valuesKmh = new Float[]{-10f, -7f, -5f, 0f, 5f, 7f, 10f, 15f, 20f};
|
||||||
Float[] valuesMph = new Float[] {-7f, -5f, -3f, 0f, 3f, 5f, 7f, 10f, 15f};
|
Float[] valuesMph = new Float[]{-7f, -5f, -3f, 0f, 3f, 5f, 7f, 10f, 15f};
|
||||||
String[] names;
|
String[] names;
|
||||||
if (settings.METRIC_SYSTEM.getModeValue(getSelectedAppMode()) == MetricsConstants.KILOMETERS_AND_METERS) {
|
if (settings.METRIC_SYSTEM.getModeValue(getSelectedAppMode()) == MetricsConstants.KILOMETERS_AND_METERS) {
|
||||||
names = new String[valuesKmh.length];
|
names = new String[valuesKmh.length];
|
||||||
|
@ -121,34 +154,34 @@ public class VoiceAnnouncesFragment extends BaseSettingsFragment implements OnPr
|
||||||
names[i] = valuesMph[i].intValue() + " " + getString(R.string.mile_per_hour);
|
names[i] = valuesMph[i].intValue() + " " + getString(R.string.mile_per_hour);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ListPreferenceEx voiceProvider = (ListPreferenceEx) findPreference(settings.SPEED_LIMIT_EXCEED_KMH.getId());
|
ListPreferenceEx voiceProvider = findPreference(settings.SPEED_LIMIT_EXCEED_KMH.getId());
|
||||||
voiceProvider.setEntries(names);
|
voiceProvider.setEntries(names);
|
||||||
voiceProvider.setEntryValues(valuesKmh);
|
voiceProvider.setEntryValues(valuesKmh);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupKeepInformingPref() {
|
private void setupKeepInformingPref() {
|
||||||
Integer[] keepInformingValues = new Integer[] {0, 1, 2, 3, 5, 7, 10, 15, 20, 25, 30};
|
Integer[] keepInformingValues = new Integer[]{0, 1, 2, 3, 5, 7, 10, 15, 20, 25, 30};
|
||||||
String[] keepInformingNames = new String[keepInformingValues.length];
|
String[] keepInformingNames = new String[keepInformingValues.length];
|
||||||
keepInformingNames[0] = getString(R.string.keep_informing_never);
|
keepInformingNames[0] = getString(R.string.keep_informing_never);
|
||||||
for (int i = 1; i < keepInformingValues.length; i++) {
|
for (int i = 1; i < keepInformingValues.length; i++) {
|
||||||
keepInformingNames[i] = keepInformingValues[i] + " " + getString(R.string.int_min);
|
keepInformingNames[i] = keepInformingValues[i] + " " + getString(R.string.int_min);
|
||||||
}
|
}
|
||||||
|
|
||||||
ListPreferenceEx keepInforming = (ListPreferenceEx) findPreference(settings.KEEP_INFORMING.getId());
|
ListPreferenceEx keepInforming = findPreference(settings.KEEP_INFORMING.getId());
|
||||||
keepInforming.setEntries(keepInformingNames);
|
keepInforming.setEntries(keepInformingNames);
|
||||||
keepInforming.setEntryValues(keepInformingValues);
|
keepInforming.setEntryValues(keepInformingValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupArrivalAnnouncementPref() {
|
private void setupArrivalAnnouncementPref() {
|
||||||
Float[] arrivalValues = new Float[] {1.5f, 1f, 0.5f, 0.25f};
|
Float[] arrivalValues = new Float[]{1.5f, 1f, 0.5f, 0.25f};
|
||||||
String[] arrivalNames = new String[] {
|
String[] arrivalNames = new String[]{
|
||||||
getString(R.string.arrival_distance_factor_early),
|
getString(R.string.arrival_distance_factor_early),
|
||||||
getString(R.string.arrival_distance_factor_normally),
|
getString(R.string.arrival_distance_factor_normally),
|
||||||
getString(R.string.arrival_distance_factor_late),
|
getString(R.string.arrival_distance_factor_late),
|
||||||
getString(R.string.arrival_distance_factor_at_last)
|
getString(R.string.arrival_distance_factor_at_last)
|
||||||
};
|
};
|
||||||
|
|
||||||
ListPreferenceEx arrivalDistanceFactor = (ListPreferenceEx) findPreference(settings.ARRIVAL_DISTANCE_FACTOR.getId());
|
ListPreferenceEx arrivalDistanceFactor = findPreference(settings.ARRIVAL_DISTANCE_FACTOR.getId());
|
||||||
arrivalDistanceFactor.setEntries(arrivalNames);
|
arrivalDistanceFactor.setEntries(arrivalNames);
|
||||||
arrivalDistanceFactor.setEntryValues(arrivalValues);
|
arrivalDistanceFactor.setEntryValues(arrivalValues);
|
||||||
}
|
}
|
||||||
|
@ -178,21 +211,21 @@ public class VoiceAnnouncesFragment extends BaseSettingsFragment implements OnPr
|
||||||
Drawable enabled = getActiveIcon(R.drawable.ic_action_volume_up);
|
Drawable enabled = getActiveIcon(R.drawable.ic_action_volume_up);
|
||||||
Drawable icon = getPersistentPrefIcon(enabled, disabled);
|
Drawable icon = getPersistentPrefIcon(enabled, disabled);
|
||||||
|
|
||||||
ListPreferenceEx voiceProvider = (ListPreferenceEx) findPreference(settings.VOICE_PROVIDER.getId());
|
ListPreferenceEx voiceProvider = findPreference(settings.VOICE_PROVIDER.getId());
|
||||||
voiceProvider.setEntries(entries);
|
voiceProvider.setEntries(entries);
|
||||||
voiceProvider.setEntryValues(entryValues);
|
voiceProvider.setEntryValues(entryValues);
|
||||||
voiceProvider.setIcon(icon);
|
voiceProvider.setIcon(icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupAudioStreamGuidancePref() {
|
private void setupAudioStreamGuidancePref() {
|
||||||
String[] streamTypes = new String[] {
|
String[] streamTypes = new String[]{
|
||||||
getString(R.string.voice_stream_music),
|
getString(R.string.voice_stream_music),
|
||||||
getString(R.string.voice_stream_notification),
|
getString(R.string.voice_stream_notification),
|
||||||
getString(R.string.voice_stream_voice_call)
|
getString(R.string.voice_stream_voice_call)
|
||||||
};
|
};
|
||||||
//getString(R.string.shared_string_default)};
|
//getString(R.string.shared_string_default)};
|
||||||
|
|
||||||
Integer[] streamIntTypes = new Integer[] {
|
Integer[] streamIntTypes = new Integer[]{
|
||||||
AudioManager.STREAM_MUSIC,
|
AudioManager.STREAM_MUSIC,
|
||||||
AudioManager.STREAM_NOTIFICATION,
|
AudioManager.STREAM_NOTIFICATION,
|
||||||
AudioManager.STREAM_VOICE_CALL
|
AudioManager.STREAM_VOICE_CALL
|
||||||
|
@ -208,6 +241,11 @@ public class VoiceAnnouncesFragment extends BaseSettingsFragment implements OnPr
|
||||||
getPreferenceScreen().addPreference(interruptMusicPref);
|
getPreferenceScreen().addPreference(interruptMusicPref);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setupTurnScreenOnNavigationInstructionsPref() {
|
||||||
|
SwitchPreferenceEx turnScreenOnNavigationInstructions = findPreference(settings.TURN_SCREEN_ON_NAVIGATION_INSTRUCTIONS.getId());
|
||||||
|
turnScreenOnNavigationInstructions.setDescription(R.string.turn_screen_on_navigation_instructions_descr);
|
||||||
|
}
|
||||||
|
|
||||||
private void updateMenu() {
|
private void updateMenu() {
|
||||||
MapActivity mapActivity = getMapActivity();
|
MapActivity mapActivity = getMapActivity();
|
||||||
if (mapActivity != null) {
|
if (mapActivity != null) {
|
||||||
|
@ -319,12 +357,11 @@ public class VoiceAnnouncesFragment extends BaseSettingsFragment implements OnPr
|
||||||
public void onPreferenceChanged(String prefId) {
|
public void onPreferenceChanged(String prefId) {
|
||||||
if (prefId.equals(settings.SPEED_CAMERAS_UNINSTALLED.getId())) {
|
if (prefId.equals(settings.SPEED_CAMERAS_UNINSTALLED.getId())) {
|
||||||
setupSpeakCamerasPref();
|
setupSpeakCamerasPref();
|
||||||
setupSpeedCamerasAlert();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupSpeakCamerasPref() {
|
private void setupSpeakCamerasPref() {
|
||||||
SwitchPreferenceCompat showCameras = (SwitchPreferenceCompat) findPreference(settings.SPEAK_SPEED_CAMERA.getId());
|
SwitchPreferenceCompat showCameras = findPreference(settings.SPEAK_SPEED_CAMERA.getId());
|
||||||
showCameras.setVisible(!settings.SPEED_CAMERAS_UNINSTALLED.get());
|
showCameras.setVisible(!settings.SPEED_CAMERAS_UNINSTALLED.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue