Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
81a6b4e107
10 changed files with 74 additions and 41 deletions
|
@ -2061,5 +2061,6 @@ Afghanistan, Albania, Algeria, Andorra, Angola, Anguilla, Antigua and Barbuda, A
|
|||
<string name="contact_us">Contact us</string>
|
||||
<string name="map_legend">Map legend</string>
|
||||
<string name="save_poi_without_poi_type_message">Do you really want to save poi without POI type?</string>
|
||||
<string name="poi_context_menu_modify_osm_change">Modify OSM change</string>
|
||||
<!-- string name="map_legend_item_description">Legend for OsmAnd default map style, Internet connectivity needed to display</string -->
|
||||
</resources>
|
||||
|
|
|
@ -124,6 +124,10 @@
|
|||
<item name="windowNoTitle">true</item>
|
||||
</style>
|
||||
|
||||
<style name="OsmandLightTheme.NoActionbar.Preferences">
|
||||
<item name="android:textColorSecondary">@color/color_black</item>
|
||||
</style>
|
||||
|
||||
<style name="OsmandLightTheme.DarkActionbar">
|
||||
<item name="android:textColorPrimary">@color/color_white</item>
|
||||
<item name="android:textColorSecondary">@color/inactive_item_orange</item>
|
||||
|
@ -166,6 +170,10 @@
|
|||
<item name="windowNoTitle">true</item>
|
||||
</style>
|
||||
|
||||
<style name="OsmandDarkTheme.NoActionbar.Preferences">
|
||||
<item name="android:textColorSecondary">@color/color_white</item>
|
||||
</style>
|
||||
|
||||
<style name="OsmandDarkTheme" parent="Theme.AppCompat">
|
||||
<item name="list_divider">@color/list_divider_light</item>
|
||||
<item name="expandable_category_color">?android:attr/colorBackground</item>
|
||||
|
|
|
@ -27,11 +27,11 @@ public abstract class ActionBarPreferenceActivity extends AppCompatPreferenceAct
|
|||
protected void onCreate(final Bundle savedInstanceState) {
|
||||
//settings needed it's own theme because of check boxes not styled properly
|
||||
OsmandSettings settings = ((OsmandApplication) getApplication()).getSettings();
|
||||
int t = R.style.OsmandLightTheme_NoActionbar;
|
||||
int t = R.style.OsmandLightTheme_NoActionbar_Preferences;
|
||||
if (settings.OSMAND_THEME.get() == OsmandSettings.OSMAND_DARK_THEME) {
|
||||
t = R.style.OsmandDarkTheme_NoActionbar;
|
||||
t = R.style.OsmandDarkTheme_NoActionbar_Preferences;
|
||||
} else if (settings.OSMAND_THEME.get() == OsmandSettings.OSMAND_LIGHT_THEME) {
|
||||
t = R.style.OsmandLightTheme_NoActionbar;
|
||||
t = R.style.OsmandLightTheme_NoActionbar_Preferences;
|
||||
}
|
||||
setTheme(t);
|
||||
super.onCreate(savedInstanceState);
|
||||
|
|
|
@ -1,16 +1,5 @@
|
|||
package net.osmand.plus.download.ui;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import net.osmand.map.OsmandRegions;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.OsmAndListFragment;
|
||||
import net.osmand.plus.download.DownloadActivity;
|
||||
import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents;
|
||||
import net.osmand.plus.download.DownloadResources;
|
||||
import net.osmand.plus.download.IndexItem;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
|
@ -27,6 +16,18 @@ import android.widget.ArrayAdapter;
|
|||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.map.OsmandRegions;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.OsmAndListFragment;
|
||||
import net.osmand.plus.download.DownloadActivity;
|
||||
import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents;
|
||||
import net.osmand.plus.download.DownloadResources;
|
||||
import net.osmand.plus.download.IndexItem;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
public class UpdatesIndexFragment extends OsmAndListFragment implements DownloadEvents {
|
||||
private static final int RELOAD_ID = 5;
|
||||
private UpdateIndexAdapter listAdapter;
|
||||
|
@ -210,5 +211,4 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download
|
|||
return v;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -97,22 +97,16 @@ public class AdvancedEditPoiFragment extends Fragment
|
|||
public void onResume() {
|
||||
super.onResume();
|
||||
mAdapter.updateViews();
|
||||
updateName();
|
||||
updatePoiType();
|
||||
mTagsChangedListener = new EditPoiData.TagsChangedListener() {
|
||||
@Override
|
||||
public void onTagsChanged(String anyTag) {
|
||||
String value = getData().getTagValues().get(anyTag);
|
||||
if (Algorithms.objectEquals(anyTag, OSMSettings.OSMTagKey.NAME.getValue())) {
|
||||
nameTextView.setText(value);
|
||||
updateName();
|
||||
}
|
||||
if (Algorithms.objectEquals(anyTag, EditPoiData.POI_TYPE_TAG)) {
|
||||
PoiType pt = getData().getPoiTypeDefined();
|
||||
if (pt != null) {
|
||||
amenityTagTextView.setText(pt.getOsmTag());
|
||||
amenityTextView.setText(pt.getOsmValue());
|
||||
} else {
|
||||
amenityTagTextView.setText(getData().getPoiCategory().getDefaultTag());
|
||||
amenityTextView.setText(getData().getPoiTypeString());
|
||||
}
|
||||
updatePoiType();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -145,6 +139,21 @@ public class AdvancedEditPoiFragment extends Fragment
|
|||
}
|
||||
}
|
||||
|
||||
private void updateName() {
|
||||
nameTextView.setText(getData().getTag(OSMSettings.OSMTagKey.NAME.getValue()));
|
||||
}
|
||||
|
||||
private void updatePoiType() {
|
||||
PoiType pt = getData().getPoiTypeDefined();
|
||||
if (pt != null) {
|
||||
amenityTagTextView.setText(pt.getOsmTag());
|
||||
amenityTextView.setText(pt.getOsmValue());
|
||||
} else {
|
||||
amenityTagTextView.setText(getData().getPoiCategory().getDefaultTag());
|
||||
amenityTextView.setText(getData().getPoiTypeString());
|
||||
}
|
||||
}
|
||||
|
||||
public class TagAdapterLinearLayoutHack {
|
||||
private final LinearLayout linearLayout;
|
||||
private final EditPoiData editPoiData;
|
||||
|
|
|
@ -257,7 +257,7 @@ public class EditPoiDialogFragment extends DialogFragment {
|
|||
});
|
||||
poiNameEditText.setOnEditorActionListener(mOnEditorActionListener);
|
||||
poiTypeEditText.setOnEditorActionListener(mOnEditorActionListener);
|
||||
poiTypeEditText.setText(editPoiData.getPoiTypeString());
|
||||
poiTypeEditText.setText(editPoiData.getPoiTypeDefined().getTranslation());
|
||||
|
||||
Button saveButton = (Button) view.findViewById(R.id.saveButton);
|
||||
saveButton.setText(mOpenstreetmapUtil instanceof OpenstreetmapRemoteUtil
|
||||
|
|
|
@ -16,7 +16,7 @@ public class OpenstreetmapLocalUtil implements OpenstreetmapUtil {
|
|||
|
||||
private final Context ctx;
|
||||
|
||||
public final static Log log = PlatformUtil.getLog(OpenstreetmapLocalUtil.class);
|
||||
public final static Log LOG = PlatformUtil.getLog(OpenstreetmapLocalUtil.class);
|
||||
|
||||
private OsmEditingPlugin plugin;
|
||||
|
||||
|
@ -61,14 +61,14 @@ public class OpenstreetmapLocalUtil implements OpenstreetmapUtil {
|
|||
Node entity = new Node(n.getLocation().getLatitude(),
|
||||
n.getLocation().getLongitude(),
|
||||
nodeId);
|
||||
entity.putTag(poiType.getOsmTag(), poiType.getOsmValue());
|
||||
entity.putTag(EditPoiData.POI_TYPE_TAG, poiType.getOsmValue());
|
||||
if(poiType.getOsmTag2() != null) {
|
||||
entity.putTag(poiType.getOsmTag2(), poiType.getOsmValue2());
|
||||
}
|
||||
entity.putTag(OSMTagKey.NAME.getValue(), n.getName());
|
||||
entity.putTag(OSMTagKey.OPENING_HOURS.getValue(), n.getOpeningHours());
|
||||
|
||||
// check whether this is node (because id of node could be the same as relation)
|
||||
|
||||
// check whether this is node (because id of node could be the same as relation)
|
||||
if(entity != null && MapUtils.getDistance(entity.getLatLon(), n.getLocation()) < 50){
|
||||
return entity;
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import android.widget.Toast;
|
|||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.data.Amenity;
|
||||
import net.osmand.osm.PoiType;
|
||||
import net.osmand.osm.edit.Entity;
|
||||
import net.osmand.osm.edit.Entity.EntityId;
|
||||
import net.osmand.osm.edit.Entity.EntityType;
|
||||
|
@ -361,6 +362,9 @@ public class OpenstreetmapRemoteUtil implements OpenstreetmapUtil {
|
|||
entityInfo = st.getRegisteredEntityInfo().get(id);
|
||||
// check whether this is node (because id of node could be the same as relation)
|
||||
if (entity != null && MapUtils.getDistance(entity.getLatLon(), n.getLocation()) < 50) {
|
||||
PoiType poiType = n.getType().getPoiTypeByKeyName(n.getSubType());
|
||||
entity.removeTag(poiType.getOsmTag());
|
||||
entity.putTag(EditPoiData.POI_TYPE_TAG, poiType.getOsmValue());
|
||||
return entity;
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -162,15 +162,11 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
|||
new EditPoiDialogFragment.ShowDeleteDialogAsyncTask(mapActivity)
|
||||
.execute((Amenity) selectedObj);
|
||||
} else if (resId == R.string.poi_context_menu_modify) {
|
||||
if (selectedObj instanceof Amenity) {
|
||||
EditPoiDialogFragment.showEditInstance((Amenity) selectedObj, mapActivity);
|
||||
} else if (selectedObj instanceof OpenstreetmapPoint) {
|
||||
final Node entity = ((OpenstreetmapPoint) selectedObj).getEntity();
|
||||
EditPoiDialogFragment.createInstance(entity, false)
|
||||
.show(mapActivity.getSupportFragmentManager(), "edit_poi");
|
||||
} else {
|
||||
throw new IllegalArgumentException("Selected object is not editable");
|
||||
}
|
||||
EditPoiDialogFragment.showEditInstance((Amenity) selectedObj, mapActivity);
|
||||
} else if (resId == R.string.poi_context_menu_modify_osm_change) {
|
||||
final Node entity = ((OpenstreetmapPoint) selectedObj).getEntity();
|
||||
EditPoiDialogFragment.createInstance(entity, false)
|
||||
.show(mapActivity.getSupportFragmentManager(), "edit_poi");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -180,12 +176,13 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
|||
Amenity amenity = (Amenity) selectedObj;
|
||||
final PoiType poiType = amenity.getType().getPoiTypeByKeyName(amenity.getSubType());
|
||||
isEditable = !amenity.getType().isWiki() && !poiType.isNotEditableOsm();
|
||||
} else if (selectedObj instanceof OpenstreetmapPoint) {
|
||||
isEditable = true;
|
||||
}
|
||||
if (isEditable) {
|
||||
adapter.item(R.string.poi_context_menu_modify).iconColor(R.drawable.ic_action_edit_dark).listen(listener).position(1).reg();
|
||||
adapter.item(R.string.poi_context_menu_delete).iconColor(R.drawable.ic_action_delete_dark).listen(listener).position(2).reg();
|
||||
} else if (selectedObj instanceof OpenstreetmapPoint) {
|
||||
adapter.item(R.string.poi_context_menu_modify_osm_change)
|
||||
.iconColor(R.drawable.ic_action_edit_dark).listen(listener).position(1).reg();
|
||||
} else {
|
||||
adapter.item(R.string.context_menu_item_create_poi).iconColor(R.drawable.ic_action_plus_dark).listen(listener).position(-1).reg();
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ import android.widget.Toast;
|
|||
|
||||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.osm.edit.Node;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
|
@ -464,6 +465,19 @@ public class OsmEditsFragment extends OsmAndListFragment
|
|||
return true;
|
||||
}
|
||||
});
|
||||
if (info instanceof OpenstreetmapPoint) {
|
||||
item = optionsMenu.getMenu().add(R.string.poi_context_menu_modify_osm_change)
|
||||
.setIcon(app.getIconsCache().getContentIcon(R.drawable.ic_action_edit_dark));
|
||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
final Node entity = ((OpenstreetmapPoint) info).getEntity();
|
||||
EditPoiDialogFragment.createInstance(entity, false)
|
||||
.show(getActivity().getSupportFragmentManager(), "edit_poi");
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
item = optionsMenu.getMenu().add(R.string.shared_string_delete).
|
||||
setIcon(app.getIconsCache().getContentIcon(R.drawable.ic_action_delete_dark));
|
||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
|
|
Loading…
Reference in a new issue