diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index 61a9130..fb7f4a8 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 30d4ca9..784e5f5 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -13,6 +13,7 @@
+
@@ -20,5 +21,5 @@
-
+
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index a919fe8..6aae962 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -60,6 +60,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
mMainActivityViewModel.updateGeofavorites());
- fab = findViewById(R.id.add);
- fab.setOnClickListener(view -> addGeofavorite());
+ fab = findViewById(R.id.open_fab);
+ fab.setOnClickListener(view -> openFab(!this.isFabOpen));
+
+ fab = findViewById(R.id.add_from_gps);
+ fab.setOnClickListener(view -> addGeofavoriteFromGps());
+
+ fab = findViewById(R.id.add_from_map);
+ fab.setOnClickListener(view -> addGeofavoriteFromMap());
toolbar = findViewById(R.id.toolbar);
homeToolbar = findViewById(R.id.home_toolbar);
@@ -215,13 +226,22 @@ public class MainActivity extends AppCompatActivity implements OnSortingOrderLis
updateGridIcon(gridViewEnabled);
}
+ @Override
+ protected void onPause() {
+ openFab(false);
+ super.onPause();
+ }
+
private void setupNavigationMenu() {
ArrayList navItems = new ArrayList<>();
navigationCommonAdapter = new NavigationAdapter(this, item -> {
switch (item.id) {
- case NAVIGATION_KEY_ADD_GEOFAVORITE:
- addGeofavorite();
+ case NAVIGATION_KEY_ADD_GEOFAVORITE_FROM_GPS:
+ addGeofavoriteFromGps();
+ break;
+ case NAVIGATION_KEY_ADD_GEOFAVORITE_FROM_MAP:
+ addGeofavoriteFromMap();
break;
case NAVIGATION_KEY_SHOW_ABOUT:
show_about();
@@ -232,7 +252,8 @@ public class MainActivity extends AppCompatActivity implements OnSortingOrderLis
}
});
- navItems.add(new NavigationItem(NAVIGATION_KEY_ADD_GEOFAVORITE, getString(R.string.new_geobookmark), R.drawable.ic_add));
+ navItems.add(new NavigationItem(NAVIGATION_KEY_ADD_GEOFAVORITE_FROM_GPS, getString(R.string.new_geobookmark_gps), R.drawable.ic_add_gps));
+ navItems.add(new NavigationItem(NAVIGATION_KEY_ADD_GEOFAVORITE_FROM_MAP, getString(R.string.new_geobookmark_map), R.drawable.ic_add_map));
navItems.add(new NavigationItem(NAVIGATION_KEY_SHOW_ABOUT, getString(R.string.about), R.drawable.ic_info_grey));
navItems.add(new NavigationItem(NAVIGATION_KEY_SWITCH_ACCOUNT, getString(R.string.switch_account), R.drawable.ic_logout_grey));
navigationCommonAdapter.setItems(navItems);
@@ -257,12 +278,18 @@ public class MainActivity extends AppCompatActivity implements OnSortingOrderLis
SortingOrderDialogFragment.newInstance(sortOrder).show(fragmentTransaction, SortingOrderDialogFragment.SORTING_ORDER_FRAGMENT);
}
- private void addGeofavorite() {
+ private void addGeofavoriteFromGps() {
startActivity(
new Intent(this, GeofavoriteDetailActivity.class)
);
}
+ private void addGeofavoriteFromMap() {
+ startActivity(
+ new Intent(this, MapPickerActivity.class)
+ );
+ }
+
private void show_about() {
startActivity(new Intent(this, AboutActivity.class));
}
@@ -336,4 +363,23 @@ public class MainActivity extends AppCompatActivity implements OnSortingOrderLis
startActivity(i);
}
+ private void openFab(boolean open) {
+ View fab = findViewById(R.id.open_fab);
+ View addFromGpsFab = findViewById(R.id.add_from_gps);
+ View addFromMapFab = findViewById(R.id.add_from_map);
+
+ if (open) {
+ this.isFabOpen = true;
+ fab.animate().rotation(45.0f);
+ addFromGpsFab.animate().translationY(-getResources().getDimension(R.dimen.fab_vertical_offset));
+ addFromMapFab.animate().translationY(-getResources().getDimension(R.dimen.fab_vertical_offset) * 2);
+ } else {
+ this.isFabOpen = false;
+ fab.animate().rotation(0f);
+ addFromGpsFab.animate().translationY(0);
+ addFromMapFab.animate().translationY(0);
+ }
+
+ }
+
}
\ No newline at end of file
diff --git a/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/mappicker/MapPickerActivity.java b/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/mappicker/MapPickerActivity.java
new file mode 100644
index 0000000..491bff3
--- /dev/null
+++ b/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/mappicker/MapPickerActivity.java
@@ -0,0 +1,52 @@
+package it.danieleverducci.nextcloudmaps.activity.mappicker;
+
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+
+import androidx.annotation.Nullable;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.preference.PreferenceManager;
+
+import org.osmdroid.config.Configuration;
+import org.osmdroid.config.IConfigurationProvider;
+
+import it.danieleverducci.nextcloudmaps.BuildConfig;
+import it.danieleverducci.nextcloudmaps.databinding.ActivityMapPickerBinding;
+
+public class MapPickerActivity extends AppCompatActivity {
+ public static final String TAG = "MapPickerActivity";
+ private ViewHolder mViewHolder;
+
+ @Override
+ protected void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ // OSMDroid config
+ IConfigurationProvider osmdroidConfig = Configuration.getInstance();
+ osmdroidConfig.load(getApplicationContext(),
+ PreferenceManager.getDefaultSharedPreferences(getApplicationContext()));
+ osmdroidConfig.setUserAgentValue(BuildConfig.APPLICATION_ID);
+
+ mViewHolder = new MapPickerActivity.ViewHolder(getLayoutInflater());
+ setContentView(mViewHolder.getRootView());
+ }
+
+ private class ViewHolder implements View.OnClickListener {
+ private final ActivityMapPickerBinding binding;
+
+ public ViewHolder(LayoutInflater inflater) {
+ this.binding = ActivityMapPickerBinding.inflate(inflater);
+ }
+
+ public View getRootView() {
+ return this.binding.root;
+ }
+
+ @Override
+ public void onClick(View view) {
+
+ }
+ }
+
+}
diff --git a/app/src/main/java/it/danieleverducci/nextcloudmaps/utils/IntentGenerator.java b/app/src/main/java/it/danieleverducci/nextcloudmaps/utils/IntentGenerator.java
index fe72a3e..d491fbf 100644
--- a/app/src/main/java/it/danieleverducci/nextcloudmaps/utils/IntentGenerator.java
+++ b/app/src/main/java/it/danieleverducci/nextcloudmaps/utils/IntentGenerator.java
@@ -2,6 +2,7 @@ package it.danieleverducci.nextcloudmaps.utils;
import android.content.Context;
import android.content.Intent;
+import android.util.Log;
import it.danieleverducci.nextcloudmaps.R;
import it.danieleverducci.nextcloudmaps.model.Geofavorite;
diff --git a/app/src/main/res/drawable/ic_manual_pos.xml b/app/src/main/res/drawable/ic_manual_pos.xml
new file mode 100644
index 0000000..5f8983c
--- /dev/null
+++ b/app/src/main/res/drawable/ic_manual_pos.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_ok.xml b/app/src/main/res/drawable/ic_ok.xml
new file mode 100644
index 0000000..0432fa6
--- /dev/null
+++ b/app/src/main/res/drawable/ic_ok.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 29ed4e1..45db2d7 100644
--- a/app/src/main/res/layout/activity_geofavorite_detail.xml
+++ b/app/src/main/res/layout/activity_geofavorite_detail.xml
@@ -53,11 +53,23 @@
android:id="@+id/back_bt"
android:layout_width="?attr/actionBarSize"
android:layout_height="?attr/actionBarSize"
+ android:layout_gravity="start"
android:padding="16dp"
android:src="@drawable/ic_back_grey"
app:tint="@color/white"
android:background="@drawable/floating_semitransparent_button_background"/>
+
+
+
diff --git a/app/src/main/res/layout/activity_list_view.xml b/app/src/main/res/layout/activity_list_view.xml
index e71eea7..7b3aeea 100644
--- a/app/src/main/res/layout/activity_list_view.xml
+++ b/app/src/main/res/layout/activity_list_view.xml
@@ -154,8 +154,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index a16f125..e714b9d 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -32,4 +32,5 @@
#fff
+ #cfff
\ No newline at end of file
diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
index 595916c..f30ed27 100644
--- a/app/src/main/res/values/dimens.xml
+++ b/app/src/main/res/values/dimens.xml
@@ -36,4 +36,7 @@
16sp
12sp
+
+ 55dp
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 934b689..3aa1db1 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -89,4 +89,8 @@
SETTING_SORT_BY
SETTING_GRID_VIEW_ENABLED
+
+ New from current position
+ New from map
+