mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-27 08:23:38 +00:00
[android] Add open in panoramax link on the place page
Signed-off-by: Jean-Baptiste <jeanbaptiste.charron@outlook.fr>
This commit is contained in:
@@ -105,4 +105,12 @@ public class PlacePageUtils
|
|||||||
});
|
});
|
||||||
popup.show();
|
popup.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String buildPanoramaxURL(double lat, double lon)
|
||||||
|
{
|
||||||
|
final String panoramaxURL = "https://api.panoramax.xyz/?map=";
|
||||||
|
final String levelZoom = "16";
|
||||||
|
final String quality_score = "&pic_score=ABC";
|
||||||
|
return panoramaxURL + levelZoom + "/" + lat + "/" + lon + quality_score;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import static android.view.View.GONE;
|
|||||||
import static android.view.View.VISIBLE;
|
import static android.view.View.VISIBLE;
|
||||||
import static app.organicmaps.sdk.util.Utils.getLocalizedFeatureType;
|
import static app.organicmaps.sdk.util.Utils.getLocalizedFeatureType;
|
||||||
import static app.organicmaps.sdk.util.Utils.getTagValueLocalized;
|
import static app.organicmaps.sdk.util.Utils.getTagValueLocalized;
|
||||||
|
import static app.organicmaps.widget.placepage.PlacePageUtils.buildPanoramaxURL;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.ColorStateList;
|
import android.content.res.ColorStateList;
|
||||||
@@ -290,6 +291,9 @@ public class PlacePageView extends Fragment
|
|||||||
openIn.setOnClickListener(this);
|
openIn.setOnClickListener(this);
|
||||||
openIn.setOnLongClickListener(this);
|
openIn.setOnLongClickListener(this);
|
||||||
openIn.setVisibility(VISIBLE);
|
openIn.setVisibility(VISIBLE);
|
||||||
|
LinearLayout openPhotoViewer = mFrame.findViewById(R.id.ll__place_open_phviewer);
|
||||||
|
openPhotoViewer.setOnClickListener(this);
|
||||||
|
openPhotoViewer.setVisibility(VISIBLE);
|
||||||
mTvLatlon = mFrame.findViewById(R.id.tv__place_latlon);
|
mTvLatlon = mFrame.findViewById(R.id.tv__place_latlon);
|
||||||
mWifi = mFrame.findViewById(R.id.ll__place_wifi);
|
mWifi = mFrame.findViewById(R.id.ll__place_wifi);
|
||||||
mTvWiFi = mFrame.findViewById(R.id.tv__place_wifi);
|
mTvWiFi = mFrame.findViewById(R.id.tv__place_wifi);
|
||||||
@@ -987,6 +991,8 @@ public class PlacePageView extends Fragment
|
|||||||
mMapObject.getName());
|
mMapObject.getName());
|
||||||
Utils.openUri(requireContext(), Uri.parse(uri), R.string.uri_open_location_failed);
|
Utils.openUri(requireContext(), Uri.parse(uri), R.string.uri_open_location_failed);
|
||||||
}
|
}
|
||||||
|
else if (id == R.id.ll__place_open_phviewer)
|
||||||
|
Utils.openUrl(requireContext(), buildPanoramaxURL(mMapObject.getLat(),mMapObject.getLon()));
|
||||||
else if (id == R.id.direction_frame)
|
else if (id == R.id.direction_frame)
|
||||||
showBigDirection();
|
showBigDirection();
|
||||||
else if (id == R.id.item_icon)
|
else if (id == R.id.item_icon)
|
||||||
@@ -1034,6 +1040,10 @@ public class PlacePageView extends Fragment
|
|||||||
mMapObject.getName());
|
mMapObject.getName());
|
||||||
PlacePageUtils.copyToClipboard(requireContext(), mFrame, uri);
|
PlacePageUtils.copyToClipboard(requireContext(), mFrame, uri);
|
||||||
}
|
}
|
||||||
|
else if (id == R.id.ll__place_open_phviewer)
|
||||||
|
{
|
||||||
|
PlacePageUtils.copyToClipboard(requireContext(),mFrame, buildPanoramaxURL(mMapObject.getLat(),mMapObject.getLon()));
|
||||||
|
}
|
||||||
else if (id == R.id.ll__place_operator)
|
else if (id == R.id.ll__place_operator)
|
||||||
items.add(mTvOperator.getText().toString());
|
items.add(mTvOperator.getText().toString());
|
||||||
else if (id == R.id.ll__place_network)
|
else if (id == R.id.ll__place_network)
|
||||||
|
|||||||
@@ -71,6 +71,8 @@
|
|||||||
<include layout="@layout/place_page_latlon"/>
|
<include layout="@layout/place_page_latlon"/>
|
||||||
|
|
||||||
<include layout="@layout/place_page_open_in"/>
|
<include layout="@layout/place_page_open_in"/>
|
||||||
|
|
||||||
|
<include layout="@layout/place_page_open_photoviewer" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<include
|
<include
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/ll__place_open_phviewer"
|
||||||
|
style="@style/PlacePageItemFrame"
|
||||||
|
tools:background="#20FF0000"
|
||||||
|
tools:visibility="visible">
|
||||||
|
|
||||||
|
<com.google.android.material.imageview.ShapeableImageView
|
||||||
|
android:id="@+id/iv__place_open_phviewer"
|
||||||
|
style="@style/PlacePageMetadataIcon"
|
||||||
|
app:srcCompat="@drawable/ic_panoramax"
|
||||||
|
app:tint="?colorSecondary"/>
|
||||||
|
|
||||||
|
<com.google.android.material.textview.MaterialTextView
|
||||||
|
android:id="@+id/tv__place_open_phviewer"
|
||||||
|
android:textAlignment="viewStart"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/open_place_in_pnx"
|
||||||
|
android:textAppearance="@style/MwmTextAppearance.PlacePage.Accent"/>
|
||||||
|
</LinearLayout>
|
||||||
@@ -966,4 +966,5 @@
|
|||||||
<string name="offline_explanation_title">Offline Maps</string>
|
<string name="offline_explanation_title">Offline Maps</string>
|
||||||
<string name="offline_explanation_text">A map needs to be downloaded to view and navigate the area.\nDownload maps for areas you want to travel.</string>
|
<string name="offline_explanation_text">A map needs to be downloaded to view and navigate the area.\nDownload maps for areas you want to travel.</string>
|
||||||
<string name="list_description_empty">Edit the list to add a description</string>
|
<string name="list_description_empty">Edit the list to add a description</string>
|
||||||
|
<string name="open_place_in_pnx">Open in Panoramax</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
Reference in New Issue
Block a user