mirror of
https://github.com/nextcloud/android.git
synced 2024-11-26 07:05:49 +03:00
Fix widget clicks for older Android versions
Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
parent
ae5bbf1ab8
commit
7e7c7e676c
1 changed files with 10 additions and 10 deletions
|
@ -84,7 +84,7 @@ class DashboardWidgetUpdater @Inject constructor(
|
|||
context,
|
||||
0,
|
||||
intent,
|
||||
getPendingIntentFlags()
|
||||
pendingIntentFlags
|
||||
)
|
||||
|
||||
remoteViews.setPendingIntentTemplate(R.id.list, pendingIntent)
|
||||
|
@ -123,7 +123,7 @@ class DashboardWidgetUpdater @Inject constructor(
|
|||
context,
|
||||
appWidgetId,
|
||||
intent,
|
||||
getPendingIntentFlags()
|
||||
pendingIntentFlags
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -138,17 +138,17 @@ class DashboardWidgetUpdater @Inject constructor(
|
|||
context,
|
||||
appWidgetId,
|
||||
intent,
|
||||
getPendingIntentFlags()
|
||||
pendingIntentFlags
|
||||
)
|
||||
}
|
||||
|
||||
private fun getPendingIntentFlags(): Int {
|
||||
return PendingIntent.FLAG_UPDATE_CURRENT or if (Build.VERSION.SDK_INT >= 34) {
|
||||
PendingIntent.FLAG_MUTABLE or PendingIntent.FLAG_ALLOW_UNSAFE_IMPLICIT_INTENT
|
||||
} else if (Build.VERSION.SDK_INT >= 31) {
|
||||
PendingIntent.FLAG_MUTABLE
|
||||
} else {
|
||||
PendingIntent.FLAG_IMMUTABLE
|
||||
private val pendingIntentFlags: Int = when {
|
||||
Build.VERSION.SDK_INT >= 34 -> {
|
||||
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_MUTABLE or PendingIntent.FLAG_ALLOW_UNSAFE_IMPLICIT_INTENT
|
||||
}
|
||||
|
||||
else -> {
|
||||
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_MUTABLE
|
||||
}
|
||||
}
|
||||
// endregion
|
||||
|
|
Loading…
Reference in a new issue