From 04619a7c0831a27461bb72befec9cce049550627 Mon Sep 17 00:00:00 2001 From: Viktor Govako Date: Sun, 21 Aug 2022 22:23:04 +0300 Subject: [PATCH] [android] Fixed wikimedia commons url. Signed-off-by: Viktor Govako --- .../maps/widget/placepage/PlacePageView.java | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java b/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java index 56082ed019..189a36cd67 100644 --- a/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java +++ b/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java @@ -1272,11 +1272,6 @@ public class PlacePageView extends NestedScrollViewClickFixed metaLayout.setVisibility(View.GONE); } - public String getWikimediaLink(String wikimedia) - { - return "https://commons.wikimedia.org/wiki/" + wikimedia; - } - public void refreshAzimuth(double northAzimuth) { if (mMapObject == null || MapObject.isOfType(MapObject.MY_POSITION, mMapObject)) @@ -1308,6 +1303,11 @@ public class PlacePageView extends NestedScrollViewClickFixed getActivity().showPositionChooserForEditor(false, true); } + /// @todo + /// - Why ll__place_editor and ll__place_latlon check if (mMapObject == null) + /// - Unify urls processing: fb, twitter, instagram, .. add prefix here while + /// wiki, website, wikimedia, ... already have full url. Better to make it in the same way and in Core. + @Override public void onClick(View v) { @@ -1351,8 +1351,7 @@ public class PlacePageView extends NestedScrollViewClickFixed Utils.openUrl(getContext(), mTvWebsite.getText().toString()); break; case R.id.ll__place_wikimedia: - String wikimedia_commons = mMapObject.getMetadata(Metadata.MetadataType.FMD_WIKIMEDIA_COMMONS); - Utils.openUrl(getContext(), getWikimediaLink(wikimedia_commons)); + Utils.openUrl(getContext(), mMapObject.getMetadata(Metadata.MetadataType.FMD_WIKIMEDIA_COMMONS)); break; case R.id.ll__place_facebook: final String facebookPage = mMapObject.getMetadata(Metadata.MetadataType.FMD_CONTACT_FACEBOOK); @@ -1378,12 +1377,6 @@ public class PlacePageView extends NestedScrollViewClickFixed Utils.openUrl(getContext(), "https://line.me/R/ti/p/@" + linePage); break; case R.id.ll__place_wiki: - // TODO: Refactor and use separate getters for Wiki and all other PP meta info too. - if (mMapObject == null) - { - Logger.e(TAG, "Cannot follow url, mMapObject is null!"); - break; - } Utils.openUrl(getContext(), mMapObject.getMetadata(Metadata.MetadataType.FMD_WIKIPEDIA)); break; case R.id.direction_frame: @@ -1411,6 +1404,9 @@ public class PlacePageView extends NestedScrollViewClickFixed fragment.show(getActivity().getSupportFragmentManager(), null); } + /// @todo Unify urls processing (fb, twitter, instagram, ...). + /// onLongClick behaviour differs even from onClick function several lines above. + @Override public boolean onLongClick(View v) { @@ -1447,8 +1443,7 @@ public class PlacePageView extends NestedScrollViewClickFixed items.add(mTvWebsite.getText().toString()); break; case R.id.ll__place_wikimedia: - String wikimedia_commons = mMapObject.getMetadata(Metadata.MetadataType.FMD_WIKIMEDIA_COMMONS); - items.add(getWikimediaLink(wikimedia_commons)); + items.add(mMapObject.getMetadata(Metadata.MetadataType.FMD_WIKIMEDIA_COMMONS)); break; case R.id.ll__place_facebook: final String facebookPage = mMapObject.getMetadata(Metadata.MetadataType.FMD_CONTACT_FACEBOOK);