Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
e68fcd1539
11 changed files with 127 additions and 45 deletions
|
@ -9,6 +9,9 @@
|
|||
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
||||
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
||||
-->
|
||||
<string name="record_plugin_description">Save your tracks with one button touch on the map screen.
|
||||
Show settings facilitating to record your trips to local GPX files or online using a web service.</string>
|
||||
<string name="record_plugin_name">Record your trips</string>
|
||||
<string name="int_hour">h</string>
|
||||
<string name="duration">Duration</string>
|
||||
<string name="distance">Distance</string>
|
||||
|
@ -507,9 +510,6 @@
|
|||
</string>
|
||||
<string name="monitoring_settings">Logging services</string>
|
||||
<string name="monitoring_settings_descr">Configure how to record trips</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</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>
|
||||
|
|
|
@ -123,7 +123,9 @@ public class NavigationService extends Service implements LocationListener {
|
|||
}
|
||||
|
||||
public void stopIfNeeded(Context ctx, int usageIntent) {
|
||||
if((usedBy & usageIntent) > 0) {
|
||||
usedBy -= usageIntent;
|
||||
}
|
||||
if (usedBy == 0) {
|
||||
final Intent serviceIntent = new Intent(ctx, NavigationService.class);
|
||||
ctx.stopService(serviceIntent);
|
||||
|
|
|
@ -174,4 +174,8 @@ public class OsmAndAppCustomization {
|
|||
public boolean onDestinationReached() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public int getWaypointSearchRadius(int searchDeviationRadius, int type) {
|
||||
return searchDeviationRadius;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -792,6 +792,7 @@ public class OsmandSettings {
|
|||
|
||||
public final CommonPreference<Boolean> SAVE_GLOBAL_TRACK_TO_GPX = new BooleanPreference("save_global_track_to_gpx", false).makeGlobal().cache();
|
||||
public final CommonPreference<Integer> SAVE_GLOBAL_TRACK_INTERVAL = new IntPreference("save_global_track_interval", 5000).makeGlobal().cache();
|
||||
public final CommonPreference<Boolean> SAVE_GLOBAL_TRACK_REMEMBER = new BooleanPreference("save_global_track_remember", false).makeGlobal().cache();
|
||||
// this value string is synchronized with settings_pref.xml preference name
|
||||
public final CommonPreference<Boolean> SAVE_TRACK_TO_GPX = new BooleanPreference("save_track_to_gpx", false).makeProfile().cache();
|
||||
{
|
||||
|
|
|
@ -8,7 +8,6 @@ import java.util.LinkedHashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.osmand.IndexConstants;
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.plus.GPXUtilities;
|
||||
|
|
|
@ -289,7 +289,7 @@ public class WaypointDialogHelper implements OsmAndLocationListener {
|
|||
str = ctx.getString(R.string.waypoints);
|
||||
break;
|
||||
case WaypointHelper.POI:
|
||||
str = waypointHelper.getPoiFilter() == null && !checked ? ctx.getString(R.string.poi) : waypointHelper
|
||||
str = waypointHelper.getPoiFilter() == null || !checked ? ctx.getString(R.string.poi) : waypointHelper
|
||||
.getPoiFilter().getName();
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -487,7 +487,7 @@ public class WaypointHelper {
|
|||
PoiFilter pf = getPoiFilter();
|
||||
if (pf != null) {
|
||||
final List<Location> locs = route.getImmutableAllLocations();
|
||||
List<Amenity> amenities = app.getResourceManager().searchAmenitiesOnThePath(locs, searchDeviationRadius,
|
||||
List<Amenity> amenities = app.getResourceManager().searchAmenitiesOnThePath(locs, getSearchRadius(POI),
|
||||
pf, new ResultMatcher<Amenity>() {
|
||||
|
||||
@Override
|
||||
|
@ -514,6 +514,11 @@ public class WaypointHelper {
|
|||
}
|
||||
|
||||
|
||||
protected int getSearchRadius(int type) {
|
||||
return app.getAppCustomization().getWaypointSearchRadius(searchDeviationRadius, type);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void calculateAlarms(RouteCalculationResult route, List<LocationPointWrapper> array) {
|
||||
for(AlarmInfo i : route.getAlarmInfo()) {
|
||||
|
@ -552,7 +557,7 @@ public class WaypointHelper {
|
|||
int[] ind = new int[1];
|
||||
for(LocationPoint p : points) {
|
||||
float dist = dist(p, immutableAllLocations, ind);
|
||||
if(dist <= searchDeviationRadius) {
|
||||
if(dist <= getSearchRadius(type)) {
|
||||
LocationPointWrapper lpw = new LocationPointWrapper(rt, type, p, dist, ind[0]);
|
||||
lpw.setAnnounce(announce);
|
||||
locationPoints.add(lpw);
|
||||
|
|
|
@ -38,8 +38,12 @@ import android.preference.Preference;
|
|||
import android.preference.Preference.OnPreferenceClickListener;
|
||||
import android.preference.PreferenceScreen;
|
||||
import android.view.View;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.SeekBar;
|
||||
import android.widget.LinearLayout.LayoutParams;
|
||||
import android.widget.SeekBar.OnSeekBarChangeListener;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
@ -50,6 +54,7 @@ public class OsmandMonitoringPlugin extends OsmandPlugin implements MonitoringIn
|
|||
private BaseMapWidget monitoringControl;
|
||||
private LiveMonitoringHelper liveMonitoringHelper;
|
||||
private boolean ADD_BG_TO_ACTION = true;
|
||||
private boolean isSaving;
|
||||
|
||||
public OsmandMonitoringPlugin(OsmandApplication app) {
|
||||
this.app = app;
|
||||
|
@ -76,12 +81,12 @@ public class OsmandMonitoringPlugin extends OsmandPlugin implements MonitoringIn
|
|||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return app.getString(R.string.osmand_monitoring_plugin_description);
|
||||
return app.getString(R.string.record_plugin_description);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return app.getString(R.string.osmand_monitoring_plugin_name);
|
||||
return app.getString(R.string.record_plugin_name);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -154,6 +159,11 @@ public class OsmandMonitoringPlugin extends OsmandPlugin implements MonitoringIn
|
|||
long lastUpdateTime;
|
||||
@Override
|
||||
public boolean updateInfo(DrawSettings drawSettings) {
|
||||
if(isSaving){
|
||||
setText(map.getString(R.string.import_save), "");
|
||||
setImageDrawable(monitoringBig);
|
||||
return true;
|
||||
}
|
||||
boolean visible = true;
|
||||
String txt = map.getString(R.string.monitoring_control_start);
|
||||
String subtxt = null;
|
||||
|
@ -227,29 +237,37 @@ public class OsmandMonitoringPlugin extends OsmandPlugin implements MonitoringIn
|
|||
} else {
|
||||
items.add(R.string.gpx_monitoring_start);
|
||||
}
|
||||
if(app.getSavingTrackHelper().hasDataToSave()) {
|
||||
items.add(R.string.save_current_track);
|
||||
}
|
||||
String[] strings = new String[items.size()];
|
||||
for(int i =0; i < strings.length; i++) {
|
||||
strings[i] = app.getString(items.get(i));
|
||||
}
|
||||
bld.setItems(strings, new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
final int[] holder = new int[] {0};
|
||||
final Runnable run = new Runnable() {
|
||||
public void run() {
|
||||
int which = holder[0];
|
||||
int item = items.get(which);
|
||||
if(item == R.string.save_current_track){
|
||||
app.getTaskManager().runInBackground(new OsmAndTaskRunnable<Void, Void, Void>() {
|
||||
|
||||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
isSaving = true;
|
||||
try {
|
||||
SavingTrackHelper helper = app.getSavingTrackHelper();
|
||||
helper.saveDataToGpx(app.getAppCustomization().getTracksDir());
|
||||
helper.close();
|
||||
} finally {
|
||||
isSaving = false;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}, (Void) null);
|
||||
} else if(item == R.string.gpx_monitoring_start) {
|
||||
startGPXMonitoring();
|
||||
startGPXMonitoring(map);
|
||||
} else if(item == R.string.gpx_monitoring_stop) {
|
||||
settings.SAVE_GLOBAL_TRACK_TO_GPX.set(false);
|
||||
if (app.getNavigationService() != null) {
|
||||
|
@ -264,7 +282,7 @@ public class OsmandMonitoringPlugin extends OsmandPlugin implements MonitoringIn
|
|||
vs.value = settings.LIVE_MONITORING_INTERVAL.get();
|
||||
showIntervalChooseDialog(map, app.getString(R.string.live_monitoring_interval) + " : %s",
|
||||
app.getString(R.string.save_track_to_gpx), SECONDS, MINUTES,
|
||||
vs, new OnClickListener() {
|
||||
null, vs, new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
settings.LIVE_MONITORING_INTERVAL.set(vs.value);
|
||||
|
@ -274,32 +292,55 @@ public class OsmandMonitoringPlugin extends OsmandPlugin implements MonitoringIn
|
|||
}
|
||||
monitoringControl.updateInfo(null);
|
||||
}
|
||||
|
||||
private void startGPXMonitoring() {
|
||||
app.getSavingTrackHelper().startNewSegment();
|
||||
final ValueHolder<Integer> vs = new ValueHolder<Integer>();
|
||||
vs.value = settings.SAVE_GLOBAL_TRACK_INTERVAL.get();
|
||||
showIntervalChooseDialog(map, app.getString(R.string.save_track_interval) + " : %s",
|
||||
app.getString(R.string.save_track_to_gpx), SECONDS, MINUTES,
|
||||
vs, new OnClickListener() {
|
||||
};
|
||||
if(strings.length == 1) {
|
||||
run.run();
|
||||
} else {
|
||||
bld.setItems(strings, new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
holder[0] = which;
|
||||
run.run();
|
||||
}
|
||||
});
|
||||
bld.show();
|
||||
}
|
||||
}
|
||||
|
||||
private void startGPXMonitoring(MapActivity map) {
|
||||
app.getSavingTrackHelper().startNewSegment();
|
||||
final ValueHolder<Integer> vs = new ValueHolder<Integer>();
|
||||
final ValueHolder<Boolean> choice = new ValueHolder<Boolean>();
|
||||
vs.value = settings.SAVE_GLOBAL_TRACK_INTERVAL.get();
|
||||
choice.value = settings.SAVE_GLOBAL_TRACK_REMEMBER.get();
|
||||
final Runnable runnable = new Runnable() {
|
||||
public void run() {
|
||||
settings.SAVE_GLOBAL_TRACK_INTERVAL.set(vs.value);
|
||||
settings.SAVE_GLOBAL_TRACK_TO_GPX.set(true);
|
||||
settings.SAVE_GLOBAL_TRACK_REMEMBER.set(choice.value);
|
||||
if (app.getNavigationService() == null) {
|
||||
settings.SERVICE_OFF_INTERVAL.set(0);
|
||||
}
|
||||
app.startNavigationService(NavigationService.USED_BY_GPX);
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
if(choice.value) {
|
||||
runnable.run();
|
||||
} else {
|
||||
showIntervalChooseDialog(map, app.getString(R.string.save_track_interval) + " : %s",
|
||||
app.getString(R.string.save_track_to_gpx), SECONDS, MINUTES, choice, vs,
|
||||
new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
runnable.run();
|
||||
}
|
||||
});
|
||||
bld.show();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void showIntervalChooseDialog(final Context uiCtx, final String patternMsg,
|
||||
String title, final int[] seconds, final int[] minutes, final ValueHolder<Integer> v, OnClickListener onclick){
|
||||
String title, final int[] seconds, final int[] minutes, final ValueHolder<Boolean> choice, final ValueHolder<Integer> v, OnClickListener onclick){
|
||||
Builder dlg = new AlertDialog.Builder(uiCtx);
|
||||
dlg.setTitle(title);
|
||||
LinearLayout ll = new LinearLayout(uiCtx);
|
||||
|
@ -356,6 +397,23 @@ public class OsmandMonitoringPlugin extends OsmandPlugin implements MonitoringIn
|
|||
ll.setOrientation(LinearLayout.VERTICAL);
|
||||
ll.addView(tv);
|
||||
ll.addView(sp);
|
||||
if (choice != null) {
|
||||
final CheckBox cb = new CheckBox(uiCtx);
|
||||
cb.setText(R.string.remember_choice);
|
||||
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT,
|
||||
LayoutParams.WRAP_CONTENT);
|
||||
lp.setMargins(7, 10, 7, 0);
|
||||
cb.setLayoutParams(lp);
|
||||
cb.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
choice.value = isChecked;
|
||||
|
||||
}
|
||||
});
|
||||
ll.addView(cb);
|
||||
}
|
||||
dlg.setView(ll);
|
||||
dlg.setPositiveButton(R.string.default_buttons_ok, onclick);
|
||||
dlg.setNegativeButton(R.string.default_buttons_cancel, null);
|
||||
|
@ -375,10 +433,11 @@ public class OsmandMonitoringPlugin extends OsmandPlugin implements MonitoringIn
|
|||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||
if (view.getApplication().getNavigationService() == null) {
|
||||
final ValueHolder<Integer> vs = new ValueHolder<Integer>();
|
||||
final ValueHolder<Boolean> choice = new ValueHolder<Boolean>();
|
||||
vs.value = view.getSettings().SERVICE_OFF_INTERVAL.get();
|
||||
showIntervalChooseDialog(view.getContext(), app.getString(R.string.gps_wakeup_interval),
|
||||
app.getString(R.string.background_router_service),
|
||||
SettingsMonitoringActivity.BG_SECONDS, SettingsMonitoringActivity.BG_MINUTES, vs,
|
||||
SettingsMonitoringActivity.BG_SECONDS, SettingsMonitoringActivity.BG_MINUTES, choice, vs,
|
||||
new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
|
|
@ -297,7 +297,9 @@ public class SherpafyCustomization extends OsmAndAppCustomization {
|
|||
|
||||
public void markStageAsNotCompleted(StageInformation si) {
|
||||
Integer gi = visitedStagesPref.get();
|
||||
if((gi & (1 << si.getOrder())) > 0) {
|
||||
gi = gi - (1 << si.getOrder());
|
||||
}
|
||||
visitedStagesPref.set(gi);
|
||||
}
|
||||
|
||||
|
@ -672,4 +674,11 @@ public class SherpafyCustomization extends OsmAndAppCustomization {
|
|||
newIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||
a.startActivityForResult(newIntent, 0);
|
||||
}
|
||||
|
||||
public int getWaypointSearchRadius(int searchDeviationRadius, int type) {
|
||||
if(type == WaypointHelper.WAYPOINTS) {
|
||||
return searchDeviationRadius;
|
||||
}
|
||||
return searchDeviationRadius;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -119,7 +119,7 @@ public class MapInfoWidgetsFactory {
|
|||
app.getString(R.string.enable_sleep_mode),
|
||||
OsmandMonitoringPlugin.SECONDS,
|
||||
OsmandMonitoringPlugin.MINUTES,
|
||||
vs, new DialogInterface.OnClickListener() {
|
||||
null, vs, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
app.getSettings().SERVICE_OFF_INTERVAL.set(vs.value);
|
||||
|
|
|
@ -53,6 +53,9 @@ public class TextInfoWidget extends BaseMapWidget {
|
|||
} else {
|
||||
setContentDescription(subtext);
|
||||
}
|
||||
if(this.text != null && this.text.length() > 7) {
|
||||
this.text = this.text.substring(0, 6) +"..";
|
||||
}
|
||||
updateVisibility(text != null);
|
||||
requestLayout();
|
||||
invalidate();
|
||||
|
|
Loading…
Reference in a new issue