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

Commit 0b704704 authored by Yining Liu's avatar Yining Liu
Browse files

Use Material3 switch to replace Switch in notification half shelf dialog

Use Material3 switch to replace Switch in notification half shelf dialog
to ensure contrast ratio.

Bug: 379594276
Test: Manual, Long press a notification, then tap: Turn off notification
Flag: EXEMPT bugfix
Change-Id: Ifac1bd92b8923d50947ba2f7c9e121c0eee81932
parent 9cf56c8a
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -71,15 +71,18 @@
                    android:textSize="16sp"
                />

                <Switch
                    android:id="@+id/toggle"
                <com.google.android.material.materialswitch.MaterialSwitch
                    android:theme="@style/Theme.Material3.DynamicColors.DayNight"
                    android:id="@+id/material_toggle"
                    android:filterTouchesWhenObscured="false"
                    android:clickable="true"
                    android:focusable="true"
                    android:padding="8dp"
                    android:layout_height="48dp"
                    android:layout_width="wrap_content"
                    android:layout_gravity="center_vertical"
                    android:padding="8dp"
                    android:track="@drawable/settingslib_track_selector"
                    android:thumb="@drawable/settingslib_thumb_selector"
                    android:theme="@style/MainSwitch.Settingslib"/>
                    style="@style/SettingslibSwitchStyle.Expressive"/>

            </com.android.systemui.statusbar.notification.row.AppControlView>

            <ScrollView
+8 −7
Original line number Diff line number Diff line
@@ -80,15 +80,16 @@
            />
        </RelativeLayout>

        <Switch
            android:id="@+id/toggle"
        <com.google.android.material.materialswitch.MaterialSwitch
            android:theme="@style/Theme.Material3.DynamicColors.DayNight"
            android:id="@+id/material_toggle"
            android:filterTouchesWhenObscured="false"
            android:clickable="true"
            android:focusable="true"
            android:padding="8dp"
            android:layout_height="48dp"
            android:layout_width="wrap_content"
            android:layout_gravity="center_vertical"
            android:padding="8dp"
            android:track="@drawable/settingslib_track_selector"
            android:thumb="@drawable/settingslib_thumb_selector"
            android:theme="@style/MainSwitch.Settingslib"
        />
            style="@style/SettingslibSwitchStyle.Expressive"/>
    </LinearLayout>
</com.android.systemui.statusbar.notification.row.ChannelRow>
+5 −5
Original line number Diff line number Diff line
@@ -34,11 +34,11 @@ import android.view.LayoutInflater
import android.view.View
import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.Switch
import android.widget.TextView
import com.android.settingslib.Utils
import com.android.systemui.res.R
import com.android.systemui.util.Assert
import com.google.android.material.materialswitch.MaterialSwitch

/** Half-shelf for notification channel controls */
class ChannelEditorListView(c: Context, attrs: AttributeSet) : LinearLayout(c, attrs) {
@@ -139,12 +139,12 @@ class ChannelEditorListView(c: Context, attrs: AttributeSet) : LinearLayout(c, a
class AppControlView(c: Context, attrs: AttributeSet) : LinearLayout(c, attrs) {
    lateinit var iconView: ImageView
    lateinit var channelName: TextView
    lateinit var switch: Switch
    lateinit var switch: MaterialSwitch

    override fun onFinishInflate() {
        iconView = requireViewById(R.id.icon)
        channelName = requireViewById(R.id.app_name)
        switch = requireViewById(R.id.toggle)
        switch = requireViewById(R.id.material_toggle)

        setOnClickListener { switch.toggle() }
    }
@@ -155,7 +155,7 @@ class ChannelRow(c: Context, attrs: AttributeSet) : LinearLayout(c, attrs) {
    lateinit var controller: ChannelEditorDialogController
    private lateinit var channelName: TextView
    private lateinit var channelDescription: TextView
    private lateinit var switch: Switch
    private lateinit var switch: MaterialSwitch
    private val highlightColor: Int
    var gentle = false

@@ -175,7 +175,7 @@ class ChannelRow(c: Context, attrs: AttributeSet) : LinearLayout(c, attrs) {
        super.onFinishInflate()
        channelName = requireViewById(R.id.channel_name)
        channelDescription = requireViewById(R.id.channel_description)
        switch = requireViewById(R.id.toggle)
        switch = requireViewById(R.id.material_toggle)
        switch.setOnCheckedChangeListener { _, b ->
            channel?.let {
                controller.proposeEditForChannel(