Use getBroadcast instead of getActivity for ACTION_REFRESH intents.
This commit is contained in:
parent
1389ddbfc0
commit
821980e938
@ -1,5 +1,6 @@
|
|||||||
package com.tommasoberlose.anotherwidget.helpers
|
package com.tommasoberlose.anotherwidget.helpers
|
||||||
|
|
||||||
|
import android.app.PendingIntent
|
||||||
import android.appwidget.AppWidgetManager
|
import android.appwidget.AppWidgetManager
|
||||||
import android.content.ComponentName
|
import android.content.ComponentName
|
||||||
import android.content.ContentUris
|
import android.content.ContentUris
|
||||||
@ -27,6 +28,13 @@ object IntentHelper {
|
|||||||
const val DO_NOTHING_OPTION = "DO_NOTHING"
|
const val DO_NOTHING_OPTION = "DO_NOTHING"
|
||||||
const val REFRESH_WIDGET_OPTION = "REFRESH_WIDGET"
|
const val REFRESH_WIDGET_OPTION = "REFRESH_WIDGET"
|
||||||
|
|
||||||
|
fun getPendingIntent(context: Context, requestCode: Int, intent: Intent, flags: Int): PendingIntent {
|
||||||
|
return if (intent.flags and Intent.FLAG_ACTIVITY_NEW_TASK == Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||||
|
PendingIntent.getActivity(context, requestCode, intent, flags)
|
||||||
|
else
|
||||||
|
PendingIntent.getBroadcast(context, requestCode, intent, 0)
|
||||||
|
}
|
||||||
|
|
||||||
fun getWidgetUpdateIntent(context: Context): Intent {
|
fun getWidgetUpdateIntent(context: Context): Intent {
|
||||||
val widgetManager = AppWidgetManager.getInstance(context)
|
val widgetManager = AppWidgetManager.getInstance(context)
|
||||||
val widgetComponent = ComponentName(context, MainWidget::class.java)
|
val widgetComponent = ComponentName(context, MainWidget::class.java)
|
||||||
@ -40,7 +48,6 @@ object IntentHelper {
|
|||||||
private fun getWidgetRefreshIntent(context: Context): Intent {
|
private fun getWidgetRefreshIntent(context: Context): Intent {
|
||||||
return Intent(context, UpdatesReceiver::class.java).apply {
|
return Intent(context, UpdatesReceiver::class.java).apply {
|
||||||
action = Actions.ACTION_REFRESH
|
action = Actions.ACTION_REFRESH
|
||||||
flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,11 +57,10 @@ object IntentHelper {
|
|||||||
//mapIntent.`package` = "com.google.android.apps.maps"
|
//mapIntent.`package` = "com.google.android.apps.maps"
|
||||||
|
|
||||||
return if (mapIntent.resolveActivity(context.packageManager) != null) {
|
return if (mapIntent.resolveActivity(context.packageManager) != null) {
|
||||||
mapIntent
|
mapIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||||
} else {
|
} else {
|
||||||
val map = "https://www.google.com/maps/search/?api=1&query=${Uri.encode(address)}"
|
val map = "https://www.google.com/maps/search/?api=1&query=${Uri.encode(address)}"
|
||||||
val i = Intent(Intent.ACTION_VIEW, Uri.parse(map))
|
Intent(Intent.ACTION_VIEW, Uri.parse(map)).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||||
i
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +68,6 @@ object IntentHelper {
|
|||||||
return when (Preferences.weatherAppPackage) {
|
return when (Preferences.weatherAppPackage) {
|
||||||
DEFAULT_OPTION -> {
|
DEFAULT_OPTION -> {
|
||||||
Intent(Intent.ACTION_VIEW).apply {
|
Intent(Intent.ACTION_VIEW).apply {
|
||||||
addCategory(Intent.CATEGORY_DEFAULT)
|
|
||||||
flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
data = Uri.parse("dynact://velour/weather/ProxyActivity")
|
data = Uri.parse("dynact://velour/weather/ProxyActivity")
|
||||||
component = ComponentName("com.google.android.googlequicksearchbox", "com.google.android.apps.gsa.velour.DynamicActivityTrampoline")
|
component = ComponentName("com.google.android.googlequicksearchbox", "com.google.android.apps.gsa.velour.DynamicActivityTrampoline")
|
||||||
@ -98,6 +103,7 @@ object IntentHelper {
|
|||||||
return when (Preferences.calendarAppPackage) {
|
return when (Preferences.calendarAppPackage) {
|
||||||
DEFAULT_OPTION -> {
|
DEFAULT_OPTION -> {
|
||||||
Intent(Intent.ACTION_VIEW).apply {
|
Intent(Intent.ACTION_VIEW).apply {
|
||||||
|
flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
data = calendarUri
|
data = calendarUri
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -111,6 +117,8 @@ object IntentHelper {
|
|||||||
val pm: PackageManager = context.packageManager
|
val pm: PackageManager = context.packageManager
|
||||||
try {
|
try {
|
||||||
pm.getLaunchIntentForPackage(Preferences.calendarAppPackage)!!.apply {
|
pm.getLaunchIntentForPackage(Preferences.calendarAppPackage)!!.apply {
|
||||||
|
addCategory(Intent.CATEGORY_LAUNCHER)
|
||||||
|
flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
action = Intent.ACTION_VIEW
|
action = Intent.ACTION_VIEW
|
||||||
data = calendarUri
|
data = calendarUri
|
||||||
}
|
}
|
||||||
@ -209,7 +217,7 @@ object IntentHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun getBatteryIntent(): Intent {
|
fun getBatteryIntent(): Intent {
|
||||||
return Intent(Intent.ACTION_POWER_USAGE_SUMMARY)
|
return Intent(Intent.ACTION_POWER_USAGE_SUMMARY).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getMusicIntent(context: Context): Intent {
|
fun getMusicIntent(context: Context): Intent {
|
||||||
@ -222,6 +230,7 @@ object IntentHelper {
|
|||||||
try {
|
try {
|
||||||
pm.getLaunchIntentForPackage(Preferences.mediaPlayerPackage)!!.apply {
|
pm.getLaunchIntentForPackage(Preferences.mediaPlayerPackage)!!.apply {
|
||||||
addCategory(Intent.CATEGORY_LAUNCHER)
|
addCategory(Intent.CATEGORY_LAUNCHER)
|
||||||
|
flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Intent()
|
Intent()
|
||||||
@ -235,6 +244,7 @@ object IntentHelper {
|
|||||||
return try {
|
return try {
|
||||||
pm.getLaunchIntentForPackage("com.google.android.apps.fitness")!!.apply {
|
pm.getLaunchIntentForPackage("com.google.android.apps.fitness")!!.apply {
|
||||||
addCategory(Intent.CATEGORY_LAUNCHER)
|
addCategory(Intent.CATEGORY_LAUNCHER)
|
||||||
|
flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Intent()
|
Intent()
|
||||||
@ -246,6 +256,7 @@ object IntentHelper {
|
|||||||
return try {
|
return try {
|
||||||
pm.getLaunchIntentForPackage(Preferences.lastNotificationPackage)!!.apply {
|
pm.getLaunchIntentForPackage(Preferences.lastNotificationPackage)!!.apply {
|
||||||
addCategory(Intent.CATEGORY_LAUNCHER)
|
addCategory(Intent.CATEGORY_LAUNCHER)
|
||||||
|
flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Intent()
|
Intent()
|
||||||
|
@ -16,14 +16,15 @@ class WidgetClickListenerReceiver : BroadcastReceiver() {
|
|||||||
override fun onReceive(context: Context, intent: Intent) {
|
override fun onReceive(context: Context, intent: Intent) {
|
||||||
if (intent.action == Actions.ACTION_OPEN_WEATHER_INTENT) {
|
if (intent.action == Actions.ACTION_OPEN_WEATHER_INTENT) {
|
||||||
try {
|
try {
|
||||||
if (Preferences.weatherAppPackage == IntentHelper.REFRESH_WIDGET_OPTION) {
|
IntentHelper.getWeatherIntent(context).run {
|
||||||
context.sendBroadcast(IntentHelper.getWeatherIntent(context))
|
if (flags and Intent.FLAG_ACTIVITY_NEW_TASK == Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||||
} else {
|
context.startActivity(this)
|
||||||
context.startActivity(IntentHelper.getWeatherIntent(context))
|
else
|
||||||
|
context.sendBroadcast(this)
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
val uri = Uri.parse("http://www.google.com/search?q=weather")
|
val uri = Uri.parse("https://www.google.com/search?q=weather")
|
||||||
val i = Intent(Intent.ACTION_VIEW, uri)
|
val i = Intent(Intent.ACTION_VIEW, uri)
|
||||||
i.flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
i.flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
try {
|
try {
|
||||||
|
@ -102,15 +102,7 @@ class GesturesFragment : Fragment() {
|
|||||||
it == IntentHelper.DO_NOTHING_OPTION -> getString(R.string.gestures_do_nothing)
|
it == IntentHelper.DO_NOTHING_OPTION -> getString(R.string.gestures_do_nothing)
|
||||||
it == IntentHelper.REFRESH_WIDGET_OPTION -> getString(R.string.gestures_refresh_widget)
|
it == IntentHelper.REFRESH_WIDGET_OPTION -> getString(R.string.gestures_refresh_widget)
|
||||||
it != IntentHelper.DEFAULT_OPTION -> it
|
it != IntentHelper.DEFAULT_OPTION -> it
|
||||||
else -> {
|
else -> getString(R.string.default_calendar_app)
|
||||||
if (IntentHelper.getCalendarIntent(requireContext()).isDefaultSet(requireContext())) {
|
|
||||||
getString(
|
|
||||||
R.string.default_calendar_app
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
getString(R.string.gestures_do_nothing)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -127,15 +119,7 @@ class GesturesFragment : Fragment() {
|
|||||||
it == IntentHelper.DO_NOTHING_OPTION -> getString(R.string.gestures_do_nothing)
|
it == IntentHelper.DO_NOTHING_OPTION -> getString(R.string.gestures_do_nothing)
|
||||||
it == IntentHelper.REFRESH_WIDGET_OPTION -> getString(R.string.gestures_refresh_widget)
|
it == IntentHelper.REFRESH_WIDGET_OPTION -> getString(R.string.gestures_refresh_widget)
|
||||||
it != IntentHelper.DEFAULT_OPTION -> it
|
it != IntentHelper.DEFAULT_OPTION -> it
|
||||||
else -> {
|
else -> getString(R.string.default_clock_app)
|
||||||
if (IntentHelper.getClockIntent(requireContext()).isDefaultSet(requireContext())) {
|
|
||||||
getString(
|
|
||||||
R.string.default_clock_app
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
getString(R.string.gestures_do_nothing)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -173,9 +157,12 @@ class GesturesFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
binding.actionCalendarApp.setOnClickListener {
|
binding.actionCalendarApp.setOnClickListener {
|
||||||
startActivityForResult(Intent(requireContext(), ChooseApplicationActivity::class.java).apply {
|
startActivityForResult(
|
||||||
putExtra(Constants.RESULT_APP_PACKAGE, Preferences.calendarAppPackage)
|
Intent(requireContext(), ChooseApplicationActivity::class.java).apply {
|
||||||
}, RequestCode.CALENDAR_APP_REQUEST_CODE.code)
|
putExtra(Constants.RESULT_APP_PACKAGE, Preferences.calendarAppPackage)
|
||||||
|
},
|
||||||
|
RequestCode.CALENDAR_APP_REQUEST_CODE.code
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.actionClockApp.setOnClickListener {
|
binding.actionClockApp.setOnClickListener {
|
||||||
|
@ -54,7 +54,7 @@ class AlignedWidget(val context: Context, val rightAligned: Boolean = false) {
|
|||||||
"setImageAlpha",
|
"setImageAlpha",
|
||||||
ColorHelper.getBackgroundAlpha(context.isDarkTheme())
|
ColorHelper.getBackgroundAlpha(context.isDarkTheme())
|
||||||
)
|
)
|
||||||
val refreshIntent = PendingIntent.getActivity(
|
val refreshIntent = IntentHelper.getPendingIntent(
|
||||||
context,
|
context,
|
||||||
appWidgetId,
|
appWidgetId,
|
||||||
IntentHelper.getWidgetUpdateIntent(context),
|
IntentHelper.getWidgetUpdateIntent(context),
|
||||||
@ -126,7 +126,7 @@ class AlignedWidget(val context: Context, val rightAligned: Boolean = false) {
|
|||||||
BitmapHelper.getBitmapFromView(bindingView.date, draw = false, width = bindingView.date.width, height = bindingView.date.height)
|
BitmapHelper.getBitmapFromView(bindingView.date, draw = false, width = bindingView.date.width, height = bindingView.date.height)
|
||||||
)
|
)
|
||||||
|
|
||||||
val calPIntent = PendingIntent.getActivity(
|
val calPIntent = IntentHelper.getPendingIntent(
|
||||||
context,
|
context,
|
||||||
widgetID,
|
widgetID,
|
||||||
IntentHelper.getCalendarIntent(context),
|
IntentHelper.getCalendarIntent(context),
|
||||||
@ -177,7 +177,7 @@ class AlignedWidget(val context: Context, val rightAligned: Boolean = false) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Event intent
|
// Event intent
|
||||||
val eventIntent = PendingIntent.getActivity(
|
val eventIntent = IntentHelper.getPendingIntent(
|
||||||
context,
|
context,
|
||||||
widgetID,
|
widgetID,
|
||||||
IntentHelper.getEventIntent(context, nextEvent),
|
IntentHelper.getEventIntent(context, nextEvent),
|
||||||
@ -214,7 +214,7 @@ class AlignedWidget(val context: Context, val rightAligned: Boolean = false) {
|
|||||||
|
|
||||||
// Event information
|
// Event information
|
||||||
if (nextEvent.address != "" && Preferences.secondRowInformation == 1) {
|
if (nextEvent.address != "" && Preferences.secondRowInformation == 1) {
|
||||||
val mapIntent = PendingIntent.getActivity(
|
val mapIntent = IntentHelper.getPendingIntent(
|
||||||
context,
|
context,
|
||||||
widgetID,
|
widgetID,
|
||||||
IntentHelper.getGoogleMapsIntentFromAddress(context, nextEvent.address),
|
IntentHelper.getGoogleMapsIntentFromAddress(context, nextEvent.address),
|
||||||
@ -222,7 +222,7 @@ class AlignedWidget(val context: Context, val rightAligned: Boolean = false) {
|
|||||||
)
|
)
|
||||||
views.setOnClickPendingIntent(R.id.sub_line_rect, mapIntent)
|
views.setOnClickPendingIntent(R.id.sub_line_rect, mapIntent)
|
||||||
} else {
|
} else {
|
||||||
val pIntentDetail = PendingIntent.getActivity(
|
val pIntentDetail = IntentHelper.getPendingIntent(
|
||||||
context,
|
context,
|
||||||
widgetID,
|
widgetID,
|
||||||
IntentHelper.getCalendarIntent(context, nextEvent.startDate),
|
IntentHelper.getCalendarIntent(context, nextEvent.startDate),
|
||||||
@ -245,7 +245,7 @@ class AlignedWidget(val context: Context, val rightAligned: Boolean = false) {
|
|||||||
when (provider) {
|
when (provider) {
|
||||||
Constants.GlanceProviderId.PLAYING_SONG -> {
|
Constants.GlanceProviderId.PLAYING_SONG -> {
|
||||||
if (MediaPlayerHelper.isSomeonePlaying(context)) {
|
if (MediaPlayerHelper.isSomeonePlaying(context)) {
|
||||||
val musicIntent = PendingIntent.getActivity(
|
val musicIntent = IntentHelper.getPendingIntent(
|
||||||
context,
|
context,
|
||||||
widgetID,
|
widgetID,
|
||||||
IntentHelper.getMusicIntent(context),
|
IntentHelper.getMusicIntent(context),
|
||||||
@ -260,7 +260,7 @@ class AlignedWidget(val context: Context, val rightAligned: Boolean = false) {
|
|||||||
if (Preferences.showNextAlarm) {
|
if (Preferences.showNextAlarm) {
|
||||||
val nextAlarm = AlarmHelper.getNextAlarm(context)
|
val nextAlarm = AlarmHelper.getNextAlarm(context)
|
||||||
if (nextAlarm != "") {
|
if (nextAlarm != "") {
|
||||||
val alarmIntent = PendingIntent.getActivity(
|
val alarmIntent = IntentHelper.getPendingIntent(
|
||||||
context,
|
context,
|
||||||
widgetID,
|
widgetID,
|
||||||
IntentHelper.getClockIntent(context),
|
IntentHelper.getClockIntent(context),
|
||||||
@ -276,7 +276,7 @@ class AlignedWidget(val context: Context, val rightAligned: Boolean = false) {
|
|||||||
if (Preferences.showBatteryCharging) {
|
if (Preferences.showBatteryCharging) {
|
||||||
BatteryHelper.updateBatteryInfo(context)
|
BatteryHelper.updateBatteryInfo(context)
|
||||||
if (Preferences.isCharging || Preferences.isBatteryLevelLow) {
|
if (Preferences.isCharging || Preferences.isBatteryLevelLow) {
|
||||||
val batteryIntent = PendingIntent.getActivity(
|
val batteryIntent = IntentHelper.getPendingIntent(
|
||||||
context,
|
context,
|
||||||
widgetID,
|
widgetID,
|
||||||
IntentHelper.getBatteryIntent(),
|
IntentHelper.getBatteryIntent(),
|
||||||
@ -295,7 +295,7 @@ class AlignedWidget(val context: Context, val rightAligned: Boolean = false) {
|
|||||||
}
|
}
|
||||||
Constants.GlanceProviderId.GOOGLE_FIT_STEPS -> {
|
Constants.GlanceProviderId.GOOGLE_FIT_STEPS -> {
|
||||||
if (Preferences.showDailySteps && Preferences.googleFitSteps > 0) {
|
if (Preferences.showDailySteps && Preferences.googleFitSteps > 0) {
|
||||||
val fitIntent = PendingIntent.getActivity(
|
val fitIntent = IntentHelper.getPendingIntent(
|
||||||
context,
|
context,
|
||||||
widgetID,
|
widgetID,
|
||||||
IntentHelper.getFitIntent(context),
|
IntentHelper.getFitIntent(context),
|
||||||
@ -316,7 +316,7 @@ class AlignedWidget(val context: Context, val rightAligned: Boolean = false) {
|
|||||||
remotePackageContext,
|
remotePackageContext,
|
||||||
Preferences.lastNotificationIcon)
|
Preferences.lastNotificationIcon)
|
||||||
}
|
}
|
||||||
val notificationIntent = PendingIntent.getActivity(
|
val notificationIntent = IntentHelper.getPendingIntent(
|
||||||
context,
|
context,
|
||||||
widgetID,
|
widgetID,
|
||||||
IntentHelper.getNotificationIntent(context),
|
IntentHelper.getNotificationIntent(context),
|
||||||
@ -340,7 +340,7 @@ class AlignedWidget(val context: Context, val rightAligned: Boolean = false) {
|
|||||||
Constants.GlanceProviderId.EVENTS -> {
|
Constants.GlanceProviderId.EVENTS -> {
|
||||||
if (Preferences.showEventsAsGlanceProvider&& Preferences.showEvents && context.checkGrantedPermission(
|
if (Preferences.showEventsAsGlanceProvider&& Preferences.showEvents && context.checkGrantedPermission(
|
||||||
Manifest.permission.READ_CALENDAR) && nextEvent != null) {
|
Manifest.permission.READ_CALENDAR) && nextEvent != null) {
|
||||||
val pIntentDetail = PendingIntent.getActivity(
|
val pIntentDetail = IntentHelper.getPendingIntent(
|
||||||
context,
|
context,
|
||||||
widgetID,
|
widgetID,
|
||||||
IntentHelper.getEventIntent(
|
IntentHelper.getEventIntent(
|
||||||
|
@ -39,7 +39,7 @@ class ClockWidget(val context: Context) {
|
|||||||
TypedValue.COMPLEX_UNIT_SP,
|
TypedValue.COMPLEX_UNIT_SP,
|
||||||
Preferences.clockTextSize.toPixel(context) / 5 * 2
|
Preferences.clockTextSize.toPixel(context) / 5 * 2
|
||||||
)
|
)
|
||||||
val clockPIntent = PendingIntent.getActivity(
|
val clockPIntent = IntentHelper.getPendingIntent(
|
||||||
context,
|
context,
|
||||||
widgetID,
|
widgetID,
|
||||||
IntentHelper.getClockIntent(context),
|
IntentHelper.getClockIntent(context),
|
||||||
|
@ -57,7 +57,7 @@ class StandardWidget(val context: Context) {
|
|||||||
"setImageAlpha",
|
"setImageAlpha",
|
||||||
ColorHelper.getBackgroundAlpha(context.isDarkTheme())
|
ColorHelper.getBackgroundAlpha(context.isDarkTheme())
|
||||||
)
|
)
|
||||||
val refreshIntent = PendingIntent.getActivity(
|
val refreshIntent = IntentHelper.getPendingIntent(
|
||||||
context,
|
context,
|
||||||
appWidgetId,
|
appWidgetId,
|
||||||
IntentHelper.getWidgetUpdateIntent(context),
|
IntentHelper.getWidgetUpdateIntent(context),
|
||||||
@ -129,7 +129,7 @@ class StandardWidget(val context: Context) {
|
|||||||
BitmapHelper.getBitmapFromView(bindingView.date, draw = false, width = bindingView.date.width, height = bindingView.date.height)
|
BitmapHelper.getBitmapFromView(bindingView.date, draw = false, width = bindingView.date.width, height = bindingView.date.height)
|
||||||
)
|
)
|
||||||
|
|
||||||
val calPIntent = PendingIntent.getActivity(
|
val calPIntent = IntentHelper.getPendingIntent(
|
||||||
context,
|
context,
|
||||||
widgetID,
|
widgetID,
|
||||||
IntentHelper.getCalendarIntent(context),
|
IntentHelper.getCalendarIntent(context),
|
||||||
@ -207,7 +207,7 @@ class StandardWidget(val context: Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Event intent
|
// Event intent
|
||||||
val eventIntent = PendingIntent.getActivity(
|
val eventIntent = IntentHelper.getPendingIntent(
|
||||||
context,
|
context,
|
||||||
widgetID,
|
widgetID,
|
||||||
IntentHelper.getEventIntent(context, nextEvent),
|
IntentHelper.getEventIntent(context, nextEvent),
|
||||||
@ -240,7 +240,7 @@ class StandardWidget(val context: Context) {
|
|||||||
|
|
||||||
// Event information
|
// Event information
|
||||||
if (nextEvent.address != "" && Preferences.secondRowInformation == 1) {
|
if (nextEvent.address != "" && Preferences.secondRowInformation == 1) {
|
||||||
val mapIntent = PendingIntent.getActivity(
|
val mapIntent = IntentHelper.getPendingIntent(
|
||||||
context,
|
context,
|
||||||
widgetID,
|
widgetID,
|
||||||
IntentHelper.getGoogleMapsIntentFromAddress(context, nextEvent.address),
|
IntentHelper.getGoogleMapsIntentFromAddress(context, nextEvent.address),
|
||||||
@ -248,7 +248,7 @@ class StandardWidget(val context: Context) {
|
|||||||
)
|
)
|
||||||
views.setOnClickPendingIntent(R.id.sub_line_rect, mapIntent)
|
views.setOnClickPendingIntent(R.id.sub_line_rect, mapIntent)
|
||||||
} else {
|
} else {
|
||||||
val pIntentDetail = PendingIntent.getActivity(
|
val pIntentDetail = IntentHelper.getPendingIntent(
|
||||||
context,
|
context,
|
||||||
widgetID,
|
widgetID,
|
||||||
IntentHelper.getCalendarIntent(context, nextEvent.startDate),
|
IntentHelper.getCalendarIntent(context, nextEvent.startDate),
|
||||||
@ -273,7 +273,7 @@ class StandardWidget(val context: Context) {
|
|||||||
when (provider) {
|
when (provider) {
|
||||||
Constants.GlanceProviderId.PLAYING_SONG -> {
|
Constants.GlanceProviderId.PLAYING_SONG -> {
|
||||||
if (MediaPlayerHelper.isSomeonePlaying(context)) {
|
if (MediaPlayerHelper.isSomeonePlaying(context)) {
|
||||||
val musicIntent = PendingIntent.getActivity(
|
val musicIntent = IntentHelper.getPendingIntent(
|
||||||
context,
|
context,
|
||||||
widgetID,
|
widgetID,
|
||||||
IntentHelper.getMusicIntent(context),
|
IntentHelper.getMusicIntent(context),
|
||||||
@ -288,7 +288,7 @@ class StandardWidget(val context: Context) {
|
|||||||
if (Preferences.showNextAlarm) {
|
if (Preferences.showNextAlarm) {
|
||||||
val nextAlarm = AlarmHelper.getNextAlarm(context)
|
val nextAlarm = AlarmHelper.getNextAlarm(context)
|
||||||
if (nextAlarm != "") {
|
if (nextAlarm != "") {
|
||||||
val alarmIntent = PendingIntent.getActivity(
|
val alarmIntent = IntentHelper.getPendingIntent(
|
||||||
context,
|
context,
|
||||||
widgetID,
|
widgetID,
|
||||||
IntentHelper.getClockIntent(context),
|
IntentHelper.getClockIntent(context),
|
||||||
@ -304,7 +304,7 @@ class StandardWidget(val context: Context) {
|
|||||||
if (Preferences.showBatteryCharging) {
|
if (Preferences.showBatteryCharging) {
|
||||||
BatteryHelper.updateBatteryInfo(context)
|
BatteryHelper.updateBatteryInfo(context)
|
||||||
if (Preferences.isCharging || Preferences.isBatteryLevelLow) {
|
if (Preferences.isCharging || Preferences.isBatteryLevelLow) {
|
||||||
val batteryIntent = PendingIntent.getActivity(
|
val batteryIntent = IntentHelper.getPendingIntent(
|
||||||
context,
|
context,
|
||||||
widgetID,
|
widgetID,
|
||||||
IntentHelper.getBatteryIntent(),
|
IntentHelper.getBatteryIntent(),
|
||||||
@ -323,7 +323,7 @@ class StandardWidget(val context: Context) {
|
|||||||
}
|
}
|
||||||
Constants.GlanceProviderId.GOOGLE_FIT_STEPS -> {
|
Constants.GlanceProviderId.GOOGLE_FIT_STEPS -> {
|
||||||
if (Preferences.showDailySteps && Preferences.googleFitSteps > 0) {
|
if (Preferences.showDailySteps && Preferences.googleFitSteps > 0) {
|
||||||
val fitIntent = PendingIntent.getActivity(
|
val fitIntent = IntentHelper.getPendingIntent(
|
||||||
context,
|
context,
|
||||||
widgetID,
|
widgetID,
|
||||||
IntentHelper.getFitIntent(context),
|
IntentHelper.getFitIntent(context),
|
||||||
@ -344,7 +344,7 @@ class StandardWidget(val context: Context) {
|
|||||||
remotePackageContext,
|
remotePackageContext,
|
||||||
Preferences.lastNotificationIcon)
|
Preferences.lastNotificationIcon)
|
||||||
}
|
}
|
||||||
val notificationIntent = PendingIntent.getActivity(
|
val notificationIntent = IntentHelper.getPendingIntent(
|
||||||
context,
|
context,
|
||||||
widgetID,
|
widgetID,
|
||||||
IntentHelper.getNotificationIntent(context),
|
IntentHelper.getNotificationIntent(context),
|
||||||
@ -368,7 +368,7 @@ class StandardWidget(val context: Context) {
|
|||||||
Constants.GlanceProviderId.EVENTS -> {
|
Constants.GlanceProviderId.EVENTS -> {
|
||||||
if (Preferences.showEventsAsGlanceProvider&& Preferences.showEvents && context.checkGrantedPermission(
|
if (Preferences.showEventsAsGlanceProvider&& Preferences.showEvents && context.checkGrantedPermission(
|
||||||
Manifest.permission.READ_CALENDAR) && nextEvent != null) {
|
Manifest.permission.READ_CALENDAR) && nextEvent != null) {
|
||||||
val pIntentDetail = PendingIntent.getActivity(
|
val pIntentDetail = IntentHelper.getPendingIntent(
|
||||||
context,
|
context,
|
||||||
widgetID,
|
widgetID,
|
||||||
IntentHelper.getEventIntent(
|
IntentHelper.getEventIntent(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user