mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-19 04:53:36 +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:
@@ -48,7 +48,10 @@ import app.organicmaps.sdk.util.log.Logger;
|
||||
import app.organicmaps.sdk.util.log.LogsManager;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Keep
|
||||
@@ -494,4 +497,15 @@ public class Utils
|
||||
return context.getString(R.string.app_site_url) + "donate/";
|
||||
return url;
|
||||
}
|
||||
|
||||
public static String buildPanoramaxURL(double lat, double lon)
|
||||
{
|
||||
final String panoramaxURL = "https://api.panoramax.xyz/?";
|
||||
LocalDateTime date = LocalDateTime.now().plusYears(-2);
|
||||
final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault());
|
||||
String minDate = "date_from=" + dateFormat.format(date);
|
||||
final String levelZoom = "16";
|
||||
final String quality_score = "&pic_score=ABC";
|
||||
return panoramaxURL + minDate + "&" + levelZoom + "/" + lat + "/" + lon + quality_score;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -290,6 +290,9 @@ public class PlacePageView extends Fragment
|
||||
openIn.setOnClickListener(this);
|
||||
openIn.setOnLongClickListener(this);
|
||||
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);
|
||||
mWifi = mFrame.findViewById(R.id.ll__place_wifi);
|
||||
mTvWiFi = mFrame.findViewById(R.id.tv__place_wifi);
|
||||
@@ -987,6 +990,8 @@ public class PlacePageView extends Fragment
|
||||
mMapObject.getName());
|
||||
Utils.openUri(requireContext(), Uri.parse(uri), R.string.uri_open_location_failed);
|
||||
}
|
||||
else if (id == R.id.ll__place_open_phviewer)
|
||||
Utils.openUrl(requireContext(), Utils.buildPanoramaxURL(mMapObject.getLat(),mMapObject.getLon()));
|
||||
else if (id == R.id.direction_frame)
|
||||
showBigDirection();
|
||||
else if (id == R.id.item_icon)
|
||||
|
||||
@@ -71,6 +71,8 @@
|
||||
<include layout="@layout/place_page_latlon"/>
|
||||
|
||||
<include layout="@layout/place_page_open_in"/>
|
||||
|
||||
<include layout="@layout/place_page_open_photoviewer" />
|
||||
</LinearLayout>
|
||||
|
||||
<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_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="open_place_in_pnx">Open in Panoramax</string>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user