Better geo: uri support, osm url support

This commit is contained in:
Daniele Verducci (Slimpenguin) 2022-02-24 08:46:55 +01:00
parent e595b12705
commit 4f64ef00b9
5 changed files with 7 additions and 31 deletions

View File

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetDropDown">
<runningDeviceTargetSelectedWithDropDown>
<Target>
<type value="RUNNING_DEVICE_TARGET" />
<deviceKey>
<Key>
<type value="VIRTUAL_DEVICE_PATH" />
<value value="$USER_HOME$/.android/avd/Nexus_4_API_30.avd" />
</Key>
</deviceKey>
</Target>
</runningDeviceTargetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2022-02-23T20:43:47.864894Z" />
</component>
</project>

View File

@ -83,21 +83,13 @@
android:scheme="https"/> android:scheme="https"/>
</intent-filter> </intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data
android:host="maps.google.com"
android:scheme="http"/>
</intent-filter>
<intent-filter> <intent-filter>
<action android:name="android.intent.action.VIEW"/> <action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/> <category android:name="android.intent.category.BROWSABLE"/>
<data <data
android:host="www.google.com" android:host="www.google.com"
android:pathPrefix="/maps"
android:scheme="https"/> android:scheme="https"/>
</intent-filter> </intent-filter>
@ -106,8 +98,8 @@
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/> <category android:name="android.intent.category.BROWSABLE"/>
<data <data
android:host="www.google.com" android:host="www.openstreetmap.org"
android:scheme="http"/> android:scheme="https"/>
</intent-filter> </intent-filter>
</activity> </activity>

View File

@ -27,6 +27,7 @@ import android.location.LocationListener;
import android.location.LocationManager; import android.location.LocationManager;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.widget.Toast; import android.widget.Toast;
@ -64,7 +65,6 @@ import it.danieleverducci.nextcloudmaps.utils.MapUtils;
public class GeofavoriteDetailActivity extends NextcloudMapsStyledActivity implements LocationListener, ActivityCompat.OnRequestPermissionsResultCallback { public class GeofavoriteDetailActivity extends NextcloudMapsStyledActivity implements LocationListener, ActivityCompat.OnRequestPermissionsResultCallback {
public static final String TAG = "GeofavDetail"; public static final String TAG = "GeofavDetail";
public static final int MINIMUM_ACCEPTABLE_ACCURACY = 50; // In meters
public static final String ARG_GEOFAVORITE = "geofav"; public static final String ARG_GEOFAVORITE = "geofav";
private static final int PERMISSION_REQUEST_CODE = 9999; private static final int PERMISSION_REQUEST_CODE = 9999;
@ -166,6 +166,7 @@ public class GeofavoriteDetailActivity extends NextcloudMapsStyledActivity imple
mGeofavorite.setLng(coords[1]); mGeofavorite.setLng(coords[1]);
mViewHolder.hideAccuracy(); mViewHolder.hideAccuracy();
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
Log.e(TAG, e.getMessage());
Toast.makeText(this, R.string.error_unsupported_uri, Toast.LENGTH_SHORT).show(); Toast.makeText(this, R.string.error_unsupported_uri, Toast.LENGTH_SHORT).show();
finish(); finish();
} }

View File

@ -12,7 +12,7 @@ public class GeoUriParser {
private static final Pattern PATTERN_GEO = Pattern.compile("geo:(-?[\\d.]+),(-?[\\d.]+)"); private static final Pattern PATTERN_GEO = Pattern.compile("geo:(-?[\\d.]+),(-?[\\d.]+)");
// Try to match not only geoUri but also Google Maps Uri // Try to match not only geoUri but also Google Maps Uri
private static final Pattern PATTERN_BROAD = Pattern.compile( private static final Pattern PATTERN_BROAD = Pattern.compile(
"(?:&query=|&center=|geo:)(-?\\d{1,2}\\.\\d{1,10})(?:,|%2C)(-?\\d{1,3}\\.\\d{1,10})" "(?:@|&query=|&center=|geo:|#map=\\d{1,2}\\/)(-?\\d{1,2}\\.\\d+)(?:,|%2C|\\/)(-?\\d{1,3}\\.\\d{1,10})"
); );
/** /**

View File

@ -1,4 +1,4 @@
Fix crash when using corrupted dataset with null category (It may happen on imports from Google Maps) Fix crash when using corrupted dataset with null category (It may happen on imports from Google Maps)
Reimplemented API Provider to try to fix NullPointerException on mApi reported in Play Store Reimplemented API Provider to try to fix NullPointerException on mApi reported in Play Store
Open Google Maps on Google devices Open Google Maps on Google devices
Support share from google maps and google maps urls Support share from: google maps urls, OpenStreetMap urls (only if containing coordinates)