diff --git a/.gitignore b/.gitignore index 39fb081..29220b5 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ /build /captures .externalNativeBuild +/tasksintegration/build \ No newline at end of file diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser index def4b35..1f02b2c 100644 Binary files a/.idea/caches/build_file_checksums.ser and b/.idea/caches/build_file_checksums.ser differ diff --git a/app/build.gradle b/app/build.gradle index 5a3311e..501c162 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -18,7 +18,7 @@ android { applicationId "com.tommasoberlose.anotherwidget" minSdkVersion 23 targetSdkVersion 29 - versionCode 62 + versionCode 65 versionName "2.0.5" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" @@ -59,15 +59,14 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation 'androidx.appcompat:appcompat:1.1.0' - implementation 'androidx.core:core-ktx:1.2.0' - implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'androidx.legacy:legacy-support-v4:1.0.0' testImplementation 'junit:junit:4.13' androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' // UI + implementation 'androidx.appcompat:appcompat:1.1.0' + implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'com.google.android.material:material:1.2.0-alpha06' implementation 'androidx.browser:browser:1.2.0' implementation 'net.idik:slimadapter:2.1.2' @@ -78,6 +77,8 @@ dependencies { implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0' implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' + implementation "androidx.work:work-runtime-ktx:2.3.4" + // EventBus implementation 'org.greenrobot:eventbus:3.1.1' @@ -89,6 +90,8 @@ dependencies { implementation 'androidx.multidex:multidex:2.0.1' implementation 'joda-time:joda-time:2.9.9' implementation 'me.everything:providers-android:1.0.1' + + //Glide implementation 'com.github.bumptech.glide:glide:4.11.0' kapt 'com.github.bumptech.glide:compiler:4.11.0' @@ -104,6 +107,7 @@ dependencies { implementation "androidx.core:core-ktx:1.2.0" implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.2.0" implementation "androidx.palette:palette-ktx:1.0.0" + implementation 'androidx.core:core-ktx:1.2.0' // Recommended: Add the Firebase SDK for Google Analytics. implementation 'com.google.firebase:firebase-analytics:17.4.0' diff --git a/app/release/app-release.aab b/app/release/app-release.aab index 8dc2325..573e547 100644 Binary files a/app/release/app-release.aab and b/app/release/app-release.aab differ diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 694c341..3efe230 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -6,6 +6,7 @@ + diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/db/EventRepository.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/db/EventRepository.kt index b176d85..2520692 100644 --- a/app/src/main/java/com/tommasoberlose/anotherwidget/db/EventRepository.kt +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/db/EventRepository.kt @@ -1,10 +1,12 @@ package com.tommasoberlose.anotherwidget.db import android.content.Context +import android.util.Log import com.chibatching.kotpref.bulk import com.tommasoberlose.anotherwidget.global.Preferences import com.tommasoberlose.anotherwidget.models.Event import com.tommasoberlose.anotherwidget.receivers.UpdatesReceiver +import com.tommasoberlose.anotherwidget.services.UpdatesWorker import com.tommasoberlose.anotherwidget.ui.widgets.MainWidget import io.realm.Realm import io.realm.RealmResults @@ -33,13 +35,10 @@ class EventRepository(val context: Context) { remove(Preferences::nextEventEndDate) remove(Preferences::nextEventCalendarId) } - - MainWidget.updateWidget(context) } fun saveNextEventData(event: Event) { Preferences.nextEventId = event.id - MainWidget.updateWidget(context) } fun getNextEvent(): Event? = realm.where(Event::class.java).equalTo("id", Preferences.nextEventId).findFirst() ?: realm.where(Event::class.java).findFirst() @@ -57,7 +56,7 @@ class EventRepository(val context: Context) { } else { resetNextEventData() } - UpdatesReceiver.setUpdates(context) + UpdatesWorker.setUpdates(context) MainWidget.updateWidget(context) } @@ -74,7 +73,7 @@ class EventRepository(val context: Context) { } else { resetNextEventData() } - UpdatesReceiver.setUpdates(context) + UpdatesWorker.setUpdates(context) MainWidget.updateWidget(context) } diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/helpers/CalendarHelper.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/helpers/CalendarHelper.kt index ff0d1e1..eb92b32 100644 --- a/app/src/main/java/com/tommasoberlose/anotherwidget/helpers/CalendarHelper.kt +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/helpers/CalendarHelper.kt @@ -10,6 +10,7 @@ import com.tommasoberlose.anotherwidget.db.EventRepository import com.tommasoberlose.anotherwidget.models.Event import com.tommasoberlose.anotherwidget.global.Preferences import com.tommasoberlose.anotherwidget.receivers.UpdatesReceiver +import com.tommasoberlose.anotherwidget.services.UpdatesWorker import com.tommasoberlose.anotherwidget.ui.activities.MainActivity import com.tommasoberlose.anotherwidget.ui.widgets.MainWidget import com.tommasoberlose.anotherwidget.utils.checkGrantedPermission @@ -124,7 +125,8 @@ object CalendarHelper { eventRepository.resetNextEventData() } - UpdatesReceiver.setUpdates(context) + UpdatesWorker.setUpdates(context) + Log.d("ciao", "force update? 7") MainWidget.updateWidget(context) EventBus.getDefault().post(MainActivity.UpdateUiMessageEvent()) 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 cf07ab1..84f2d49 100644 --- a/app/src/main/java/com/tommasoberlose/anotherwidget/helpers/WeatherHelper.kt +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/helpers/WeatherHelper.kt @@ -2,6 +2,8 @@ package com.tommasoberlose.anotherwidget.helpers import android.Manifest import android.content.Context +import android.os.Build +import android.util.Log import com.google.android.gms.location.LocationServices import com.kwabenaberko.openweathermaplib.constants.Units import com.kwabenaberko.openweathermaplib.implementation.OpenWeatherMapHelper @@ -24,7 +26,7 @@ object WeatherHelper { val networkApi = WeatherNetworkApi(context) if (Preferences.customLocationAdd != "") { networkApi.updateWeather() - } else if (context.checkGrantedPermission(Manifest.permission.ACCESS_BACKGROUND_LOCATION)) { + } else if (context.checkGrantedPermission(if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) Manifest.permission.ACCESS_BACKGROUND_LOCATION else Manifest.permission.ACCESS_FINE_LOCATION)) { LocationServices.getFusedLocationProviderClient(context).lastLocation.addOnCompleteListener { task -> if (task.isSuccessful) { val location = task.result diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/helpers/WidgetHelper.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/helpers/WidgetHelper.kt index 8a92d03..fb90dab 100644 --- a/app/src/main/java/com/tommasoberlose/anotherwidget/helpers/WidgetHelper.kt +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/helpers/WidgetHelper.kt @@ -39,4 +39,13 @@ object WidgetHelper { private fun Context.dip(value: Int): Int = (value * resources.displayMetrics.density).toInt() } + + fun Pair.reduceDimensionWithMaxWidth(width: Int): Pair { + return if (first < width) { + this + } else { + val factor = width / first + width to second * factor + } + } } \ No newline at end of file diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/network/WeatherNetworkApi.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/network/WeatherNetworkApi.kt index d2ebaeb..d94e4b7 100644 --- a/app/src/main/java/com/tommasoberlose/anotherwidget/network/WeatherNetworkApi.kt +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/network/WeatherNetworkApi.kt @@ -1,6 +1,7 @@ package com.tommasoberlose.anotherwidget.network import android.content.Context +import android.util.Log import com.kwabenaberko.openweathermaplib.constants.Units import com.kwabenaberko.openweathermaplib.implementation.OpenWeatherMapHelper import com.kwabenaberko.openweathermaplib.implementation.callbacks.CurrentWeatherCallback @@ -23,9 +24,7 @@ class WeatherNetworkApi(val context: Context) { Preferences.weatherTemp = currentWeather.main.temp.toFloat() Preferences.weatherIcon = currentWeather.weather[0].icon Preferences.weatherRealTempUnit = Preferences.weatherTempUnit - MainWidget.updateWidget( - context - ) + MainWidget.updateWidget(context) EventBus.getDefault().post(MainActivity.UpdateUiMessageEvent()) } diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/receivers/UpdatesReceiver.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/receivers/UpdatesReceiver.kt index 883f545..c8be36f 100644 --- a/app/src/main/java/com/tommasoberlose/anotherwidget/receivers/UpdatesReceiver.kt +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/receivers/UpdatesReceiver.kt @@ -28,41 +28,10 @@ class UpdatesReceiver : BroadcastReceiver() { "com.sec.android.widgetapp.APPWIDGET_RESIZE", Intent.ACTION_DATE_CHANGED, - AlarmManager.ACTION_NEXT_ALARM_CLOCK_CHANGED -> MainWidget.updateWidget(context) - } - } - - companion object { - fun setUpdates(context: Context) { - removeUpdates(context) - - val eventRepository = EventRepository(context) - with(context.getSystemService(Context.ALARM_SERVICE) as AlarmManager) { - eventRepository.getEvents().forEach { event -> - val hoursDiff = Period(Calendar.getInstance().timeInMillis, event.startDate).hours - - // Update the widget every hour till the event - (0 .. hoursDiff).forEach { - setExact( - AlarmManager.RTC_WAKEUP, - (event.startDate + 1000) - it * 1000 * 60* 60, - PendingIntent.getBroadcast(context, 0, Intent(context, UpdatesReceiver::class.java).apply { action = Actions.ACTION_TIME_UPDATE }, 0) - ) - } - - // Update the widget one second after the event is finished - setExact( - AlarmManager.RTC_WAKEUP, - event.endDate + 1000, - PendingIntent.getBroadcast(context, 0, Intent(context, UpdatesReceiver::class.java).apply { action = Actions.ACTION_TIME_UPDATE }, 0) - ) - } - } - } - - fun removeUpdates(context: Context) { - with(context.getSystemService(Context.ALARM_SERVICE) as AlarmManager) { - cancel(PendingIntent.getBroadcast(context, 0, Intent(context, UpdatesReceiver::class.java), 0)) + AlarmManager.ACTION_NEXT_ALARM_CLOCK_CHANGED, + Actions.ACTION_TIME_UPDATE -> { + Log.d("ciao", "force update? 4 - ${intent.action}") + MainWidget.updateWidget(context) } } } diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/receivers/WeatherReceiver.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/receivers/WeatherReceiver.kt index ddae697..e6b12ca 100644 --- a/app/src/main/java/com/tommasoberlose/anotherwidget/receivers/WeatherReceiver.kt +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/receivers/WeatherReceiver.kt @@ -8,6 +8,7 @@ import android.content.Intent import com.tommasoberlose.anotherwidget.global.Actions import com.tommasoberlose.anotherwidget.global.Preferences import com.tommasoberlose.anotherwidget.helpers.WeatherHelper +import com.tommasoberlose.anotherwidget.services.WeatherWorker import java.util.* @@ -19,68 +20,7 @@ class WeatherReceiver : BroadcastReceiver() { Intent.ACTION_MY_PACKAGE_REPLACED, Intent.ACTION_TIMEZONE_CHANGED, Intent.ACTION_LOCALE_CHANGED, - Intent.ACTION_TIME_CHANGED -> setUpdates(context) - - Actions.ACTION_WEATHER_UPDATE -> WeatherHelper.updateWeather(context) - } - } - - companion object { - fun setUpdates(context: Context) { - removeUpdates(context) - - if (Preferences.showWeather && Preferences.weatherProviderApi != "") { - WeatherHelper.updateWeather(context) - - with(context.getSystemService(Context.ALARM_SERVICE) as AlarmManager) { - val pi = PendingIntent.getBroadcast( - context, - 1, - Intent(context, WeatherReceiver::class.java).apply { - action = Actions.ACTION_WEATHER_UPDATE - }, - 0 - ) - - val refresh: Long = when (Preferences.weatherRefreshPeriod) { - 0 -> 30 - 1 -> 60 - 2 -> 60 * 3 - 3 -> 60 * 6 - 4 -> 60 * 12 - 5 -> 60 * 24 - else -> 60 - } - val now = Calendar.getInstance().apply { - set(Calendar.MILLISECOND, 0) - set(Calendar.SECOND, 0) - } - - setRepeating(AlarmManager.RTC_WAKEUP, now.timeInMillis, 1000 * 60 * refresh, pi) - } - } - } - - fun setOneTimeUpdate(context: Context) { - // Update the weather in a few minuter when the api key has been changed - with(context.getSystemService(Context.ALARM_SERVICE) as AlarmManager) { - val pi = PendingIntent.getBroadcast(context, 1, Intent(context, WeatherReceiver::class.java).apply { action = Actions.ACTION_WEATHER_UPDATE }, 0) - val now = Calendar.getInstance().apply { - set(Calendar.MILLISECOND, 0) - set(Calendar.SECOND, 0) - } - - listOf(10, 15, 20).forEach { - setExact(AlarmManager.RTC_WAKEUP, now.timeInMillis + 1000 * 60 * it, pi) - } - } - } - - fun removeUpdates(context: Context) { - val intent = Intent(context, WeatherReceiver::class.java) - val sender = PendingIntent.getBroadcast(context, 1, intent, 0) - val alarmManager = context.getSystemService(Context.ALARM_SERVICE) as AlarmManager - alarmManager.cancel(sender) + Intent.ACTION_TIME_CHANGED -> WeatherWorker.setUpdates(context) } } } diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/services/UpdatesWorker.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/services/UpdatesWorker.kt new file mode 100644 index 0000000..790225b --- /dev/null +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/services/UpdatesWorker.kt @@ -0,0 +1,51 @@ +package com.tommasoberlose.anotherwidget.services + +import android.app.AlarmManager +import android.app.PendingIntent +import android.content.Context +import android.content.Intent +import androidx.work.OneTimeWorkRequestBuilder +import androidx.work.WorkManager +import androidx.work.Worker +import androidx.work.WorkerParameters +import com.tommasoberlose.anotherwidget.db.EventRepository +import com.tommasoberlose.anotherwidget.global.Actions +import com.tommasoberlose.anotherwidget.helpers.CalendarHelper +import com.tommasoberlose.anotherwidget.receivers.UpdatesReceiver +import org.joda.time.Period +import java.util.* +import java.util.concurrent.TimeUnit + + +class UpdatesWorker(appContext: Context, workerParams: WorkerParameters) : Worker(appContext, workerParams) { + override fun doWork(): Result { + CalendarHelper.updateEventList(applicationContext) + return Result.success() + } + + companion object { + private const val JOB_TAG = "UPDATES_WORKER" + + fun setUpdates(context: Context) { + removeUpdates(context) + val now = Calendar.getInstance().timeInMillis + val workManager = WorkManager.getInstance(context) + val eventRepository = EventRepository(context) + eventRepository.getEvents().forEach { event -> + val hoursDiff = Period(Calendar.getInstance().timeInMillis, event.startDate).hours + + // Update the widget every hour till the event + (0 .. hoursDiff).forEach { + workManager.enqueue(OneTimeWorkRequestBuilder().setInitialDelay((event.startDate + 1000) - now - it * 1000 * 60* 60, TimeUnit.MILLISECONDS).build()) + } + + // Update the widget one second after the event is finished + workManager.enqueue(OneTimeWorkRequestBuilder().setInitialDelay(event.endDate + 1000 - now, TimeUnit.MILLISECONDS).build()) + } + } + + fun removeUpdates(context: Context) { + WorkManager.getInstance(context).cancelAllWorkByTag(JOB_TAG) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/services/WeatherWorker.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/services/WeatherWorker.kt new file mode 100644 index 0000000..8c96584 --- /dev/null +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/services/WeatherWorker.kt @@ -0,0 +1,58 @@ +package com.tommasoberlose.anotherwidget.services + +import android.app.AlarmManager +import android.app.PendingIntent +import android.content.Context +import android.content.Intent +import androidx.work.* +import com.tommasoberlose.anotherwidget.global.Actions +import com.tommasoberlose.anotherwidget.global.Preferences +import com.tommasoberlose.anotherwidget.helpers.WeatherHelper +import com.tommasoberlose.anotherwidget.receivers.WeatherReceiver +import java.util.* +import java.util.concurrent.TimeUnit + + +class WeatherWorker(appContext: Context, workerParams: WorkerParameters) : Worker(appContext, workerParams) { + override fun doWork(): Result { + WeatherHelper.updateWeather(applicationContext) + return Result.success() + } + + companion object { + private const val JOB_TAG = "WEATHER_WORKER" + + fun setUpdates(context: Context) { + removeUpdates(context) + + if (Preferences.showWeather && Preferences.weatherProviderApi != "") { + WeatherHelper.updateWeather(context) + + WorkManager.getInstance(context).enqueue(PeriodicWorkRequestBuilder( + when (Preferences.weatherRefreshPeriod) { + 0 -> 30 + 1 -> 60 + 2 -> 60L * 3 + 3 -> 60L * 6 + 4 -> 60L * 12 + 5 -> 60L * 24 + else -> 60 + } + , TimeUnit.MINUTES) + .addTag(JOB_TAG) + .build()) + } + } + + fun setOneTimeUpdate(context: Context) { + val workManager = WorkManager.getInstance(context) + listOf(10L, 15L, 20L).forEach { + workManager.enqueue(OneTimeWorkRequestBuilder().setInitialDelay(it, TimeUnit.MINUTES).addTag(JOB_TAG).build()) + } + } + + fun removeUpdates(context: Context) { + WorkManager.getInstance(context).cancelAllWorkByTag(JOB_TAG) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/activities/CustomLocationActivity.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/activities/CustomLocationActivity.kt index 4a368be..de80c60 100644 --- a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/activities/CustomLocationActivity.kt +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/activities/CustomLocationActivity.kt @@ -5,6 +5,7 @@ import android.annotation.SuppressLint import android.app.Activity import android.location.Address import android.location.Geocoder +import android.os.Build import android.os.Bundle import com.tommasoberlose.anotherwidget.R import android.text.Editable @@ -125,7 +126,7 @@ class CustomLocationActivity : AppCompatActivity() { private fun requirePermission() { Dexter.withContext(this) .withPermissions( - Manifest.permission.ACCESS_BACKGROUND_LOCATION + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) Manifest.permission.ACCESS_BACKGROUND_LOCATION else Manifest.permission.ACCESS_FINE_LOCATION ).withListener(object: MultiplePermissionsListener { override fun onPermissionsChecked(report: MultiplePermissionsReport?) { report?.let { diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/activities/MainActivity.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/activities/MainActivity.kt index a7a330a..626019e 100644 --- a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/activities/MainActivity.kt +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/activities/MainActivity.kt @@ -5,6 +5,7 @@ import android.app.Activity import android.appwidget.AppWidgetManager import android.content.Intent import android.content.SharedPreferences +import android.graphics.drawable.BitmapDrawable import android.os.Bundle import android.util.Log import android.util.TypedValue @@ -38,6 +39,7 @@ import kotlinx.coroutines.* import org.greenrobot.eventbus.EventBus import org.greenrobot.eventbus.Subscribe import org.greenrobot.eventbus.ThreadMode +import java.lang.Exception class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceChangeListener { @@ -80,7 +82,6 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh subscribeUi(viewModel) updateUI() - CalendarHelper.updateEventList(this) WeatherHelper.updateWeather(this) } @@ -93,8 +94,16 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh uiJob = lifecycleScope.launch(Dispatchers.IO) { delay(200) val generatedView = MainWidget.generateWidgetView(this@MainActivity) - generatedView.measure(0, 0) - preview.measure(0, 0) + + withContext(Dispatchers.Main) { + generatedView.measure(0, 0) + preview.measure(0, 0) + try { + // Try to recycle old bitmaps + (bitmap_container.drawable as BitmapDrawable).bitmap.recycle() + } catch (ignore: Exception) {} + } + val bitmap = BitmapHelper.getBitmapFromView(generatedView, if (preview.width > 0) preview.width else generatedView.measuredWidth, generatedView.measuredHeight) withContext(Dispatchers.Main) { // Clock diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/AdvancedSettingsFragment.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/AdvancedSettingsFragment.kt index 27affee..14d8c84 100644 --- a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/AdvancedSettingsFragment.kt +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/AdvancedSettingsFragment.kt @@ -70,7 +70,7 @@ class AdvancedSettingsFragment : Fragment() { setupListener() - app_version.text = "v%s".format(BuildConfig.VERSION_NAME) + app_version.text = "v%s (%s)".format(BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE) requirePermission() } diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/WeatherSettingsFragment.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/WeatherSettingsFragment.kt index 25205e0..951077c 100644 --- a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/WeatherSettingsFragment.kt +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/WeatherSettingsFragment.kt @@ -3,8 +3,8 @@ package com.tommasoberlose.anotherwidget.ui.fragments import android.Manifest import android.app.Activity import android.content.Intent +import android.os.Build import android.os.Bundle -import android.util.Log import android.view.LayoutInflater import android.view.View import android.view.ViewGroup @@ -28,6 +28,7 @@ import com.tommasoberlose.anotherwidget.global.Preferences import com.tommasoberlose.anotherwidget.global.RequestCode import com.tommasoberlose.anotherwidget.helpers.SettingsStringHelper import com.tommasoberlose.anotherwidget.receivers.WeatherReceiver +import com.tommasoberlose.anotherwidget.services.WeatherWorker import com.tommasoberlose.anotherwidget.ui.activities.ChooseApplicationActivity import com.tommasoberlose.anotherwidget.ui.activities.CustomLocationActivity import com.tommasoberlose.anotherwidget.ui.activities.MainActivity @@ -134,9 +135,9 @@ class WeatherSettingsFragment : Fragment() { } private fun checkLocationPermission() { - if (activity?.checkGrantedPermission(Manifest.permission.ACCESS_BACKGROUND_LOCATION) == true) { + if (activity?.checkGrantedPermission(if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) Manifest.permission.ACCESS_BACKGROUND_LOCATION else Manifest.permission.ACCESS_FINE_LOCATION) == true) { location_permission_alert_icon.isVisible = false - WeatherReceiver.setUpdates(requireContext()) + WeatherWorker.setUpdates(requireContext()) } else if (Preferences.showWeather && Preferences.customLocationAdd == "") { location_permission_alert_icon.isVisible = true location_permission_alert_icon.setOnClickListener { @@ -211,7 +212,7 @@ class WeatherSettingsFragment : Fragment() { if (resultCode == Activity.RESULT_OK) { when (requestCode) { Constants.RESULT_CODE_CUSTOM_LOCATION -> { - WeatherReceiver.setUpdates(requireContext()) + WeatherWorker.setUpdates(requireContext()) checkLocationPermission() } RequestCode.WEATHER_APP_REQUEST_CODE.code -> { @@ -222,7 +223,7 @@ class WeatherSettingsFragment : Fragment() { MainWidget.updateWidget(requireContext()) } RequestCode.WEATHER_PROVIDER_REQUEST_CODE.code -> { - WeatherReceiver.setOneTimeUpdate(requireContext()) + WeatherWorker.setOneTimeUpdate(requireContext()) } } } @@ -232,7 +233,7 @@ class WeatherSettingsFragment : Fragment() { private fun requirePermission() { Dexter.withContext(requireContext()) .withPermissions( - Manifest.permission.ACCESS_BACKGROUND_LOCATION + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) Manifest.permission.ACCESS_BACKGROUND_LOCATION else Manifest.permission.ACCESS_FINE_LOCATION ).withListener(object: MultiplePermissionsListener { override fun onPermissionsChecked(report: MultiplePermissionsReport?) { report?.let { diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/widgets/MainWidget.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/widgets/MainWidget.kt index fff2340..09ab82d 100644 --- a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/widgets/MainWidget.kt +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/widgets/MainWidget.kt @@ -20,21 +20,25 @@ import android.widget.RemoteViews import android.widget.TextView import androidx.core.content.ContextCompat import androidx.core.view.isVisible +import com.google.firebase.crashlytics.FirebaseCrashlytics import com.tommasoberlose.anotherwidget.R import com.tommasoberlose.anotherwidget.db.EventRepository import com.tommasoberlose.anotherwidget.global.Actions import com.tommasoberlose.anotherwidget.global.Constants import com.tommasoberlose.anotherwidget.global.Preferences import com.tommasoberlose.anotherwidget.helpers.* +import com.tommasoberlose.anotherwidget.helpers.WidgetHelper.reduceDimensionWithMaxWidth import com.tommasoberlose.anotherwidget.receivers.NewCalendarEventReceiver import com.tommasoberlose.anotherwidget.receivers.UpdatesReceiver import com.tommasoberlose.anotherwidget.receivers.WeatherReceiver import com.tommasoberlose.anotherwidget.receivers.WidgetClickListenerReceiver +import com.tommasoberlose.anotherwidget.services.UpdatesWorker +import com.tommasoberlose.anotherwidget.services.WeatherWorker import com.tommasoberlose.anotherwidget.utils.checkGrantedPermission -import com.tommasoberlose.anotherwidget.utils.convertSpToPixels import com.tommasoberlose.anotherwidget.utils.getCapWordString import com.tommasoberlose.anotherwidget.utils.toPixel import kotlinx.android.synthetic.main.the_widget.view.* +import java.lang.Exception import java.text.DateFormat import java.util.* import java.util.concurrent.TimeUnit @@ -55,7 +59,7 @@ class MainWidget : AppWidgetProvider() { override fun onEnabled(context: Context) { CalendarHelper.updateEventList(context) - WeatherReceiver.setUpdates(context) + WeatherWorker.setUpdates(context) if (Preferences.showEvents) { CalendarHelper.setEventUpdatesAndroidN(context) @@ -66,8 +70,8 @@ class MainWidget : AppWidgetProvider() { override fun onDisabled(context: Context) { if (getWidgetCount(context) == 0) { - UpdatesReceiver.removeUpdates(context) - WeatherReceiver.removeUpdates(context) + UpdatesWorker.removeUpdates(context) + WeatherWorker.removeUpdates(context) } } @@ -94,7 +98,7 @@ class MainWidget : AppWidgetProvider() { val displayMetrics = Resources.getSystem().displayMetrics val width = displayMetrics.widthPixels - val dimensions = WidgetHelper.WidgetSizeProvider(context, appWidgetManager).getWidgetsSize(appWidgetId) + val dimensions = WidgetHelper.WidgetSizeProvider(context, appWidgetManager).getWidgetsSize(appWidgetId).reduceDimensionWithMaxWidth(1200) generateWidgetView(context, appWidgetId, appWidgetManager, dimensions.first - 8.toPixel(context) /*width - 16.toPixel(context)*/) } @@ -115,117 +119,233 @@ class MainWidget : AppWidgetProvider() { } private fun updateCalendarView(context: Context, v: View, views: RemoteViews, widgetID: Int): RemoteViews { - val eventRepository = EventRepository(context) + try { + val eventRepository = EventRepository(context) - views.setImageViewBitmap(R.id.empty_date_rect, BitmapHelper.getBitmapFromView(v.empty_date, draw = false)) + views.setImageViewBitmap( + R.id.empty_date_rect, + BitmapHelper.getBitmapFromView(v.empty_date, draw = false) + ) - views.setViewVisibility(R.id.empty_layout_rect, View.VISIBLE) - views.setViewVisibility(R.id.calendar_layout_rect, View.GONE) - views.setViewVisibility(R.id.second_row_rect, View.GONE) + views.setViewVisibility(R.id.empty_layout_rect, View.VISIBLE) + views.setViewVisibility(R.id.calendar_layout_rect, View.GONE) + views.setViewVisibility(R.id.second_row_rect, View.GONE) - val calPIntent = PendingIntent.getActivity(context, widgetID, IntentHelper.getCalendarIntent(context), 0) - views.setOnClickPendingIntent(R.id.empty_date_rect, calPIntent) + val calPIntent = PendingIntent.getActivity( + context, + widgetID, + IntentHelper.getCalendarIntent(context), + 0 + ) + views.setOnClickPendingIntent(R.id.empty_date_rect, calPIntent) - val nextEvent = eventRepository.getNextEvent() - val nextAlarm = AlarmHelper.getNextAlarm(context) + val nextEvent = eventRepository.getNextEvent() + val nextAlarm = AlarmHelper.getNextAlarm(context) - if (Preferences.showEvents && context.checkGrantedPermission(Manifest.permission.READ_CALENDAR) && nextEvent != null) { - if (Preferences.showNextEvent && eventRepository.getEventsCount() > 1) { - views.setImageViewBitmap(R.id.action_next_rect, BitmapHelper.getBitmapFromView(v.action_next, draw = false)) - views.setViewVisibility(R.id.action_next_rect, View.VISIBLE) - views.setOnClickPendingIntent(R.id.action_next_rect, PendingIntent.getBroadcast(context, widgetID, Intent(context, NewCalendarEventReceiver::class.java).apply { action = Actions.ACTION_GO_TO_NEXT_EVENT }, 0)) + if (Preferences.showEvents && context.checkGrantedPermission(Manifest.permission.READ_CALENDAR) && nextEvent != null) { + if (Preferences.showNextEvent && eventRepository.getEventsCount() > 1) { + views.setImageViewBitmap( + R.id.action_next_rect, + BitmapHelper.getBitmapFromView(v.action_next, draw = false) + ) + views.setViewVisibility(R.id.action_next_rect, View.VISIBLE) + views.setOnClickPendingIntent( + R.id.action_next_rect, + PendingIntent.getBroadcast( + context, + widgetID, + Intent( + context, + NewCalendarEventReceiver::class.java + ).apply { action = Actions.ACTION_GO_TO_NEXT_EVENT }, + 0 + ) + ) - views.setImageViewBitmap(R.id.action_previous_rect, BitmapHelper.getBitmapFromView(v.action_previous, draw = false)) - views.setViewVisibility(R.id.action_previous_rect, View.VISIBLE) - views.setOnClickPendingIntent(R.id.action_previous_rect, PendingIntent.getBroadcast(context, widgetID, Intent(context, NewCalendarEventReceiver::class.java).apply { action = Actions.ACTION_GO_TO_PREVIOUS_EVENT }, 0)) - } else { - views.setViewVisibility(R.id.action_next_rect, View.GONE) - views.setViewVisibility(R.id.action_previous_rect, View.GONE) + views.setImageViewBitmap( + R.id.action_previous_rect, + BitmapHelper.getBitmapFromView(v.action_previous, draw = false) + ) + views.setViewVisibility(R.id.action_previous_rect, View.VISIBLE) + views.setOnClickPendingIntent( + R.id.action_previous_rect, + PendingIntent.getBroadcast( + context, + widgetID, + Intent( + context, + NewCalendarEventReceiver::class.java + ).apply { action = Actions.ACTION_GO_TO_PREVIOUS_EVENT }, + 0 + ) + ) + } else { + views.setViewVisibility(R.id.action_next_rect, View.GONE) + views.setViewVisibility(R.id.action_previous_rect, View.GONE) + } + + val pIntent = PendingIntent.getActivity( + context, + widgetID, + IntentHelper.getEventIntent(context, nextEvent), + 0 + ) + views.setOnClickPendingIntent(R.id.next_event_rect, pIntent) + views.setOnClickPendingIntent(R.id.next_event_difference_time_rect, pIntent) + + if (Preferences.showDiffTime && Calendar.getInstance().timeInMillis < (nextEvent.startDate - 1000 * 60 * 60)) { + views.setImageViewBitmap( + R.id.next_event_difference_time_rect, + BitmapHelper.getBitmapFromView( + v.next_event_difference_time, + draw = false + ) + ) + views.setViewVisibility(R.id.next_event_difference_time_rect, View.VISIBLE) + } else { + views.setViewVisibility(R.id.next_event_difference_time_rect, View.GONE) + } + + if (nextEvent.address != "" && Preferences.secondRowInformation == 1) { + val mapIntent = PendingIntent.getActivity( + context, + widgetID, + IntentHelper.getGoogleMapsIntentFromAddress(context, nextEvent.address), + 0 + ) + views.setOnClickPendingIntent(R.id.second_row_rect, mapIntent) + } else { + val pIntentDetail = PendingIntent.getActivity( + context, + widgetID, + IntentHelper.getEventIntent( + context, + nextEvent, + forceEventDetails = true + ), + 0 + ) + views.setOnClickPendingIntent(R.id.second_row_rect, pIntentDetail) + } + + views.setImageViewBitmap( + R.id.next_event_rect, + BitmapHelper.getBitmapFromView(v.next_event, draw = false) + ) + + views.setImageViewBitmap( + R.id.second_row_rect, + BitmapHelper.getBitmapFromView(v.second_row, draw = false) + ) + views.setViewVisibility(R.id.second_row_rect, View.VISIBLE) + + views.setViewVisibility(R.id.empty_layout_rect, View.GONE) + views.setViewVisibility(R.id.calendar_layout_rect, View.VISIBLE) + } else if (Preferences.showNextAlarm && nextAlarm != "") { + val clockIntent = PendingIntent.getActivity( + context, + widgetID, + IntentHelper.getClockIntent(context), + 0 + ) + views.setOnClickPendingIntent(R.id.second_row_rect, clockIntent) + + views.setImageViewBitmap( + R.id.next_event_rect, + BitmapHelper.getBitmapFromView(v.next_event, draw = false) + ) + + views.setImageViewBitmap( + R.id.second_row_rect, + BitmapHelper.getBitmapFromView(v.second_row, draw = false) + ) + views.setViewVisibility(R.id.second_row_rect, View.VISIBLE) + + views.setViewVisibility(R.id.empty_layout_rect, View.GONE) + views.setViewVisibility(R.id.calendar_layout_rect, View.VISIBLE) } - - val pIntent = PendingIntent.getActivity(context, widgetID, IntentHelper.getEventIntent(context, nextEvent), 0) - views.setOnClickPendingIntent(R.id.next_event_rect, pIntent) - views.setOnClickPendingIntent(R.id.next_event_difference_time_rect, pIntent) - - if (Preferences.showDiffTime && Calendar.getInstance().timeInMillis < (nextEvent.startDate - 1000 * 60 * 60)) { - views.setImageViewBitmap(R.id.next_event_difference_time_rect, BitmapHelper.getBitmapFromView(v.next_event_difference_time, draw = false)) - views.setViewVisibility(R.id.next_event_difference_time_rect, View.VISIBLE) - } else { - views.setViewVisibility(R.id.next_event_difference_time_rect, View.GONE) - } - - if (nextEvent.address != "" && Preferences.secondRowInformation == 1) { - val mapIntent = PendingIntent.getActivity(context, widgetID, IntentHelper.getGoogleMapsIntentFromAddress(context, nextEvent.address), 0) - views.setOnClickPendingIntent(R.id.second_row_rect, mapIntent) - } else { - val pIntentDetail = PendingIntent.getActivity(context, widgetID, IntentHelper.getEventIntent(context, nextEvent, forceEventDetails = true), 0) - views.setOnClickPendingIntent(R.id.second_row_rect, pIntentDetail) - } - - views.setImageViewBitmap(R.id.next_event_rect, BitmapHelper.getBitmapFromView(v.next_event, draw = false)) - - views.setImageViewBitmap(R.id.second_row_rect, BitmapHelper.getBitmapFromView(v.second_row, draw = false)) - views.setViewVisibility(R.id.second_row_rect, View.VISIBLE) - - views.setViewVisibility(R.id.empty_layout_rect, View.GONE) - views.setViewVisibility(R.id.calendar_layout_rect, View.VISIBLE) - } else if (Preferences.showNextAlarm && nextAlarm != "") { - val clockIntent = PendingIntent.getActivity(context, widgetID, IntentHelper.getClockIntent(context), 0) - views.setOnClickPendingIntent(R.id.second_row_rect, clockIntent) - - views.setImageViewBitmap(R.id.next_event_rect, BitmapHelper.getBitmapFromView(v.next_event, draw = false)) - - views.setImageViewBitmap(R.id.second_row_rect, BitmapHelper.getBitmapFromView(v.second_row, draw = false)) - views.setViewVisibility(R.id.second_row_rect, View.VISIBLE) - - views.setViewVisibility(R.id.empty_layout_rect, View.GONE) - views.setViewVisibility(R.id.calendar_layout_rect, View.VISIBLE) + } catch (ex: Exception) { + FirebaseCrashlytics.getInstance().recordException(ex) } return views } private fun updateWeatherView(context: Context, v: View, views: RemoteViews, widgetID: Int): RemoteViews { + try { + if (Preferences.showWeather && Preferences.weatherIcon != "") { + views.setViewVisibility(R.id.weather_rect, View.VISIBLE) + views.setViewVisibility(R.id.calendar_weather_rect, View.VISIBLE) - if (Preferences.showWeather && Preferences.weatherIcon != "") { - views.setViewVisibility(R.id.weather_rect, View.VISIBLE) - views.setViewVisibility(R.id.calendar_weather_rect, View.VISIBLE) + val i = Intent(context, WidgetClickListenerReceiver::class.java) + i.action = Actions.ACTION_OPEN_WEATHER_INTENT + val weatherPIntent = PendingIntent.getBroadcast(context, widgetID, i, 0) - val i = Intent(context, WidgetClickListenerReceiver::class.java) - i.action = Actions.ACTION_OPEN_WEATHER_INTENT - val weatherPIntent = PendingIntent.getBroadcast(context, widgetID, i, 0) + views.setOnClickPendingIntent(R.id.weather_rect, weatherPIntent) + views.setOnClickPendingIntent(R.id.calendar_weather_rect, weatherPIntent) - views.setOnClickPendingIntent(R.id.weather_rect, weatherPIntent) - views.setOnClickPendingIntent(R.id.calendar_weather_rect, weatherPIntent) + views.setImageViewBitmap( + R.id.weather_rect, + BitmapHelper.getBitmapFromView(v.weather, draw = false) + ) - views.setImageViewBitmap(R.id.weather_rect, BitmapHelper.getBitmapFromView(v.weather, draw = false)) - - views.setImageViewBitmap(R.id.calendar_weather_rect, BitmapHelper.getBitmapFromView(v.calendar_weather, draw = false)) - } else { - views.setViewVisibility(R.id.weather_rect, View.GONE) - views.setViewVisibility(R.id.calendar_weather_rect, View.GONE) + views.setImageViewBitmap( + R.id.calendar_weather_rect, + BitmapHelper.getBitmapFromView(v.calendar_weather, draw = false) + ) + } else { + views.setViewVisibility(R.id.weather_rect, View.GONE) + views.setViewVisibility(R.id.calendar_weather_rect, View.GONE) + } + } catch (ex: Exception) { + FirebaseCrashlytics.getInstance().recordException(ex) } return views } private fun updateClockView(context: Context, views: RemoteViews, widgetID: Int): RemoteViews { - if (!Preferences.showClock) { - views.setViewVisibility(R.id.time, View.GONE) - views.setViewVisibility(R.id.clock_bottom_margin_none, View.GONE) - views.setViewVisibility(R.id.clock_bottom_margin_small, View.GONE) - views.setViewVisibility(R.id.clock_bottom_margin_medium, View.GONE) - views.setViewVisibility(R.id.clock_bottom_margin_large, View.GONE) - } else { - views.setTextColor(R.id.time, ColorHelper.getFontColor()) - views.setTextViewTextSize(R.id.time, TypedValue.COMPLEX_UNIT_SP, Preferences.clockTextSize.toPixel(context)) - val clockPIntent = PendingIntent.getActivity(context, widgetID, IntentHelper.getClockIntent(context), 0) - views.setOnClickPendingIntent(R.id.time, clockPIntent) - views.setViewVisibility(R.id.time, View.VISIBLE) + try { + if (!Preferences.showClock) { + views.setViewVisibility(R.id.time, View.GONE) + views.setViewVisibility(R.id.clock_bottom_margin_none, View.GONE) + views.setViewVisibility(R.id.clock_bottom_margin_small, View.GONE) + views.setViewVisibility(R.id.clock_bottom_margin_medium, View.GONE) + views.setViewVisibility(R.id.clock_bottom_margin_large, View.GONE) + } else { + views.setTextColor(R.id.time, ColorHelper.getFontColor()) + views.setTextViewTextSize( + R.id.time, + TypedValue.COMPLEX_UNIT_SP, + Preferences.clockTextSize.toPixel(context) + ) + val clockPIntent = PendingIntent.getActivity( + context, + widgetID, + IntentHelper.getClockIntent(context), + 0 + ) + views.setOnClickPendingIntent(R.id.time, clockPIntent) + views.setViewVisibility(R.id.time, View.VISIBLE) - views.setViewVisibility(R.id.clock_bottom_margin_none, if (Preferences.clockBottomMargin == Constants.ClockBottomMargin.NONE.value) View.VISIBLE else View.GONE) - views.setViewVisibility(R.id.clock_bottom_margin_small, if (Preferences.clockBottomMargin == Constants.ClockBottomMargin.SMALL.value) View.VISIBLE else View.GONE) - views.setViewVisibility(R.id.clock_bottom_margin_medium, if (Preferences.clockBottomMargin == Constants.ClockBottomMargin.MEDIUM.value) View.VISIBLE else View.GONE) - views.setViewVisibility(R.id.clock_bottom_margin_large, if (Preferences.clockBottomMargin == Constants.ClockBottomMargin.LARGE.value) View.VISIBLE else View.GONE) + views.setViewVisibility( + R.id.clock_bottom_margin_none, + if (Preferences.clockBottomMargin == Constants.ClockBottomMargin.NONE.value) View.VISIBLE else View.GONE + ) + views.setViewVisibility( + R.id.clock_bottom_margin_small, + if (Preferences.clockBottomMargin == Constants.ClockBottomMargin.SMALL.value) View.VISIBLE else View.GONE + ) + views.setViewVisibility( + R.id.clock_bottom_margin_medium, + if (Preferences.clockBottomMargin == Constants.ClockBottomMargin.MEDIUM.value) View.VISIBLE else View.GONE + ) + views.setViewVisibility( + R.id.clock_bottom_margin_large, + if (Preferences.clockBottomMargin == Constants.ClockBottomMargin.LARGE.value) View.VISIBLE else View.GONE + ) + } + } catch (ex: Exception) { + FirebaseCrashlytics.getInstance().recordException(ex) } return views diff --git a/app/src/main/res/layout/the_widget_sans.xml b/app/src/main/res/layout/the_widget_sans.xml index d03be13..a826b08 100644 --- a/app/src/main/res/layout/the_widget_sans.xml +++ b/app/src/main/res/layout/the_widget_sans.xml @@ -132,7 +132,7 @@ diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 8eda38c..e095afb 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -100,7 +100,7 @@ Schlüssel aktiviert ist, ist das Wetter sichtbar. Hi zusammen! - Öffnen von OpenWeather.com + Öffnen von OpenWeatherMap.com zehn Minuten dauern, bis der API-Schlüssel aktiviert wird.
Entspannen Sie! Das Wetter wird aktualisiert, sobald es verfügbar ist !!]]>
Gut gemacht! diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index f3d81e5..3a745fb 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -86,7 +86,7 @@ Saisissez la clé dans l\'app Collez la clé dans le champ ci-dessus et enregistrez-la. Une fois la clé activée, la météo deviendra visible. Bonjour tout le monde ! - Aller sur le site d\'OpenWeather + Aller sur le site d\'OpenWeatherMap 10 minutes avant que votre clé API soit activée. La météo sera mise à jour dès qu\'elle sera disponible !]]> Bien joué ! h diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 1b6d4d4..e699205 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -80,8 +80,8 @@ Nessun calendario trovato. Cosa fare Registrati su OpenWeather - Apri OpenWeather.com - Registra un account gratuito su OpenWeather.com in pochi minuti. + Apri OpenWeatherMap.com + Registra un account gratuito su OpenWeatherMap.com in pochi minuti. Accedi alle chiavi API nelle impostazioni e copia la chiave di default. Aggiungi la chiave all\'applicazione in questa sezione e, una volta che la chiave sarà attivata, apparirà il meteo. Copia la chiave API diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 1aa4251..732e94f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -93,7 +93,7 @@ Enter the key to the app Paste the key into the field above and save it. Once the key is activated the weather will become visible. Hi Everyone! - Go to OpenWeather.com + Go to OpenWeatherMap.com ten minutes before your API key is activated. The weather will be updated as soon as it is available!]]> Well Done! h diff --git a/app/src/main/res/xml/the_widget_info.xml b/app/src/main/res/xml/the_widget_info.xml index f7e88bc..ce9f8b6 100644 --- a/app/src/main/res/xml/the_widget_info.xml +++ b/app/src/main/res/xml/the_widget_info.xml @@ -10,5 +10,5 @@ android:minResizeWidth="300dp" android:previewImage="@drawable/widget_preview" android:resizeMode="vertical|horizontal" - android:updatePeriodMillis="60000" + android:updatePeriodMillis="86400000" android:widgetCategory="home_screen" /> \ No newline at end of file diff --git a/tasksintegration/build/intermediates/bundle_manifest/debug/bundle-manifest/AndroidManifest.xml b/tasksintegration/build/intermediates/bundle_manifest/debug/bundle-manifest/AndroidManifest.xml index 02cd6e0..270c35a 100644 --- a/tasksintegration/build/intermediates/bundle_manifest/debug/bundle-manifest/AndroidManifest.xml +++ b/tasksintegration/build/intermediates/bundle_manifest/debug/bundle-manifest/AndroidManifest.xml @@ -3,7 +3,7 @@ xmlns:dist="http://schemas.android.com/apk/distribution" featureSplit="tasksintegration" package="com.tommasoberlose.anotherwidget" - android:versionCode="61" + android:versionCode="64" android:versionName="2.0.5" > 8 9