diff --git a/omniNotes/build.gradle b/omniNotes/build.gradle
index 58c980b4a..14b13794a 100644
--- a/omniNotes/build.gradle
+++ b/omniNotes/build.gradle
@@ -206,11 +206,10 @@ dependencies {
implementation 'com.github.federicoiosue:pixlui:3.0.1'
// Flavors specific dependencies
- playImplementation 'io.nlopez.smartlocation:library:3.2.4'
- betaImplementation 'io.nlopez.smartlocation:library:3.2.4'
- alphaImplementation 'io.nlopez.smartlocation:library:3.2.4'
- fossImplementation 'com.github.federicoiosue:smart-location-lib:3.2.6'
- fossImplementation 'com.jakewharton.timber:timber:5.0.1'
+ playImplementation 'com.google.android.gms:play-services-location:21.3.0'
+ betaImplementation 'com.google.android.gms:play-services-location:21.3.0'
+ alphaImplementation 'com.google.android.gms:play-services-location:21.3.0'
+// fossImplementation 'com.jakewharton.timber:timber:5.0.1'
}
def jacocoVersion = "0.8.7"
diff --git a/omniNotes/src/alpha/java/it/feio/android/omninotes/helpers/GeocodeProviderFactory.java b/omniNotes/src/alpha/java/it/feio/android/omninotes/helpers/GeocodeProviderFactory.java
index e2736784d..e8e0a3c17 100644
--- a/omniNotes/src/alpha/java/it/feio/android/omninotes/helpers/GeocodeProviderFactory.java
+++ b/omniNotes/src/alpha/java/it/feio/android/omninotes/helpers/GeocodeProviderFactory.java
@@ -1,22 +1,22 @@
-/*
- * Copyright (C) 2013-2024 Federico Iosue (federico@iosue.it)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-package it.feio.android.omninotes.helpers;
-
-public class GeocodeProviderFactory extends GeocodeProviderBaseFactory {
-
-}
\ No newline at end of file
+///*
+// * Copyright (C) 2013-2024 Federico Iosue (federico@iosue.it)
+// *
+// * This program is free software: you can redistribute it and/or modify
+// * it under the terms of the GNU General Public License as published by
+// * the Free Software Foundation, either version 3 of the License, or
+// * (at your option) any later version.
+// *
+// * This program is distributed in the hope that it will be useful,
+// * but WITHOUT ANY WARRANTY; without even the implied warranty of
+// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// * GNU General Public License for more details.
+// *
+// * You should have received a copy of the GNU General Public License
+// * along with this program. If not, see .
+// */
+//
+//package it.feio.android.omninotes.helpers;
+//
+//public class GeocodeProviderFactory extends GeocodeProviderBaseFactory {
+//
+//}
\ No newline at end of file
diff --git a/omniNotes/src/androidTest/java/it/feio/android/omninotes/helpers/GeocodeProviderBaseFactoryTest.kt b/omniNotes/src/androidTest/java/it/feio/android/omninotes/helpers/GeocodeProviderBaseFactoryTest.kt
index f53f4c630..9cbf33d5b 100644
--- a/omniNotes/src/androidTest/java/it/feio/android/omninotes/helpers/GeocodeProviderBaseFactoryTest.kt
+++ b/omniNotes/src/androidTest/java/it/feio/android/omninotes/helpers/GeocodeProviderBaseFactoryTest.kt
@@ -1,41 +1,41 @@
-/*
- * Copyright (C) 2013-2024 Federico Iosue (federico@iosue.it)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package it.feio.android.omninotes.helpers
-
-import it.feio.android.omninotes.testutils.BaseAndroidTestCase
-import org.junit.Assert.assertNotNull
-import org.junit.Assert.assertTrue
-import org.junit.Test
-
-class GeocodeProviderBaseFactoryTest : BaseAndroidTestCase() {
-
- @Test
- @Throws(Exception::class)
- fun checkUtilityClassWellDefined() {
- assertUtilityClassWellDefined(GeocodeProviderBaseFactory::class.java, true, true)
- }
-
- @Test
- fun provider() {
- assertNotNull(GeocodeProviderBaseFactory.getProvider(testContext))
- }
-
- @Test
- fun checkHighAccuracyLocationProvider() {
- assertTrue(GeocodeProviderBaseFactory.checkHighAccuracyLocationProvider(testContext))
- }
-}
\ No newline at end of file
+///*
+// * Copyright (C) 2013-2024 Federico Iosue (federico@iosue.it)
+// *
+// * This program is free software: you can redistribute it and/or modify
+// * it under the terms of the GNU General Public License as published by
+// * the Free Software Foundation, either version 3 of the License, or
+// * (at your option) any later version.
+// *
+// * This program is distributed in the hope that it will be useful,
+// * but WITHOUT ANY WARRANTY; without even the implied warranty of
+// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// * GNU General Public License for more details.
+// *
+// * You should have received a copy of the GNU General Public License
+// * along with this program. If not, see .
+// */
+//package it.feio.android.omninotes.helpers
+//
+//import it.feio.android.omninotes.testutils.BaseAndroidTestCase
+//import org.junit.Assert.assertNotNull
+//import org.junit.Assert.assertTrue
+//import org.junit.Test
+//
+//class GeocodeProviderBaseFactoryTest : BaseAndroidTestCase() {
+//
+// @Test
+// @Throws(Exception::class)
+// fun checkUtilityClassWellDefined() {
+// assertUtilityClassWellDefined(GeocodeProviderBaseFactory::class.java, true, true)
+// }
+//
+// @Test
+// fun provider() {
+// assertNotNull(GeocodeProviderBaseFactory.getProvider(testContext))
+// }
+//
+// @Test
+// fun checkHighAccuracyLocationProvider() {
+// assertTrue(GeocodeProviderBaseFactory.checkHighAccuracyLocationProvider(testContext))
+// }
+//}
\ No newline at end of file
diff --git a/omniNotes/src/androidTest/java/it/feio/android/omninotes/testutils/BaseAndroidTestCase.java b/omniNotes/src/androidTest/java/it/feio/android/omninotes/testutils/BaseAndroidTestCase.java
index c9b6fff4a..26d0f765a 100644
--- a/omniNotes/src/androidTest/java/it/feio/android/omninotes/testutils/BaseAndroidTestCase.java
+++ b/omniNotes/src/androidTest/java/it/feio/android/omninotes/testutils/BaseAndroidTestCase.java
@@ -18,7 +18,6 @@
package it.feio.android.omninotes.testutils;
import static android.Manifest.permission.ACCESS_COARSE_LOCATION;
-import static android.Manifest.permission.ACCESS_FINE_LOCATION;
import static android.Manifest.permission.POST_NOTIFICATIONS;
import static android.Manifest.permission.READ_EXTERNAL_STORAGE;
import static android.Manifest.permission.RECORD_AUDIO;
@@ -102,7 +101,7 @@ public void tearDown() {
.grant(android.Manifest.permission.CAMERA);
private static void grantPermissions() {
- GrantPermissionRule.grant(ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION, READ_EXTERNAL_STORAGE, RECORD_AUDIO);
+ GrantPermissionRule.grant(ACCESS_COARSE_LOCATION, READ_EXTERNAL_STORAGE, RECORD_AUDIO);
if (BuildHelper.isBelowOrEqual(VERSION_CODES.Q)) {
GrantPermissionRule.grant(WRITE_EXTERNAL_STORAGE);
}
diff --git a/omniNotes/src/beta/java/it/feio/android/omninotes/helpers/GeocodeProviderFactory.java b/omniNotes/src/beta/java/it/feio/android/omninotes/helpers/GeocodeProviderFactory.java
index b938ab847..07bcf9dac 100644
--- a/omniNotes/src/beta/java/it/feio/android/omninotes/helpers/GeocodeProviderFactory.java
+++ b/omniNotes/src/beta/java/it/feio/android/omninotes/helpers/GeocodeProviderFactory.java
@@ -1,22 +1,22 @@
-/*
- * Copyright (C) 2017-2024 Federico Iosue (federico.iosue@gmail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundatibehaon, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-package it.feio.android.omninotes.helpers;
-
-public class GeocodeProviderFactory extends GeocodeProviderBaseFactory {
-
-}
+///*
+// * Copyright (C) 2017-2024 Federico Iosue (federico.iosue@gmail.com)
+// *
+// * This program is free software: you can redistribute it and/or modify
+// * it under the terms of the GNU General Public License as published by
+// * the Free Software Foundatibehaon, either version 3 of the License, or
+// * (at your option) any later version.
+// *
+// * This program is distributed in the hope that it will be useful,
+// * but WITHOUT ANY WARRANTY; without even the implied warranty of
+// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// * GNU General Public License for more details.
+// *
+// * You should have received a copy of the GNU General Public License
+// * along with this program. If not, see .
+// */
+//
+//package it.feio.android.omninotes.helpers;
+//
+//public class GeocodeProviderFactory extends GeocodeProviderBaseFactory {
+//
+//}
diff --git a/omniNotes/src/foss/java/it/feio/android/omninotes/helpers/GeocodeProviderFactory.java b/omniNotes/src/foss/java/it/feio/android/omninotes/helpers/GeocodeProviderFactory.java
index d791f9159..94387a02b 100644
--- a/omniNotes/src/foss/java/it/feio/android/omninotes/helpers/GeocodeProviderFactory.java
+++ b/omniNotes/src/foss/java/it/feio/android/omninotes/helpers/GeocodeProviderFactory.java
@@ -1,33 +1,33 @@
-/*
- * Copyright (C) 2013-2024 Federico Iosue (federico@iosue.it)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-package it.feio.android.omninotes.helpers;
-
-import android.content.Context;
-import io.nlopez.smartlocation.location.LocationProvider;
-import io.nlopez.smartlocation.location.providers.LocationManagerProvider;
-
-public class GeocodeProviderFactory {
-
- private GeocodeProviderFactory() {
- // hides public constructor
- }
-
- public static LocationProvider getProvider(Context context) {
- return new LocationManagerProvider();
- }
-}
\ No newline at end of file
+///*
+// * Copyright (C) 2013-2024 Federico Iosue (federico@iosue.it)
+// *
+// * This program is free software: you can redistribute it and/or modify
+// * it under the terms of the GNU General Public License as published by
+// * the Free Software Foundation, either version 3 of the License, or
+// * (at your option) any later version.
+// *
+// * This program is distributed in the hope that it will be useful,
+// * but WITHOUT ANY WARRANTY; without even the implied warranty of
+// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// * GNU General Public License for more details.
+// *
+// * You should have received a copy of the GNU General Public License
+// * along with this program. If not, see .
+// */
+//
+//package it.feio.android.omninotes.helpers;
+//
+//import android.content.Context;
+//import io.nlopez.smartlocation.location.LocationProvider;
+//import io.nlopez.smartlocation.location.providers.LocationManagerProvider;
+//
+//public class GeocodeProviderFactory {
+//
+// private GeocodeProviderFactory() {
+// // hides public constructor
+// }
+//
+// public static LocationProvider getProvider(Context context) {
+// return new LocationManagerProvider();
+// }
+//}
\ No newline at end of file
diff --git a/omniNotes/src/main/AndroidManifest.xml b/omniNotes/src/main/AndroidManifest.xml
index f360e00fb..7832ef988 100644
--- a/omniNotes/src/main/AndroidManifest.xml
+++ b/omniNotes/src/main/AndroidManifest.xml
@@ -18,9 +18,7 @@
-
-
@@ -245,7 +243,14 @@
-
+
+
+
+
+
+
+
+
GeocodeHelper.getLocation(onGeoUtilResultListener));
}
@@ -2272,6 +2272,7 @@ public void onLocationRetrieved(Location location) {
noteTmpWeakReference.get().setLatitude(location.getLatitude());
noteTmpWeakReference.get().setLongitude(location.getLongitude());
GeocodeHelper.getAddressFromCoordinates(location, detailFragmentWeakReference.get());
+ GeocodeHelper.getAddressFromCoordinates(location, detailFragmentWeakReference.get());
} else {
GeocodeHelper.getCoordinatesFromAddress(autoCompView.getText().toString(),
detailFragmentWeakReference.get());
diff --git a/omniNotes/src/main/java/it/feio/android/omninotes/helpers/GeocodeProviderBaseFactory.java b/omniNotes/src/main/java/it/feio/android/omninotes/helpers/GeocodeProviderBaseFactory.java
index a2d8caec0..205ec7d47 100644
--- a/omniNotes/src/main/java/it/feio/android/omninotes/helpers/GeocodeProviderBaseFactory.java
+++ b/omniNotes/src/main/java/it/feio/android/omninotes/helpers/GeocodeProviderBaseFactory.java
@@ -1,50 +1,48 @@
-/*
- * Copyright (C) 2013-2024 Federico Iosue (federico@iosue.it)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-package it.feio.android.omninotes.helpers;
-
-import android.content.Context;
-import android.content.Intent;
-import android.location.LocationManager;
-import android.os.Build.VERSION_CODES;
-import android.provider.Settings;
-import android.widget.Toast;
-import io.nlopez.smartlocation.location.LocationProvider;
-import io.nlopez.smartlocation.location.providers.LocationGooglePlayServicesWithFallbackProvider;
-import it.feio.android.omninotes.R;
-import it.feio.android.omninotes.utils.GeocodeHelper;
-
-public class GeocodeProviderBaseFactory {
-
- protected GeocodeProviderBaseFactory() {
- // hides public constructor
- }
-
- public static LocationProvider getProvider(Context context) {
- if (BuildHelper.isBelow(VERSION_CODES.P) && checkHighAccuracyLocationProvider(context)) {
- Toast.makeText(context, R.string.location_set_high_accuracy, Toast.LENGTH_SHORT).show();
- context.startActivity((new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS)));
- }
-
- return new LocationGooglePlayServicesWithFallbackProvider(context);
- }
-
- public static boolean checkHighAccuracyLocationProvider(Context context) {
- return GeocodeHelper.checkLocationProviderEnabled(context, LocationManager.GPS_PROVIDER);
- }
-
-}
+///*
+// * Copyright (C) 2013-2024 Federico Iosue (federico@iosue.it)
+// *
+// * This program is free software: you can redistribute it and/or modify
+// * it under the terms of the GNU General Public License as published by
+// * the Free Software Foundation, either version 3 of the License, or
+// * (at your option) any later version.
+// *
+// * This program is distributed in the hope that it will be useful,
+// * but WITHOUT ANY WARRANTY; without even the implied warranty of
+// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// * GNU General Public License for more details.
+// *
+// * You should have received a copy of the GNU General Public License
+// * along with this program. If not, see .
+// */
+//
+//package it.feio.android.omninotes.helpers;
+//
+//import android.content.Context;
+//import android.content.Intent;
+//import android.location.LocationManager;
+//import android.os.Build.VERSION_CODES;
+//import android.provider.Settings;
+//import android.widget.Toast;
+//import it.feio.android.omninotes.R;
+//import it.feio.android.omninotes.utils.GeocodeHelper;
+//
+//public class GeocodeProviderBaseFactory {
+//
+// protected GeocodeProviderBaseFactory() {
+// // hides public constructor
+// }
+//
+// public static LocationProvider getProvider(Context context) {
+// if (BuildHelper.isBelow(VERSION_CODES.P) && checkHighAccuracyLocationProvider(context)) {
+// Toast.makeText(context, R.string.location_set_high_accuracy, Toast.LENGTH_SHORT).show();
+// context.startActivity((new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS)));
+// }
+//
+// return new LocationGooglePlayServicesWithFallbackProvider(context);
+// }
+//
+// public static boolean checkHighAccuracyLocationProvider(Context context) {
+// return GeocodeHelper.checkLocationProviderEnabled(context, LocationManager.GPS_PROVIDER);
+// }
+//
+//}
diff --git a/omniNotes/src/main/java/it/feio/android/omninotes/utils/GeocodeHelper.java b/omniNotes/src/main/java/it/feio/android/omninotes/utils/GeocodeHelper.java
index 4c2bb4735..82f55a810 100644
--- a/omniNotes/src/main/java/it/feio/android/omninotes/utils/GeocodeHelper.java
+++ b/omniNotes/src/main/java/it/feio/android/omninotes/utils/GeocodeHelper.java
@@ -18,8 +18,6 @@
package it.feio.android.omninotes.utils;
import static it.feio.android.omninotes.BuildConfig.MAPS_API_KEY;
-import static it.feio.android.omninotes.helpers.GeocodeProviderBaseFactory.checkHighAccuracyLocationProvider;
-import static it.feio.android.omninotes.helpers.GeocodeProviderBaseFactory.getProvider;
import android.content.Context;
import android.location.Address;
@@ -29,11 +27,13 @@
import android.location.LocationManager;
import android.os.Bundle;
import android.text.TextUtils;
-import io.nlopez.smartlocation.SmartLocation;
-import io.nlopez.smartlocation.location.config.LocationParams;
-import io.nlopez.smartlocation.rx.ObservableFactory;
+import androidx.annotation.NonNull;
+import com.google.android.gms.location.LocationServices;
+import com.google.android.gms.tasks.OnFailureListener;
+import com.google.android.gms.tasks.OnSuccessListener;
import it.feio.android.omninotes.OmniNotes;
import it.feio.android.omninotes.helpers.LogDelegate;
+import it.feio.android.omninotes.helpers.PermissionsHelper;
import it.feio.android.omninotes.models.listeners.OnGeoUtilResultListener;
import java.io.IOException;
import java.io.InputStreamReader;
@@ -47,6 +47,7 @@
import java.util.Locale;
import java.util.concurrent.TimeUnit;
import java.util.regex.Pattern;
+import org.apache.commons.lang3.ArrayUtils;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
@@ -86,45 +87,58 @@ public void onProviderDisabled(String provider) {
public static void getLocation(OnGeoUtilResultListener onGeoUtilResultListener) {
- SmartLocation.LocationControl bod = SmartLocation.with(OmniNotes.getAppContext())
- .location(getProvider(OmniNotes.getAppContext()))
- .config(LocationParams.NAVIGATION).oneFix();
-
- Observable locations = ObservableFactory.from(bod).timeout(2, TimeUnit.SECONDS);
- locations.subscribe(new Subscriber<>() {
- @Override
- public void onNext(Location location) {
- onGeoUtilResultListener.onLocationRetrieved(location);
- unsubscribe();
- }
-
- @Override
- public void onCompleted() {
- // Nothing to do
- }
- @Override
- public void onError(Throwable e) {
- if(checkHighAccuracyLocationProvider(OmniNotes.getAppContext()) == true) {
- onGeoUtilResultListener.onLocationUnavailable();
- }else{
- onGeoUtilResultListener.onLocationNotEnabled();
- }
- unsubscribe();
- }
- });
+ LocationServices.getFusedLocationProviderClient(OmniNotes.getAppContext()).getLastLocation()
+ .addOnSuccessListener(location -> {
+ onGeoUtilResultListener.onLocationRetrieved(location);
+ if (location != null) {
+ onGeoUtilResultListener.onLocationUnavailable();
+ }
+ })
+ .addOnFailureListener(e -> onGeoUtilResultListener.onLocationUnavailable());
}
+// public static void getLocationOld(OnGeoUtilResultListener onGeoUtilResultListener) {
+// SmartLocation.LocationControl bod = SmartLocation.with(OmniNotes.getAppContext())
+// .location(getProvider(OmniNotes.getAppContext()))
+// .config(LocationParams.NAVIGATION).oneFix();
+//
+// Observable locations = ObservableFactory.from(bod).timeout(2, TimeUnit.SECONDS);
+// locations.subscribe(new Subscriber<>() {
+// @Override
+// public void onNext(Location location) {
+// onGeoUtilResultListener.onLocationRetrieved(location);
+// unsubscribe();
+// }
+//
+// @Override
+// public void onCompleted() {
+// // Nothing to do
+// }
+//
+// @Override
+// public void onError(Throwable e) {
+// if(checkHighAccuracyLocationProvider(OmniNotes.getAppContext()) == true) {
+// onGeoUtilResultListener.onLocationUnavailable();
+// }else{
+// onGeoUtilResultListener.onLocationNotEnabled();
+// }
+// unsubscribe();
+// }
+// });
+// }
+
public static void stop() {
- SmartLocation.with(OmniNotes.getAppContext()).location().stop();
- if (Geocoder.isPresent()) {
- SmartLocation.with(OmniNotes.getAppContext()).geocoding().stop();
- }
+// SmartLocation.with(OmniNotes.getAppContext()).location().stop();
+// if (Geocoder.isPresent()) {
+// SmartLocation.with(OmniNotes.getAppContext()).geocoding().stop();
+// }
+ LogDelegate.d("Location updates stopped");
}
- static String getAddressFromCoordinates(Context mContext, double latitude,
+ public static String getAddressFromCoordinates(Context mContext, double latitude,
double longitude) throws IOException {
String addressString = "";
Geocoder geocoder = new Geocoder(mContext, Locale.getDefault());
@@ -141,14 +155,13 @@ static String getAddressFromCoordinates(Context mContext, double latitude,
public static void getAddressFromCoordinates(Location location,
final OnGeoUtilResultListener onGeoUtilResultListener) {
- if (!Geocoder.isPresent()) {
- onGeoUtilResultListener.onAddressResolved("");
- } else {
- SmartLocation.with(OmniNotes.getAppContext()).geocoding()
- .reverse(location, (location1, list) -> {
- String address = !list.isEmpty() ? list.get(0).getAddressLine(0) : null;
- onGeoUtilResultListener.onAddressResolved(address);
- });
+ try {
+ var address= getAddressFromCoordinates(OmniNotes.getAppContext(), location.getLatitude(),
+ location.getLongitude());
+ onGeoUtilResultListener.onAddressResolved(address);
+ } catch (IOException e) {
+ LogDelegate.e("Error getting address from coordinates", e);
+ onGeoUtilResultListener.onLocationUnavailable();
}
}
@@ -170,11 +183,15 @@ public static double[] getCoordinatesFromAddress(Context mContext, String addres
public static void getCoordinatesFromAddress(String address, final OnGeoUtilResultListener
listener) {
- SmartLocation.with(OmniNotes.getAppContext()).geocoding().direct(address, (name, results) -> {
- if (!results.isEmpty()) {
- listener.onCoordinatesResolved(results.get(0).getLocation(), address);
+ try {
+ var coordinates = getCoordinatesFromAddress(OmniNotes.getAppContext(), address);
+ if (!ArrayUtils.isEmpty(coordinates)) {
+ //TODO: Make it work
+// listener.onCoordinatesResolved(new Location()results.get(0).getLocation(), address);
}
- });
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
}
diff --git a/omniNotes/src/main/res/values/integers.xml b/omniNotes/src/main/res/values/integers.xml
index 2c431a8e1..b6b4534c1 100644
--- a/omniNotes/src/main/res/values/integers.xml
+++ b/omniNotes/src/main/res/values/integers.xml
@@ -25,5 +25,5 @@
1
2
- 9080000
+ 12451000
diff --git a/omniNotes/src/play/java/it/feio/android/omninotes/helpers/GeocodeProviderFactory.java b/omniNotes/src/play/java/it/feio/android/omninotes/helpers/GeocodeProviderFactory.java
index 46047f148..4daf072a9 100644
--- a/omniNotes/src/play/java/it/feio/android/omninotes/helpers/GeocodeProviderFactory.java
+++ b/omniNotes/src/play/java/it/feio/android/omninotes/helpers/GeocodeProviderFactory.java
@@ -1,33 +1,33 @@
-/*
- * Copyright (C) 2013-2024 Federico Iosue (federico@iosue.it)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-package it.feio.android.omninotes.helpers;
-
-import android.content.Context;
-import io.nlopez.smartlocation.location.LocationProvider;
-import io.nlopez.smartlocation.location.providers.LocationGooglePlayServicesWithFallbackProvider;
-
-public class GeocodeProviderFactory {
-
- private GeocodeProviderFactory() {
- // hides public constructor
- }
-
- public static LocationProvider getProvider(Context context) {
- return new LocationGooglePlayServicesWithFallbackProvider(context);
- }
-}
+///*
+// * Copyright (C) 2013-2024 Federico Iosue (federico@iosue.it)
+// *
+// * This program is free software: you can redistribute it and/or modify
+// * it under the terms of the GNU General Public License as published by
+// * the Free Software Foundation, either version 3 of the License, or
+// * (at your option) any later version.
+// *
+// * This program is distributed in the hope that it will be useful,
+// * but WITHOUT ANY WARRANTY; without even the implied warranty of
+// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// * GNU General Public License for more details.
+// *
+// * You should have received a copy of the GNU General Public License
+// * along with this program. If not, see .
+// */
+//
+//package it.feio.android.omninotes.helpers;
+//
+//import android.content.Context;
+//import io.nlopez.smartlocation.location.LocationProvider;
+//import io.nlopez.smartlocation.location.providers.LocationGooglePlayServicesWithFallbackProvider;
+//
+//public class GeocodeProviderFactory {
+//
+// private GeocodeProviderFactory() {
+// // hides public constructor
+// }
+//
+// public static LocationProvider getProvider(Context context) {
+// return new LocationGooglePlayServicesWithFallbackProvider(context);
+// }
+//}