Start google tasks integration

This commit is contained in:
Tommaso Berlose 2020-05-03 20:40:41 +02:00
parent 5b9ef9abc7
commit 67fc3dbcd8
10 changed files with 49 additions and 4 deletions

Binary file not shown.

1
.idea/gradle.xml generated
View File

@ -11,6 +11,7 @@
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
<option value="$PROJECT_DIR$/tasksintegration" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />

1
.idea/modules.xml generated
View File

@ -4,6 +4,7 @@
<modules>
<module fileurl="file://$PROJECT_DIR$/Another Widget.iml" filepath="$PROJECT_DIR$/Another Widget.iml" group="Another Widget" />
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" group="Another Widget/app" />
<module fileurl="file://$PROJECT_DIR$/tasksintegration/tasksintegration.iml" filepath="$PROJECT_DIR$/tasksintegration/tasksintegration.iml" group="Another Widget/tasksintegration" />
</modules>
</component>
</project>

View File

@ -52,6 +52,7 @@ android {
viewBinding.enabled = true
dynamicFeatures = [":tasksintegration"]
}
dependencies {

View File

@ -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()
}
}
}
}

View File

@ -182,4 +182,5 @@
<string name="support_dev_subtitle">This is a single developer project,\nso thank you for the support!</string>
<string name="settings_feedback_subtitle">This is an open-source project, feel free to help.</string>
<string name="settings_feedback_title">Feedback and feature requests</string>
<string name="title_tasksintegration">Tasks Integration</string>
</resources>

View File

@ -1,2 +1,3 @@
rootProject.name='Another Widget'
include ':app'
include ':tasksintegration'

1
tasksintegration/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/build

View File

@ -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')
}

View File

@ -0,0 +1,14 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:dist="http://schemas.android.com/apk/distribution"
package="com.tommasoberlose.tasksintegration">
<dist:module
dist:instant="false"
dist:title="@string/title_tasksintegration">
<dist:delivery>
<dist:on-demand />
</dist:delivery>
<dist:fusing dist:include="true" />
</dist:module>
</manifest>