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

Commit 9db19deb authored by Yining Liu's avatar Yining Liu
Browse files

Format kotlin codes

Format kotlin codes for further changes in ChannelEditorListView.

Bug: 379585979
Flag: EXEMPT refactor
Test: atest SystemUITests
Change-Id: Ic1af5f0a2b36c00a065730254479bc8ffd7cc35e
parent 25c889de
Loading
Loading
Loading
Loading
+19 −26
Original line number Diff line number Diff line
@@ -41,9 +41,7 @@ import com.android.settingslib.Utils
import com.android.systemui.res.R
import com.android.systemui.util.Assert

/**
 * Half-shelf for notification channel controls
 */
/** Half-shelf for notification channel controls */
class ChannelEditorListView(c: Context, attrs: AttributeSet) : LinearLayout(c, attrs) {
    lateinit var controller: ChannelEditorDialogController
    var appIcon: Drawable? = null
@@ -84,23 +82,21 @@ class ChannelEditorListView(c: Context, attrs: AttributeSet) : LinearLayout(c, a

        val transition = AutoTransition()
        transition.duration = 200
        transition.addListener(object : Transition.TransitionListener {
        transition.addListener(
            object : Transition.TransitionListener {
                override fun onTransitionEnd(p0: Transition?) {
                    notifySubtreeAccessibilityStateChangedIfNeeded()
                }

            override fun onTransitionResume(p0: Transition?) {
            }
                override fun onTransitionResume(p0: Transition?) {}

            override fun onTransitionPause(p0: Transition?) {
            }
                override fun onTransitionPause(p0: Transition?) {}

            override fun onTransitionCancel(p0: Transition?) {
            }
                override fun onTransitionCancel(p0: Transition?) {}

            override fun onTransitionStart(p0: Transition?) {
                override fun onTransitionStart(p0: Transition?) {}
            }
        })
        )
        TransitionManager.beginDelayedTransition(this, transition)

        // Remove any rows
@@ -164,8 +160,8 @@ class ChannelRow(c: Context, attrs: AttributeSet) : LinearLayout(c, attrs) {
    var gentle = false

    init {
        highlightColor = Utils.getColorAttrDefaultColor(
                context, android.R.attr.colorControlHighlight)
        highlightColor =
            Utils.getColorAttrDefaultColor(context, android.R.attr.colorControlHighlight)
    }

    var channel: NotificationChannel? = null
@@ -182,17 +178,16 @@ class ChannelRow(c: Context, attrs: AttributeSet) : LinearLayout(c, attrs) {
        switch = requireViewById(R.id.toggle)
        switch.setOnCheckedChangeListener { _, b ->
            channel?.let {
                controller.proposeEditForChannel(it,
                        if (b) it.originalImportance.coerceAtLeast(IMPORTANCE_LOW)
                        else IMPORTANCE_NONE)
                controller.proposeEditForChannel(
                    it,
                    if (b) it.originalImportance.coerceAtLeast(IMPORTANCE_LOW) else IMPORTANCE_NONE,
                )
            }
        }
        setOnClickListener { switch.toggle() }
    }

    /**
     * Play an animation that highlights this row
     */
    /** Play an animation that highlights this row */
    fun playHighlight() {
        // Use 0 for the start value because our background is given to us by our parent
        val fadeInLoop = ValueAnimator.ofObject(ArgbEvaluator(), 0, highlightColor)
@@ -211,9 +206,7 @@ class ChannelRow(c: Context, attrs: AttributeSet) : LinearLayout(c, attrs) {

        channelName.text = nc.name ?: ""

        nc.group?.let { groupId ->
            channelDescription.text = controller.groupNameForId(groupId)
        }
        nc.group?.let { groupId -> channelDescription.text = controller.groupNameForId(groupId) }

        if (nc.group == null || TextUtils.isEmpty(channelDescription.text)) {
            channelDescription.visibility = View.GONE