mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-08-29 21:27:40 +00:00
refactor: fix API change of startActivityAndCollapse
See also: https://developer.android.com/reference/android/service/quicksettings/TileService#startActivityAndCollapse(android.content.Intent)
This commit is contained in:
parent
bed6fe2c55
commit
e5eb61fd54
@ -6,10 +6,13 @@
|
||||
|
||||
package org.kde.kdeconnect.Plugins.ClibpoardPlugin
|
||||
|
||||
import android.app.PendingIntent
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import android.service.quicksettings.TileService
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.core.service.quicksettings.PendingIntentActivityWrapper
|
||||
import androidx.core.service.quicksettings.TileServiceCompat
|
||||
import org.kde.kdeconnect.KdeConnect
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.N)
|
||||
@ -17,12 +20,14 @@ class ClipboardTileService : TileService() {
|
||||
override fun onClick() {
|
||||
super.onClick()
|
||||
|
||||
startActivityAndCollapse(Intent(this, ClipboardFloatingActivity::class.java).apply {
|
||||
TileServiceCompat.startActivityAndCollapse(this, PendingIntentActivityWrapper(
|
||||
this, 0, Intent(this, ClipboardFloatingActivity::class.java).apply {
|
||||
flags = Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
val ids = KdeConnect.getInstance().devices.values
|
||||
.filter { it.isReachable && it.isPaired }
|
||||
.map { it.deviceId }
|
||||
putExtra("connectedDeviceIds", ArrayList(ids))
|
||||
})
|
||||
}, PendingIntent.FLAG_ONE_SHOT, true
|
||||
))
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user