Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a1ac4ee8 authored by Yuri Lin's avatar Yuri Lin
Browse files

Set initial ModesTile state to inactive

The default state of QSTile.State() is "active", and thus the tile looks on for a second before the first time fully expanding the shade.

Bug: 359595596
Test: manual
Flag: android.app.modes_ui
Change-Id: I7f9379a86c4d6e5a77cb9d06a3416bf49024975e
parent dd0a5739
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.app.Flags
import android.content.Intent
import android.os.Handler
import android.os.Looper
import android.service.quicksettings.Tile
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.coroutineScope
import androidx.lifecycle.repeatOnLifecycle
@@ -94,7 +95,13 @@ constructor(

    override fun getTileLabel(): CharSequence = tileState.label

    override fun newTileState() = QSTile.State()
    override fun newTileState(): QSTile.State {
        return QSTile.State().apply {
            label = mContext.getString(R.string.quick_settings_modes_label)
            icon = ResourceIcon.get(R.drawable.qs_dnd_icon_off)
            state = Tile.STATE_INACTIVE
        }
    }

    override fun handleClick(expandable: Expandable?) = runBlocking {
        userActionInteractor.handleClick(expandable)