diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml
deleted file mode 100644
index 24f4b97..0000000
--- a/.idea/deploymentTargetDropDown.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 1000c36..561b289 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -6,6 +6,9 @@
+
+
+
diff --git a/app/build.gradle b/app/build.gradle
index f8e32af..61920ee 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -73,6 +73,9 @@ dependencies {
implementation "com.github.nextcloud:Android-SingleSignOn:0.5.6"
// OSMDroid
- compile 'org.osmdroid:osmdroid-android:6.1.10'
+ implementation 'org.osmdroid:osmdroid-android:6.1.10'
+
+ //Threeten-Backport (ports Java 8 Date API on Java 6+)
+ implementation 'org.threeten:threetenbp:1.5.1'
}
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 2d27f32..1142d21 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
@@ -19,6 +19,7 @@ package it.danieleverducci.nextcloudmaps.activity.detail;
import android.Manifest;
import android.content.Context;
+import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.location.Location;
@@ -43,13 +44,17 @@ import org.osmdroid.config.Configuration;
import org.osmdroid.util.GeoPoint;
import org.osmdroid.views.CustomZoomButtonsController;
import org.osmdroid.views.overlay.Marker;
+import org.threeten.bp.format.DateTimeFormatter;
+import org.threeten.bp.format.FormatStyle;
import java.util.Date;
import it.danieleverducci.nextcloudmaps.R;
+import it.danieleverducci.nextcloudmaps.activity.main.MainActivity;
import it.danieleverducci.nextcloudmaps.api.ApiProvider;
import it.danieleverducci.nextcloudmaps.databinding.ActivityGeofavoriteDetailBinding;
import it.danieleverducci.nextcloudmaps.model.Geofavorite;
+import it.danieleverducci.nextcloudmaps.utils.IntentGenerator;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@@ -81,6 +86,21 @@ public class GeofavoriteDetailActivity extends AppCompatActivity implements Loca
finish();
}
+ @Override
+ public void onActionIconShareClicked() {
+ startActivity(Intent.createChooser(IntentGenerator.newShareIntent(GeofavoriteDetailActivity.this, mGeofavorite), getString(R.string.share_via)));
+ }
+
+ @Override
+ public void onActionIconNavClicked() {
+ startActivity(IntentGenerator.newGeoUriIntent(GeofavoriteDetailActivity.this, mGeofavorite));
+ }
+
+ @Override
+ public void onActionIconDeleteClicked() {
+ // TODO
+ }
+
@Override
public void onSubmit() {
saveGeofavorite();
@@ -102,6 +122,8 @@ public class GeofavoriteDetailActivity extends AppCompatActivity implements Loca
mGeofavorite.setCategory(DEFAULT_CATEGORY);
mGeofavorite.setDateCreated(System.currentTimeMillis());
mGeofavorite.setDateModified(System.currentTimeMillis());
+ mViewHolder.hideActions();
+
// Precompile location
getLocation();
}
@@ -255,6 +277,7 @@ public class GeofavoriteDetailActivity extends AppCompatActivity implements Loca
private class ViewHolder implements View.OnClickListener {
private final ActivityGeofavoriteDetailBinding binding;
+ private DateTimeFormatter dateFormatter = DateTimeFormatter.ofLocalizedDate(FormatStyle.LONG);
private OnSubmitListener listener;
private Marker mapMarker;
@@ -263,6 +286,9 @@ public class GeofavoriteDetailActivity extends AppCompatActivity implements Loca
this.binding.submitBt.setOnClickListener(this);
this.binding.mapBt.setOnClickListener(this);
this.binding.backBt.setOnClickListener(this);
+ this.binding.actionIconShare.setOnClickListener(this);
+ this.binding.actionIconDelete.setOnClickListener(this);
+ this.binding.actionIconNav.setOnClickListener(this);
// Set map properties
this.binding.map.getZoomController().setVisibility(CustomZoomButtonsController.Visibility.NEVER);
@@ -283,8 +309,8 @@ public class GeofavoriteDetailActivity extends AppCompatActivity implements Loca
binding.collapsingToolbar.setTitle(item.getName() != null ? item.getName() : getString(R.string.new_geobookmark));
binding.nameEt.setText(item.getName());
binding.descriptionEt.setText(item.getComment());
- binding.createdTv.setText(new Date(item.getDateCreated() * 1000).toString());
- binding.modifiedTv.setText(new Date(item.getDateModified() * 1000).toString());
+ binding.createdTv.setText(item.getLocalDateCreated().format(dateFormatter));
+ binding.modifiedTv.setText(item.getLocalDateCreated().format(dateFormatter));
binding.categoryTv.setText(item.getCategory()); // TODO: Category spinner from existing categories
updateViewCoords(item);
}
@@ -322,6 +348,10 @@ public class GeofavoriteDetailActivity extends AppCompatActivity implements Loca
binding.accuracyTv.setVisibility(View.GONE);
}
+ public void hideActions() {
+ binding.actionIcons.setVisibility(View.GONE);
+ }
+
public void setOnSubmitListener(OnSubmitListener listener) {
this.listener = listener;
}
@@ -345,6 +375,17 @@ public class GeofavoriteDetailActivity extends AppCompatActivity implements Loca
if (v.getId() == R.id.back_bt && this.listener != null) {
this.listener.onBackPressed();
}
+
+ // Actions
+ if (v.getId() == R.id.action_icon_share && this.listener != null) {
+ this.listener.onActionIconShareClicked();
+ }
+ if (v.getId() == R.id.action_icon_nav && this.listener != null) {
+ this.listener.onActionIconNavClicked();
+ }
+ if (v.getId() == R.id.action_icon_delete && this.listener != null) {
+ this.listener.onActionIconDeleteClicked();
+ }
}
}
@@ -352,5 +393,8 @@ public class GeofavoriteDetailActivity extends AppCompatActivity implements Loca
void onSubmit();
void onMapClicked();
void onBackPressed();
+ void onActionIconShareClicked();
+ void onActionIconNavClicked();
+ void onActionIconDeleteClicked();
}
}
diff --git a/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/main/GeofavoriteAdapter.java b/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/main/GeofavoriteAdapter.java
index e28f9a1..8f2b2f1 100644
--- a/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/main/GeofavoriteAdapter.java
+++ b/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/main/GeofavoriteAdapter.java
@@ -21,13 +21,9 @@
package it.danieleverducci.nextcloudmaps.activity.main;
import android.content.Context;
-import android.content.Intent;
import android.text.Html;
import android.util.Log;
-import android.view.ContextMenu;
import android.view.LayoutInflater;
-import android.view.Menu;
-import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
@@ -40,6 +36,9 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
+import org.threeten.bp.format.DateTimeFormatter;
+import org.threeten.bp.format.FormatStyle;
+
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -57,6 +56,7 @@ public class GeofavoriteAdapter extends RecyclerView.Adapter geofavoriteList = new ArrayList<>();
private List geofavoriteListFiltered = new ArrayList<>();
@@ -117,6 +117,7 @@ public class GeofavoriteAdapter extends RecyclerView.Adapter
+
+
diff --git a/app/src/main/res/drawable/ic_nav.xml b/app/src/main/res/drawable/ic_nav.xml
new file mode 100644
index 0000000..d1274d8
--- /dev/null
+++ b/app/src/main/res/drawable/ic_nav.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/app/src/main/res/layout/activity_geofavorite_detail.xml b/app/src/main/res/layout/activity_geofavorite_detail.xml
index 7d5d19e..ba4be56 100644
--- a/app/src/main/res/layout/activity_geofavorite_detail.xml
+++ b/app/src/main/res/layout/activity_geofavorite_detail.xml
@@ -87,6 +87,43 @@
android:textColor="@android:color/white"
android:background="@android:color/darker_gray"/>
+
+
+
+
+
+
+
+
+
+
+
+ android:background="@android:color/transparent"
+ android:drawableLeft="@drawable/ic_edit"
+ android:drawablePadding="5dp"/>
@@ -37,51 +38,76 @@
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginStart="10dp"
+ android:layout_marginStart="16dp"
+ android:layout_marginEnd="8dp"
android:layout_weight="1">
-
-
+ android:orientation="horizontal">
+
+
+
+
+
+
+
+
+ android:padding="8dp"
+ android:src="@drawable/ic_nav"
+ android:tint="@color/secondary_text_color" />
+ android:tint="@color/secondary_text_color" />
\ No newline at end of file
diff --git a/app/src/main/res/menu/list_context_menu.xml b/app/src/main/res/menu/list_context_menu.xml
index add86b2..00bb0f9 100644
--- a/app/src/main/res/menu/list_context_menu.xml
+++ b/app/src/main/res/menu/list_context_menu.xml
@@ -1,10 +1,10 @@