diff --git a/android/app/src/main/java/app/organicmaps/widget/placepage/PlacePageView.java b/android/app/src/main/java/app/organicmaps/widget/placepage/PlacePageView.java
index 7d76e112b..8568874b2 100644
--- a/android/app/src/main/java/app/organicmaps/widget/placepage/PlacePageView.java
+++ b/android/app/src/main/java/app/organicmaps/widget/placepage/PlacePageView.java
@@ -154,6 +154,7 @@ public class PlacePageView extends Fragment
private MaterialTextView mTvLastChecked;
private View mEditPlace;
private View mAddPlace;
+ private View mMapTooOld;
private View mEditTopSpace;
private ShapeableImageView mColorIcon;
private MaterialTextView mTvCategory;
@@ -318,6 +319,7 @@ public class PlacePageView extends Fragment
mTvLastChecked = mFrame.findViewById(R.id.place_page_last_checked);
mEditPlace = mFrame.findViewById(R.id.ll__place_editor);
mAddPlace = mFrame.findViewById(R.id.ll__place_add);
+ mMapTooOld = mFrame.findViewById(R.id.cv__map_too_old);
mEditTopSpace = mFrame.findViewById(R.id.edit_top_space);
latlon.setOnLongClickListener(this);
address.setOnLongClickListener(this);
@@ -684,7 +686,7 @@ public class PlacePageView extends Fragment
if (RoutingController.get().isNavigating() || RoutingController.get().isPlanning())
{
- UiUtils.hide(mEditPlace, mAddPlace, mEditTopSpace);
+ UiUtils.hide(mEditPlace, mAddPlace, mEditTopSpace, mMapTooOld);
}
else
{
@@ -692,31 +694,59 @@ public class PlacePageView extends Fragment
UiUtils.showIf(Editor.nativeShouldShowAddPlace(), mAddPlace);
MaterialButton mTvEditPlace = mEditPlace.findViewById(R.id.mb__place_editor);
MaterialButton mTvAddPlace = mAddPlace.findViewById(R.id.mb__place_add);
- mTvEditPlace.setOnClickListener(this);
- mTvAddPlace.setOnClickListener(this);
- mTvEditPlace.setEnabled(Editor.nativeShouldEnableEditPlace());
- mTvAddPlace.setEnabled(Editor.nativeShouldEnableAddPlace());
- final int editTextButtonColor =
- Editor.nativeShouldEnableEditPlace()
+
+ boolean shouldEnableEditPlace = Editor.nativeShouldEnableEditPlace();
+
+ if (shouldEnableEditPlace)
+ {
+ mTvEditPlace.setOnClickListener(this);
+ mTvAddPlace.setOnClickListener(this);
+ }
+ else
+ {
+ mTvEditPlace.setOnClickListener((v) -> {
+ Utils.showSnackbar(v.getContext(), v.getRootView(), R.string.place_page_too_old_to_edit);
+ });
+ mTvAddPlace.setOnClickListener((v) -> {
+ Utils.showSnackbar(v.getContext(), v.getRootView(), R.string.place_page_too_old_to_edit);
+ });
+
+ CountryItem map = CountryItem.fill(MapManager.nativeGetSelectedCountry());
+
+ if (map.status == CountryItem.STATUS_UPDATABLE || map.status == CountryItem.STATUS_DONE
+ || map.status == CountryItem.STATUS_FAILED)
+ {
+ mMapTooOld.setVisibility(VISIBLE);
+ MaterialButton mTvUpdateTooOldMap = mMapTooOld.findViewById(R.id.mb__update_too_old_map);
+ boolean canUpdateMap = map.status != CountryItem.STATUS_DONE;
+
+ if (canUpdateMap)
+ {
+ mTvUpdateTooOldMap.setOnClickListener((v) -> {
+ MapManagerHelper.warn3gAndDownload(requireActivity(), map.id, null);
+ mMapTooOld.setVisibility(GONE);
+ });
+ }
+ else
+ {
+ mTvUpdateTooOldMap.setVisibility(GONE);
+ MaterialTextView mapTooOldDescription = mMapTooOld.findViewById(R.id.tv__map_too_old_description);
+ mapTooOldDescription.setText(R.string.place_page_app_too_old_description);
+ }
+ }
+ }
+
+ final int editButtonColor =
+ shouldEnableEditPlace
? ContextCompat.getColor(
getContext(),
UiUtils.getStyledResourceId(getContext(), com.google.android.material.R.attr.colorSecondary))
: ContextCompat.getColor(getContext(), R.color.button_accent_text_disabled);
- final ColorStateList editStrokeButtonColor = new ColorStateList(
- new int[][]{
- new int[]{android.R.attr.state_enabled}, // enabled
- new int[]{-android.R.attr.state_enabled} // disabled
- },
- new int[]{
- ContextCompat.getColor(
- getContext(),
- UiUtils.getStyledResourceId(getContext(), com.google.android.material.R.attr.colorSecondary)),
- ContextCompat.getColor(getContext(), R.color.button_accent_text_disabled)
- });
- mTvEditPlace.setTextColor(editTextButtonColor);
- mTvAddPlace.setTextColor(editTextButtonColor);
- mTvEditPlace.setStrokeColor(editStrokeButtonColor);
- mTvAddPlace.setStrokeColor(editStrokeButtonColor);
+
+ mTvEditPlace.setTextColor(editButtonColor);
+ mTvAddPlace.setTextColor(editButtonColor);
+ mTvEditPlace.setStrokeColor(ColorStateList.valueOf(editButtonColor));
+ mTvAddPlace.setStrokeColor(ColorStateList.valueOf(editButtonColor));
UiUtils.showIf(
UiUtils.isVisible(mEditPlace) || UiUtils.isVisible(mAddPlace),
mEditTopSpace);
diff --git a/android/app/src/main/res/drawable/info_icon.xml b/android/app/src/main/res/drawable/info_icon.xml
new file mode 100644
index 000000000..d59228bd4
--- /dev/null
+++ b/android/app/src/main/res/drawable/info_icon.xml
@@ -0,0 +1,10 @@
+
+
+
\ No newline at end of file
diff --git a/android/app/src/main/res/layout/place_page_details.xml b/android/app/src/main/res/layout/place_page_details.xml
index 3f81fa3a8..c927dc0bf 100644
--- a/android/app/src/main/res/layout/place_page_details.xml
+++ b/android/app/src/main/res/layout/place_page_details.xml
@@ -89,6 +89,8 @@
android:paddingHorizontal="@dimen/margin_base"
tools:text="Existence confirmed 1 month ago"/>
+
+
diff --git a/android/app/src/main/res/layout/place_page_map_too_old.xml b/android/app/src/main/res/layout/place_page_map_too_old.xml
new file mode 100644
index 000000000..fb41ed5cc
--- /dev/null
+++ b/android/app/src/main/res/layout/place_page_map_too_old.xml
@@ -0,0 +1,65 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml
index 2679300f9..3d4c9ae30 100644
--- a/android/app/src/main/res/values/strings.xml
+++ b/android/app/src/main/res/values/strings.xml
@@ -573,6 +573,16 @@
Enter a valid Mastodon username or web address
Enter a valid Bluesky username or web address
Add Place to OpenStreetMap
+
+ Map data outdated
+
+ Your current map data is very old, please update the map.
+
+ Your current map data is very old, please update the CoMaps app.
+
+ Update map region
+
+ OpenStreetMap editing is disabled because the map data is too old.
Or, alternatively, leave a note to OpenStreetMap community so that someone else can add or fix a place here.
Note will be sent to OpenStreetMap