diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser
index 20da4b7..dab3beb 100644
Binary files a/.idea/caches/build_file_checksums.ser and b/.idea/caches/build_file_checksums.ser differ
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index 5cd135a..791dac0 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -11,6 +11,7 @@
+
diff --git a/.idea/modules.xml b/.idea/modules.xml
index e31ade1..3a35afd 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -4,6 +4,7 @@
+
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index fdb4e24..f33fedc 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -52,6 +52,7 @@ android {
viewBinding.enabled = true
+ dynamicFeatures = [":tasksintegration"]
}
dependencies {
diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/helpers/WeatherHelper.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/helpers/WeatherHelper.kt
index 03727b7..09b88d5 100644
--- a/app/src/main/java/com/tommasoberlose/anotherwidget/helpers/WeatherHelper.kt
+++ b/app/src/main/java/com/tommasoberlose/anotherwidget/helpers/WeatherHelper.kt
@@ -1,5 +1,6 @@
package com.tommasoberlose.anotherwidget.helpers
+import android.Manifest
import android.content.Context
import com.google.android.gms.location.LocationServices
import com.kwabenaberko.openweathermaplib.constants.Units
@@ -10,6 +11,7 @@ import com.tommasoberlose.anotherwidget.R
import com.tommasoberlose.anotherwidget.global.Preferences
import com.tommasoberlose.anotherwidget.network.WeatherNetworkApi
import com.tommasoberlose.anotherwidget.ui.widgets.MainWidget
+import com.tommasoberlose.anotherwidget.utils.checkGrantedPermission
/**
@@ -22,12 +24,14 @@ object WeatherHelper {
val networkApi = WeatherNetworkApi(context)
if (Preferences.customLocationAdd != "") {
networkApi.updateWeather()
- } else {
+ } else if (context.checkGrantedPermission(Manifest.permission.ACCESS_FINE_LOCATION)) {
LocationServices.getFusedLocationProviderClient(context).lastLocation.addOnSuccessListener {
- Preferences.customLocationLat = it.latitude.toString()
- Preferences.customLocationLon = it.longitude.toString()
+ if (it != null) {
+ Preferences.customLocationLat = it.latitude.toString()
+ Preferences.customLocationLon = it.longitude.toString()
- networkApi.updateWeather()
+ networkApi.updateWeather()
+ }
}
}
}
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index a0a6719..c08588d 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -182,4 +182,5 @@
This is a single developer project,\nso thank you for the support!
This is an open-source project, feel free to help.
Feedback and feature requests
+ Tasks Integration
diff --git a/settings.gradle b/settings.gradle
index 9ab0d5f..bc7a0af 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,2 +1,3 @@
rootProject.name='Another Widget'
include ':app'
+include ':tasksintegration'
diff --git a/tasksintegration/.gitignore b/tasksintegration/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/tasksintegration/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/tasksintegration/build.gradle b/tasksintegration/build.gradle
new file mode 100644
index 0000000..fc97adb
--- /dev/null
+++ b/tasksintegration/build.gradle
@@ -0,0 +1,21 @@
+apply plugin: 'com.android.dynamic-feature'
+
+android {
+ compileSdkVersion 29
+
+
+ defaultConfig {
+ minSdkVersion 23
+ targetSdkVersion 29
+ versionCode 1
+ versionName "1.0"
+
+ }
+
+
+}
+
+dependencies {
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
+ implementation project(':app')
+}
diff --git a/tasksintegration/src/main/AndroidManifest.xml b/tasksintegration/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..2c2fa4d
--- /dev/null
+++ b/tasksintegration/src/main/AndroidManifest.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+