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

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

[QSDetailedView] Add the see all buttton to the list view

Bug: 430145412
Flag: com.android.systemui.qs_tile_detailed_view
Test: UI change only. Existing unit tests still pass.
Change-Id: I6bcb6d9ee543e9e1f25301521eacc8b70d9fc9e5
parent 290fce88
Loading
Loading
Loading
Loading
+42 −42
Original line number Diff line number Diff line
@@ -340,7 +340,6 @@
            <LinearLayout
                android:id="@+id/see_all_layout"
                style="@style/InternetDialog.Network"
                android:background="@drawable/settingslib_entry_bg_off_end"
                android:layout_marginTop="@dimen/tile_details_entry_gap"
                android:layout_height="64dp"
                android:paddingStart="20dp">
@@ -376,6 +375,47 @@
                </FrameLayout>
            </LinearLayout>

            <LinearLayout
                android:id="@+id/add_network_button"
                style="@style/InternetDialog.Network"
                android:background="@drawable/settingslib_entry_bg_off_end"
                android:layout_marginTop="@dimen/tile_details_entry_gap"
                android:layout_height="64dp"
                android:paddingStart="20dp"
                android:visibility="gone">

                <FrameLayout
                    android:layout_width="24dp"
                    android:layout_height="24dp"
                    android:layout_gravity="center_vertical|start"
                    android:clickable="false">

                    <ImageView
                        android:contentDescription="@string/add_network_button_text"
                        android:src="@drawable/ic_add"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:tint="@androidprv:color/materialColorOnSurface" />
                </FrameLayout>

                <FrameLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_marginStart="@dimen/internet_dialog_network_layout_margin"
                    android:clickable="false"
                    android:orientation="vertical">

                    <TextView
                        android:text="@string/add_network_button_text"
                        android:layout_width="wrap_content"
                        android:layout_height="match_parent"
                        android:gravity="start|center_vertical"
                        android:textAppearance="@style/TextAppearance.TileDetailsEntryTitle"
                        android:textSize="14sp" />
                </FrameLayout>
            </LinearLayout>

            <LinearLayout
                android:id="@+id/login_screen_change_connected_wifi_notify_layout"
                style="@style/InternetDialog.Network"
@@ -482,53 +522,13 @@
                android:layout_height="wrap_content"
                android:layout_marginBottom="@dimen/dialog_bottom_padding">

                <LinearLayout
                    android:id="@+id/add_network_button"
                    style="@style/InternetDialog.Network"
                    android:layout_height="@dimen/tile_details_button_row_height"
                    android:layout_width="0dp"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintEnd_toStartOf="@id/share_wifi_button"
                    app:layout_constraintTop_toTopOf="parent"
                    app:layout_constraintBottom_toBottomOf="parent"
                    android:background="@drawable/settingslib_entry_bg_off"
                    android:gravity="center"
                    android:visibility="gone">

                    <FrameLayout
                        android:layout_width="@dimen/tile_details_button_size"
                        android:layout_height="@dimen/tile_details_button_size"
                        android:clickable="false">

                        <ImageView
                            android:contentDescription="@string/add_network_button_text"
                            android:src="@drawable/ic_add"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:tint="@androidprv:color/materialColorOnSurface" />
                    </FrameLayout>

                    <FrameLayout
                        android:clickable="false"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="@dimen/internet_dialog_network_layout_margin">

                        <TextView
                            android:text="@string/add_network_button_text"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:textAppearance="@style/TextAppearance.TileDetailsEntryTitle" />
                    </FrameLayout>
                </LinearLayout>

                <LinearLayout
                    android:id="@+id/share_wifi_button"
                    style="@style/InternetDialog.Network"
                    android:layout_height="@dimen/tile_details_button_row_height"
                    android:layout_width="0dp"
                    app:layout_constrainedWidth="true"
                    app:layout_constraintStart_toEndOf="@id/add_network_button"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintTop_toTopOf="parent"
                    app:layout_constraintBottom_toBottomOf="parent"
+15 −4
Original line number Diff line number Diff line
@@ -331,8 +331,9 @@ constructor(
                            when {
                                itemCount == 1 -> entryBackgroundInactive
                                adapterPosition == 0 -> entryBackgroundStart
                                adapterPosition == itemCount - 1 && !hasMoreWifiEntries ->
                                    entryBackgroundEnd
                                adapterPosition == itemCount - 1 &&
                                    !hasMoreWifiEntries &&
                                    !QsWifiConfig.isEnabled -> entryBackgroundEnd
                                else -> entryBackgroundMiddle
                            }

@@ -792,10 +793,12 @@ constructor(
            addNetworkButton.visibility = View.GONE
            return
        }
        if (QsWifiConfig.isEnabled) {
        val isAddNetworkVisible = QsWifiConfig.isEnabled

        if (isAddNetworkVisible) {
            addNetworkButton.visibility = View.VISIBLE
        }
        if (QsWifiConfig.isEnabled && internetContent.showAllWifiInList) {
        if (isAddNetworkVisible && internetContent.showAllWifiInList) {
            hasMoreWifiEntries = false
            adapter.setShowAllWifi()
            seeAllLayout.visibility = View.GONE
@@ -812,6 +815,14 @@ constructor(
            seeAllLayout.visibility = if (hasMoreWifiEntries) View.VISIBLE else View.INVISIBLE
        }
        wifiRecyclerView.invalidateItemDecorations()

        // Here using `View.setBackgroundResource` instead of setting the background directly. This
        // is a deliberate choice to avoid issues where a shared Drawable's state can cause
        // rendering problems (e.g., an empty background).
        seeAllLayout.setBackgroundResource(
            if (isAddNetworkVisible) R.drawable.settingslib_entry_bg_off_middle
            else R.drawable.settingslib_entry_bg_off_end
        )
        wifiRecyclerView.visibility = View.VISIBLE
    }