Fix reconnect and map refresh
This commit is contained in:
parent
4e7479a51f
commit
d17809e416
3 changed files with 28 additions and 10 deletions
|
@ -100,6 +100,7 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
|
|||
public static final int SHARE_SESSION = 7;
|
||||
public static final int GROUP_INFO = 8;
|
||||
protected static final int SETTINGS_ID = 9;
|
||||
protected static final int SETTINGS_DEV_ID = 10;
|
||||
private static final int LIST_REFRESH_MSG_ID = OsmAndConstants.UI_HANDLER_SEARCH + 30;
|
||||
private static final long RECENT_THRESHOLD = 60000;
|
||||
|
||||
|
@ -345,7 +346,7 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
|
|||
MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
||||
///
|
||||
if(device != null) {
|
||||
createMenuItem(menu, SETTINGS_ID, R.string.settings, R.drawable.ic_action_settings_light, R.drawable.ic_action_settings_dark,
|
||||
createMenuItem(menu, SETTINGS_DEV_ID, R.string.settings, R.drawable.ic_action_settings_light, R.drawable.ic_action_settings_dark,
|
||||
MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
||||
}
|
||||
if(group != null) {
|
||||
|
@ -385,7 +386,7 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
|
|||
|
||||
@Override
|
||||
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
|
||||
if(item.getItemId() == SETTINGS_ID) {
|
||||
if(item.getItemId() == SETTINGS_DEV_ID) {
|
||||
showSettingsDialog(device);
|
||||
} else if(item.getItemId() == DELETE_ACTION_ID ) {
|
||||
Builder bld = new AlertDialog.Builder(OsMoGroupsActivity.this);
|
||||
|
|
|
@ -3,18 +3,16 @@ package net.osmand.plus.osmo;
|
|||
import java.text.SimpleDateFormat;
|
||||
|
||||
import net.osmand.Location;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.SettingsActivity;
|
||||
import net.osmand.plus.osmo.OsMoGroupsStorage.OsMoDevice;
|
||||
import net.osmand.plus.osmo.OsMoService.SessionInfo;
|
||||
import net.osmand.plus.osmodroid.OsMoDroidLayer;
|
||||
import net.osmand.plus.parkingpoint.ParkingPositionLayer;
|
||||
import net.osmand.plus.osmo.OsMoTracker.OsmoTrackerListener;
|
||||
import net.osmand.plus.views.MapInfoLayer;
|
||||
import net.osmand.plus.views.MonitoringInfoControl;
|
||||
import net.osmand.plus.views.MonitoringInfoControl.MonitoringInfoControlServices;
|
||||
|
@ -43,6 +41,7 @@ public class OsMoPlugin extends OsmandPlugin implements MonitoringInfoControlSer
|
|||
|
||||
// 2014-05-27 23:11:40
|
||||
public static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
private OsmandMapTileView mv;
|
||||
|
||||
public OsMoPlugin(final OsmandApplication app) {
|
||||
service = new OsMoService(app);
|
||||
|
@ -108,6 +107,27 @@ public class OsMoPlugin extends OsmandPlugin implements MonitoringInfoControlSer
|
|||
activity.getMapView().addLayer(olayer, 5.5f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mapActivityPause(MapActivity activity) {
|
||||
mv = null;
|
||||
tracker.setUITrackerListener(new OsmoTrackerListener() {
|
||||
|
||||
@Override
|
||||
public void locationChange(String trackerId, Location location) {
|
||||
if(mv != null) {
|
||||
mv.refreshMap();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mapActivityResume(MapActivity activity) {
|
||||
mv = activity.getMapView();
|
||||
tracker.setUITrackerListener(null);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* creates (if it wasn't created previously) the control to be added on a MapInfoLayer that shows a monitoring state (recorded/stopped)
|
||||
*/
|
||||
|
|
|
@ -14,22 +14,19 @@ import java.util.LinkedList;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.plus.osmo.OsMoService.SessionInfo;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.HandlerThread;
|
||||
import android.os.Message;
|
||||
import android.util.TimeUtils;
|
||||
|
||||
public class OsMoThread {
|
||||
// private static String TRACKER_SERVER = "srv.osmo.mobi";
|
||||
|
|
Loading…
Reference in a new issue