diff --git a/OsmAnd/res/layout/point_editor_fragment_new.xml b/OsmAnd/res/layout/point_editor_fragment_new.xml
index edb092f31e..4dcaa46680 100644
--- a/OsmAnd/res/layout/point_editor_fragment_new.xml
+++ b/OsmAnd/res/layout/point_editor_fragment_new.xml
@@ -1,528 +1,586 @@
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:osmand="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:id="@+id/point_edit_layout"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="@android:color/transparent"
+ android:fitsSystemWindows="true">
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+ android:id="@+id/name_caption"
+ style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:hint="@string/shared_string_name"
+ app:boxBackgroundColor="@color/material_text_input_layout_bg">
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
+
+
-
+
-
+
-
+
-
+
-
+
+
-
+
-
+
-
+
-
-
+
-
+
-
-
+
-
-
+
-
+
-
+
+
-
+
-
+
+
-
+
+
-
+
-
+
-
-
+
-
-
+
-
+
-
+
-
-
+
-
+
+
-
+
-
+
-
+
-
+
-
+
+
-
+
-
+
-
+
-
+
-
+
-
-
+
-
+
-
+
-
+
-
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml
index 0981dc27a2..42178c713b 100644
--- a/OsmAnd/res/values/strings.xml
+++ b/OsmAnd/res/values/strings.xml
@@ -11,6 +11,9 @@
Thx - Hardy
-->
+ Enter address
+ Add address
+ Delete address
Street-level imagery
Select a track file for which a new segment will be added.
Navigation profile
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/FavoritePointEditorFragmentNew.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/FavoritePointEditorFragmentNew.java
index b3159922cf..091b93f9a0 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/FavoritePointEditorFragmentNew.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/FavoritePointEditorFragmentNew.java
@@ -405,6 +405,12 @@ public class FavoritePointEditorFragmentNew extends PointEditorFragmentNew {
return favorite != null ? favorite.getDescription() : "";
}
+ @Override
+ public String getAddressInitValue() {
+ FavouritePoint favourite = getFavorite();
+ return favorite != null ? favorite.getAddress() : "";
+ }
+
@Override
public Drawable getNameIcon() {
FavouritePoint favorite = getFavorite();
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/PointEditorFragmentNew.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/PointEditorFragmentNew.java
index 6751c9181c..69b4ea524a 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/PointEditorFragmentNew.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/PointEditorFragmentNew.java
@@ -75,6 +75,7 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
private View view;
private EditText nameEdit;
private TextView addDelDescription;
+ private TextView addAddressBtn;
private TextView addToHiddenGroupInfo;
private boolean cancelled;
private boolean nightMode;
@@ -91,7 +92,9 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
private LinkedHashMap iconCategories;
private OsmandApplication app;
private View descriptionCaption;
+ private View addressCaption;
private EditText descriptionEdit;
+ private EditText addressEdit;
private int layoutHeightPrevious = 0;
@SuppressLint("ClickableViewAccessibility")
@@ -142,11 +145,12 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
hideKeyboard();
descriptionEdit.clearFocus();
nameEdit.clearFocus();
+ addressEdit.clearFocus();
}
}
});
- int activeColorResId = nightMode ? R.color.active_color_primary_dark : R.color.active_color_primary_light;
+ final int activeColorResId = nightMode ? R.color.active_color_primary_dark : R.color.active_color_primary_light;
ImageView toolbarAction = (ImageView) view.findViewById(R.id.toolbar_action);
view.findViewById(R.id.background_layout).setBackgroundResource(nightMode
? R.color.app_bar_color_dark : R.color.list_background_color_light);
@@ -218,38 +222,73 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
}
descriptionEdit = (EditText) view.findViewById(R.id.description_edit);
+ addressEdit = (EditText) view.findViewById(R.id.address_edit);
AndroidUtils.setTextPrimaryColor(view.getContext(), descriptionEdit, nightMode);
+ AndroidUtils.setTextPrimaryColor(view.getContext(), addressEdit, nightMode);
AndroidUtils.setHintTextSecondaryColor(view.getContext(), descriptionEdit, nightMode);
+ AndroidUtils.setHintTextSecondaryColor(view.getContext(), addressEdit, nightMode);
if (getDescriptionInitValue() != null) {
descriptionEdit.setText(getDescriptionInitValue());
}
+ if (getAddressInitValue() != null){
+ addressEdit.setText(getAddressInitValue());
+ }
descriptionCaption = view.findViewById(R.id.description);
+ addressCaption = view.findViewById(R.id.address);
addDelDescription = (TextView) view.findViewById(R.id.description_button);
+ addAddressBtn = view.findViewById(R.id.address_button);
addDelDescription.setTextColor(getResources().getColor(activeColorResId));
+ addAddressBtn.setTextColor(getResources().getColor(activeColorResId));
+ addAddressBtn.setCompoundDrawablesWithIntrinsicBounds(
+ app.getUIUtilities().getIcon(R.drawable.ic_action_location_off, activeColorResId),null,null,null);
+ addDelDescription.setCompoundDrawablesWithIntrinsicBounds(
+ app.getUIUtilities().getIcon(R.drawable.ic_action_description, activeColorResId),null,null,null);
addDelDescription.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (descriptionCaption.getVisibility() != View.VISIBLE) {
descriptionCaption.setVisibility(View.VISIBLE);
addDelDescription.setText(view.getResources().getString(R.string.delete_description));
+ addDelDescription.setCompoundDrawablesWithIntrinsicBounds(
+ app.getUIUtilities().getIcon(R.drawable.ic_action_delete_item,
+ activeColorResId),null,null,null);
View descriptionEdit = view.findViewById(R.id.description_edit);
descriptionEdit.requestFocus();
AndroidUtils.softKeyboardDelayed(descriptionEdit);
} else {
descriptionCaption.setVisibility(View.GONE);
addDelDescription.setText(view.getResources().getString(R.string.add_description));
+ addDelDescription.setCompoundDrawablesWithIntrinsicBounds(
+ app.getUIUtilities().getIcon(R.drawable.ic_action_location_off,
+ activeColorResId),null,null,null);
AndroidUtils.hideSoftKeyboard(requireActivity(), descriptionEdit);
descriptionEdit.clearFocus();
}
}
});
+ addAddressBtn.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (addressCaption.getVisibility() != View.VISIBLE) {
+ addressCaption.setVisibility(View.VISIBLE);
+ addAddressBtn.setText(view.getResources().getString(R.string.delete_address));
+ View addressEdit = view.findViewById(R.id.address_edit);
+ addressEdit.requestFocus();
+ AndroidUtils.softKeyboardDelayed(addressEdit);
+ } else {
+ addressCaption.setVisibility(View.GONE);
+ addAddressBtn.setText(view.getResources().getString(R.string.add_address));
+ AndroidUtils.hideSoftKeyboard(requireActivity(), addressEdit);
+ addressEdit.clearFocus();
+ }
+ }
+ });
nameIcon.setImageDrawable(getNameIcon());
if (app.accessibilityEnabled()) {
nameCaption.setFocusable(true);
nameEdit.setHint(R.string.access_hint_enter_name);
- descriptionEdit.setHint(R.string.access_hint_enter_description);
}
View deleteButton = view.findViewById(R.id.button_delete_container);
@@ -348,6 +387,13 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
descriptionCaption.setVisibility(View.GONE);
addDelDescription.setText(app.getString(R.string.add_description));
}
+ if (!addressEdit.getText().toString().isEmpty() || addressEdit.hasFocus()) {
+ addressCaption.setVisibility(View.VISIBLE);
+ addAddressBtn.setText(app.getString(R.string.delete_address));
+ } else {
+ addressCaption.setVisibility(View.GONE);
+ addAddressBtn.setText(app.getString(R.string.add_address));
+ }
}
private void createGroupSelector() {
@@ -754,6 +800,8 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
public abstract String getDescriptionInitValue();
+ public abstract String getAddressInitValue();
+
public abstract Drawable getNameIcon();
public abstract Drawable getCategoryIcon();
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditorFragmentNew.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditorFragmentNew.java
index 9142e13d6f..92d6368a04 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditorFragmentNew.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditorFragmentNew.java
@@ -402,6 +402,9 @@ public class WptPtEditorFragmentNew extends PointEditorFragmentNew {
return wpt != null ? wpt.desc : "";
}
+ @Override
+ public String getAddressInitValue() { return ""; }
+
@Override
public Drawable getNameIcon() {
WptPt wptPt = getWpt();