Use FLAG_IMMUTABLE as required by android 12 (#366)
This commit is contained in:
parent
c0ae0466c2
commit
2dff3d9191
@ -36,7 +36,7 @@ android {
|
|||||||
targetCompatibility JavaVersion.VERSION_1_8
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
}
|
}
|
||||||
compileSdkVersion 31
|
compileSdkVersion 31
|
||||||
buildToolsVersion '30.0.3'
|
buildToolsVersion '31.0.0'
|
||||||
buildFeatures {
|
buildFeatures {
|
||||||
viewBinding true
|
viewBinding true
|
||||||
}
|
}
|
||||||
@ -109,6 +109,7 @@ dependencies {
|
|||||||
implementation "androidx.browser:browser:1.3.0"
|
implementation "androidx.browser:browser:1.3.0"
|
||||||
implementation "androidx.cardview:cardview:$android_version"
|
implementation "androidx.cardview:cardview:$android_version"
|
||||||
implementation "androidx.annotation:annotation:1.2.0"
|
implementation "androidx.annotation:annotation:1.2.0"
|
||||||
|
implementation 'androidx.work:work-runtime-ktx:2.7.0'
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
|
||||||
implementation 'org.jsoup:jsoup:1.13.1'
|
implementation 'org.jsoup:jsoup:1.13.1'
|
||||||
|
|
||||||
@ -121,7 +122,7 @@ dependencies {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Async
|
// Async
|
||||||
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.0'
|
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2'
|
||||||
|
|
||||||
// Retrofit + http logging + okhttp
|
// Retrofit + http logging + okhttp
|
||||||
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
||||||
@ -151,13 +152,13 @@ dependencies {
|
|||||||
//PhotoView
|
//PhotoView
|
||||||
implementation 'com.github.chrisbanes:PhotoView:2.0.0'
|
implementation 'com.github.chrisbanes:PhotoView:2.0.0'
|
||||||
|
|
||||||
implementation 'androidx.core:core-ktx:1.7.0-beta02'
|
implementation 'androidx.core:core-ktx:1.7.0-rc01'
|
||||||
|
|
||||||
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.4.0-rc01"
|
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.4.0-rc01"
|
||||||
implementation "androidx.lifecycle:lifecycle-common-java8:2.4.0-rc01"
|
implementation "androidx.lifecycle:lifecycle-common-java8:2.4.0-rc01"
|
||||||
|
|
||||||
implementation "androidx.room:room-ktx:2.4.0-alpha05"
|
implementation "androidx.room:room-ktx:2.4.0-beta01"
|
||||||
kapt "androidx.room:room-compiler:2.4.0-alpha05"
|
kapt "androidx.room:room-compiler:2.4.0-beta01"
|
||||||
|
|
||||||
implementation "android.arch.work:work-runtime-ktx:$work_version"
|
implementation "android.arch.work:work-runtime-ktx:$work_version"
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import android.app.NotificationManager
|
|||||||
import android.app.PendingIntent
|
import android.app.PendingIntent
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
import android.os.Build
|
||||||
import android.preference.PreferenceManager
|
import android.preference.PreferenceManager
|
||||||
import androidx.core.app.NotificationCompat
|
import androidx.core.app.NotificationCompat
|
||||||
import androidx.core.app.NotificationCompat.PRIORITY_DEFAULT
|
import androidx.core.app.NotificationCompat.PRIORITY_DEFAULT
|
||||||
@ -117,8 +118,12 @@ override fun doWork(): Result {
|
|||||||
val intent = Intent(context, MainActivity::class.java).apply {
|
val intent = Intent(context, MainActivity::class.java).apply {
|
||||||
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
|
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
|
||||||
}
|
}
|
||||||
val pendingIntent: PendingIntent =
|
val pflags = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
PendingIntent.getActivity(context, 0, intent, 0)
|
PendingIntent.FLAG_IMMUTABLE
|
||||||
|
} else {
|
||||||
|
0
|
||||||
|
}
|
||||||
|
val pendingIntent: PendingIntent = PendingIntent.getActivity(context, 0, intent, pflags)
|
||||||
|
|
||||||
val newItemsNotification =
|
val newItemsNotification =
|
||||||
NotificationCompat.Builder(applicationContext, Config.newItemsChannelId)
|
NotificationCompat.Builder(applicationContext, Config.newItemsChannelId)
|
||||||
|
@ -7,6 +7,7 @@ import android.content.Context
|
|||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.graphics.BitmapFactory
|
import android.graphics.BitmapFactory
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
|
import android.os.Build
|
||||||
import android.text.Spannable
|
import android.text.Spannable
|
||||||
import android.text.style.ClickableSpan
|
import android.text.style.ClickableSpan
|
||||||
import androidx.browser.customtabs.CustomTabsIntent
|
import androidx.browser.customtabs.CustomTabsIntent
|
||||||
@ -26,11 +27,16 @@ fun Context.buildCustomTabsIntent(): CustomTabsIntent {
|
|||||||
|
|
||||||
val actionIntent = Intent(Intent.ACTION_SEND)
|
val actionIntent = Intent(Intent.ACTION_SEND)
|
||||||
actionIntent.type = "text/plain"
|
actionIntent.type = "text/plain"
|
||||||
|
val pflags = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
|
PendingIntent.FLAG_IMMUTABLE
|
||||||
|
} else {
|
||||||
|
0
|
||||||
|
}
|
||||||
val createPendingShareIntent: PendingIntent = PendingIntent.getActivity(
|
val createPendingShareIntent: PendingIntent = PendingIntent.getActivity(
|
||||||
this,
|
this,
|
||||||
0,
|
0,
|
||||||
actionIntent,
|
actionIntent,
|
||||||
0
|
pflags
|
||||||
)
|
)
|
||||||
|
|
||||||
val intentBuilder = CustomTabsIntent.Builder()
|
val intentBuilder = CustomTabsIntent.Builder()
|
||||||
|
Loading…
Reference in New Issue
Block a user