From 314982b65aedc388a0a49f2cbef84c730f06e0e7 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Date: Thu, 11 Sep 2025 19:23:34 +0200 Subject: [PATCH] [android] Update styles of edit button Signed-off-by: Jean-Baptiste --- .../widget/placepage/PlacePageView.java | 28 +++++++++++-------- .../src/main/res/layout/place_page_add.xml | 11 ++++---- .../res/layout/place_page_add_business.xml | 9 +++--- .../src/main/res/layout/place_page_editor.xml | 9 +++--- 4 files changed, 32 insertions(+), 25 deletions(-) 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 52f52058e..e4c86bc19 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 @@ -6,6 +6,7 @@ import static app.organicmaps.sdk.util.Utils.getLocalizedFeatureType; import static app.organicmaps.sdk.util.Utils.getTagValueLocalized; import android.content.Context; +import android.content.res.ColorStateList; import android.graphics.drawable.Drawable; import android.location.Location; import android.net.Uri; @@ -310,11 +311,8 @@ 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); - mEditPlace.setOnClickListener(this); mAddOrganisation = mFrame.findViewById(R.id.ll__add_organisation); - mAddOrganisation.setOnClickListener(this); mAddPlace = mFrame.findViewById(R.id.ll__place_add); - mAddPlace.setOnClickListener(this); mEditTopSpace = mFrame.findViewById(R.id.edit_top_space); latlon.setOnLongClickListener(this); address.setOnLongClickListener(this); @@ -681,12 +679,15 @@ public class PlacePageView extends Fragment 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()); - MaterialTextView mTvEditPlace = mEditPlace.findViewById(R.id.tv__editor); - MaterialTextView mTvAddBusiness = mAddPlace.findViewById(R.id.tv__editor); - MaterialTextView mTvAddPlace = mAddPlace.findViewById(R.id.tv__editor); + 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() ? ContextCompat.getColor( @@ -696,6 +697,9 @@ public class PlacePageView extends Fragment 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), mEditTopSpace); @@ -853,11 +857,11 @@ public class PlacePageView extends Fragment // A workaround to make single taps toggle the bottom sheet. mPlacePageViewListener.onPlacePageRequestToggleState(); } - else if (id == R.id.ll__place_editor) + else if (id == R.id.mb__place_editor) ((MwmActivity) requireActivity()).showEditor(); - else if (id == R.id.ll__add_organisation) + else if (id == R.id.mb__add_organisation) addOrganisation(); - else if (id == R.id.ll__place_add) + else if (id == R.id.mb__place_add) addPlace(); else if (id == R.id.ll__place_latlon) { diff --git a/android/app/src/main/res/layout/place_page_add.xml b/android/app/src/main/res/layout/place_page_add.xml index 8a02fff0f..da7852d2f 100644 --- a/android/app/src/main/res/layout/place_page_add.xml +++ b/android/app/src/main/res/layout/place_page_add.xml @@ -6,9 +6,10 @@ style="@style/PlacePageItemFrame" tools:visibility="visible"> - + diff --git a/android/app/src/main/res/layout/place_page_add_business.xml b/android/app/src/main/res/layout/place_page_add_business.xml index f5f99350b..38e87b3db 100644 --- a/android/app/src/main/res/layout/place_page_add_business.xml +++ b/android/app/src/main/res/layout/place_page_add_business.xml @@ -7,10 +7,11 @@ android:visibility="visible" tools:visibility="visible"> - diff --git a/android/app/src/main/res/layout/place_page_editor.xml b/android/app/src/main/res/layout/place_page_editor.xml index 5e6ba47df..c085142d6 100644 --- a/android/app/src/main/res/layout/place_page_editor.xml +++ b/android/app/src/main/res/layout/place_page_editor.xml @@ -5,9 +5,10 @@ android:id="@+id/ll__place_editor" style="@style/PlacePageItemFrame" tools:visibility="visible"> -