Merge develop

This commit is contained in:
Tommaso Berlose 2021-01-04 12:07:59 +01:00
commit 5b2d245e80
2464 changed files with 323 additions and 246 deletions
.idea
app
build.gradle
src/main
AndroidManifest.xml
java/com/tommasoberlose/anotherwidget
res/drawable-hdpi
ic_stat_notification.pngoutline_info_white.pngoutline_info_white_18.pngoutline_info_white_36.pngoutline_info_white_48.pnground_access_alarm.pnground_access_alarm_black_18.pnground_access_alarm_black_24.pnground_access_alarm_black_48.pnground_add.pnground_add_circle_outline_white_18.pnground_add_circle_outline_white_24.pnground_add_circle_outline_white_36.pnground_add_circle_outline_white_48.pnground_add_to_home_screen.pnground_add_to_home_screen_white_18.pnground_add_to_home_screen_white_24.pnground_add_to_home_screen_white_48.pnground_add_white_18.pnground_add_white_24.pnground_add_white_48.pnground_alarm.pnground_alarm_black_18.pnground_alarm_black_24.pnground_alarm_black_36.pnground_all_inclusive.pnground_all_inclusive_black_18.pnground_all_inclusive_black_36.pnground_all_inclusive_black_48.pnground_api_white_18.pnground_api_white_24.pnground_api_white_36.pnground_api_white_48.pnground_arrow_back.pnground_arrow_back_black_18.pnground_arrow_back_black_24.pnground_arrow_back_black_36.pnground_arrow_back_black_48.pnground_arrow_circle_down.pnground_arrow_circle_down_white_18.pnground_arrow_circle_down_white_36.pnground_arrow_circle_down_white_48.pnground_aspect_ratio.pnground_aspect_ratio_black_18.pnground_aspect_ratio_black_36.pnground_aspect_ratio_black_48.pnground_battery_charging_full.pnground_battery_charging_full_black_18.pnground_battery_charging_full_black_24.pnground_battery_charging_full_black_36.pnground_border_vertical_black_18.pnground_border_vertical_black_24.pnground_border_vertical_black_36.pnground_border_vertical_black_48.pnground_brightness_4.pnground_brightness_4_black_18.pnground_brightness_4_black_24.pnground_brightness_4_black_36.pnground_brightness_5.pnground_brightness_5_black_18.pnground_brightness_5_black_36.pnground_brightness_5_black_48.pnground_brightness_7.pnground_brightness_7_black_24.pnground_brightness_7_black_36.pnground_brightness_7_black_48.pnground_brightness_low.pnground_brightness_low_black_18.pnground_brightness_low_black_36.pnground_brightness_low_black_48.pnground_bug_report.pnground_bug_report_black_18.pnground_bug_report_black_24.pnground_bug_report_black_48.pnground_call_made.pnground_call_made_white_18.pnground_call_made_white_24.pnground_call_made_white_48.pnground_cancel_presentation.pnground_cancel_presentation_black_18.pnground_cancel_presentation_black_24.pnground_cancel_presentation_black_36.pnground_category.pnground_category_black_18.png

@ -123,6 +123,29 @@
</PersistentState> </PersistentState>
</value> </value>
</entry> </entry>
<entry key="vectorWizard">
<value>
<PersistentState>
<option name="children">
<map>
<entry key="vectorAssetStep">
<value>
<PersistentState>
<option name="values">
<map>
<entry key="assetSourceType" value="FILE" />
<entry key="outputName" value="round_aspect_ratio_24" />
<entry key="sourceFile" value="$USER_HOME$/Desktop/round_aspect_ratio_24.svg" />
</map>
</option>
</PersistentState>
</value>
</entry>
</map>
</option>
</PersistentState>
</value>
</entry>
</map> </map>
</option> </option>
</component> </component>

@ -16,15 +16,15 @@ apikeyProperties.load(new FileInputStream(apikeyPropertiesFile))
android { android {
compileSdkVersion 29 compileSdkVersion 30
buildToolsVersion "29.0.3" buildToolsVersion "29.0.3"
defaultConfig { defaultConfig {
applicationId "com.tommasoberlose.anotherwidget" applicationId "com.tommasoberlose.anotherwidget"
minSdkVersion 23 minSdkVersion 23
targetSdkVersion 29 targetSdkVersion 30
versionCode 111 versionCode 114
versionName "2.0.15" versionName "2.1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
buildConfigField("String", "GOOGLE_API_KEY", apikeyProperties['GOOGLE_API_KEY']) buildConfigField("String", "GOOGLE_API_KEY", apikeyProperties['GOOGLE_API_KEY'])
@ -72,9 +72,9 @@ dependencies {
// UI // UI
implementation 'androidx.appcompat:appcompat:1.2.0' implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.2' implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.google.android.material:material:1.3.0-alpha03' implementation 'com.google.android.material:material:1.3.0-beta01'
implementation 'androidx.browser:browser:1.2.0' implementation 'androidx.browser:browser:1.3.0'
implementation 'net.idik:slimadapter:2.1.2' implementation 'net.idik:slimadapter:2.1.2'
implementation 'com.google.android:flexbox:2.0.1' implementation 'com.google.android:flexbox:2.0.1'
@ -89,8 +89,8 @@ dependencies {
implementation 'org.greenrobot:eventbus:3.2.0' implementation 'org.greenrobot:eventbus:3.2.0'
// Navigation // Navigation
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.1' implementation 'androidx.navigation:navigation-fragment-ktx:2.3.2'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.1' implementation 'androidx.navigation:navigation-ui-ktx:2.3.2'
// Other // Other
implementation 'androidx.multidex:multidex:2.0.1' implementation 'androidx.multidex:multidex:2.0.1'
@ -103,7 +103,7 @@ dependencies {
kapt 'com.github.bumptech.glide:compiler:4.11.0' kapt 'com.github.bumptech.glide:compiler:4.11.0'
// Fitness // Fitness
implementation 'com.google.android.gms:play-services-fitness:18.0.0' implementation 'com.google.android.gms:play-services-fitness:20.0.0'
implementation 'com.google.android.gms:play-services-auth:18.1.0' implementation 'com.google.android.gms:play-services-auth:18.1.0'
//Weather //Weather
@ -111,8 +111,8 @@ dependencies {
implementation 'com.google.android.gms:play-services-location:17.1.0' implementation 'com.google.android.gms:play-services-location:17.1.0'
// Billing // Billing
implementation 'com.android.billingclient:billing:3.0.1' implementation 'com.android.billingclient:billing:3.0.2'
implementation 'com.android.billingclient:billing-ktx:3.0.1' implementation 'com.android.billingclient:billing-ktx:3.0.2'
// KTX // KTX
implementation "androidx.core:core-ktx:1.3.2" implementation "androidx.core:core-ktx:1.3.2"
@ -128,10 +128,10 @@ dependencies {
implementation "com.github.haroldadmin:NetworkResponseAdapter:4.0.1" implementation "com.github.haroldadmin:NetworkResponseAdapter:4.0.1"
//Coroutines //Coroutines
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.5' implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9'
// Add the Firebase SDK for Crashlytics. // Add the Firebase SDK for Crashlytics.
implementation 'com.google.firebase:firebase-crashlytics:17.2.2' implementation 'com.google.firebase:firebase-crashlytics:17.3.0'
// Preferences // Preferences
implementation 'com.chibatching.kotpref:kotpref:2.11.0' implementation 'com.chibatching.kotpref:kotpref:2.11.0'

@ -5,7 +5,6 @@
<uses-permission android:name="android.permission.READ_CALENDAR" /> <uses-permission android:name="android.permission.READ_CALENDAR" />
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="com.android.vending.BILLING" /> <uses-permission android:name="com.android.vending.BILLING" />
@ -13,6 +12,7 @@
<uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" /> <uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" />
<uses-permission android:name="android.gms.permission.ACTIVITY_RECOGNITION"/> <uses-permission android:name="android.gms.permission.ACTIVITY_RECOGNITION"/>
<uses-permission android:name="com.google.android.gms.permission.ACTIVITY_RECOGNITION" /> <uses-permission android:name="com.google.android.gms.permission.ACTIVITY_RECOGNITION" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<application <application
@ -154,6 +154,14 @@
android:name=".services.UpdateCalendarJob" android:name=".services.UpdateCalendarJob"
android:permission="android.permission.BIND_JOB_SERVICE" android:permission="android.permission.BIND_JOB_SERVICE"
android:exported="true"/> android:exported="true"/>
<service
android:name=".services.LocationService"
android:enabled="true"
android:exported="false"
android:foregroundServiceType="location" />
</application> </application>
<queries>
<package android:name="com.google.android.apps.fitness"/>
</queries>
</manifest> </manifest>

@ -24,6 +24,7 @@ import com.tommasoberlose.anotherwidget.R
import com.tommasoberlose.anotherwidget.helpers.ColorHelper import com.tommasoberlose.anotherwidget.helpers.ColorHelper
import com.tommasoberlose.anotherwidget.helpers.ColorHelper.isColorDark import com.tommasoberlose.anotherwidget.helpers.ColorHelper.isColorDark
import com.tommasoberlose.anotherwidget.utils.expand import com.tommasoberlose.anotherwidget.utils.expand
import com.tommasoberlose.anotherwidget.utils.isDarkTheme
import com.tommasoberlose.anotherwidget.utils.reveal import com.tommasoberlose.anotherwidget.utils.reveal
import com.tommasoberlose.anotherwidget.utils.toPixel import com.tommasoberlose.anotherwidget.utils.toPixel
import com.warkiz.widget.IndicatorSeekBar import com.warkiz.widget.IndicatorSeekBar
@ -93,6 +94,7 @@ class BottomSheetColorPicker(
injector injector
.with<MaterialCardView>(R.id.color) { .with<MaterialCardView>(R.id.color) {
it.setCardBackgroundColor(ColorStateList.valueOf(item)) it.setCardBackgroundColor(ColorStateList.valueOf(item))
it.strokeWidth = if ((colors.indexOf(item) == 0 && !context.isDarkTheme()) || (colors.indexOf(item) == 10 && context.isDarkTheme())) 2 else 0
} }
.with<AppCompatImageView>(R.id.check) { .with<AppCompatImageView>(R.id.check) {
if (getSelected?.invoke() == item) { if (getSelected?.invoke() == item) {

@ -45,49 +45,49 @@ object GlanceProviderHelper {
Constants.GlanceProviderId.NEXT_CLOCK_ALARM -> { Constants.GlanceProviderId.NEXT_CLOCK_ALARM -> {
GlanceProvider(providerId.id, GlanceProvider(providerId.id,
context.getString(R.string.settings_show_next_alarm_title), context.getString(R.string.settings_show_next_alarm_title),
R.drawable.round_access_alarm R.drawable.round_access_alarm_24
) )
} }
Constants.GlanceProviderId.PLAYING_SONG -> { Constants.GlanceProviderId.PLAYING_SONG -> {
GlanceProvider(providerId.id, GlanceProvider(providerId.id,
context.getString(R.string.settings_show_music_title), context.getString(R.string.settings_show_music_title),
R.drawable.round_music_note R.drawable.round_music_note_24
) )
} }
Constants.GlanceProviderId.CUSTOM_INFO -> { Constants.GlanceProviderId.CUSTOM_INFO -> {
GlanceProvider(providerId.id, GlanceProvider(providerId.id,
context.getString(R.string.settings_custom_notes_title), context.getString(R.string.settings_custom_notes_title),
R.drawable.round_sticky_note_2 R.drawable.round_sticky_note_2_24
) )
} }
Constants.GlanceProviderId.BATTERY_LEVEL_LOW -> { Constants.GlanceProviderId.BATTERY_LEVEL_LOW -> {
GlanceProvider(providerId.id, GlanceProvider(providerId.id,
context.getString(R.string.settings_low_battery_level_title), context.getString(R.string.settings_low_battery_level_title),
R.drawable.round_battery_charging_full R.drawable.round_battery_charging_full_24
) )
} }
Constants.GlanceProviderId.GOOGLE_FIT_STEPS -> { Constants.GlanceProviderId.GOOGLE_FIT_STEPS -> {
GlanceProvider(providerId.id, GlanceProvider(providerId.id,
context.getString(R.string.settings_daily_steps_title), context.getString(R.string.settings_daily_steps_title),
R.drawable.round_favorite_border R.drawable.round_favorite_border_24
) )
} }
Constants.GlanceProviderId.NOTIFICATIONS -> { Constants.GlanceProviderId.NOTIFICATIONS -> {
GlanceProvider(providerId.id, GlanceProvider(providerId.id,
context.getString(R.string.settings_show_notifications_title), context.getString(R.string.settings_show_notifications_title),
R.drawable.round_notifications R.drawable.round_notifications_24
) )
} }
Constants.GlanceProviderId.GREETINGS -> { Constants.GlanceProviderId.GREETINGS -> {
GlanceProvider(providerId.id, GlanceProvider(providerId.id,
context.getString(R.string.settings_show_greetings_title), context.getString(R.string.settings_show_greetings_title),
R.drawable.round_history_edu R.drawable.round_history_edu_24
) )
} }
Constants.GlanceProviderId.EVENTS -> { Constants.GlanceProviderId.EVENTS -> {
GlanceProvider(providerId.id, GlanceProvider(providerId.id,
context.getString(R.string.settings_show_events_as_glance_provider_title), context.getString(R.string.settings_show_events_as_glance_provider_title),
R.drawable.round_event_note R.drawable.round_event_note_24
) )
} }
} }

@ -10,6 +10,7 @@ import com.tommasoberlose.anotherwidget.R
import com.tommasoberlose.anotherwidget.global.Constants import com.tommasoberlose.anotherwidget.global.Constants
import com.tommasoberlose.anotherwidget.global.Preferences import com.tommasoberlose.anotherwidget.global.Preferences
import com.tommasoberlose.anotherwidget.network.WeatherNetworkApi import com.tommasoberlose.anotherwidget.network.WeatherNetworkApi
import com.tommasoberlose.anotherwidget.services.LocationService
import com.tommasoberlose.anotherwidget.ui.fragments.MainFragment import com.tommasoberlose.anotherwidget.ui.fragments.MainFragment
import com.tommasoberlose.anotherwidget.ui.widgets.MainWidget import com.tommasoberlose.anotherwidget.ui.widgets.MainWidget
import com.tommasoberlose.anotherwidget.utils.checkGrantedPermission import com.tommasoberlose.anotherwidget.utils.checkGrantedPermission
@ -31,26 +32,8 @@ object WeatherHelper {
val networkApi = WeatherNetworkApi(context) val networkApi = WeatherNetworkApi(context)
if (Preferences.customLocationAdd != "") { if (Preferences.customLocationAdd != "") {
networkApi.updateWeather() networkApi.updateWeather()
} else if (context.checkGrantedPermission(if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) Manifest.permission.ACCESS_BACKGROUND_LOCATION else Manifest.permission.ACCESS_FINE_LOCATION)) { } else if (context.checkGrantedPermission(Manifest.permission.ACCESS_FINE_LOCATION)) {
LocationServices.getFusedLocationProviderClient(context).lastLocation.addOnCompleteListener { task -> LocationService.requestNewLocation(context)
if (task.isSuccessful) {
val location = task.result
if (location != null) {
Preferences.customLocationLat = location.latitude.toString()
Preferences.customLocationLon = location.longitude.toString()
}
CoroutineScope(Dispatchers.IO).launch {
networkApi.updateWeather()
}
EventBus.getDefault().post(MainFragment.UpdateUiMessageEvent())
} else {
CoroutineScope(Dispatchers.IO).launch {
networkApi.updateWeather()
}
EventBus.getDefault().post(MainFragment.UpdateUiMessageEvent())
}
}
} }
} }

@ -37,21 +37,16 @@ class NotificationListener : NotificationListenerService() {
if (bundle.containsKey(Notification.EXTRA_TITLE) && !isGroupHeader && !isOngoing && ActiveNotificationsHelper.isAppAccepted(sbn.packageName) && !sbn.packageName.contains("com.android.systemui")) { if (bundle.containsKey(Notification.EXTRA_TITLE) && !isGroupHeader && !isOngoing && ActiveNotificationsHelper.isAppAccepted(sbn.packageName) && !sbn.packageName.contains("com.android.systemui")) {
Preferences.lastNotificationId = sbn.id Preferences.lastNotificationId = sbn.id
Preferences.lastNotificationTitle = bundle.getString(Notification.EXTRA_TITLE) ?: "" Preferences.lastNotificationTitle = bundle.getString(Notification.EXTRA_TITLE) ?: ""
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { try {
try { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
Preferences.lastNotificationIcon = sbn.notification.smallIcon.resId Preferences.lastNotificationIcon = sbn.notification.smallIcon.resId
} catch (ex: Exception) { } else {
Preferences.lastNotificationIcon = 0
}
Preferences.lastNotificationPackage = sbn.packageName
} else {
try {
Preferences.lastNotificationIcon = sbn.notification.icon Preferences.lastNotificationIcon = sbn.notification.icon
} catch (ex: Exception) {
Preferences.lastNotificationIcon = 0
} }
Preferences.lastNotificationPackage = sbn.packageName } catch (ex: Exception) {
Preferences.lastNotificationIcon = 0
} }
Preferences.lastNotificationPackage = sbn.packageName
MainWidget.updateWidget(this) MainWidget.updateWidget(this)
setTimeout(this) setTimeout(this)
} }

@ -0,0 +1,129 @@
package com.tommasoberlose.anotherwidget.services
import android.Manifest
import android.app.*
import android.app.job.JobScheduler
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import android.location.Address
import android.location.Geocoder
import android.os.IBinder
import android.util.Log
import androidx.core.app.*
import androidx.core.content.ContextCompat
import com.google.android.gms.location.LocationServices
import com.tommasoberlose.anotherwidget.R
import com.tommasoberlose.anotherwidget.global.Preferences
import com.tommasoberlose.anotherwidget.network.WeatherNetworkApi
import com.tommasoberlose.anotherwidget.ui.activities.MainActivity
import com.tommasoberlose.anotherwidget.ui.fragments.MainFragment
import kotlinx.coroutines.*
import org.greenrobot.eventbus.EventBus
import java.lang.Exception
import java.util.*
import kotlin.collections.ArrayList
class LocationService : Service() {
private val jobs: ArrayList<Job> = ArrayList()
override fun onCreate() {
super.onCreate()
startForeground(LOCATION_ACCESS_NOTIFICATION_ID, getLocationAccessNotification())
}
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
if (ActivityCompat.checkSelfPermission(
this,
Manifest.permission.ACCESS_FINE_LOCATION
) == PackageManager.PERMISSION_GRANTED
) {
jobs += GlobalScope.launch(Dispatchers.IO) {
LocationServices.getFusedLocationProviderClient(this@LocationService).lastLocation.addOnCompleteListener { task ->
val networkApi = WeatherNetworkApi(this@LocationService)
if (task.isSuccessful) {
val location = task.result
if (location != null) {
Preferences.customLocationLat = location.latitude.toString()
Preferences.customLocationLon = location.longitude.toString()
}
CoroutineScope(Dispatchers.IO).launch {
networkApi.updateWeather()
withContext(Dispatchers.Main) {
stopSelf()
}
}
EventBus.getDefault().post(MainFragment.UpdateUiMessageEvent())
} else {
CoroutineScope(Dispatchers.IO).launch {
networkApi.updateWeather()
withContext(Dispatchers.Main) {
stopSelf()
}
}
EventBus.getDefault().post(MainFragment.UpdateUiMessageEvent())
}
}
}
} else {
stopSelf()
}
return START_STICKY
}
override fun onDestroy() {
super.onDestroy()
jobs.forEach {
it.cancel()
}
}
companion object {
const val LOCATION_ACCESS_NOTIFICATION_ID = 28465
@JvmStatic
fun requestNewLocation(context: Context) {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
context.startForegroundService(Intent(context, LocationService::class.java))
} else {
context.startService(Intent(context, LocationService::class.java))
}
}
}
override fun onBind(intent: Intent?): IBinder? {
return null
}
private fun getLocationAccessNotification(): Notification {
with(NotificationManagerCompat.from(this)) {
// Create channel
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
createNotificationChannel(
NotificationChannel(
getString(R.string.location_access_notification_channel_id),
getString(R.string.location_access_notification_channel_name),
NotificationManager.IMPORTANCE_LOW
).apply {
description = getString(R.string.location_access_notification_channel_description)
}
)
}
val builder = NotificationCompat.Builder(this@LocationService, getString(R.string.location_access_notification_channel_id))
.setSmallIcon(R.drawable.ic_stat_notification)
.setContentTitle(getString(R.string.location_access_notification_title))
.setStyle(NotificationCompat.BigTextStyle().bigText(getString(R.string.location_access_notification_subtitle)))
.setOngoing(true)
.setColor(ContextCompat.getColor(this@LocationService, R.color.colorAccent))
// Main intent that open the activity
builder.setContentIntent(PendingIntent.getActivity(this@LocationService, 0, Intent(this@LocationService, MainActivity::class.java), PendingIntent.FLAG_UPDATE_CURRENT))
return builder.build()
}
}
}

@ -85,6 +85,24 @@ class UpdateCalendarJob : JobIntentService() {
instance.end = instance.end =
end.timeInMillis - end.timeZone.getOffset(end.timeInMillis) end.timeInMillis - end.timeZone.getOffset(end.timeInMillis)
} }
// Check all day events
val startDate = Calendar.getInstance()
startDate.timeInMillis = instance.begin
val endDate = Calendar.getInstance()
endDate.timeInMillis = instance.end
val isAllDay = e.allDay || (
startDate.get(Calendar.MILLISECOND) == 0
&& startDate.get(Calendar.SECOND) == 0
&& startDate.get(Calendar.MINUTE) == 0
&& startDate.get(Calendar.HOUR_OF_DAY) == 0
&& endDate.get(Calendar.MILLISECOND) == 0
&& endDate.get(Calendar.SECOND) == 0
&& endDate.get(Calendar.MINUTE) == 0
&& endDate.get(Calendar.HOUR_OF_DAY) == 0
)
eventList.add( eventList.add(
Event( Event(
id = instance.id, id = instance.id,
@ -93,7 +111,7 @@ class UpdateCalendarJob : JobIntentService() {
startDate = instance.begin, startDate = instance.begin,
endDate = instance.end, endDate = instance.end,
calendarID = e.calendarId.toInt(), calendarID = e.calendarId.toInt(),
allDay = e.allDay, allDay = isAllDay,
address = e.eventLocation ?: "", address = e.eventLocation ?: "",
selfAttendeeStatus = e.selfAttendeeStatus.toInt(), selfAttendeeStatus = e.selfAttendeeStatus.toInt(),
availability = e.availability availability = e.availability

@ -53,7 +53,7 @@ class ChooseApplicationActivity : AppCompatActivity() {
.register<String>(R.layout.application_info_layout) { _, injector -> .register<String>(R.layout.application_info_layout) { _, injector ->
injector injector
.text(R.id.text, getString(R.string.default_name)) .text(R.id.text, getString(R.string.default_name))
.image(R.id.icon, R.drawable.round_add_to_home_screen) .image(R.id.icon, R.drawable.round_add_to_home_screen_24)
.with<ImageView>(R.id.icon) { .with<ImageView>(R.id.icon) {
it.scaleX = 0.8f it.scaleX = 0.8f
it.scaleY = 0.8f it.scaleY = 0.8f

@ -140,7 +140,7 @@ class CustomLocationActivity : AppCompatActivity() {
private fun requirePermission() { private fun requirePermission() {
Dexter.withContext(this) Dexter.withContext(this)
.withPermissions( .withPermissions(
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) Manifest.permission.ACCESS_BACKGROUND_LOCATION else Manifest.permission.ACCESS_FINE_LOCATION Manifest.permission.ACCESS_FINE_LOCATION
).withListener(object: MultiplePermissionsListener { ).withListener(object: MultiplePermissionsListener {
override fun onPermissionsChecked(report: MultiplePermissionsReport?) { override fun onPermissionsChecked(report: MultiplePermissionsReport?) {
report?.let { report?.let {

@ -129,7 +129,7 @@ class WeatherProviderActivity : AppCompatActivity() {
it.isVisible = false it.isVisible = false
} }
} }
.image(R.id.action_configure, ContextCompat.getDrawable(this, if (WeatherHelper.isKeyRequired(provider)) R.drawable.round_settings else R.drawable.outline_info_white)) .image(R.id.action_configure, ContextCompat.getDrawable(this, if (WeatherHelper.isKeyRequired(provider)) R.drawable.round_settings_24 else R.drawable.outline_info_24))
}.attachTo(list_view) }.attachTo(list_view)
adapter.updateData( adapter.updateData(

@ -351,7 +351,7 @@ class MainFragment : Fragment(), SharedPreferences.OnSharedPreferenceChangeList
}?.isVisible = if (Preferences.showWeather) { }?.isVisible = if (Preferences.showWeather) {
(WeatherHelper.isKeyRequired() && WeatherHelper.getApiKey() == "") (WeatherHelper.isKeyRequired() && WeatherHelper.getApiKey() == "")
|| (Preferences.customLocationAdd == "" && activity?.checkGrantedPermission( || (Preferences.customLocationAdd == "" && activity?.checkGrantedPermission(
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) Manifest.permission.ACCESS_BACKGROUND_LOCATION else Manifest.permission.ACCESS_FINE_LOCATION Manifest.permission.ACCESS_FINE_LOCATION
) != true) ) != true)
|| (Preferences.weatherProviderError != "" && Preferences.weatherProviderError != "-") || (Preferences.weatherProviderError != "" && Preferences.weatherProviderError != "-")
|| (Preferences.weatherProviderLocationError != "") || (Preferences.weatherProviderLocationError != "")

@ -161,12 +161,7 @@ class WeatherTabFragment : Fragment() {
} }
private fun checkLocationPermission() { private fun checkLocationPermission() {
// Background permission if (requireActivity().checkGrantedPermission(Manifest.permission.ACCESS_FINE_LOCATION)) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && activity?.checkGrantedPermission(Manifest.permission.ACCESS_FINE_LOCATION) == true && activity?.checkGrantedPermission(Manifest.permission.ACCESS_BACKGROUND_LOCATION) != true) {
requirePermission()
}
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?.isVisible = false location_permission_alert?.isVisible = false
background_location_warning.isVisible = Preferences.customLocationAdd == "" background_location_warning.isVisible = Preferences.customLocationAdd == ""
WeatherReceiver.setUpdates(requireContext()) WeatherReceiver.setUpdates(requireContext())
@ -299,7 +294,7 @@ class WeatherTabFragment : Fragment() {
private fun requirePermission() { private fun requirePermission() {
Dexter.withContext(requireContext()) Dexter.withContext(requireContext())
.withPermissions( .withPermissions(
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) Manifest.permission.ACCESS_BACKGROUND_LOCATION else Manifest.permission.ACCESS_FINE_LOCATION Manifest.permission.ACCESS_FINE_LOCATION
).withListener(object: MultiplePermissionsListener { ).withListener(object: MultiplePermissionsListener {
override fun onPermissionsChecked(report: MultiplePermissionsReport?) { override fun onPermissionsChecked(report: MultiplePermissionsReport?) {
report?.let { report?.let {

@ -605,7 +605,7 @@ class MainWidget : AppWidgetProvider() {
v.second_row_icon.setImageDrawable( v.second_row_icon.setImageDrawable(
ContextCompat.getDrawable( ContextCompat.getDrawable(
context, context,
R.drawable.round_place R.drawable.round_place_24
) )
) )
v.next_event_date.text = nextEvent.address v.next_event_date.text = nextEvent.address
@ -613,7 +613,7 @@ class MainWidget : AppWidgetProvider() {
v.second_row_icon.setImageDrawable( v.second_row_icon.setImageDrawable(
ContextCompat.getDrawable( ContextCompat.getDrawable(
context, context,
R.drawable.round_today R.drawable.round_today_24
) )
) )
if (!nextEvent.allDay) { if (!nextEvent.allDay) {
@ -694,7 +694,7 @@ class MainWidget : AppWidgetProvider() {
v.second_row_icon.setImageDrawable( v.second_row_icon.setImageDrawable(
ContextCompat.getDrawable( ContextCompat.getDrawable(
context, context,
R.drawable.round_music_note R.drawable.round_music_note_24
) )
) )
v.next_event_date.text = MediaPlayerHelper.getMediaInfo() v.next_event_date.text = MediaPlayerHelper.getMediaInfo()
@ -707,7 +707,7 @@ class MainWidget : AppWidgetProvider() {
v.second_row_icon.setImageDrawable( v.second_row_icon.setImageDrawable(
ContextCompat.getDrawable( ContextCompat.getDrawable(
context, context,
R.drawable.round_alarm R.drawable.round_alarm_24
) )
) )
v.next_event_date.text = AlarmHelper.getNextAlarm(context) v.next_event_date.text = AlarmHelper.getNextAlarm(context)
@ -807,7 +807,7 @@ class MainWidget : AppWidgetProvider() {
v.second_row_icon.setImageDrawable( v.second_row_icon.setImageDrawable(
ContextCompat.getDrawable( ContextCompat.getDrawable(
context, context,
R.drawable.round_today R.drawable.round_today_24
) )
) )
showSomething = true showSomething = true

@ -21,6 +21,7 @@ import android.content.Intent
import android.content.res.Resources import android.content.res.Resources
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.util.DisplayMetrics import android.util.DisplayMetrics
import android.util.Log
import android.util.TypedValue import android.util.TypedValue
import android.view.ViewPropertyAnimator import android.view.ViewPropertyAnimator
import android.view.animation.Animation import android.view.animation.Animation

Binary file not shown.

After

(image error) Size: 674 B

Binary file not shown.

Before

(image error) Size: 518 B

Binary file not shown.

Before

(image error) Size: 449 B

Binary file not shown.

Before

(image error) Size: 751 B

Binary file not shown.

Before

(image error) Size: 953 B

Binary file not shown.

Before

(image error) Size: 868 B

Binary file not shown.

Before

(image error) Size: 459 B

Binary file not shown.

Before

(image error) Size: 601 B

Binary file not shown.

Before

(image error) Size: 1.1 KiB

Binary file not shown.

Before

(image error) Size: 229 B

Binary file not shown.

Before

(image error) Size: 465 B

Binary file not shown.

Before

(image error) Size: 548 B

Binary file not shown.

Before

(image error) Size: 804 B

Binary file not shown.

Before

(image error) Size: 1013 B

Binary file not shown.

Before

(image error) Size: 399 B

Binary file not shown.

Before

(image error) Size: 277 B

Binary file not shown.

Before

(image error) Size: 289 B

Binary file not shown.

Before

(image error) Size: 439 B

Binary file not shown.

Before

(image error) Size: 150 B

Binary file not shown.

Before

(image error) Size: 163 B

Binary file not shown.

Before

(image error) Size: 242 B

Binary file not shown.

Before

(image error) Size: 1.1 KiB

Binary file not shown.

Before

(image error) Size: 459 B

Binary file not shown.

Before

(image error) Size: 601 B

Binary file not shown.

Before

(image error) Size: 868 B

Binary file not shown.

Before

(image error) Size: 465 B

Binary file not shown.

Before

(image error) Size: 399 B

Binary file not shown.

Before

(image error) Size: 665 B

Binary file not shown.

Before

(image error) Size: 867 B

Binary file not shown.

Before

(image error) Size: 329 B

Binary file not shown.

Before

(image error) Size: 407 B

Binary file not shown.

Before

(image error) Size: 538 B

Binary file not shown.

Before

(image error) Size: 648 B

Binary file not shown.

Before

(image error) Size: 183 B

Binary file not shown.

Before

(image error) Size: 158 B

Binary file not shown.

Before

(image error) Size: 183 B

Binary file not shown.

Before

(image error) Size: 244 B

Binary file not shown.

Before

(image error) Size: 275 B

Binary file not shown.

Before

(image error) Size: 536 B

Binary file not shown.

Before

(image error) Size: 466 B

Binary file not shown.

Before

(image error) Size: 778 B

Binary file not shown.

Before

(image error) Size: 1005 B

Binary file not shown.

Before

(image error) Size: 295 B

Binary file not shown.

Before

(image error) Size: 275 B

Binary file not shown.

Before

(image error) Size: 399 B

Binary file not shown.

Before

(image error) Size: 428 B

Binary file not shown.

Before

(image error) Size: 426 B

Binary file not shown.

Before

(image error) Size: 238 B

Binary file not shown.

Before

(image error) Size: 263 B

Binary file not shown.

Before

(image error) Size: 355 B

Binary file not shown.

Before

(image error) Size: 186 B

Binary file not shown.

Before

(image error) Size: 184 B

Binary file not shown.

Before

(image error) Size: 241 B

Binary file not shown.

Before

(image error) Size: 248 B

Binary file not shown.

Before

(image error) Size: 616 B

Binary file not shown.

Before

(image error) Size: 324 B

Binary file not shown.

Before

(image error) Size: 372 B

Binary file not shown.

Before

(image error) Size: 517 B

Binary file not shown.

Before

(image error) Size: 361 B

Binary file not shown.

Before

(image error) Size: 333 B

Binary file not shown.

Before

(image error) Size: 509 B

Binary file not shown.

Before

(image error) Size: 642 B

Binary file not shown.

Before

(image error) Size: 393 B

Binary file not shown.

Before

(image error) Size: 441 B

Binary file not shown.

Before

(image error) Size: 628 B

Binary file not shown.

Before

(image error) Size: 802 B

Binary file not shown.

Before

(image error) Size: 399 B

Binary file not shown.

Before

(image error) Size: 362 B

Binary file not shown.

Before

(image error) Size: 541 B

Binary file not shown.

Before

(image error) Size: 689 B

Binary file not shown.

Before

(image error) Size: 444 B

Binary file not shown.

Before

(image error) Size: 304 B

Binary file not shown.

Before

(image error) Size: 295 B

Binary file not shown.

Before

(image error) Size: 538 B

Binary file not shown.

Before

(image error) Size: 273 B

Binary file not shown.

Before

(image error) Size: 184 B

Binary file not shown.

Before

(image error) Size: 195 B

Binary file not shown.

Before

(image error) Size: 295 B

Binary file not shown.

Before

(image error) Size: 507 B

Binary file not shown.

Before

(image error) Size: 276 B

Binary file not shown.

Before

(image error) Size: 304 B

Binary file not shown.

Before

(image error) Size: 427 B

Binary file not shown.

Before

(image error) Size: 345 B

Binary file not shown.

Before

(image error) Size: 292 B

Some files were not shown because too many files have changed in this diff Show More