Skip to content

Commit

Permalink
Merge pull request #125 from papjul/collapsetile
Browse files Browse the repository at this point in the history
Allow tile to collapse on newer Android versions
  • Loading branch information
sakusaku3939 authored Nov 8, 2024
2 parents 4d5c2f9 + 7e5d2e6 commit 5c59d2c
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package com.example.deeplviewer.service

import android.annotation.SuppressLint
import android.app.PendingIntent
import android.content.Intent
import android.os.Build
import android.service.quicksettings.TileService
import androidx.annotation.RequiresApi
import android.annotation.SuppressLint
import com.example.deeplviewer.activity.FloatingTextSelection

@RequiresApi(Build.VERSION_CODES.N)
Expand All @@ -15,8 +16,10 @@ class QSTileService : TileService() {
intent.putExtra(Intent.EXTRA_TEXT, "")

@SuppressLint("StartActivityAndCollapseDeprecated")
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
startActivity(intent)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
startActivityAndCollapse(
PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_IMMUTABLE)
)
} else {
startActivityAndCollapse(intent)
}
Expand Down

0 comments on commit 5c59d2c

Please sign in to comment.