Merge branch 'master' of https://github.com/osmandapp/Osmand
This commit is contained in:
commit
a6549597cc
8 changed files with 102 additions and 56 deletions
|
@ -1,13 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical" >
|
||||
|
||||
<Switch
|
||||
android:id="@+id/check_item"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:focusable="false"
|
||||
android:gravity="center_vertical"/>
|
||||
|
||||
|
|
|
@ -1,14 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical" >
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/check_item"
|
||||
android:text="@string/osmo_connect_menu"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="3dp"
|
||||
android:layout_marginRight="3dp"
|
||||
android:layout_marginTop="3dp"
|
||||
android:layout_marginBottom="3dp"
|
||||
android:focusable="false"
|
||||
android:gravity="center_vertical" />
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:background="?attr/expandable_category_color"
|
||||
android:paddingBottom="5dp"
|
||||
android:paddingLeft="4dp"
|
||||
android:paddingLeft="3dp"
|
||||
android:paddingRight="4dp"
|
||||
android:paddingTop="5dp" >
|
||||
|
||||
|
@ -21,27 +21,29 @@
|
|||
style="@style/ListText"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginTop="0dp"
|
||||
android:layout_weight="1"
|
||||
android:textSize="18sp" >
|
||||
</TextView>
|
||||
|
||||
<!--
|
||||
<include layout="@layout/check_item_rel" />
|
||||
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_gravity="center_vertical" >
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/check_item"
|
||||
<ImageView
|
||||
android:id="@+id/settings"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="8dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:layout_marginRight="1dp"
|
||||
android:focusable="false"
|
||||
android:gravity="center_vertical" />
|
||||
android:src="@drawable/ic_action_settings_dark" />
|
||||
</RelativeLayout>
|
||||
-->
|
||||
|
||||
</LinearLayout>
|
|
@ -62,7 +62,7 @@
|
|||
<string name="osmo_create_group">Create group</string>
|
||||
<string name="osmo_server_operation_failed">OsMo Server operation failed</string>
|
||||
<string name="osmo_activity">OpenStreetMap-Monitoring</string>
|
||||
<string name="osmo_enable_tracker">Send my lcations</string>
|
||||
<string name="osmo_enable_tracker">Send my locations</string>
|
||||
<string name="osmo_control">OsMo quick access</string>
|
||||
<string name="hours_ago">hours ago</string>
|
||||
<string name="minutes_ago">min ago</string>
|
||||
|
|
|
@ -75,7 +75,11 @@ public abstract class OsmandPlugin {
|
|||
installPlugin(SRTM_PLUGIN_COMPONENT, SRTMPlugin.FREE_ID, app,
|
||||
new SRTMPlugin(app, false));
|
||||
}
|
||||
installPlugin(PARKING_PLUGIN_COMPONENT, ParkingPositionPlugin.ID, app, new ParkingPositionPlugin(app));
|
||||
final ParkingPositionPlugin parking = new ParkingPositionPlugin(app);
|
||||
boolean f = installPlugin(PARKING_PLUGIN_COMPONENT, ParkingPositionPlugin.ID, app, parking);
|
||||
if(!f && Version.isParkingPluginInlined(app)) {
|
||||
installedPlugins.add(parking);
|
||||
}
|
||||
installPlugin(OSMODROID_PLUGIN_COMPONENT, OsMoDroidPlugin.ID, app, new OsMoDroidPlugin(app));
|
||||
installedPlugins.add(new OsmEditingPlugin(app));
|
||||
installedPlugins.add(new OsmandDevelopmentPlugin(app));
|
||||
|
|
|
@ -123,12 +123,12 @@ public class OsMoGroups implements OsMoReactor, OsmoTrackerListener {
|
|||
}
|
||||
|
||||
public void disconnectDevice(OsMoDevice model) {
|
||||
model.enabled = false;
|
||||
disconnectImpl(model);
|
||||
storage.save();
|
||||
}
|
||||
|
||||
private void disconnectImpl(OsMoDevice model) {
|
||||
model.enabled = false;
|
||||
model.active = false;
|
||||
tracker.stopTrackingId(model);
|
||||
}
|
||||
|
@ -162,15 +162,16 @@ public class OsMoGroups implements OsMoReactor, OsmoTrackerListener {
|
|||
group = storage.getGroup(gid);
|
||||
if(group != null) {
|
||||
List<OsMoDevice> delta = mergeGroup(group, obj, false);
|
||||
String mygid = service.getMyGroupTrackerId();
|
||||
StringBuilder b = new StringBuilder();
|
||||
for(OsMoDevice d : delta) {
|
||||
if(d.getDeletedTimestamp() != 0 && d.isEnabled()) {
|
||||
if(group.name != null) {
|
||||
if(group.name != null && !d.getTrackerId().equals(mygid)) {
|
||||
b.append(app.getString(R.string.osmo_user_left, d.getVisibleName(), group.getVisibleName(app))).append("\n");
|
||||
}
|
||||
disconnectImpl(d);
|
||||
} else if(!d.isActive()) {
|
||||
if(group.name != null) {
|
||||
if(group.name != null && !d.getTrackerId().equals(mygid)) {
|
||||
b.append(app.getString(R.string.osmo_user_joined, d.getVisibleName(), group.getVisibleName(app))).append("\n");
|
||||
}
|
||||
connectDeviceImpl(d);
|
||||
|
@ -191,12 +192,14 @@ public class OsMoGroups implements OsMoReactor, OsmoTrackerListener {
|
|||
} else if(command.equalsIgnoreCase("GROUP_CONNECT")) {
|
||||
group = storage.getGroup(gid);
|
||||
if(group != null) {
|
||||
group.users.clear();
|
||||
mergeGroup(group, obj, true);
|
||||
group.active = true;
|
||||
// connect to all devices in group
|
||||
// connect to enabled devices in group
|
||||
for(OsMoDevice d : group.getGroupUsers(null)) {
|
||||
connectDeviceImpl(d);
|
||||
if(d.isEnabled()) {
|
||||
d.active = false;
|
||||
connectDeviceImpl(d);
|
||||
}
|
||||
}
|
||||
storage.save();
|
||||
}
|
||||
|
|
|
@ -36,6 +36,8 @@ import net.osmand.plus.osmo.OsMoGroups.OsMoGroupsUIListener;
|
|||
import net.osmand.plus.osmo.OsMoGroupsStorage.OsMoDevice;
|
||||
import net.osmand.plus.osmo.OsMoGroupsStorage.OsMoGroup;
|
||||
import net.osmand.plus.osmo.OsMoService.SessionInfo;
|
||||
import net.osmand.util.MapAlgorithms;
|
||||
import net.osmand.util.MapUtils;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.AlertDialog.Builder;
|
||||
import android.content.Context;
|
||||
|
@ -203,34 +205,6 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
|
|||
white.setAntiAlias(true);
|
||||
|
||||
updateStatus();
|
||||
getExpandableListView().setOnGroupClickListener(new OnGroupClickListener() {
|
||||
@Override
|
||||
public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
|
||||
OsMoGroup gr = adapter.getGroup(groupPosition);
|
||||
if(gr.isMainGroup()) {
|
||||
if(parent.isGroupExpanded(groupPosition)) {
|
||||
parent.collapseGroup(groupPosition);
|
||||
} else {
|
||||
parent.expandGroup(groupPosition);
|
||||
}
|
||||
} else {
|
||||
if(selectedObject == gr) {
|
||||
quitSelectionMode();
|
||||
if(parent.isGroupExpanded(groupPosition)) {
|
||||
parent.collapseGroup(groupPosition);
|
||||
} else {
|
||||
parent.expandGroup(groupPosition);
|
||||
}
|
||||
} else {
|
||||
enterSelectionMode(gr);
|
||||
}
|
||||
}
|
||||
if(groupPosition == 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
long lastUpdateTime;
|
||||
|
@ -339,7 +313,7 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
|
|||
device = (OsMoDevice) (o instanceof OsMoDevice ?o : null);
|
||||
group = (OsMoGroup) (o instanceof OsMoGroup ?o : null);
|
||||
MenuItem mi = null;
|
||||
if(device == null || device.getGroup().isMainGroup()) {
|
||||
if(device != null) {
|
||||
mi = createMenuItem(menu, ON_OFF_ACTION_ID, R.string.default_buttons_ok, 0, 0,
|
||||
MenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||
}
|
||||
|
@ -466,6 +440,7 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
|
|||
quitSelectionMode();
|
||||
}
|
||||
});
|
||||
refreshList();
|
||||
}
|
||||
|
||||
private StringBuilder setFields(StringBuilder bld, int field, String value) {
|
||||
|
@ -535,6 +510,7 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
|
|||
private void quitSelectionMode() {
|
||||
selectedObject = null;
|
||||
actionMode.finish();
|
||||
refreshList();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -929,6 +905,44 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
|
|||
} else {
|
||||
label.setTypeface(Typeface.DEFAULT, Typeface.ITALIC);
|
||||
}
|
||||
View v = row.findViewById(R.id.settings);
|
||||
if(model.isMainGroup()) {
|
||||
v.setVisibility(View.GONE);
|
||||
} else {
|
||||
v.setVisibility(View.VISIBLE);
|
||||
v.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (model != selectedObject) {
|
||||
enterSelectionMode(model);
|
||||
} else {
|
||||
quitSelectionMode();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
CompoundButton ci = (CompoundButton) row.findViewById(R.id.check_item);
|
||||
if(model.isMainGroup()) {
|
||||
ci.setVisibility(View.GONE);
|
||||
} else {
|
||||
ci.setVisibility(View.VISIBLE);
|
||||
ci.setOnCheckedChangeListener(null);
|
||||
ci.setChecked(model.isEnabled() && model.isActive());
|
||||
ci.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if(isChecked) {
|
||||
String operation = osMoPlugin.getGroups().connectGroup(model);
|
||||
startLongRunningOperation(operation);
|
||||
} else {
|
||||
String operation = osMoPlugin.getGroups().disconnectGroup(model);
|
||||
startLongRunningOperation(operation);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return row;
|
||||
}
|
||||
|
||||
|
@ -961,17 +975,25 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
|
|||
osMoPlugin.getGroups().setGenColor(model, activeColor);
|
||||
}
|
||||
//Location location = tracker.getLastLocation(model.trackerId);
|
||||
if (location == null || mapLocation == null) {
|
||||
if(!model.isEnabled()) {
|
||||
icon.setVisibility(View.INVISIBLE);
|
||||
label.setTypeface(Typeface.DEFAULT, Typeface.ITALIC);
|
||||
label.setText(model.getVisibleName());
|
||||
} else if (location == null || mapLocation == null) {
|
||||
label.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
|
||||
icon.setVisibility(View.VISIBLE);
|
||||
NonDirectionDrawable draw ;
|
||||
if(icon.getDrawable() instanceof NonDirectionDrawable) {
|
||||
draw = (NonDirectionDrawable) icon.getDrawable();
|
||||
} else {
|
||||
draw = new NonDirectionDrawable();
|
||||
}
|
||||
draw.setColor(model.isEnabled()?activeColor : color);
|
||||
draw.setColor(model.isEnabled() ? activeColor : color);
|
||||
icon.setImageDrawable(draw);
|
||||
label.setText(model.getVisibleName());
|
||||
} else {
|
||||
label.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
|
||||
icon.setVisibility(View.VISIBLE);
|
||||
DirectionDrawable draw;
|
||||
if (icon.getDrawable() instanceof DirectionDrawable) {
|
||||
draw = (DirectionDrawable) icon.getDrawable();
|
||||
|
@ -1022,8 +1044,11 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
|
|||
public void updateLocation(Location location) {
|
||||
MapViewTrackingUtilities mv = MapActivity.getMapViewTrackingUtilities();
|
||||
if(mv != null && mv.isMapLinkedToLocation() && location != null) {
|
||||
Location lt = mapLocation;
|
||||
mapLocation = location;
|
||||
adapter.notifyDataSetInvalidated();
|
||||
if(lt == null || location.distanceTo(lt) > 8) {
|
||||
refreshList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1033,8 +1058,11 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
|
|||
|
||||
@Override
|
||||
public void updateCompassValue(float value) {
|
||||
float vl = lastCompass;
|
||||
lastCompass = value;
|
||||
refreshList();
|
||||
if(Math.abs(MapUtils.degreesDiff(vl, value)) > 15) {
|
||||
refreshList();
|
||||
}
|
||||
}
|
||||
|
||||
private void refreshList() {
|
||||
|
@ -1042,7 +1070,7 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
|
|||
Message msg = Message.obtain(uiHandler, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
adapter.notifyDataSetChanged();
|
||||
adapter.notifyDataSetInvalidated();
|
||||
updateStatus();
|
||||
}
|
||||
});
|
||||
|
@ -1051,10 +1079,13 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void deviceLocationChanged(OsMoDevice device) {
|
||||
refreshList();
|
||||
}
|
||||
|
||||
public static String colorToString(int color) {
|
||||
if ((0xFF000000 & color) == 0xFF000000) {
|
||||
return "#" + Integer.toHexString(color & 0x00FFFFFF); //$NON-NLS-1$
|
||||
|
|
|
@ -164,7 +164,7 @@ public class DownloadedRegionsLayer extends OsmandMapLayer {
|
|||
int right = MapUtils.get31TileNumberX(tileBox.getRightBottomLatLon().getLongitude());
|
||||
int top = MapUtils.get31TileNumberY(tileBox.getLeftTopLatLon().getLatitude());
|
||||
int bottom = MapUtils.get31TileNumberY(tileBox.getRightBottomLatLon().getLatitude());
|
||||
final boolean empty = rm.getRenderer().isLastMapRenderedEmpty(false);
|
||||
final boolean empty = rm.getRenderer().isLastMapRenderedEmpty(tileBox.getZoom() < 12);
|
||||
noMapsPresent = empty;
|
||||
if (!empty && tileBox.getZoom() >= ZOOM_TO_SHOW_MAP_NAMES) {
|
||||
return Collections.emptyList();
|
||||
|
|
Loading…
Reference in a new issue