Fix widget refresh intent

This commit is contained in:
Tommaso Berlose
2021-01-11 09:42:55 +01:00
parent 5176331e84
commit 06583197c7
6 changed files with 29 additions and 10 deletions

View File

@ -12,8 +12,10 @@ import android.provider.CalendarContract
import android.provider.CalendarContract.Events
import android.util.Log
import com.tommasoberlose.anotherwidget.R
import com.tommasoberlose.anotherwidget.global.Actions
import com.tommasoberlose.anotherwidget.global.Preferences
import com.tommasoberlose.anotherwidget.models.Event
import com.tommasoberlose.anotherwidget.receivers.UpdatesReceiver
import com.tommasoberlose.anotherwidget.ui.widgets.MainWidget
import com.tommasoberlose.anotherwidget.utils.toast
import java.util.*
@ -35,6 +37,12 @@ object IntentHelper {
}
}
private fun getWidgetRefreshIntent(context: Context): Intent {
return Intent(context, UpdatesReceiver::class.java).apply {
action = Actions.ACTION_REFRESH
}
}
fun getGoogleMapsIntentFromAddress(context: Context, address: String): Intent {
val gmmIntentUri: Uri = Uri.parse("geo:0,0?q=$address")
val mapIntent = Intent(Intent.ACTION_VIEW, gmmIntentUri)
@ -63,7 +71,7 @@ object IntentHelper {
Intent()
}
REFRESH_WIDGET_OPTION -> {
getWidgetUpdateIntent(context)
getWidgetRefreshIntent(context)
}
else -> {
val pm: PackageManager = context.packageManager
@ -95,7 +103,7 @@ object IntentHelper {
Intent()
}
REFRESH_WIDGET_OPTION -> {
getWidgetUpdateIntent(context)
getWidgetRefreshIntent(context)
}
else -> {
val pm: PackageManager = context.packageManager
@ -183,7 +191,7 @@ object IntentHelper {
Intent()
}
REFRESH_WIDGET_OPTION -> {
getWidgetUpdateIntent(context)
getWidgetRefreshIntent(context)
}
else -> {
val pm: PackageManager = context.packageManager