diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index fb7f4a8..b589d56 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml
index dd779ac..0c0c338 100644
--- a/.idea/deploymentTargetDropDown.xml
+++ b/.idea/deploymentTargetDropDown.xml
@@ -1,17 +1,10 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/migrations.xml b/.idea/migrations.xml
new file mode 100644
index 0000000..f8051a6
--- /dev/null
+++ b/.idea/migrations.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 0a57690..8730822 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -26,5 +26,5 @@
-
+
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index 26fbc7d..c90c6ba 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -37,6 +37,9 @@ android {
}
}
compileOptions {
+ // Flag to enable support for the new language APIs
+ coreLibraryDesugaringEnabled true
+ // Sets Java compatibility to Java 8
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
@@ -55,6 +58,9 @@ repositories {
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
+ // Desugaring lib: see https://developer.android.com/studio/write/java8-support
+ coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.0.3")
+
implementation 'com.android.support:design:34.0.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.recyclerview:recyclerview:1.3.2'
diff --git a/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/main/MainActivity.java b/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/main/MainActivity.java
index 5bbc995..0eb3c28 100644
--- a/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/main/MainActivity.java
+++ b/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/main/MainActivity.java
@@ -18,33 +18,20 @@
package it.danieleverducci.nextcloudmaps.activity.main;
import android.content.Intent;
-import android.content.SharedPreferences;
import android.os.Bundle;
-import android.text.TextUtils;
-import android.util.Log;
import android.view.View;
-import android.widget.Toast;
-import androidx.annotation.Nullable;
-import androidx.appcompat.widget.AppCompatImageButton;
-import androidx.appcompat.widget.AppCompatImageView;
-import androidx.appcompat.widget.SearchView;
-import androidx.appcompat.widget.Toolbar;
import androidx.core.view.GravityCompat;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
-import androidx.lifecycle.ViewModelProvider;
-import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.RecyclerView;
-import com.google.android.material.card.MaterialCardView;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.nextcloud.android.sso.helper.SingleAccountHelper;
import java.util.ArrayList;
-import java.util.List;
import it.danieleverducci.nextcloudmaps.R;
import it.danieleverducci.nextcloudmaps.activity.NextcloudMapsStyledActivity;
@@ -52,23 +39,12 @@ import it.danieleverducci.nextcloudmaps.activity.about.AboutActivity;
import it.danieleverducci.nextcloudmaps.activity.detail.GeofavoriteDetailActivity;
import it.danieleverducci.nextcloudmaps.activity.login.LoginActivity;
import it.danieleverducci.nextcloudmaps.activity.main.NavigationAdapter.NavigationItem;
-import it.danieleverducci.nextcloudmaps.activity.main.SortingOrderDialogFragment.OnSortingOrderListener;
import it.danieleverducci.nextcloudmaps.activity.mappicker.MapPickerActivity;
import it.danieleverducci.nextcloudmaps.api.ApiProvider;
import it.danieleverducci.nextcloudmaps.fragments.GeofavoriteListFragment;
import it.danieleverducci.nextcloudmaps.fragments.GeofavoriteMapFragment;
-import it.danieleverducci.nextcloudmaps.fragments.GeofavoritesFragment;
-import it.danieleverducci.nextcloudmaps.model.Geofavorite;
import it.danieleverducci.nextcloudmaps.utils.SettingsManager;
-import static android.view.View.GONE;
-import static android.view.View.VISIBLE;
-import static it.danieleverducci.nextcloudmaps.activity.main.GeofavoriteAdapter.*;
-import static it.danieleverducci.nextcloudmaps.activity.main.GeofavoriteAdapter.SORT_BY_CREATED;
-import static it.danieleverducci.nextcloudmaps.activity.main.GeofavoriteAdapter.SORT_BY_TITLE;
-import androidx.lifecycle.Observer;
-import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
-
public class MainActivity extends NextcloudMapsStyledActivity {
private static final String TAG = "MainActivity";
diff --git a/app/src/main/java/it/danieleverducci/nextcloudmaps/fragments/GeofavoriteMapFragment.java b/app/src/main/java/it/danieleverducci/nextcloudmaps/fragments/GeofavoriteMapFragment.java
index 2128f8c..02829db 100644
--- a/app/src/main/java/it/danieleverducci/nextcloudmaps/fragments/GeofavoriteMapFragment.java
+++ b/app/src/main/java/it/danieleverducci/nextcloudmaps/fragments/GeofavoriteMapFragment.java
@@ -1,5 +1,6 @@
package it.danieleverducci.nextcloudmaps.fragments;
+import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
@@ -7,27 +8,84 @@ import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
+import androidx.appcompat.content.res.AppCompatResources;
+import androidx.core.graphics.drawable.DrawableCompat;
+import androidx.lifecycle.Observer;
+
+import org.osmdroid.util.GeoPoint;
+import org.osmdroid.views.MapView;
+import org.osmdroid.views.overlay.Marker;
+
+import java.util.List;
import it.danieleverducci.nextcloudmaps.R;
import it.danieleverducci.nextcloudmaps.activity.main.MainActivity;
+import it.danieleverducci.nextcloudmaps.model.Geofavorite;
+import it.danieleverducci.nextcloudmaps.utils.MapUtils;
public class GeofavoriteMapFragment extends GeofavoritesFragment {
+ private MapView map;
+
+ @Override
+ public void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ MapUtils.configOsmdroid(requireContext());
+ }
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_geofavorite_map, container, false);
-
+ map = v.findViewById(R.id.map);
// Setup view listeners
View showListButton = v.findViewById(R.id.view_mode_list);
- showListButton.setOnClickListener(View -> ((MainActivity)requireActivity()).showMap());
+ showListButton.setOnClickListener(View -> ((MainActivity)requireActivity()).showList());
+
+ View loadingWall = v.findViewById(R.id.loading_wall);
+
+ // Register for data source events
+ mGeofavoritesFragmentViewModel.getIsUpdating().observe(getViewLifecycleOwner(), new Observer() {
+ @Override
+ public void onChanged(@Nullable Boolean changed) {
+ if(Boolean.TRUE.equals(changed)){
+ loadingWall.setVisibility(View.VISIBLE);
+ }
+ else{
+ loadingWall.setVisibility(View.GONE);
+ }
+ }
+ });
+ mGeofavoritesFragmentViewModel.getGeofavorites().observe(getViewLifecycleOwner(), new Observer>() {
+ @Override
+ public void onChanged(List geofavorites) {
+ for(Geofavorite gf : geofavorites)
+ addMarker(gf);
+ }
+ });
return v;
}
@Override
public void onSearch(String query) {
+ // TODO: filter
+ }
+ private void addMarker(Geofavorite geofavorite){
+ GeoPoint pos = new GeoPoint(geofavorite.getLat(), geofavorite.getLng());
+
+ Drawable icon = DrawableCompat.wrap(AppCompatResources.getDrawable(requireContext(), R.drawable.ic_list_pin));
+ DrawableCompat.setTint(icon, geofavorite.categoryColor());
+
+ Marker m = new Marker(map);
+ m.setPosition(pos);
+ m.setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM);
+ m.setIcon(icon);
+ m.setTitle(geofavorite.getName());
+ m.setSnippet(geofavorite.getComment());
+ m.setSubDescription(geofavorite.getCategory());
+ map.getOverlays().add(m);
}
}
diff --git a/app/src/main/res/layout/fragment_geofavorite_map.xml b/app/src/main/res/layout/fragment_geofavorite_map.xml
index 3b4d6d2..c7eb431 100644
--- a/app/src/main/res/layout/fragment_geofavorite_map.xml
+++ b/app/src/main/res/layout/fragment_geofavorite_map.xml
@@ -8,6 +8,21 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
+
+
+
+
+
+
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/values-night/colors.xml b/app/src/main/res/values-night/colors.xml
index 6947715..2c41e6d 100644
--- a/app/src/main/res/values-night/colors.xml
+++ b/app/src/main/res/values-night/colors.xml
@@ -3,4 +3,5 @@
#eee
#888
#000
+ #C000
\ 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 41be338..98f353b 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -20,6 +20,7 @@
#ffffff
#00000000
+ #CFFF
#0082C9
#550082C9
#666
diff --git a/build.gradle b/build.gradle
index 0df4579..54ff531 100644
--- a/build.gradle
+++ b/build.gradle
@@ -25,7 +25,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:7.4.0'
+ classpath 'com.android.tools.build:gradle:8.2.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
diff --git a/gradle.properties b/gradle.properties
index 25f662f..180a23a 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -36,4 +36,7 @@ org.gradle.jvmargs=-Xmx2048m
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
-android.enableJetifier=true
\ No newline at end of file
+android.enableJetifier=true
+android.defaults.buildfeatures.buildconfig=true
+android.nonTransitiveRClass=false
+android.nonFinalResIds=false
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index ff1bb46..bacfdee 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
#Sun Feb 20 08:50:37 CET 2022
distributionBase=GRADLE_USER_HOME
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME