Merge develop
23
.idea/assetWizardSettings.xml
generated
@ -123,6 +123,29 @@
|
||||
</PersistentState>
|
||||
</value>
|
||||
</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>
|
||||
</option>
|
||||
</component>
|
||||
|
@ -16,15 +16,15 @@ apikeyProperties.load(new FileInputStream(apikeyPropertiesFile))
|
||||
|
||||
android {
|
||||
|
||||
compileSdkVersion 29
|
||||
compileSdkVersion 30
|
||||
buildToolsVersion "29.0.3"
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.tommasoberlose.anotherwidget"
|
||||
minSdkVersion 23
|
||||
targetSdkVersion 29
|
||||
versionCode 111
|
||||
versionName "2.0.15"
|
||||
targetSdkVersion 30
|
||||
versionCode 114
|
||||
versionName "2.1.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
buildConfigField("String", "GOOGLE_API_KEY", apikeyProperties['GOOGLE_API_KEY'])
|
||||
@ -72,9 +72,9 @@ dependencies {
|
||||
|
||||
// UI
|
||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.2'
|
||||
implementation 'com.google.android.material:material:1.3.0-alpha03'
|
||||
implementation 'androidx.browser:browser:1.2.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
||||
implementation 'com.google.android.material:material:1.3.0-beta01'
|
||||
implementation 'androidx.browser:browser:1.3.0'
|
||||
implementation 'net.idik:slimadapter:2.1.2'
|
||||
implementation 'com.google.android:flexbox:2.0.1'
|
||||
|
||||
@ -89,8 +89,8 @@ dependencies {
|
||||
implementation 'org.greenrobot:eventbus:3.2.0'
|
||||
|
||||
// Navigation
|
||||
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.1'
|
||||
implementation 'androidx.navigation:navigation-ui-ktx:2.3.1'
|
||||
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.2'
|
||||
implementation 'androidx.navigation:navigation-ui-ktx:2.3.2'
|
||||
|
||||
// Other
|
||||
implementation 'androidx.multidex:multidex:2.0.1'
|
||||
@ -103,7 +103,7 @@ dependencies {
|
||||
kapt 'com.github.bumptech.glide:compiler:4.11.0'
|
||||
|
||||
// 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'
|
||||
|
||||
//Weather
|
||||
@ -111,8 +111,8 @@ dependencies {
|
||||
implementation 'com.google.android.gms:play-services-location:17.1.0'
|
||||
|
||||
// Billing
|
||||
implementation 'com.android.billingclient:billing:3.0.1'
|
||||
implementation 'com.android.billingclient:billing-ktx:3.0.1'
|
||||
implementation 'com.android.billingclient:billing:3.0.2'
|
||||
implementation 'com.android.billingclient:billing-ktx:3.0.2'
|
||||
|
||||
// KTX
|
||||
implementation "androidx.core:core-ktx:1.3.2"
|
||||
@ -128,10 +128,10 @@ dependencies {
|
||||
implementation "com.github.haroldadmin:NetworkResponseAdapter:4.0.1"
|
||||
|
||||
//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.
|
||||
implementation 'com.google.firebase:firebase-crashlytics:17.2.2'
|
||||
implementation 'com.google.firebase:firebase-crashlytics:17.3.0'
|
||||
|
||||
// Preferences
|
||||
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.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.RECEIVE_BOOT_COMPLETED" />
|
||||
<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.gms.permission.ACTIVITY_RECOGNITION"/>
|
||||
<uses-permission android:name="com.google.android.gms.permission.ACTIVITY_RECOGNITION" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
|
||||
|
||||
<application
|
||||
@ -154,6 +154,14 @@
|
||||
android:name=".services.UpdateCalendarJob"
|
||||
android:permission="android.permission.BIND_JOB_SERVICE"
|
||||
android:exported="true"/>
|
||||
<service
|
||||
android:name=".services.LocationService"
|
||||
android:enabled="true"
|
||||
android:exported="false"
|
||||
android:foregroundServiceType="location" />
|
||||
</application>
|
||||
|
||||
<queries>
|
||||
<package android:name="com.google.android.apps.fitness"/>
|
||||
</queries>
|
||||
</manifest>
|
@ -24,6 +24,7 @@ import com.tommasoberlose.anotherwidget.R
|
||||
import com.tommasoberlose.anotherwidget.helpers.ColorHelper
|
||||
import com.tommasoberlose.anotherwidget.helpers.ColorHelper.isColorDark
|
||||
import com.tommasoberlose.anotherwidget.utils.expand
|
||||
import com.tommasoberlose.anotherwidget.utils.isDarkTheme
|
||||
import com.tommasoberlose.anotherwidget.utils.reveal
|
||||
import com.tommasoberlose.anotherwidget.utils.toPixel
|
||||
import com.warkiz.widget.IndicatorSeekBar
|
||||
@ -93,6 +94,7 @@ class BottomSheetColorPicker(
|
||||
injector
|
||||
.with<MaterialCardView>(R.id.color) {
|
||||
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) {
|
||||
if (getSelected?.invoke() == item) {
|
||||
|
@ -45,49 +45,49 @@ object GlanceProviderHelper {
|
||||
Constants.GlanceProviderId.NEXT_CLOCK_ALARM -> {
|
||||
GlanceProvider(providerId.id,
|
||||
context.getString(R.string.settings_show_next_alarm_title),
|
||||
R.drawable.round_access_alarm
|
||||
R.drawable.round_access_alarm_24
|
||||
)
|
||||
}
|
||||
Constants.GlanceProviderId.PLAYING_SONG -> {
|
||||
GlanceProvider(providerId.id,
|
||||
context.getString(R.string.settings_show_music_title),
|
||||
R.drawable.round_music_note
|
||||
R.drawable.round_music_note_24
|
||||
)
|
||||
}
|
||||
Constants.GlanceProviderId.CUSTOM_INFO -> {
|
||||
GlanceProvider(providerId.id,
|
||||
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 -> {
|
||||
GlanceProvider(providerId.id,
|
||||
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 -> {
|
||||
GlanceProvider(providerId.id,
|
||||
context.getString(R.string.settings_daily_steps_title),
|
||||
R.drawable.round_favorite_border
|
||||
R.drawable.round_favorite_border_24
|
||||
)
|
||||
}
|
||||
Constants.GlanceProviderId.NOTIFICATIONS -> {
|
||||
GlanceProvider(providerId.id,
|
||||
context.getString(R.string.settings_show_notifications_title),
|
||||
R.drawable.round_notifications
|
||||
R.drawable.round_notifications_24
|
||||
)
|
||||
}
|
||||
Constants.GlanceProviderId.GREETINGS -> {
|
||||
GlanceProvider(providerId.id,
|
||||
context.getString(R.string.settings_show_greetings_title),
|
||||
R.drawable.round_history_edu
|
||||
R.drawable.round_history_edu_24
|
||||
)
|
||||
}
|
||||
Constants.GlanceProviderId.EVENTS -> {
|
||||
GlanceProvider(providerId.id,
|
||||
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.Preferences
|
||||
import com.tommasoberlose.anotherwidget.network.WeatherNetworkApi
|
||||
import com.tommasoberlose.anotherwidget.services.LocationService
|
||||
import com.tommasoberlose.anotherwidget.ui.fragments.MainFragment
|
||||
import com.tommasoberlose.anotherwidget.ui.widgets.MainWidget
|
||||
import com.tommasoberlose.anotherwidget.utils.checkGrantedPermission
|
||||
@ -31,26 +32,8 @@ object WeatherHelper {
|
||||
val networkApi = WeatherNetworkApi(context)
|
||||
if (Preferences.customLocationAdd != "") {
|
||||
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)) {
|
||||
LocationServices.getFusedLocationProviderClient(context).lastLocation.addOnCompleteListener { task ->
|
||||
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())
|
||||
}
|
||||
}
|
||||
} else if (context.checkGrantedPermission(Manifest.permission.ACCESS_FINE_LOCATION)) {
|
||||
LocationService.requestNewLocation(context)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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")) {
|
||||
Preferences.lastNotificationId = sbn.id
|
||||
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
|
||||
} catch (ex: Exception) {
|
||||
Preferences.lastNotificationIcon = 0
|
||||
}
|
||||
Preferences.lastNotificationPackage = sbn.packageName
|
||||
} else {
|
||||
try {
|
||||
} else {
|
||||
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)
|
||||
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 =
|
||||
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(
|
||||
Event(
|
||||
id = instance.id,
|
||||
@ -93,7 +111,7 @@ class UpdateCalendarJob : JobIntentService() {
|
||||
startDate = instance.begin,
|
||||
endDate = instance.end,
|
||||
calendarID = e.calendarId.toInt(),
|
||||
allDay = e.allDay,
|
||||
allDay = isAllDay,
|
||||
address = e.eventLocation ?: "",
|
||||
selfAttendeeStatus = e.selfAttendeeStatus.toInt(),
|
||||
availability = e.availability
|
||||
|
@ -53,7 +53,7 @@ class ChooseApplicationActivity : AppCompatActivity() {
|
||||
.register<String>(R.layout.application_info_layout) { _, injector ->
|
||||
injector
|
||||
.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) {
|
||||
it.scaleX = 0.8f
|
||||
it.scaleY = 0.8f
|
||||
|
@ -140,7 +140,7 @@ class CustomLocationActivity : AppCompatActivity() {
|
||||
private fun requirePermission() {
|
||||
Dexter.withContext(this)
|
||||
.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 {
|
||||
override fun onPermissionsChecked(report: MultiplePermissionsReport?) {
|
||||
report?.let {
|
||||
|
@ -129,7 +129,7 @@ class WeatherProviderActivity : AppCompatActivity() {
|
||||
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)
|
||||
|
||||
adapter.updateData(
|
||||
|
@ -351,7 +351,7 @@ class MainFragment : Fragment(), SharedPreferences.OnSharedPreferenceChangeList
|
||||
}?.isVisible = if (Preferences.showWeather) {
|
||||
(WeatherHelper.isKeyRequired() && WeatherHelper.getApiKey() == "")
|
||||
|| (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)
|
||||
|| (Preferences.weatherProviderError != "" && Preferences.weatherProviderError != "-")
|
||||
|| (Preferences.weatherProviderLocationError != "")
|
||||
|
@ -161,12 +161,7 @@ class WeatherTabFragment : Fragment() {
|
||||
}
|
||||
|
||||
private fun checkLocationPermission() {
|
||||
// Background permission
|
||||
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) {
|
||||
if (requireActivity().checkGrantedPermission(Manifest.permission.ACCESS_FINE_LOCATION)) {
|
||||
location_permission_alert?.isVisible = false
|
||||
background_location_warning.isVisible = Preferences.customLocationAdd == ""
|
||||
WeatherReceiver.setUpdates(requireContext())
|
||||
@ -299,7 +294,7 @@ class WeatherTabFragment : Fragment() {
|
||||
private fun requirePermission() {
|
||||
Dexter.withContext(requireContext())
|
||||
.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 {
|
||||
override fun onPermissionsChecked(report: MultiplePermissionsReport?) {
|
||||
report?.let {
|
||||
|
@ -605,7 +605,7 @@ class MainWidget : AppWidgetProvider() {
|
||||
v.second_row_icon.setImageDrawable(
|
||||
ContextCompat.getDrawable(
|
||||
context,
|
||||
R.drawable.round_place
|
||||
R.drawable.round_place_24
|
||||
)
|
||||
)
|
||||
v.next_event_date.text = nextEvent.address
|
||||
@ -613,7 +613,7 @@ class MainWidget : AppWidgetProvider() {
|
||||
v.second_row_icon.setImageDrawable(
|
||||
ContextCompat.getDrawable(
|
||||
context,
|
||||
R.drawable.round_today
|
||||
R.drawable.round_today_24
|
||||
)
|
||||
)
|
||||
if (!nextEvent.allDay) {
|
||||
@ -694,7 +694,7 @@ class MainWidget : AppWidgetProvider() {
|
||||
v.second_row_icon.setImageDrawable(
|
||||
ContextCompat.getDrawable(
|
||||
context,
|
||||
R.drawable.round_music_note
|
||||
R.drawable.round_music_note_24
|
||||
)
|
||||
)
|
||||
v.next_event_date.text = MediaPlayerHelper.getMediaInfo()
|
||||
@ -707,7 +707,7 @@ class MainWidget : AppWidgetProvider() {
|
||||
v.second_row_icon.setImageDrawable(
|
||||
ContextCompat.getDrawable(
|
||||
context,
|
||||
R.drawable.round_alarm
|
||||
R.drawable.round_alarm_24
|
||||
)
|
||||
)
|
||||
v.next_event_date.text = AlarmHelper.getNextAlarm(context)
|
||||
@ -807,7 +807,7 @@ class MainWidget : AppWidgetProvider() {
|
||||
v.second_row_icon.setImageDrawable(
|
||||
ContextCompat.getDrawable(
|
||||
context,
|
||||
R.drawable.round_today
|
||||
R.drawable.round_today_24
|
||||
)
|
||||
)
|
||||
showSomething = true
|
||||
|
@ -21,6 +21,7 @@ import android.content.Intent
|
||||
import android.content.res.Resources
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.util.DisplayMetrics
|
||||
import android.util.Log
|
||||
import android.util.TypedValue
|
||||
import android.view.ViewPropertyAnimator
|
||||
import android.view.animation.Animation
|
||||
|
BIN
app/src/main/res/drawable-hdpi/ic_stat_notification.png
Normal file
After Width: | Height: | Size: 674 B |
Before Width: | Height: | Size: 518 B |
Before Width: | Height: | Size: 449 B |
Before Width: | Height: | Size: 751 B |
Before Width: | Height: | Size: 953 B |
Before Width: | Height: | Size: 868 B |
Before Width: | Height: | Size: 459 B |
Before Width: | Height: | Size: 601 B |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 229 B |
Before Width: | Height: | Size: 465 B |
Before Width: | Height: | Size: 548 B |
Before Width: | Height: | Size: 804 B |
Before Width: | Height: | Size: 1013 B |
Before Width: | Height: | Size: 399 B |
Before Width: | Height: | Size: 277 B |
Before Width: | Height: | Size: 289 B |
Before Width: | Height: | Size: 439 B |
Before Width: | Height: | Size: 150 B |
Before Width: | Height: | Size: 163 B |
Before Width: | Height: | Size: 242 B |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 459 B |
Before Width: | Height: | Size: 601 B |
Before Width: | Height: | Size: 868 B |
Before Width: | Height: | Size: 465 B |
Before Width: | Height: | Size: 399 B |
Before Width: | Height: | Size: 665 B |
Before Width: | Height: | Size: 867 B |
Before Width: | Height: | Size: 329 B |
Before Width: | Height: | Size: 407 B |
Before Width: | Height: | Size: 538 B |
Before Width: | Height: | Size: 648 B |
Before Width: | Height: | Size: 183 B |
Before Width: | Height: | Size: 158 B |
Before Width: | Height: | Size: 183 B |
Before Width: | Height: | Size: 244 B |
Before Width: | Height: | Size: 275 B |
Before Width: | Height: | Size: 536 B |
Before Width: | Height: | Size: 466 B |
Before Width: | Height: | Size: 778 B |
Before Width: | Height: | Size: 1005 B |
Before Width: | Height: | Size: 295 B |
Before Width: | Height: | Size: 275 B |
Before Width: | Height: | Size: 399 B |
Before Width: | Height: | Size: 428 B |
Before Width: | Height: | Size: 426 B |
Before Width: | Height: | Size: 238 B |
Before Width: | Height: | Size: 263 B |
Before Width: | Height: | Size: 355 B |
Before Width: | Height: | Size: 186 B |
Before Width: | Height: | Size: 184 B |
Before Width: | Height: | Size: 241 B |
Before Width: | Height: | Size: 248 B |
Before Width: | Height: | Size: 616 B |
Before Width: | Height: | Size: 324 B |
Before Width: | Height: | Size: 372 B |
Before Width: | Height: | Size: 517 B |
Before Width: | Height: | Size: 361 B |
Before Width: | Height: | Size: 333 B |
Before Width: | Height: | Size: 509 B |
Before Width: | Height: | Size: 642 B |
Before Width: | Height: | Size: 393 B |
Before Width: | Height: | Size: 441 B |
Before Width: | Height: | Size: 628 B |
Before Width: | Height: | Size: 802 B |
Before Width: | Height: | Size: 399 B |
Before Width: | Height: | Size: 362 B |
Before Width: | Height: | Size: 541 B |
Before Width: | Height: | Size: 689 B |
Before Width: | Height: | Size: 444 B |
Before Width: | Height: | Size: 304 B |
Before Width: | Height: | Size: 295 B |
Before Width: | Height: | Size: 538 B |
Before Width: | Height: | Size: 273 B |
Before Width: | Height: | Size: 184 B |
Before Width: | Height: | Size: 195 B |
Before Width: | Height: | Size: 295 B |
Before Width: | Height: | Size: 507 B |
Before Width: | Height: | Size: 276 B |
Before Width: | Height: | Size: 304 B |
Before Width: | Height: | Size: 427 B |
Before Width: | Height: | Size: 345 B |
Before Width: | Height: | Size: 292 B |