Updated new sleep mode functionality
This commit is contained in:
parent
7badd3dfd7
commit
a34fc80999
2 changed files with 8 additions and 10 deletions
|
@ -1919,7 +1919,9 @@ Afghanistan, Albania, Algeria, Andorra, Angola, Anguilla, Antigua and Barbuda, A
|
||||||
<string name="av_photo_play_sound">Play sound on photo shot</string>
|
<string name="av_photo_play_sound">Play sound on photo shot</string>
|
||||||
<string name="av_photo_play_sound_descr">Choose whether to play a sound when shooting photos</string>
|
<string name="av_photo_play_sound_descr">Choose whether to play a sound when shooting photos</string>
|
||||||
<string name="navigation_intent_invalid">Invalid format: %s</string>
|
<string name="navigation_intent_invalid">Invalid format: %s</string>
|
||||||
<string name="navigation_stop_dialog">Do you want to stop service?</string>
|
<string name="sleep_mode_stop_dialog">Do you want to stop sleep mode service?</string>
|
||||||
<string name="keep_navigation_service">Keep</string>
|
<string name="keep_navigation_service">Keep</string>
|
||||||
<string name="stop_navigation_service">Stop</string>
|
<string name="stop_navigation_service">Stop</string>
|
||||||
|
<string name="enable_sleep_mode">Enable sleep mode</string>
|
||||||
|
<string name="gps_wake_up_timer">Service off interval</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -101,7 +101,7 @@ public class MapInfoWidgetsFactory {
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
if (app.getNavigationService() != null){
|
if (app.getNavigationService() != null){
|
||||||
AlertDialog.Builder dlg = new AlertDialog.Builder(map);
|
AlertDialog.Builder dlg = new AlertDialog.Builder(map);
|
||||||
dlg.setTitle(app.getString(R.string.navigation_stop_dialog));
|
dlg.setTitle(app.getString(R.string.sleep_mode_stop_dialog));
|
||||||
dlg.setPositiveButton(app.getString(R.string.keep_navigation_service), null);
|
dlg.setPositiveButton(app.getString(R.string.keep_navigation_service), null);
|
||||||
dlg.setNegativeButton(app.getString(R.string.stop_navigation_service), new DialogInterface.OnClickListener() {
|
dlg.setNegativeButton(app.getString(R.string.stop_navigation_service), new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -114,19 +114,15 @@ public class MapInfoWidgetsFactory {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
final MonitoringInfoControl.ValueHolder<Integer> vs = new MonitoringInfoControl.ValueHolder<Integer>();
|
final MonitoringInfoControl.ValueHolder<Integer> vs = new MonitoringInfoControl.ValueHolder<Integer>();
|
||||||
vs.value = app.getSettings().SAVE_GLOBAL_TRACK_INTERVAL.get();
|
vs.value = app.getSettings().SERVICE_OFF_INTERVAL.get();
|
||||||
OsmandMonitoringPlugin.showIntervalChooseDialog(map, app.getString(R.string.save_track_interval) + " : %s",
|
OsmandMonitoringPlugin.showIntervalChooseDialog(map, app.getString(R.string.gps_wake_up_timer) + " : %s",
|
||||||
app.getString(R.string.save_track_to_gpx),
|
app.getString(R.string.enable_sleep_mode),
|
||||||
OsmandMonitoringPlugin.SECONDS,
|
OsmandMonitoringPlugin.SECONDS,
|
||||||
OsmandMonitoringPlugin.MINUTES,
|
OsmandMonitoringPlugin.MINUTES,
|
||||||
vs, new DialogInterface.OnClickListener() {
|
vs, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
app.getSettings().SAVE_GLOBAL_TRACK_INTERVAL.set(vs.value);
|
app.getSettings().SERVICE_OFF_INTERVAL.set(vs.value);
|
||||||
app.getSettings().SAVE_GLOBAL_TRACK_TO_GPX.set(true);
|
|
||||||
if (app.getNavigationService() == null) {
|
|
||||||
app.getSettings().SERVICE_OFF_INTERVAL.set(0);
|
|
||||||
}
|
|
||||||
app.startNavigationService(NavigationService.USED_BY_GPX);
|
app.startNavigationService(NavigationService.USED_BY_GPX);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue