Moved sleep mode to GPS info plugin
This commit is contained in:
parent
0bd60d9478
commit
7badd3dfd7
3 changed files with 52 additions and 9 deletions
|
@ -471,11 +471,11 @@
|
|||
\n\t* Additional settings for stabilizing compass
|
||||
\n\t* Top left button on the map screen replaces Menu button
|
||||
</string>
|
||||
<string name="monitoring_settings">Logging services & Sleep mode</string>
|
||||
<string name="monitoring_settings">Logging services</string>
|
||||
<string name="monitoring_settings_descr">Configure how to record trips and enable sleep mode</string>
|
||||
<string name="osmand_monitoring_plugin_description">Enable tracking and navigation in sleep (screen off) mode via periodically waking up the GPS device.
|
||||
Show settings facilitating to record your trips to local GPX files or online using a web service.</string>
|
||||
<string name="osmand_monitoring_plugin_name">Logging services & Sleep Mode</string>
|
||||
<string name="osmand_monitoring_plugin_name">Logging services</string>
|
||||
<string name="osmand_background_plugin_description">Show settings to enable tracking and navigation in sleep (screen off) mode via periodically waking up the GPS device.</string>
|
||||
<string name="contribution_activity">Install version</string>
|
||||
<string name="choose_osmand_theme_descr">Choose application theme</string>
|
||||
|
@ -1919,4 +1919,7 @@ 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_descr">Choose whether to play a sound when shooting photos</string>
|
||||
<string name="navigation_intent_invalid">Invalid format: %s</string>
|
||||
<string name="navigation_stop_dialog">Do you want to stop service?</string>
|
||||
<string name="keep_navigation_service">Keep</string>
|
||||
<string name="stop_navigation_service">Stop</string>
|
||||
</resources>
|
||||
|
|
|
@ -46,9 +46,9 @@ public class SettingsMonitoringActivity extends SettingsBaseActivity {
|
|||
|
||||
createLoggingSection(grp);
|
||||
createLiveSection(grp);
|
||||
if(REGISTER_BG_SETTINGS) {
|
||||
registerBackgroundSettings();
|
||||
}
|
||||
// if(REGISTER_BG_SETTINGS) {
|
||||
// registerBackgroundSettings();
|
||||
// }
|
||||
profileDialog();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,16 +1,18 @@
|
|||
package net.osmand.plus.views.mapwidgets;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import net.osmand.Location;
|
||||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.binary.RouteDataObject;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.plus.OsmAndLocationProvider;
|
||||
import net.osmand.plus.*;
|
||||
import net.osmand.plus.OsmAndLocationProvider.GPSInfo;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
||||
import net.osmand.plus.routing.RouteDirectionInfo;
|
||||
import net.osmand.plus.routing.RoutingHelper;
|
||||
import net.osmand.plus.views.MonitoringInfoControl;
|
||||
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
|
||||
import net.osmand.plus.views.OsmandMapTileView;
|
||||
import net.osmand.plus.views.ShadowText;
|
||||
|
@ -94,6 +96,44 @@ public class MapInfoWidgetsFactory {
|
|||
};
|
||||
gpsInfoControl.setImageDrawable(app.getResources().getDrawable(R.drawable.widget_gps_info));
|
||||
gpsInfoControl.setText(null, null);
|
||||
gpsInfoControl.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (app.getNavigationService() != null){
|
||||
AlertDialog.Builder dlg = new AlertDialog.Builder(map);
|
||||
dlg.setTitle(app.getString(R.string.navigation_stop_dialog));
|
||||
dlg.setPositiveButton(app.getString(R.string.keep_navigation_service), null);
|
||||
dlg.setNegativeButton(app.getString(R.string.stop_navigation_service), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
Intent serviceIntent = new Intent(app, NavigationService.class);
|
||||
app.stopService(serviceIntent);
|
||||
}
|
||||
});
|
||||
dlg.show();
|
||||
|
||||
} else {
|
||||
final MonitoringInfoControl.ValueHolder<Integer> vs = new MonitoringInfoControl.ValueHolder<Integer>();
|
||||
vs.value = app.getSettings().SAVE_GLOBAL_TRACK_INTERVAL.get();
|
||||
OsmandMonitoringPlugin.showIntervalChooseDialog(map, app.getString(R.string.save_track_interval) + " : %s",
|
||||
app.getString(R.string.save_track_to_gpx),
|
||||
OsmandMonitoringPlugin.SECONDS,
|
||||
OsmandMonitoringPlugin.MINUTES,
|
||||
vs, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
app.getSettings().SAVE_GLOBAL_TRACK_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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
return gpsInfoControl;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue