From 0de02c6d44e9375223607b01b361f65c0e4f17b2 Mon Sep 17 00:00:00 2001 From: "Daniele Verducci (Slimpenguin)" Date: Fri, 1 Mar 2024 07:02:39 +0100 Subject: [PATCH] Copy coords to clipboard, faster autocomplete, category hint --- .../activity/detail/GeofavoriteDetailActivity.java | 8 ++++++++ app/src/main/res/drawable/ic_copy.xml | 5 +++++ .../main/res/layout/activity_geofavorite_detail.xml | 13 +++++++++++-- app/src/main/res/values-it/strings.xml | 3 ++- app/src/main/res/values/strings.xml | 3 ++- 5 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 app/src/main/res/drawable/ic_copy.xml diff --git a/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/detail/GeofavoriteDetailActivity.java b/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/detail/GeofavoriteDetailActivity.java index 30b11e7..00e151f 100644 --- a/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/detail/GeofavoriteDetailActivity.java +++ b/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/detail/GeofavoriteDetailActivity.java @@ -18,6 +18,8 @@ package it.danieleverducci.nextcloudmaps.activity.detail; import android.Manifest; +import android.content.ClipData; +import android.content.ClipboardManager; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; @@ -335,6 +337,12 @@ public class GeofavoriteDetailActivity extends NextcloudMapsStyledActivity imple public void updateViewCoords(Geofavorite item) { binding.coordsTv.setText(item.getCoordinatesString()); + binding.coordsTv.setOnClickListener((v) -> { + ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); + ClipData clip = ClipData.newPlainText(item.getCoordinatesString(), item.getCoordinatesString()); + clipboard.setPrimaryClip(clip); + Toast.makeText(GeofavoriteDetailActivity.this, R.string.coords_copied, Toast.LENGTH_SHORT).show(); + }); // Center map GeoPoint position = new GeoPoint(item.getLat(), item.getLng()); diff --git a/app/src/main/res/drawable/ic_copy.xml b/app/src/main/res/drawable/ic_copy.xml new file mode 100644 index 0000000..bac0f60 --- /dev/null +++ b/app/src/main/res/drawable/ic_copy.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/layout/activity_geofavorite_detail.xml b/app/src/main/res/layout/activity_geofavorite_detail.xml index 224334d..8becd41 100644 --- a/app/src/main/res/layout/activity_geofavorite_detail.xml +++ b/app/src/main/res/layout/activity_geofavorite_detail.xml @@ -211,7 +211,14 @@ android:drawableLeft="@drawable/ic_category_asc" android:drawablePadding="5dp" android:drawableTint="@color/defaultBrand" - android:hint="@string/category"/> + android:hint="@string/category" + android:completionThreshold="0"/> + + + android:textAlignment="textEnd" + app:drawableEndCompat="@drawable/ic_copy" + android:drawablePadding="10sp"/> Accuratezza: {accuracy} m Nessun segnale GPS! Per creare un geosegnalibro รจ necessario consentire l\'accesso alla posizione. - Salva + Scrivi il nome per creare una nuova categoria Impossibile salvare il geosegnalibro Impossibile ottenere le coordinate dai dati ricevuti Geosegnalibro salvato Geosegnalibro incompleto: nome e categoria sono obbligatori + Coordinate copiate nella clipboard Le coordinate dovrebbero essere nel formato xx.xxxxxx diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 8d70915..93bbad3 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -63,11 +63,12 @@ Accuracy: {accuracy} m No GPS signal! Location permission is required to create a geofavorite. - Save + Write the name to create a new category Unable to save geofavorite Unable to obtain coordinates from shared data Geofavorite saved Incomplete geofavorite: Name and category are mandatory + Coordinates have been copied to the clipboard Coordinates should be in format xx.xxxxxx