Fix osmo
Conflicts: OsmAnd/res/values/strings.xml
This commit is contained in:
parent
5b51255b38
commit
64daabc5c7
4 changed files with 44 additions and 4 deletions
|
@ -11,8 +11,8 @@
|
||||||
-->
|
-->
|
||||||
<string name="map_preferred_locale_descr">Preferred lanaguage for labels on the map (if it is not available will switch to English or to local names)</string>
|
<string name="map_preferred_locale_descr">Preferred lanaguage for labels on the map (if it is not available will switch to English or to local names)</string>
|
||||||
<string name="map_preferred_locale">Map prefferred language</string>
|
<string name="map_preferred_locale">Map prefferred language</string>
|
||||||
<string name="osmo_leave_confirmation_msg">Leave group %1$s?</string>
|
<string name="osmo_leave_confirmation_msg">Do you want to leave group %1$s?</string>
|
||||||
<string name="osmo_specify_tracker_id">Please specify tracker id</string>
|
<string name="osmo_specify_tracker_id">Please specify id</string>
|
||||||
<string name="continue_navigation">Continue Navigation</string>
|
<string name="continue_navigation">Continue Navigation</string>
|
||||||
<string name="pause_navigation">Pause Navigation</string>
|
<string name="pause_navigation">Pause Navigation</string>
|
||||||
<string name="keep_navigation_service">Keep</string>
|
<string name="keep_navigation_service">Keep</string>
|
||||||
|
|
|
@ -329,6 +329,7 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
|
||||||
if(osMoPlugin.getService().isConnected()) {
|
if(osMoPlugin.getService().isConnected()) {
|
||||||
adapter.synchronizeGroups();
|
adapter.synchronizeGroups();
|
||||||
}
|
}
|
||||||
|
osMoPlugin.setGroupsActivity(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -340,6 +341,7 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
|
||||||
}
|
}
|
||||||
app.getLocationProvider().removeLocationListener(this);
|
app.getLocationProvider().removeLocationListener(this);
|
||||||
osMoPlugin.getGroups().setUiListener(null);
|
osMoPlugin.getGroups().setUiListener(null);
|
||||||
|
osMoPlugin.setGroupsActivity(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enterSelectionMode(final Object o) {
|
private void enterSelectionMode(final Object o) {
|
||||||
|
|
|
@ -61,9 +61,11 @@ public class OsMoPlugin extends OsmandPlugin implements MonitoringInfoControlSer
|
||||||
private BaseMapWidget osmoControl;
|
private BaseMapWidget osmoControl;
|
||||||
private OsMoPositionLayer olayer;
|
private OsMoPositionLayer olayer;
|
||||||
protected MapActivity mapActivity;
|
protected MapActivity mapActivity;
|
||||||
|
protected OsMoGroupsActivity groupsActivity;
|
||||||
|
|
||||||
private final static Log log = PlatformUtil.getLog(OsMoPlugin.class);
|
private final static Log log = PlatformUtil.getLog(OsMoPlugin.class);
|
||||||
|
|
||||||
|
|
||||||
public OsMoPlugin(final OsmandApplication app) {
|
public OsMoPlugin(final OsmandApplication app) {
|
||||||
service = new OsMoService(app, this);
|
service = new OsMoService(app, this);
|
||||||
tracker = new OsMoTracker(service, app.getSettings().OSMO_SAVE_TRACK_INTERVAL,
|
tracker = new OsMoTracker(service, app.getSettings().OSMO_SAVE_TRACK_INTERVAL,
|
||||||
|
@ -83,6 +85,14 @@ public class OsMoPlugin extends OsmandPlugin implements MonitoringInfoControlSer
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public OsMoGroupsActivity getGroupsActivity() {
|
||||||
|
return groupsActivity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGroupsActivity(OsMoGroupsActivity groupsActivity) {
|
||||||
|
this.groupsActivity = groupsActivity;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disable(OsmandApplication app) {
|
public void disable(OsmandApplication app) {
|
||||||
super.disable(app);
|
super.disable(app);
|
||||||
|
|
|
@ -27,11 +27,15 @@ import org.json.JSONArray;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.app.AlertDialog.Builder;
|
||||||
import android.app.Notification;
|
import android.app.Notification;
|
||||||
import android.app.NotificationManager;
|
import android.app.NotificationManager;
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.content.DialogInterface.OnClickListener;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
|
@ -300,8 +304,18 @@ public class OsMoService implements OsMoReactor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void runNotification(String error) {
|
private void runNotification(final String error) {
|
||||||
if (notification == null) {
|
final OsMoGroupsActivity ga = plugin.getGroupsActivity();
|
||||||
|
if(ga != null) {
|
||||||
|
app.runInUIThread(new Runnable() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
showRegisterAgain(ga, app.getString(R.string.osmo_auth_error, error));
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if (notification == null) {
|
||||||
Intent notificationIntent = new Intent(OSMO_REGISTER_AGAIN);
|
Intent notificationIntent = new Intent(OSMO_REGISTER_AGAIN);
|
||||||
PendingIntent intent = PendingIntent.getBroadcast(app, 0, notificationIntent,
|
PendingIntent intent = PendingIntent.getBroadcast(app, 0, notificationIntent,
|
||||||
PendingIntent.FLAG_UPDATE_CURRENT);
|
PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
|
@ -319,6 +333,20 @@ public class OsMoService implements OsMoReactor {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected void showRegisterAgain(OsMoGroupsActivity ga, String msg) {
|
||||||
|
Builder bld = new AlertDialog.Builder(ga);
|
||||||
|
bld.setMessage(msg);
|
||||||
|
bld.setPositiveButton(R.string.default_buttons_ok, new OnClickListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
registerAsync();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
bld.setNegativeButton(R.string.default_buttons_cancel, null);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private void showDialogAskToReregister(String error) {
|
private void showDialogAskToReregister(String error) {
|
||||||
// Builder bld = new AlertDialog.Builder(this);
|
// Builder bld = new AlertDialog.Builder(this);
|
||||||
// bld.setMessage(app.getString(R.string.osmo_io_error) + error);
|
// bld.setMessage(app.getString(R.string.osmo_io_error) + error);
|
||||||
|
|
Loading…
Reference in a new issue