add poi, poi type (no skip dialog yet)
This commit is contained in:
parent
b0e3306de7
commit
44f2e3b6ff
10 changed files with 419 additions and 44 deletions
24
OsmAnd/res/drawable/bg_orange_rounded_coners.xml
Normal file
24
OsmAnd/res/drawable/bg_orange_rounded_coners.xml
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<item android:state_pressed="false">
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<solid android:color="@color/fab_color" />
|
||||||
|
<corners android:bottomRightRadius="2dp"
|
||||||
|
android:bottomLeftRadius="2dp"
|
||||||
|
android:topRightRadius="2dp"
|
||||||
|
android:topLeftRadius="2dp"/>
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
<item android:state_pressed="true">
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<solid android:color="@color/fab_color_pressed" />
|
||||||
|
<corners android:bottomRightRadius="2dp"
|
||||||
|
android:bottomLeftRadius="2dp"
|
||||||
|
android:topRightRadius="2dp"
|
||||||
|
android:topLeftRadius="2dp"/>
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
</selector>
|
|
@ -4,23 +4,134 @@
|
||||||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:theme="?attr/new_app_theme">
|
android:theme="?attr/new_app_theme">
|
||||||
|
|
||||||
<FrameLayout
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="56dp"
|
||||||
|
android:background="?attr/bg_color"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView3"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:padding="16dp"
|
||||||
|
android:text="@string/quick_action_add_poi_dialog"
|
||||||
|
android:textColor="?android:textColorPrimary"
|
||||||
|
android:textSize="@dimen/default_list_text_size"/>
|
||||||
|
|
||||||
|
<android.support.v7.widget.SwitchCompat
|
||||||
|
android:id="@+id/saveButton"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_marginLeft="16dp"
|
||||||
|
android:layout_marginRight="16dp"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="top"
|
||||||
|
android:scaleType="fitXY"
|
||||||
|
android:src="@drawable/bg_shadow_list_bottom"/>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="top"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:scaleType="fitXY"
|
||||||
|
android:src="@drawable/bg_shadow_list_top"/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?attr/bg_color"
|
||||||
|
android:paddingTop="16dp"
|
||||||
|
android:paddingBottom="16dp"
|
||||||
|
osmand:layout_scrollFlags="scroll">
|
||||||
|
<!--android:layout_marginLeft="72dp"-->
|
||||||
|
|
||||||
|
<!--<ImageButton-->
|
||||||
|
<!--android:id="@+id/poiTypeButton"-->
|
||||||
|
<!--android:contentDescription="@string/poi_dialog_poi_type"-->
|
||||||
|
<!--android:layout_width="48dp"-->
|
||||||
|
<!--android:layout_height="48dp"-->
|
||||||
|
<!--android:layout_gravity="bottom"-->
|
||||||
|
<!--android:background="@null"-->
|
||||||
|
<!--android:src="@drawable/ic_action_label"/>-->
|
||||||
|
|
||||||
|
<android.support.design.widget.TextInputLayout
|
||||||
|
android:id="@+id/poiTypeTextInputLayout"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="16dp"
|
||||||
|
android:layout_weight="1">
|
||||||
|
|
||||||
|
<AutoCompleteTextView
|
||||||
|
android:id="@+id/poiTypeEditText"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:completionThreshold="1"
|
||||||
|
android:drawableTint="@color/osmand_orange"
|
||||||
|
android:drawableRight="@drawable/ic_action_arrow_drop_down"
|
||||||
|
android:hint="@string/poi_dialog_poi_type"
|
||||||
|
android:imeOptions="actionSend"
|
||||||
|
android:inputType="text"
|
||||||
|
tools:text="@string/lorem_ipsum"/>
|
||||||
|
|
||||||
|
</android.support.design.widget.TextInputLayout>
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/onlineDocumentationButton"
|
||||||
|
android:contentDescription="@string/shared_string_help"
|
||||||
|
android:layout_width="48dp"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:layout_gravity="bottom"
|
||||||
|
android:background="@null"
|
||||||
|
android:src="@drawable/ic_action_help"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!--<ImageView-->
|
||||||
|
<!--android:layout_width="match_parent"-->
|
||||||
|
<!--android:layout_height="wrap_content"-->
|
||||||
|
<!--android:layout_gravity="top"-->
|
||||||
|
<!--android:scaleType="fitXY"-->
|
||||||
|
<!--android:src="@drawable/bg_shadow_list_bottom"/>-->
|
||||||
|
|
||||||
|
<!--<ImageView-->
|
||||||
|
<!--android:layout_width="match_parent"-->
|
||||||
|
<!--android:layout_height="wrap_content"-->
|
||||||
|
<!--android:layout_gravity="top"-->
|
||||||
|
<!--android:layout_marginTop="16dp"-->
|
||||||
|
<!--android:scaleType="fitXY"-->
|
||||||
|
<!--android:src="@drawable/bg_shadow_list_top"/>-->
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?attr/bg_color"
|
||||||
|
android:paddingTop="16dp"
|
||||||
|
android:paddingBottom="16dp"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/editTagsList"
|
android:id="@+id/editTagsList"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="14dp"
|
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:saveEnabled="false"/>
|
android:saveEnabled="false"/>
|
||||||
|
|
||||||
|
@ -28,13 +139,29 @@
|
||||||
android:id="@+id/addTagButton"
|
android:id="@+id/addTagButton"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="12dp"
|
android:layout_marginLeft="16dp"
|
||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="16dp"
|
||||||
android:background="@color/osmand_orange"
|
android:background="@drawable/bg_orange_rounded_coners"
|
||||||
android:textColor="@color/color_white"
|
android:paddingLeft="16dp"
|
||||||
|
android:paddingRight="16dp"
|
||||||
android:text="@string/add_tag"
|
android:text="@string/add_tag"
|
||||||
|
android:textColor="@color/color_white"
|
||||||
android:textSize="@dimen/default_sub_text_size"
|
android:textSize="@dimen/default_sub_text_size"
|
||||||
osmand:typeface="@string/font_roboto_medium"/>
|
osmand:typeface="@string/font_roboto_medium"/>
|
||||||
|
|
||||||
|
<!--<net.osmand.plus.widgets.ButtonEx-->
|
||||||
|
<!--android:id="@+id/addTypeButton"-->
|
||||||
|
<!--android:layout_width="wrap_content"-->
|
||||||
|
<!--android:layout_height="wrap_content"-->
|
||||||
|
<!--android:layout_marginLeft="16dp"-->
|
||||||
|
<!--android:layout_marginTop="16dp"-->
|
||||||
|
<!--android:background="@drawable/bg_orange_rounded_coners"-->
|
||||||
|
<!--android:paddingLeft="16dp"-->
|
||||||
|
<!--android:paddingRight="16dp"-->
|
||||||
|
<!--android:text="Add type test"-->
|
||||||
|
<!--android:textColor="@color/color_white"-->
|
||||||
|
<!--android:textSize="@dimen/default_sub_text_size"-->
|
||||||
|
<!--osmand:typeface="@string/font_roboto_medium"/>-->
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</FrameLayout>
|
</LinearLayout>
|
||||||
</android.support.v4.widget.NestedScrollView>
|
</android.support.v4.widget.NestedScrollView>
|
||||||
|
|
|
@ -2503,6 +2503,7 @@ If you need help with OsmAnd application, please contact our support team: suppo
|
||||||
<string name="quick_action_navigation_voice_discr">Tap on action will disable or enable voice during navigation.</string>
|
<string name="quick_action_navigation_voice_discr">Tap on action will disable or enable voice during navigation.</string>
|
||||||
<string name="quick_action_add_parking_discr">Tap on action will add Parking place to the specified location.</string>
|
<string name="quick_action_add_parking_discr">Tap on action will add Parking place to the specified location.</string>
|
||||||
<string name="quick_action_favorite_dialog">Show favorite dialog</string>
|
<string name="quick_action_favorite_dialog">Show favorite dialog</string>
|
||||||
|
<string name="quick_action_add_poi_dialog">Show add POI dialog</string>
|
||||||
<string name="quick_action_gpx_dialog">Show GPX waypoint dialog</string>
|
<string name="quick_action_gpx_dialog">Show GPX waypoint dialog</string>
|
||||||
<string name="favorite_autofill_toast_text">" is saved to "</string>
|
<string name="favorite_autofill_toast_text">" is saved to "</string>
|
||||||
<string name="favorite_empty_place_name">Place</string>
|
<string name="favorite_empty_place_name">Place</string>
|
||||||
|
|
|
@ -2454,9 +2454,9 @@ public class OsmandSettings {
|
||||||
public static final String QUICK_FAB_MARGIN_X_LANDSCAPE_MARGIN = "quick_fab_margin_x_landscape_margin";
|
public static final String QUICK_FAB_MARGIN_X_LANDSCAPE_MARGIN = "quick_fab_margin_x_landscape_margin";
|
||||||
public static final String QUICK_FAB_MARGIN_Y_LANDSCAPE_MARGIN = "quick_fab_margin_y_landscape_margin";
|
public static final String QUICK_FAB_MARGIN_Y_LANDSCAPE_MARGIN = "quick_fab_margin_y_landscape_margin";
|
||||||
|
|
||||||
public final CommonPreference<String> QUICK_ACTION = new StringPreference("quick_action_new", "").makeProfile();
|
public final CommonPreference<String> QUICK_ACTION = new StringPreference("quick_action_new", "").makeGlobal();
|
||||||
|
|
||||||
public final CommonPreference<String> QUICK_ACTION_LIST = new StringPreference("quick_action_list", "").makeProfile();
|
public final CommonPreference<String> QUICK_ACTION_LIST = new StringPreference("quick_action_list", "").makeGlobal();
|
||||||
|
|
||||||
public boolean setPortraitFabMargin(int x, int y) {
|
public boolean setPortraitFabMargin(int x, int y) {
|
||||||
return settingsAPI.edit(globalPreferences).putInt(QUICK_FAB_MARGIN_X_PORTRAIT_MARGIN, x)
|
return settingsAPI.edit(globalPreferences).putInt(QUICK_FAB_MARGIN_X_PORTRAIT_MARGIN, x)
|
||||||
|
|
|
@ -127,8 +127,6 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
Map<String, String> mp = (Map<String, String>) savedInstanceState.getSerializable(TAGS_LIST);
|
Map<String, String> mp = (Map<String, String>) savedInstanceState.getSerializable(TAGS_LIST);
|
||||||
editPoiData.updateTags(mp);
|
editPoiData.updateTags(mp);
|
||||||
} else if (getArguments().getSerializable(TAGS_LIST) != null){
|
|
||||||
editPoiData.updateTags((Map<String, String>) getArguments().getSerializable(TAGS_LIST));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isAddingPoi = getArguments().getBoolean(IS_ADDING_POI);
|
boolean isAddingPoi = getArguments().getBoolean(IS_ADDING_POI);
|
||||||
|
@ -222,7 +220,13 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
|
||||||
poiTypeButton.setOnClickListener(new View.OnClickListener() {
|
poiTypeButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
DialogFragment fragment = PoiTypeDialogFragment.createInstance();
|
PoiTypeDialogFragment fragment = PoiTypeDialogFragment.createInstance();
|
||||||
|
fragment.setOnItemSelectListener(new PoiTypeDialogFragment.OnItemSelectListener() {
|
||||||
|
@Override
|
||||||
|
public void select(PoiCategory poiCategory) {
|
||||||
|
setPoiCategory(poiCategory);
|
||||||
|
}
|
||||||
|
});
|
||||||
fragment.show(getChildFragmentManager(), "PoiTypeDialogFragment");
|
fragment.show(getChildFragmentManager(), "PoiTypeDialogFragment");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -282,8 +286,14 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
|
||||||
- editText.getCompoundDrawables()[DRAWABLE_RIGHT].getBounds().width()
|
- editText.getCompoundDrawables()[DRAWABLE_RIGHT].getBounds().width()
|
||||||
- editText.getPaddingRight())) {
|
- editText.getPaddingRight())) {
|
||||||
if (editPoiData.getPoiCategory() != null) {
|
if (editPoiData.getPoiCategory() != null) {
|
||||||
DialogFragment dialogFragment =
|
PoiSubTypeDialogFragment dialogFragment =
|
||||||
PoiSubTypeDialogFragment.createInstance(editPoiData.getPoiCategory());
|
PoiSubTypeDialogFragment.createInstance(editPoiData.getPoiCategory());
|
||||||
|
dialogFragment.setOnItemSelectListener(new PoiSubTypeDialogFragment.OnItemSelectListener() {
|
||||||
|
@Override
|
||||||
|
public void select(String category) {
|
||||||
|
setSubCategory(category);
|
||||||
|
}
|
||||||
|
});
|
||||||
dialogFragment.show(getChildFragmentManager(), "PoiSubTypeDialogFragment");
|
dialogFragment.show(getChildFragmentManager(), "PoiSubTypeDialogFragment");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -232,6 +232,13 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
||||||
osmBugsLayer.openBug(latitude, longitude, "");
|
osmBugsLayer.openBug(latitude, longitude, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void openOsmNote(MapActivity mapActivity, double latitude, double longitude, String message) {
|
||||||
|
if (osmBugsLayer == null) {
|
||||||
|
registerLayers(mapActivity);
|
||||||
|
}
|
||||||
|
osmBugsLayer.openBug(latitude, longitude, message);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addMyPlacesTab(FavoritesActivity favoritesActivity, List<TabActivity.TabItem> mTabs, Intent intent) {
|
public void addMyPlacesTab(FavoritesActivity favoritesActivity, List<TabActivity.TabItem> mTabs, Intent intent) {
|
||||||
if (getDBPOI().getOpenstreetmapPoints().size() > 0 || getDBBug().getOsmbugsPoints().size() > 0) {
|
if (getDBPOI().getOpenstreetmapPoints().size() > 0 || getDBBug().getOsmbugsPoints().size() > 0) {
|
||||||
|
|
|
@ -1,13 +1,5 @@
|
||||||
package net.osmand.plus.osmedit.dialogs;
|
package net.osmand.plus.osmedit.dialogs;
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.TreeSet;
|
|
||||||
|
|
||||||
import net.osmand.osm.MapPoiTypes;
|
|
||||||
import net.osmand.osm.PoiCategory;
|
|
||||||
import net.osmand.osm.PoiType;
|
|
||||||
import net.osmand.plus.OsmandApplication;
|
|
||||||
import net.osmand.plus.osmedit.EditPoiDialogFragment;
|
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
@ -15,8 +7,17 @@ import android.support.annotation.NonNull;
|
||||||
import android.support.v4.app.DialogFragment;
|
import android.support.v4.app.DialogFragment;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
|
|
||||||
|
import net.osmand.osm.MapPoiTypes;
|
||||||
|
import net.osmand.osm.PoiCategory;
|
||||||
|
import net.osmand.osm.PoiType;
|
||||||
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.TreeSet;
|
||||||
|
|
||||||
public class PoiSubTypeDialogFragment extends DialogFragment {
|
public class PoiSubTypeDialogFragment extends DialogFragment {
|
||||||
private static final String KEY_POI_CATEGORY = "amenity";
|
private static final String KEY_POI_CATEGORY = "amenity";
|
||||||
|
private OnItemSelectListener onItemSelectListener;
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
|
@ -38,7 +39,7 @@ public class PoiSubTypeDialogFragment extends DialogFragment {
|
||||||
builder.setItems(subCats, new DialogInterface.OnClickListener() {
|
builder.setItems(subCats, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
((EditPoiDialogFragment) getParentFragment()).setSubCategory(subCats[which]);
|
onItemSelectListener.select(subCats[which]);
|
||||||
dismiss();
|
dismiss();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -60,4 +61,12 @@ public class PoiSubTypeDialogFragment extends DialogFragment {
|
||||||
fragment.setArguments(args);
|
fragment.setArguments(args);
|
||||||
return fragment;
|
return fragment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setOnItemSelectListener(OnItemSelectListener onItemSelectListener) {
|
||||||
|
this.onItemSelectListener = onItemSelectListener;
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface OnItemSelectListener {
|
||||||
|
void select(String category);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,12 +1,5 @@
|
||||||
package net.osmand.plus.osmedit.dialogs;
|
package net.osmand.plus.osmedit.dialogs;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.osmand.osm.MapPoiTypes;
|
|
||||||
import net.osmand.osm.PoiCategory;
|
|
||||||
import net.osmand.plus.OsmandApplication;
|
|
||||||
import net.osmand.plus.osmedit.EditPoiDialogFragment;
|
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
@ -14,7 +7,15 @@ import android.support.annotation.NonNull;
|
||||||
import android.support.v4.app.DialogFragment;
|
import android.support.v4.app.DialogFragment;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
|
|
||||||
|
import net.osmand.osm.MapPoiTypes;
|
||||||
|
import net.osmand.osm.PoiCategory;
|
||||||
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class PoiTypeDialogFragment extends DialogFragment {
|
public class PoiTypeDialogFragment extends DialogFragment {
|
||||||
|
private OnItemSelectListener onItemSelectListener;
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
|
@ -33,7 +34,7 @@ public class PoiTypeDialogFragment extends DialogFragment {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
PoiCategory aType = categories.get(which);
|
PoiCategory aType = categories.get(which);
|
||||||
((EditPoiDialogFragment) getParentFragment()).setPoiCategory(aType);
|
onItemSelectListener.select(aType);
|
||||||
dismiss();
|
dismiss();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -46,4 +47,12 @@ public class PoiTypeDialogFragment extends DialogFragment {
|
||||||
poiTypeDialogFragment.setArguments(args);
|
poiTypeDialogFragment.setArguments(args);
|
||||||
return poiTypeDialogFragment;
|
return poiTypeDialogFragment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setOnItemSelectListener(OnItemSelectListener onItemSelectListener) {
|
||||||
|
this.onItemSelectListener = onItemSelectListener;
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface OnItemSelectListener {
|
||||||
|
void select(PoiCategory poiCategory);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -5,7 +5,6 @@ import android.os.Bundle;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.v4.app.DialogFragment;
|
import android.support.v4.app.DialogFragment;
|
||||||
|
|
||||||
import android.support.v7.view.ContextThemeWrapper;
|
import android.support.v7.view.ContextThemeWrapper;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
@ -155,7 +154,7 @@ public class AddQuickActionDialog extends DialogFragment {
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
|
||||||
CreateEditActionDialog dialog = CreateEditActionDialog.newInstance(action.type);
|
CreateEditActionDialog dialog = CreateEditActionDialog.newInstance(action.type);
|
||||||
dialog.show(getFragmentManager(), AddQuickActionDialog.TAG);
|
dialog.show(getFragmentManager(), CreateEditActionDialog.TAG);
|
||||||
|
|
||||||
dismiss();
|
dismiss();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,12 @@ import android.app.Dialog;
|
||||||
import android.app.ProgressDialog;
|
import android.app.ProgressDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.res.Resources;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.support.design.widget.TextInputLayout;
|
||||||
import android.support.annotation.DrawableRes;
|
import android.support.annotation.DrawableRes;
|
||||||
import android.support.annotation.StringRes;
|
import android.support.annotation.StringRes;
|
||||||
import android.support.v4.util.Pair;
|
import android.support.v4.util.Pair;
|
||||||
|
@ -17,13 +22,16 @@ import android.support.v7.widget.helper.ItemTouchHelper;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
|
import android.util.TypedValue;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.AdapterView;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.AutoCompleteTextView;
|
import android.widget.AutoCompleteTextView;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
|
import android.widget.CompoundButton;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
@ -38,9 +46,9 @@ import net.osmand.data.LatLon;
|
||||||
import net.osmand.data.PointDescription;
|
import net.osmand.data.PointDescription;
|
||||||
import net.osmand.osm.AbstractPoiType;
|
import net.osmand.osm.AbstractPoiType;
|
||||||
import net.osmand.osm.MapPoiTypes;
|
import net.osmand.osm.MapPoiTypes;
|
||||||
|
import net.osmand.osm.PoiCategory;
|
||||||
import net.osmand.osm.PoiType;
|
import net.osmand.osm.PoiType;
|
||||||
import net.osmand.osm.edit.Node;
|
import net.osmand.osm.edit.Node;
|
||||||
import net.osmand.osm.edit.OSMSettings;
|
|
||||||
import net.osmand.plus.ContextMenuAdapter;
|
import net.osmand.plus.ContextMenuAdapter;
|
||||||
import net.osmand.plus.ContextMenuItem;
|
import net.osmand.plus.ContextMenuItem;
|
||||||
import net.osmand.plus.FavouritesDbHelper;
|
import net.osmand.plus.FavouritesDbHelper;
|
||||||
|
@ -55,9 +63,9 @@ import net.osmand.plus.dialogs.ConfigureMapMenu;
|
||||||
import net.osmand.plus.mapcontextmenu.editors.EditCategoryDialogFragment;
|
import net.osmand.plus.mapcontextmenu.editors.EditCategoryDialogFragment;
|
||||||
import net.osmand.plus.mapcontextmenu.editors.SelectCategoryDialogFragment;
|
import net.osmand.plus.mapcontextmenu.editors.SelectCategoryDialogFragment;
|
||||||
import net.osmand.plus.openseamapsplugin.NauticalMapsPlugin;
|
import net.osmand.plus.openseamapsplugin.NauticalMapsPlugin;
|
||||||
import net.osmand.plus.osmedit.EditPoiData;
|
|
||||||
import net.osmand.plus.osmedit.EditPoiDialogFragment;
|
import net.osmand.plus.osmedit.EditPoiDialogFragment;
|
||||||
import net.osmand.plus.osmedit.OsmEditingPlugin;
|
import net.osmand.plus.osmedit.OsmEditingPlugin;
|
||||||
|
import net.osmand.plus.osmedit.dialogs.PoiSubTypeDialogFragment;
|
||||||
import net.osmand.plus.parkingpoint.ParkingPositionPlugin;
|
import net.osmand.plus.parkingpoint.ParkingPositionPlugin;
|
||||||
import net.osmand.plus.poi.PoiFiltersHelper;
|
import net.osmand.plus.poi.PoiFiltersHelper;
|
||||||
import net.osmand.plus.poi.PoiUIFilter;
|
import net.osmand.plus.poi.PoiUIFilter;
|
||||||
|
@ -67,11 +75,13 @@ import net.osmand.plus.render.RenderingIcons;
|
||||||
import net.osmand.plus.views.OsmandMapTileView;
|
import net.osmand.plus.views.OsmandMapTileView;
|
||||||
import net.osmand.plus.widgets.AutoCompleteTextViewEx;
|
import net.osmand.plus.widgets.AutoCompleteTextViewEx;
|
||||||
import net.osmand.render.RenderingRulesStorage;
|
import net.osmand.render.RenderingRulesStorage;
|
||||||
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -80,6 +90,7 @@ import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import static net.osmand.plus.osmedit.AdvancedEditPoiFragment.addPoiToStringSet;
|
import static net.osmand.plus.osmedit.AdvancedEditPoiFragment.addPoiToStringSet;
|
||||||
|
import static net.osmand.plus.osmedit.EditPoiData.POI_TYPE_TAG;
|
||||||
|
|
||||||
public class QuickActionFactory {
|
public class QuickActionFactory {
|
||||||
|
|
||||||
|
@ -1451,6 +1462,7 @@ public class QuickActionFactory {
|
||||||
public static class AddPOIAction extends QuickAction {
|
public static class AddPOIAction extends QuickAction {
|
||||||
public static final int TYPE = 13;
|
public static final int TYPE = 13;
|
||||||
public static final String KEY_TAG = "key_tag";
|
public static final String KEY_TAG = "key_tag";
|
||||||
|
public static final String KEY_DIALOG = "dialog";
|
||||||
|
|
||||||
protected AddPOIAction() {
|
protected AddPOIAction() {
|
||||||
super(TYPE);
|
super(TYPE);
|
||||||
|
@ -1469,17 +1481,17 @@ public class QuickActionFactory {
|
||||||
|
|
||||||
OsmEditingPlugin plugin = OsmandPlugin.getPlugin(OsmEditingPlugin.class);
|
OsmEditingPlugin plugin = OsmandPlugin.getPlugin(OsmEditingPlugin.class);
|
||||||
if (plugin != null) {
|
if (plugin != null) {
|
||||||
|
Node node = new Node(latLon.getLatitude(), latLon.getLongitude(), -1);
|
||||||
|
node.replaceTags(getTagsFromParams());
|
||||||
EditPoiDialogFragment editPoiDialogFragment =
|
EditPoiDialogFragment editPoiDialogFragment =
|
||||||
// EditPoiDialogFragment.createAddPoiInstance(latLon.getLatitude(), latLon.getLongitude(),
|
EditPoiDialogFragment.createInstance(node, true, getTagsFromParams());
|
||||||
// activity.getMyApplication());
|
|
||||||
EditPoiDialogFragment.createInstance(new Node(latLon.getLatitude(), latLon.getLongitude(), -1), true, getTagsFromParams());
|
|
||||||
editPoiDialogFragment.show(activity.getSupportFragmentManager(),
|
editPoiDialogFragment.show(activity.getSupportFragmentManager(),
|
||||||
EditPoiDialogFragment.TAG);
|
EditPoiDialogFragment.TAG);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawUI(ViewGroup parent, MapActivity activity) {
|
public void drawUI(final ViewGroup parent, final MapActivity activity) {
|
||||||
final View view = LayoutInflater.from(parent.getContext())
|
final View view = LayoutInflater.from(parent.getContext())
|
||||||
.inflate(R.layout.quick_action_add_poi_layout, parent, false);
|
.inflate(R.layout.quick_action_add_poi_layout, parent, false);
|
||||||
|
|
||||||
|
@ -1490,16 +1502,17 @@ public class QuickActionFactory {
|
||||||
LinearLayout editTagsLineaLayout =
|
LinearLayout editTagsLineaLayout =
|
||||||
(LinearLayout) view.findViewById(R.id.editTagsList);
|
(LinearLayout) view.findViewById(R.id.editTagsList);
|
||||||
|
|
||||||
final MapPoiTypes mapPoiTypes = application.getPoiTypes();
|
final MapPoiTypes poiTypes = application.getPoiTypes();
|
||||||
|
final Map<String, PoiType> allTranslatedNames = poiTypes.getAllTranslatedNames(true);
|
||||||
final TagAdapterLinearLayoutHack mAdapter = new TagAdapterLinearLayoutHack(editTagsLineaLayout, getTagsFromParams(), deleteDrawable);
|
final TagAdapterLinearLayoutHack mAdapter = new TagAdapterLinearLayoutHack(editTagsLineaLayout, getTagsFromParams(), deleteDrawable);
|
||||||
// It is possible to not restart initialization every time, and probably move initialization to appInit
|
// It is possible to not restart initialization every time, and probably move initialization to appInit
|
||||||
Map<String, PoiType> translatedTypes = mapPoiTypes.getAllTranslatedNames(true);
|
Map<String, PoiType> translatedTypes = poiTypes.getAllTranslatedNames(true);
|
||||||
HashSet<String> tagKeys = new HashSet<>();
|
HashSet<String> tagKeys = new HashSet<>();
|
||||||
HashSet<String> valueKeys = new HashSet<>();
|
HashSet<String> valueKeys = new HashSet<>();
|
||||||
for (AbstractPoiType abstractPoiType : translatedTypes.values()) {
|
for (AbstractPoiType abstractPoiType : translatedTypes.values()) {
|
||||||
addPoiToStringSet(abstractPoiType, tagKeys, valueKeys);
|
addPoiToStringSet(abstractPoiType, tagKeys, valueKeys);
|
||||||
}
|
}
|
||||||
addPoiToStringSet(mapPoiTypes.getOtherMapCategory(), tagKeys, valueKeys);
|
addPoiToStringSet(poiTypes.getOtherMapCategory(), tagKeys, valueKeys);
|
||||||
tagKeys.addAll(EditPoiDialogFragment.BASIC_TAGS);
|
tagKeys.addAll(EditPoiDialogFragment.BASIC_TAGS);
|
||||||
mAdapter.setTagData(tagKeys.toArray(new String[tagKeys.size()]));
|
mAdapter.setTagData(tagKeys.toArray(new String[tagKeys.size()]));
|
||||||
mAdapter.setValueData(valueKeys.toArray(new String[valueKeys.size()]));
|
mAdapter.setValueData(valueKeys.toArray(new String[valueKeys.size()]));
|
||||||
|
@ -1513,9 +1526,179 @@ public class QuickActionFactory {
|
||||||
|
|
||||||
mAdapter.updateViews();
|
mAdapter.updateViews();
|
||||||
|
|
||||||
|
final TextInputLayout poiTypeTextInputLayout = (TextInputLayout) view.findViewById(R.id.poiTypeTextInputLayout);
|
||||||
|
final AutoCompleteTextView poiTypeEditText = (AutoCompleteTextView) view.findViewById(R.id.poiTypeEditText);
|
||||||
|
final SwitchCompat showDialog = (SwitchCompat) view.findViewById(R.id.saveButton);
|
||||||
|
showDialog.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
|
getParams().put(KEY_DIALOG, Boolean.toString(isChecked));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
showDialog.setChecked(Boolean.valueOf(getParams().get(KEY_DIALOG)));
|
||||||
|
|
||||||
|
String text = getTagsFromParams().get(POI_TYPE_TAG);
|
||||||
|
poiTypeEditText.addTextChangedListener(new TextWatcher() {
|
||||||
|
@Override
|
||||||
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterTextChanged(Editable s) {
|
||||||
|
String tp = s.toString();
|
||||||
|
putTagIntoParams(POI_TYPE_TAG, tp);
|
||||||
|
PoiCategory category = getCategory(allTranslatedNames);
|
||||||
|
if (category != null) {
|
||||||
|
poiTypeTextInputLayout.setHint(category.getTranslation());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
poiTypeEditText.setText(text != null ? text : "");
|
||||||
|
poiTypeEditText.setOnTouchListener(new View.OnTouchListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onTouch(final View v, MotionEvent event) {
|
||||||
|
final EditText editText = (EditText) v;
|
||||||
|
final int DRAWABLE_RIGHT = 2;
|
||||||
|
if (event.getAction() == MotionEvent.ACTION_UP) {
|
||||||
|
if (event.getX() >= (editText.getRight()
|
||||||
|
- editText.getCompoundDrawables()[DRAWABLE_RIGHT].getBounds().width()
|
||||||
|
- editText.getPaddingRight())) {
|
||||||
|
PoiCategory category = getCategory(allTranslatedNames);
|
||||||
|
PoiCategory tempPoiCategory= (category != null) ? category : poiTypes.getOtherPoiCategory();
|
||||||
|
PoiSubTypeDialogFragment f =
|
||||||
|
PoiSubTypeDialogFragment.createInstance(tempPoiCategory);
|
||||||
|
f.setOnItemSelectListener(new PoiSubTypeDialogFragment.OnItemSelectListener() {
|
||||||
|
@Override
|
||||||
|
public void select(String category) {
|
||||||
|
poiTypeEditText.setText(category);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
CreateEditActionDialog parentFragment = (CreateEditActionDialog) activity.getSupportFragmentManager().findFragmentByTag(CreateEditActionDialog.TAG);
|
||||||
|
f.show(parentFragment.getChildFragmentManager(), "PoiSubTypeDialogFragment");
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
setUpAdapterForPoiTypeEditText(activity, allTranslatedNames, poiTypeEditText);
|
||||||
|
|
||||||
|
ImageButton onlineDocumentationButton =
|
||||||
|
(ImageButton) view.findViewById(R.id.onlineDocumentationButton);
|
||||||
|
onlineDocumentationButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
activity.startActivity(new Intent(Intent.ACTION_VIEW,
|
||||||
|
Uri.parse("https://wiki.openstreetmap.org/wiki/Map_Features")));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
boolean isLightTheme = activity.getMyApplication().getSettings().OSMAND_THEME.get() == OsmandSettings.OSMAND_LIGHT_THEME;
|
||||||
|
final int colorId = isLightTheme ? R.color.inactive_item_orange : R.color.dash_search_icon_dark;
|
||||||
|
final int color = activity.getResources().getColor(colorId);
|
||||||
|
onlineDocumentationButton.setImageDrawable(activity.getMyApplication().getIconsCache().getPaintedIcon(R.drawable.ic_action_help, color));
|
||||||
|
// poiTypeEditText.setCompoundDrawables(null, null, activity.getMyApplication().getIconsCache().getPaintedIcon(R.drawable.ic_action_arrow_drop_down, color), null);
|
||||||
|
|
||||||
|
// Button addTypeButton = (Button) view.findViewById(R.id.addTypeButton);
|
||||||
|
// addTypeButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
// @Override
|
||||||
|
// public void onClick(View v) {
|
||||||
|
// PoiSubTypeDialogFragment f = PoiSubTypeDialogFragment.createInstance(poiTypes.getOtherPoiCategory());
|
||||||
|
// f.setOnItemSelectListener(new PoiSubTypeDialogFragment.OnItemSelectListener() {
|
||||||
|
// @Override
|
||||||
|
// public void select(String category) {
|
||||||
|
// putTagIntoParams(POI_TYPE_TAG, category);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// CreateEditActionDialog parentFragment = (CreateEditActionDialog) activity.getSupportFragmentManager().findFragmentByTag(CreateEditActionDialog.TAG);
|
||||||
|
// f.show(parentFragment.getChildFragmentManager(), "PoiSubTypeDialogFragment");
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
parent.addView(view);
|
parent.addView(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setUpAdapterForPoiTypeEditText(final MapActivity activity, final Map<String, PoiType> allTranslatedNames, final AutoCompleteTextView poiTypeEditText) {
|
||||||
|
final Map<String, PoiType> subCategories = new LinkedHashMap<>();
|
||||||
|
// PoiCategory ct = editPoiData.getPoiCategory();
|
||||||
|
// if (ct != null) {
|
||||||
|
// for (PoiType s : ct.getPoiTypes()) {
|
||||||
|
// if (!s.isReference() && !s.isNotEditableOsm() && s.getBaseLangType() == null) {
|
||||||
|
// addMapEntryAdapter(subCategories, s.getTranslation(), s);
|
||||||
|
// if(!s.getKeyName().contains("osmand")) {
|
||||||
|
// addMapEntryAdapter(subCategories, s.getKeyName().replace('_', ' '), s);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
for (Entry<String, PoiType> s : allTranslatedNames.entrySet()) {
|
||||||
|
addMapEntryAdapter(subCategories, s.getKey(), s.getValue());
|
||||||
|
}
|
||||||
|
final ArrayAdapter<Object> adapter;
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
|
adapter = new ArrayAdapter<>(activity,
|
||||||
|
R.layout.list_textview, subCategories.keySet().toArray());
|
||||||
|
} else {
|
||||||
|
TypedValue typedValue = new TypedValue();
|
||||||
|
Resources.Theme theme = activity.getTheme();
|
||||||
|
theme.resolveAttribute(android.R.attr.textColorSecondary, typedValue, true);
|
||||||
|
final int textColor = typedValue.data;
|
||||||
|
|
||||||
|
adapter = new ArrayAdapter<Object>(activity,
|
||||||
|
R.layout.list_textview, subCategories.keySet().toArray()) {
|
||||||
|
@Override
|
||||||
|
public View getView(int position, View convertView, ViewGroup parent) {
|
||||||
|
final View view = super.getView(position, convertView, parent);
|
||||||
|
((TextView) view.findViewById(R.id.textView)).setTextColor(textColor);
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
adapter.sort(new Comparator<Object>() {
|
||||||
|
@Override
|
||||||
|
public int compare(Object lhs, Object rhs) {
|
||||||
|
return lhs.toString().compareTo(rhs.toString());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
poiTypeEditText.setAdapter(adapter);
|
||||||
|
poiTypeEditText.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||||
|
Object item = parent.getAdapter().getItem(position);
|
||||||
|
poiTypeEditText.setText(item.toString());
|
||||||
|
setUpAdapterForPoiTypeEditText(activity, allTranslatedNames, poiTypeEditText);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNothingSelected(AdapterView<?> parent) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private PoiCategory getCategory(Map<String, PoiType> allTranslatedNames) {
|
||||||
|
String tp = getTagsFromParams().get(POI_TYPE_TAG);
|
||||||
|
PoiType pt = allTranslatedNames.get(tp.toLowerCase());
|
||||||
|
if (pt != null) {
|
||||||
|
return pt.getCategory();
|
||||||
|
} else
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addMapEntryAdapter(final Map<String, PoiType> subCategories, String key, PoiType v) {
|
||||||
|
if (!subCategories.containsKey(key.toLowerCase())) {
|
||||||
|
subCategories.put(Algorithms.capitalizeFirstLetterAndLowercase(key), v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private class TagAdapterLinearLayoutHack {
|
private class TagAdapterLinearLayoutHack {
|
||||||
private final LinearLayout linearLayout;
|
private final LinearLayout linearLayout;
|
||||||
private final Map<String, String> tagsData;
|
private final Map<String, String> tagsData;
|
||||||
|
@ -1538,8 +1721,8 @@ public class QuickActionFactory {
|
||||||
linearLayout.removeAllViews();
|
linearLayout.removeAllViews();
|
||||||
List<Entry<String, String>> entries = new ArrayList<>(tagsData.entrySet());
|
List<Entry<String, String>> entries = new ArrayList<>(tagsData.entrySet());
|
||||||
for (Entry<String, String> tag : entries) {
|
for (Entry<String, String> tag : entries) {
|
||||||
if (tag.getKey().equals(EditPoiData.POI_TYPE_TAG)
|
if (tag.getKey().equals(POI_TYPE_TAG)
|
||||||
|| tag.getKey().equals(OSMSettings.OSMTagKey.NAME.getValue()))
|
/*|| tag.getKey().equals(OSMSettings.OSMTagKey.NAME.getValue())*/)
|
||||||
continue;
|
continue;
|
||||||
addTagView(tag.getKey(), tag.getValue());
|
addTagView(tag.getKey(), tag.getValue());
|
||||||
}
|
}
|
||||||
|
@ -1656,6 +1839,12 @@ public class QuickActionFactory {
|
||||||
private void setTagsIntoParams(Map<String, String> tags) {
|
private void setTagsIntoParams(Map<String, String> tags) {
|
||||||
getParams().put(KEY_TAG, new Gson().toJson(tags));
|
getParams().put(KEY_TAG, new Gson().toJson(tags));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void putTagIntoParams(String tag, String value) {
|
||||||
|
Map<String, String> tagsFromParams = getTagsFromParams();
|
||||||
|
tagsFromParams.put(tag, value);
|
||||||
|
setTagsIntoParams(tagsFromParams);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class MapStyleAction extends SwitchableAction<String> {
|
public static class MapStyleAction extends SwitchableAction<String> {
|
||||||
|
|
Loading…
Reference in a new issue