-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update annotations to match SDK upgrades
- Loading branch information
1 parent
4f4266d
commit 3433d31
Showing
1 changed file
with
10 additions
and
1 deletion.
There are no files selected for viewing
11 changes: 10 additions & 1 deletion
11
app/src/main/java/com/example/deeplviewer/service/QSTileService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,26 @@ | ||
package com.example.deeplviewer.service | ||
|
||
import android.annotation.SuppressLint | ||
import android.annotation.TargetApi | ||
import android.content.Intent | ||
import android.os.Build | ||
import android.service.quicksettings.TileService | ||
import androidx.annotation.RequiresApi | ||
import com.example.deeplviewer.activity.FloatingTextSelection | ||
|
||
@RequiresApi(Build.VERSION_CODES.N) | ||
@TargetApi(Build.VERSION_CODES.N) | ||
class QSTileService : TileService() { | ||
override fun onClick() { | ||
val intent = Intent(applicationContext, FloatingTextSelection::class.java) | ||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) | ||
intent.putExtra(Intent.EXTRA_TEXT, "") | ||
startActivityAndCollapse(intent) | ||
|
||
@SuppressLint("StartActivityAndCollapseDeprecated") | ||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { | ||
startActivity(intent) | ||
} else { | ||
startActivityAndCollapse(intent) | ||
} | ||
} | ||
} |