Copy coords to clipboard, faster autocomplete, category hint
This commit is contained in:
		| @@ -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()); | ||||
|   | ||||
							
								
								
									
										5
									
								
								app/src/main/res/drawable/ic_copy.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								app/src/main/res/drawable/ic_copy.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,5 @@ | ||||
| <vector android:height="24dp" android:tint="#000000" | ||||
|     android:viewportHeight="24" android:viewportWidth="24" | ||||
|     android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> | ||||
|     <path android:fillColor="@android:color/white" android:pathData="M16,1L4,1c-1.1,0 -2,0.9 -2,2v14h2L4,3h12L16,1zM19,5L8,5c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h11c1.1,0 2,-0.9 2,-2L21,7c0,-1.1 -0.9,-2 -2,-2zM19,21L8,21L8,7h11v14z"/> | ||||
| </vector> | ||||
| @@ -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"/> | ||||
|  | ||||
|                 <TextView | ||||
|                     android:layout_width="match_parent" | ||||
|                     android:layout_height="match_parent" | ||||
|                     android:text="@string/category_hint" | ||||
|                     android:textSize="12sp"/> | ||||
|  | ||||
|                 <TextView | ||||
|                     android:layout_width="match_parent" | ||||
| @@ -250,7 +257,9 @@ | ||||
|                     android:id="@+id/coords_tv" | ||||
|                     android:layout_width="match_parent" | ||||
|                     android:layout_height="wrap_content" | ||||
|                     android:textAlignment="textEnd" /> | ||||
|                     android:textAlignment="textEnd" | ||||
|                     app:drawableEndCompat="@drawable/ic_copy" | ||||
|                     android:drawablePadding="10sp"/> | ||||
|  | ||||
|                 <ProgressBar | ||||
|                     android:id="@+id/progress" | ||||
|   | ||||
| @@ -64,11 +64,12 @@ | ||||
|     <string name="accuracy">Accuratezza: {accuracy} m</string> | ||||
|     <string name="accuracy_nosignal">Nessun segnale GPS!</string> | ||||
|     <string name="location_permission_required">Per creare un geosegnalibro è necessario consentire l\'accesso alla posizione.</string> | ||||
|     <string name="confirm">Salva</string> | ||||
|     <string name="category_hint">Scrivi il nome per creare una nuova categoria</string> | ||||
|     <string name="error_saving_geofavorite">Impossibile salvare il geosegnalibro</string> | ||||
|     <string name="error_unsupported_uri">Impossibile ottenere le coordinate dai dati ricevuti</string> | ||||
|     <string name="geofavorite_saved">Geosegnalibro salvato</string> | ||||
|     <string name="incomplete_geofavorite">Geosegnalibro incompleto: nome e categoria sono obbligatori</string> | ||||
|     <string name="coords_copied">Coordinate copiate nella clipboard</string> | ||||
|  | ||||
|     <!-- Map picker activity --> | ||||
|     <string name="coordinates_parse_error">Le coordinate dovrebbero essere nel formato xx.xxxxxx</string> | ||||
|   | ||||
| @@ -63,11 +63,12 @@ | ||||
|     <string name="accuracy">Accuracy: {accuracy} m</string> | ||||
|     <string name="accuracy_nosignal">No GPS signal!</string> | ||||
|     <string name="location_permission_required">Location permission is required to create a geofavorite.</string> | ||||
|     <string name="confirm">Save</string> | ||||
|     <string name="category_hint">Write the name to create a new category</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> | ||||
|     <string name="coords_copied">Coordinates have been copied to the clipboard</string> | ||||
|  | ||||
|     <!-- Map picker activity --> | ||||
|     <string name="coordinates_parse_error">Coordinates should be in format xx.xxxxxx</string> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user