Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
48597e4102
8 changed files with 54 additions and 18 deletions
|
@ -1526,7 +1526,7 @@
|
|||
<string name="osmo_connect_to_device_tracker_id">ID трекера</string>
|
||||
<string name="osmo_auto_send_locations_descr">Автоматически стартовать сессию трекера и отправлять местоположение после запуска приложения</string>
|
||||
<string name="osmo_auto_send_locations">Автоматически запускать мониторинг</string>
|
||||
<string name="osmo_tracker_id">Персональный ID трекера</string>
|
||||
<string name="osmo_tracker_id">Персональный ID</string>
|
||||
<string name="osmo_session_token">Токен сессии: %1$s</string>
|
||||
<string name="tip_recent_changes_1_8_alpha">"Изменения в 1.8: * Расчёт маршрута между маршрутными точками трека GPX * Изменённый порядок стран для загрузок (поддерживается местный поиск имён) * Поддержка импорта GPX/KML (конвертация KML в GPX) * GPX треки перемещены в \"Мои данные\" * Вы можете разбить GPX трек по дистанции и сверить разницу высот/скорость * Автостарт навигации по тайм-ауту "</string>
|
||||
<string name="osmo_tracker_id_descr">Выберите чтобы посмотреть или поделиться ID трекера.
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
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="gps_network_not_enabled">Location service is not enabled. Do you want to turn it on?</string>
|
||||
<string name="disable_recording_once_app_killed">Run in background</string>
|
||||
<string name="disable_recording_once_app_killed_descrp">Unless checked, GPX recording will stop when the app is killed (via recent apps). Upon app restart, the recording will resume (see notification in the top bar about the OsmAnd Sleep mode process).</string>
|
||||
<string name="shared_string_import2osmand">Import to OsmAnd</string>
|
||||
|
|
|
@ -17,7 +17,10 @@ import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
|||
import net.osmand.plus.routing.RoutingHelper;
|
||||
import net.osmand.router.RouteSegmentResult;
|
||||
import net.osmand.util.MapUtils;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.hardware.GeomagneticField;
|
||||
import android.hardware.Sensor;
|
||||
import android.hardware.SensorEvent;
|
||||
|
@ -31,6 +34,7 @@ import android.location.LocationListener;
|
|||
import android.location.LocationManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
|
||||
public class OsmAndLocationProvider implements SensorEventListener {
|
||||
|
@ -871,6 +875,37 @@ public class OsmAndLocationProvider implements SensorEventListener {
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public boolean checkGPSEnabled(final Context context) {
|
||||
LocationManager lm = (LocationManager)app.getSystemService(Context.LOCATION_SERVICE);
|
||||
boolean gpsenabled = false;
|
||||
boolean networkenabled = false;
|
||||
|
||||
try {
|
||||
gpsenabled = lm.isProviderEnabled(LocationManager.GPS_PROVIDER);
|
||||
} catch(Exception ex) {}
|
||||
|
||||
try {
|
||||
networkenabled = lm.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
|
||||
} catch(Exception ex) {}
|
||||
|
||||
if(!gpsenabled && !networkenabled) {
|
||||
// notify user
|
||||
AlertDialog.Builder dialog = new AlertDialog.Builder(context);
|
||||
dialog.setMessage(context.getResources().getString(R.string.gps_network_not_enabled));
|
||||
dialog.setPositiveButton(context.getResources().getString(R.string.shared_string_settings), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface paramDialogInterface, int paramInt) {
|
||||
Intent myIntent = new Intent( Settings.ACTION_LOCATION_SOURCE_SETTINGS);
|
||||
context.startActivity(myIntent);
|
||||
}
|
||||
});
|
||||
dialog.setNegativeButton(context.getString(R.string.shared_string_cancel), null);
|
||||
dialog.show();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -668,6 +668,7 @@ public class OsmandApplication extends Application {
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void startNavigationService(int intent) {
|
||||
final Intent serviceIntent = new Intent(this, NavigationService.class);
|
||||
|
|
|
@ -18,6 +18,7 @@ import net.osmand.plus.OsmandSettings;
|
|||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.SavingTrackHelper;
|
||||
import net.osmand.plus.osmo.OsMoGroupsActivity;
|
||||
import net.osmand.plus.views.MapInfoLayer;
|
||||
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
|
||||
import net.osmand.plus.views.OsmandMapTileView;
|
||||
|
@ -258,7 +259,9 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
|
|||
if(item == R.string.save_current_track){
|
||||
saveCurrentTrack();
|
||||
} else if(item == R.string.gpx_monitoring_start) {
|
||||
startGPXMonitoring(map);
|
||||
if (app.getLocationProvider().checkGPSEnabled(map)) {
|
||||
startGPXMonitoring(map);
|
||||
}
|
||||
} else if(item == R.string.gpx_monitoring_stop) {
|
||||
stopRecording();
|
||||
} else if(item == R.string.gpx_start_new_segment) {
|
||||
|
|
|
@ -178,7 +178,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
|
||||
}
|
||||
|
||||
public static void updateCurrentTrack(View v, final Activity ctx, OsmandApplication app) {
|
||||
public static void updateCurrentTrack(View v, final Activity ctx, final OsmandApplication app) {
|
||||
if (OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -199,7 +199,9 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
if (isRecording) {
|
||||
plugin.stopRecording();
|
||||
} else {
|
||||
plugin.startGPXMonitoring(ctx);
|
||||
if (app.getLocationProvider().checkGPSEnabled(ctx)) {
|
||||
plugin.startGPXMonitoring(ctx);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -221,12 +221,14 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
|
|||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if(isChecked) {
|
||||
if (osMoPlugin != null && osMoPlugin.getTracker() != null){
|
||||
osMoPlugin.getTracker().enableTracker();
|
||||
if (app.getLocationProvider().checkGPSEnabled(OsMoGroupsActivity.this)) {
|
||||
if (osMoPlugin != null && osMoPlugin.getTracker() != null) {
|
||||
osMoPlugin.getTracker().enableTracker();
|
||||
}
|
||||
app.startNavigationService(NavigationService.USED_BY_LIVE);
|
||||
// interval setting not needed here, handled centrally in app.startNavigationService
|
||||
// app.getSettings().SERVICE_OFF_INTERVAL.set(0);
|
||||
}
|
||||
app.startNavigationService(NavigationService.USED_BY_LIVE);
|
||||
//interval setting not needed here, handled centrally in app.startNavigationService
|
||||
//app.getSettings().SERVICE_OFF_INTERVAL.set(0);
|
||||
} else {
|
||||
if (osMoPlugin != null && osMoPlugin.getTracker() != null){
|
||||
osMoPlugin.getTracker().disableTracker();
|
||||
|
|
|
@ -4,20 +4,11 @@ import java.io.BufferedReader;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.math.BigInteger;
|
||||
import java.security.KeyFactory;
|
||||
import java.security.KeyPair;
|
||||
import java.security.KeyPairGenerator;
|
||||
import java.security.PublicKey;
|
||||
import java.security.interfaces.RSAPublicKey;
|
||||
import java.security.spec.RSAPublicKeySpec;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
|
|
Loading…
Reference in a new issue