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