1package soy.iko.opencode.platform
3import android.app.PendingIntent
4import android.content.Intent
6import android.service.quicksettings.TileService
7import soy.iko.opencode.MainActivity
10 * Quick-settings tile that starts a new opencode session. Tapping launches [MainActivity]
11 * with [MainActivity.ACTION_NEW_SESSION]; the app creates and opens a fresh session once
12 * connected. On Android 14+ [startActivityAndCollapse] requires a PendingIntent.
14class NewSessionTileService : TileService() {
16 override fun onClick() {
18 val intent = Intent(this, MainActivity::class.java).apply {
19 action = MainActivity.ACTION_NEW_SESSION
20 addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_SINGLE_TOP)
22 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
23 val pending = PendingIntent.getActivity(
25 PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT,
27 startActivityAndCollapse(pending)
29 @Suppress("DEPRECATION", "StartActivityAndCollapseDeprecated")
30 startActivityAndCollapse(intent)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list