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

Commit f543854c authored by Jiaming Cheng's avatar Jiaming Cheng
Browse files

[QSDetailedView] Add the entry backgroud for single item

in the cast details view

Bug: 378513588
Flag: com.android.systemui.qs_tile_detailed_view
Test: Existing unit tests still pass.
Change-Id: Ic7660c6dd527b0ccdfeeb81ee0590f82f836b137
parent fd2e603f
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -168,6 +168,7 @@ private fun customizeView(listView: ListView) {
    val entryBackgroundEnd = context.getDrawable(SystemUiR.drawable.settingslib_entry_bg_off_end)
    val entryBackgroundMiddle =
        context.getDrawable(SystemUiR.drawable.settingslib_entry_bg_off_middle)
    val entryBackgroundSingle = context.getDrawable(SystemUiR.drawable.settingslib_entry_bg_off)

    // This code will run after the ListView has had a chance to complete its layout.
    listView.post {
@@ -185,9 +186,10 @@ private fun customizeView(listView: ListView) {
            if (adapterPosition != ListView.INVALID_POSITION) {
                val entry = child.getChildAt(0) as LinearLayout
                entry.background =
                    when (adapterPosition) {
                        0 -> entryBackgroundStart
                        totalItemCount - 1 -> entryBackgroundEnd
                    when {
                        totalItemCount == 1 -> entryBackgroundSingle
                        adapterPosition == 0 -> entryBackgroundStart
                        adapterPosition == totalItemCount - 1 -> entryBackgroundEnd
                        else -> entryBackgroundMiddle
                    }
                setPadding(context, child)