diff --git a/android/app/src/main/cpp/app/organicmaps/editor/Editor.cpp b/android/app/src/main/cpp/app/organicmaps/editor/Editor.cpp index b126499ecb..c30c6b0955 100644 --- a/android/app/src/main/cpp/app/organicmaps/editor/Editor.cpp +++ b/android/app/src/main/cpp/app/organicmaps/editor/Editor.cpp @@ -177,6 +177,16 @@ Java_app_organicmaps_editor_Editor_nativeShouldShowEditPlace(JNIEnv *, jclass) return g_framework->GetPlacePageInfo().ShouldShowEditPlace(); } +JNIEXPORT jboolean JNICALL +Java_app_organicmaps_editor_Editor_nativeShouldShowAddBusiness(JNIEnv *, jclass) +{ + ::Framework * frm = g_framework->NativeFramework(); + if (!frm->HasPlacePageInfo()) + return static_cast(false); + + return g_framework->GetPlacePageInfo().ShouldShowAddBusiness(); +} + JNIEXPORT jboolean JNICALL Java_app_organicmaps_editor_Editor_nativeShouldShowAddPlace(JNIEnv *, jclass) { diff --git a/android/app/src/main/java/app/organicmaps/editor/Editor.java b/android/app/src/main/java/app/organicmaps/editor/Editor.java index 4e359bb1aa..7d74db9dae 100644 --- a/android/app/src/main/java/app/organicmaps/editor/Editor.java +++ b/android/app/src/main/java/app/organicmaps/editor/Editor.java @@ -54,6 +54,7 @@ public final class Editor } public static native boolean nativeShouldShowEditPlace(); + public static native boolean nativeShouldShowAddBusiness(); public static native boolean nativeShouldShowAddPlace(); public static native boolean nativeShouldEnableEditPlace(); public static native boolean nativeShouldEnableAddPlace(); 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 9ff6318d50..0e962350fd 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 @@ -450,12 +450,16 @@ public class PlacePageView extends Fragment implements View.OnClickListener, else { UiUtils.showIf(Editor.nativeShouldShowEditPlace(), mEditPlace); + UiUtils.showIf(Editor.nativeShouldShowAddBusiness(), mAddOrganisation); UiUtils.showIf(Editor.nativeShouldShowAddPlace(), mAddPlace); mEditPlace.setEnabled(Editor.nativeShouldEnableEditPlace()); + mAddOrganisation.setEnabled(Editor.nativeShouldEnableAddPlace()); mAddPlace.setEnabled(Editor.nativeShouldEnableAddPlace()); TextView mTvEditPlace = mEditPlace.findViewById(R.id.tv__editor); + TextView mTvAddBusiness = mAddPlace.findViewById(R.id.tv__editor); TextView mTvAddPlace = mAddPlace.findViewById(R.id.tv__editor); mTvEditPlace.setTextColor(Editor.nativeShouldEnableEditPlace() ? getResources().getColor(R.color.base_accent) : getResources().getColor(R.color.button_accent_text_disabled)); + mTvAddBusiness.setTextColor(Editor.nativeShouldEnableEditPlace() ? getResources().getColor(R.color.base_accent) : getResources().getColor(R.color.button_accent_text_disabled)); mTvAddPlace.setTextColor(Editor.nativeShouldEnableEditPlace() ? getResources().getColor(R.color.base_accent) : getResources().getColor(R.color.button_accent_text_disabled)); UiUtils.showIf(UiUtils.isVisible(mEditPlace) || UiUtils.isVisible(mAddOrganisation) diff --git a/map/place_page_info.hpp b/map/place_page_info.hpp index 4ed026198d..14e5226ad7 100644 --- a/map/place_page_info.hpp +++ b/map/place_page_info.hpp @@ -113,6 +113,7 @@ public: /// Edit and add bool ShouldShowAddPlace() const; + bool ShouldShowAddBusiness() const { return m_canEditOrAdd && IsBuilding(); } bool ShouldShowEditPlace() const; bool ShouldEnableAddPlace() const { return m_canEditOrAdd; };