merge add place/business options

Signed-off-by: map-per <map-per@gmx.de>
This commit is contained in:
map-per
2025-09-25 16:26:32 +02:00
committed by x7z4w
parent e3c287db53
commit efc8e44350
8 changed files with 4 additions and 50 deletions

View File

@@ -146,7 +146,6 @@ public class PlacePageView extends Fragment
private MaterialTextView mTvEntrance;
private MaterialTextView mTvLastChecked;
private View mEditPlace;
private View mAddOrganisation;
private View mAddPlace;
private View mEditTopSpace;
private ShapeableImageView mColorIcon;
@@ -311,7 +310,6 @@ public class PlacePageView extends Fragment
mTvEntrance = mEntrance.findViewById(R.id.tv__place_entrance);
mTvLastChecked = mFrame.findViewById(R.id.place_page_last_checked);
mEditPlace = mFrame.findViewById(R.id.ll__place_editor);
mAddOrganisation = mFrame.findViewById(R.id.ll__add_organisation);
mAddPlace = mFrame.findViewById(R.id.ll__place_add);
mEditTopSpace = mFrame.findViewById(R.id.edit_top_space);
latlon.setOnLongClickListener(this);
@@ -672,21 +670,17 @@ public class PlacePageView extends Fragment
if (RoutingController.get().isNavigating() || RoutingController.get().isPlanning())
{
UiUtils.hide(mEditPlace, mAddOrganisation, mAddPlace, mEditTopSpace);
UiUtils.hide(mEditPlace, mAddPlace, mEditTopSpace);
}
else
{
UiUtils.showIf(Editor.nativeShouldShowEditPlace(), mEditPlace);
UiUtils.showIf(Editor.nativeShouldShowAddBusiness(), mAddOrganisation);
UiUtils.showIf(Editor.nativeShouldShowAddPlace(), mAddPlace);
MaterialButton mTvEditPlace = mEditPlace.findViewById(R.id.mb__place_editor);
MaterialButton mTvAddBusiness = mAddOrganisation.findViewById(R.id.mb__add_organisation);
MaterialButton mTvAddPlace = mAddPlace.findViewById(R.id.mb__place_add);
mTvEditPlace.setOnClickListener(this);
mTvAddBusiness.setOnClickListener(this);
mTvAddPlace.setOnClickListener(this);
mTvEditPlace.setEnabled(Editor.nativeShouldEnableEditPlace());
mTvAddBusiness.setEnabled(Editor.nativeShouldEnableAddPlace());
mTvAddPlace.setEnabled(Editor.nativeShouldEnableAddPlace());
final int editPlaceButtonColor =
Editor.nativeShouldEnableEditPlace()
@@ -695,13 +689,11 @@ public class PlacePageView extends Fragment
UiUtils.getStyledResourceId(getContext(), com.google.android.material.R.attr.colorSecondary))
: ContextCompat.getColor(getContext(), R.color.button_accent_text_disabled);
mTvEditPlace.setTextColor(editPlaceButtonColor);
mTvAddBusiness.setTextColor(editPlaceButtonColor);
mTvAddPlace.setTextColor(editPlaceButtonColor);
mTvEditPlace.setStrokeColor(ColorStateList.valueOf(editPlaceButtonColor));
mTvAddBusiness.setStrokeColor(ColorStateList.valueOf(editPlaceButtonColor));
mTvAddPlace.setStrokeColor(ColorStateList.valueOf(editPlaceButtonColor));
UiUtils.showIf(
UiUtils.isVisible(mEditPlace) || UiUtils.isVisible(mAddOrganisation) || UiUtils.isVisible(mAddPlace),
UiUtils.isVisible(mEditPlace) || UiUtils.isVisible(mAddPlace),
mEditTopSpace);
}
updateLinksView();
@@ -837,11 +829,6 @@ public class PlacePageView extends Fragment
UiUtils.hide(mTvOpenState);
}
private void addOrganisation()
{
((MwmActivity) requireActivity()).showPositionChooserForEditor(true, true);
}
private void addPlace()
{
((MwmActivity) requireActivity()).showPositionChooserForEditor(false, true);
@@ -859,8 +846,6 @@ public class PlacePageView extends Fragment
}
else if (id == R.id.mb__place_editor)
((MwmActivity) requireActivity()).showEditor();
else if (id == R.id.mb__add_organisation)
addOrganisation();
else if (id == R.id.mb__place_add)
addPlace();
else if (id == R.id.ll__place_latlon)

View File

@@ -1,17 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/ll__add_organisation"
style="@style/PlacePageItemFrame"
android:visibility="visible"
tools:visibility="visible">
<com.google.android.material.button.MaterialButton
android:id="@+id/mb__add_organisation"
style="@style/MwmWidget.M3.Button.Secondary"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:text="@string/placepage_add_business_button"/>
</LinearLayout>

View File

@@ -85,8 +85,6 @@
<include android:visibility="gone" layout="@layout/place_page_editor"/>
<include android:visibility="gone" layout="@layout/place_page_add_business"/>
<include android:visibility="gone" layout="@layout/place_page_add"/>
<android.widget.Space

View File

@@ -494,7 +494,6 @@
<string name="editor_edit_place_category_title">Category</string>
<string name="detailed_problem_description">Detailed description of the issue</string>
<string name="editor_report_problem_other_title">Different problem</string>
<string name="placepage_add_business_button">Add business</string>
<string name="message_invalid_feature_position">No object can be located here</string>
<!-- Text in About and OSM Login screens. First %@ is replaced by a local, human readable date. -->
<string name="osm_presentation">Community-created OpenStreetMap data as of %s. Learn more about how to edit and update the map at OpenStreetMap.org</string>

View File

@@ -167,15 +167,6 @@ JNIEXPORT jboolean JNICALL Java_app_organicmaps_sdk_editor_Editor_nativeShouldSh
return g_framework->GetPlacePageInfo().ShouldShowEditPlace();
}
JNIEXPORT jboolean JNICALL Java_app_organicmaps_sdk_editor_Editor_nativeShouldShowAddBusiness(JNIEnv *, jclass)
{
::Framework * frm = g_framework->NativeFramework();
if (!frm->HasPlacePageInfo())
return static_cast<jboolean>(false);
return g_framework->GetPlacePageInfo().ShouldShowAddBusiness();
}
JNIEXPORT jboolean JNICALL Java_app_organicmaps_sdk_editor_Editor_nativeShouldShowAddPlace(JNIEnv *, jclass)
{
::Framework * frm = g_framework->NativeFramework();

View File

@@ -49,7 +49,6 @@ 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();

View File

@@ -30,8 +30,7 @@ bool Info::IsBookmark() const
bool Info::ShouldShowAddPlace() const
{
auto const isPointOrBuilding = IsPointType() || IsBuilding();
return !IsTrack() && !(IsFeature() && isPointOrBuilding);
return !IsTrack() && !(IsFeature() && IsPointType());
}
void Info::SetFromFeatureType(FeatureType & ft)

View File

@@ -105,7 +105,7 @@ public:
/// Edit and add
bool ShouldShowAddPlace() const;
bool ShouldShowAddBusiness() const { return IsBuilding(); }
bool ShouldShowAddBusiness() const { return false; } //TODO: delete function when not used in iOS any more
bool ShouldShowEditPlace() const;
bool ShouldEnableAddPlace() const { return m_canEditOrAdd; }