8 Commits

21 changed files with 103 additions and 14 deletions

2
.idea/compiler.xml generated
View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="11" />
<bytecodeTargetLevel target="1.8" />
</component>
</project>

2
.idea/misc.xml generated
View File

@ -20,5 +20,5 @@
</option>
</component>
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="11" project-jdk-type="JavaSDK" />
</project>

View File

@ -2,9 +2,12 @@
# Nextcloud Maps Geobookmarks Android app
[<img src="https://fdroid.gitlab.io/artwork/badge/get-it-on.png" alt="Get it on F-Droid" height="80">](https://f-droid.org/it/packages/it.danieleverducci.nextcloudmaps)
[<img src="https://cdn.rawgit.com/steverichey/google-play-badge-svg/master/img/en_get.svg" height="80">](https://play.google.com/store/apps/details?id=it.danieleverducci.nextcloudmaps)
[<img src="https://raw.githubusercontent.com/andOTP/andOTP/master/assets/badges/get-it-on-github.png" height="80">](https://github.com/penguin86/nextcloud-maps-client/releases/latest)
(Always prefer [F-Droid](https://f-droid.org) build, when possible).
Android app to show your Nextcloud Maps geobookmarks list. Geobookmarks can be opened in all apps supporting geo links (i.e. Google Maps, Organic Maps etc...).
A new geobookmark can be created on current location.
@ -14,5 +17,3 @@ This work is heavily based on [matiasdelellis's Nextcloud SSO example](https://g
![Screenshot 1](screenshots/1.png) ![Screenshot 1](screenshots/2.png)
Download it from [the releases page](https://github.com/penguin86/nextcloud-maps-client/releases)

View File

@ -24,8 +24,8 @@ android {
applicationId "it.danieleverducci.nextcloudmaps"
minSdkVersion 23
targetSdkVersion 30
versionCode 4
versionName "0.3.2"
versionCode 5
versionName "0.3.3"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

View File

@ -50,7 +50,17 @@
<activity
android:name=".activity.detail.GeofavoriteDetailActivity"
android:theme="@style/AppTheme"/>
android:theme="@style/AppTheme">
<!-- standard "geo" scheme -->
<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:scheme="geo"/>
</intent-filter>
</activity>
<activity
android:name=".activity.about.AboutActivity"

View File

@ -62,6 +62,10 @@ public class AboutActivity extends AppCompatActivity {
TextView tvIssues = findViewById(R.id.about_issues);
tvIssues.setText(Html.fromHtml(getString(R.string.about_issues, getString(R.string.url_issues))));
tvIssues.setOnClickListener(view -> openUtl(getString(R.string.url_issues)));
TextView tvMaps = findViewById(R.id.about_maps);
tvMaps.setText(Html.fromHtml(getString(R.string.about_maps)));
tvMaps.setOnClickListener(view -> openUtl(getString(R.string.url_maps)));
}
@Override

View File

@ -59,6 +59,7 @@ import it.danieleverducci.nextcloudmaps.activity.main.MainActivityViewModel;
import it.danieleverducci.nextcloudmaps.api.ApiProvider;
import it.danieleverducci.nextcloudmaps.databinding.ActivityGeofavoriteDetailBinding;
import it.danieleverducci.nextcloudmaps.model.Geofavorite;
import it.danieleverducci.nextcloudmaps.utils.GeoUriParser;
import it.danieleverducci.nextcloudmaps.utils.IntentGenerator;
import retrofit2.Call;
import retrofit2.Callback;
@ -158,8 +159,21 @@ public class GeofavoriteDetailActivity extends AppCompatActivity implements Loca
mGeofavorite.setDateModified(System.currentTimeMillis() / 1000);
mViewHolder.hideActions();
// Precompile location
getLocation();
if (getIntent().getData() != null) {
// Opened by external generic intent: parse URI
try {
double[] coords = GeoUriParser.parseUri(getIntent().getData());
mGeofavorite.setLat(coords[0]);
mGeofavorite.setLng(coords[1]);
mViewHolder.hideAccuracy();
} catch (IllegalArgumentException e) {
Toast.makeText(this, R.string.error_unsupported_uri, Toast.LENGTH_SHORT).show();
finish();
}
} else {
// Precompile location with current one
getLocation();
}
}
mViewHolder.updateView(mGeofavorite);
@ -306,6 +320,7 @@ public class GeofavoriteDetailActivity extends AppCompatActivity implements Loca
// Set map properties
this.binding.map.getZoomController().setVisibility(CustomZoomButtonsController.Visibility.NEVER);
this.binding.map.setMultiTouchControls(true);
// this.binding.map.setTilesScaledToDpi(true);
// Create marker
mapMarker = new Marker(binding.map);

View File

@ -56,6 +56,7 @@ import it.danieleverducci.nextcloudmaps.activity.login.LoginActivity;
import it.danieleverducci.nextcloudmaps.activity.main.NavigationAdapter.NavigationItem;
import it.danieleverducci.nextcloudmaps.activity.main.SortingOrderDialogFragment.OnSortingOrderListener;
import it.danieleverducci.nextcloudmaps.model.Geofavorite;
import it.danieleverducci.nextcloudmaps.utils.GeoUriParser;
import it.danieleverducci.nextcloudmaps.utils.IntentGenerator;
import static android.view.View.GONE;

View File

@ -154,7 +154,7 @@ public class Geofavorite implements Serializable {
*/
public static Comparator<Geofavorite> ByTitleAZ = (gf0, gf1) -> gf0.name.compareTo(gf1.name);
public static Comparator<Geofavorite> ByLastCreated = (gf0, gf1) -> (int) (gf1.dateCreated - gf0.dateCreated);
public static Comparator<Geofavorite> ByCategory = (gf0, gf1) -> gf0.category.compareTo(gf1.category);
public static Comparator<Geofavorite> ByCategory = (gf0, gf1) -> (gf0.category + gf0.name).compareTo(gf1.category + gf1.name);
public static Comparator<Geofavorite> ByDistance = (gf0, gf1) -> 0; // (int) ((gf1.getDistanceFrom(userPosition) - gf0.getDistanceFrom(userPosition)) * 1000);
public String getCoordinatesString() {

View File

@ -107,7 +107,7 @@ public class GeofavoriteRepository {
if (geofav.getId() != 0) {
geofavs.remove(geofav);
}
geofavs.add(geofav);
geofavs.add(response.body());
mGeofavorites.postValue(geofavs);
mIsUpdating.postValue(false);
mOnFinished.postValue(true);

View File

@ -0,0 +1,31 @@
package it.danieleverducci.nextcloudmaps.utils;
import android.net.Uri;
import android.util.Log;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import it.danieleverducci.nextcloudmaps.model.Geofavorite;
public class GeoUriParser {
private static final Pattern PATTERN_GEO = Pattern.compile("geo:(-?[\\d.]+),(-?[\\d.]+)");
public static double[] parseUri(Uri uri) throws IllegalArgumentException {
if (uri == null)
throw new IllegalArgumentException("no uri");
Matcher m = PATTERN_GEO.matcher(uri.toString());
if (m.find() && m.groupCount() == 2) {
String sLat = m.group(1);
String sLon = m.group(2);
try {
return new double[]{Double.parseDouble(sLat), Double.parseDouble(sLon)};
} catch (NumberFormatException e) {
throw new IllegalArgumentException("unable to parse uri");
}
} else {
throw new IllegalArgumentException("unable to parse uri");
}
}
}

View File

@ -115,6 +115,20 @@
android:layout_height="wrap_content"
android:padding="10dp"
android:text="@string/about_issues" />
<TextView
style="?android:attr/listSeparatorTextViewStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/about_maps_title" />
<TextView
android:id="@+id/about_maps"
style="?android:attr/editTextPreferenceStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:text="@string/about_maps" />
</LinearLayout>
</com.google.android.material.appbar.AppBarLayout>

View File

@ -58,6 +58,7 @@
<string name="location_permission_required">Location permission is required to create a geofavorite.</string>
<string name="confirm">Save</string>
<string name="error_saving_geofavorite">Unable to save geofavorite</string>
<string name="error_unsupported_uri">Unable to obtain coordinates from shared data</string>
<string name="geofavorite_saved">Geofavorite saved</string>
<string name="incomplete_geofavorite">Incomplete geofavorite: Name and category are mandatory</string>
@ -68,6 +69,8 @@
<string name="about_source">This project is hosted on GitHub: &lt;a href="%1$s">%1$s&lt;/a></string>
<string name="about_issues_title">Issues</string>
<string name="about_issues">You can report bugs, enhancement proposals and feature requests at the GitHub issue tracker: &lt;a href="%1$s">%1$s&lt;/a></string>
<string name="about_maps_title">Maps</string>
<string name="about_maps">This app uses Open Street Maps tiles and servers to display the map. I do not accept any donation for this app, but strongly encourage to make any donation to &lt;a href="%1$s">OpenStreetMap&lt;/a>, as this application could not exist without them.</string>
<string name="about_app_license_title">App license</string>
<string name="about_app_license">This application is licensed under the GNU GENERAL PUBLIC LICENSE v3+.</string>
<string name="about_app_license_button">View license</string>
@ -78,8 +81,9 @@
<!-- URLs -->
<string name="url_source" translatable="false">https://github.com/penguin86/nextcloud-maps-client</string>
<string name="url_issues" translatable="false">https://github.com/penguin86/nextcloud-maps-client/issues/new/choose</string>
<string name="url_issues" translatable="false">https://github.com/penguin86/nextcloud-maps-client/issues</string>
<string name="url_license" translatable="false">https://raw.githubusercontent.com/penguin86/nextcloud-maps-client/master/LICENSE</string>
<string name="url_maps" translatable="false">https://donate.openstreetmap.org</string>
<!-- Settings -->
<string name="setting_sort_by">SETTING_SORT_BY</string>

View File

@ -0,0 +1 @@
Added geofavorite detail and deletion

View File

@ -0,0 +1 @@
Added map in geofavorite detail

View File

@ -0,0 +1 @@
First categories implementation

View File

@ -0,0 +1 @@
Fixed bug when opening newly-created element

View File

@ -1,4 +1,9 @@
UNOFFICIAL Nextcloud Maps client at its earliest stages of developement. Shows your Nextcloud Maps geobookmarks list.
UNOFFICIAL and FOSS Nextcloud Maps client at its earliest stages of developement. Shows your Nextcloud Maps geobookmarks list.
Geobookmarks can be opened in all apps supporting geo links (i.e. Google Maps, Organic Maps etc...).
A new geobookmark can be created on current location.
A new geobookmark can be created on current location or by sharing a geo: uri from another app.
Requires Maps app to be installed on the Nextcloud instance.
As per Nextcloud's guidelines, the login is implemented using Nextcloud's Single Sign On module and thus requires Nextcloud app installed.
Promo banner by Gasteaud, Public domain, via Wikimedia Commons.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB