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

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

[QSDetailedView] Revamp the internet details view UI (part3)

Implemented the wifi entry background.

Rewritten InternetAdapterTest as a Parameterized test that checks
whether it's in details view or not.

Bug:378514300
Flag: com.android.systemui.qs_tile_detailed_view
Test: InternetAdapterTest
Change-Id: If22a63536c6e94a5248cb9628a5109905b72ab4a
parent 734bc03e
Loading
Loading
Loading
Loading
+17 −3
Original line number Diff line number Diff line
@@ -18,14 +18,18 @@ import android.testing.TestableResources;
import android.view.View;
import android.widget.LinearLayout;

import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.SmallTest;

import com.android.systemui.SysuiTestCase;
import com.android.systemui.res.R;
import com.android.wifitrackerlib.WifiEntry;

import com.google.common.collect.ImmutableList;

import kotlinx.coroutines.CoroutineScope;
import platform.test.runner.parameterized.Parameter;
import platform.test.runner.parameterized.ParameterizedAndroidJunit4;
import platform.test.runner.parameterized.Parameters;

import org.junit.Before;
import org.junit.Rule;
@@ -37,10 +41,11 @@ import org.mockito.junit.MockitoJUnit;
import org.mockito.junit.MockitoRule;

import java.util.Arrays;
import java.util.Collection;
import java.util.List;

@SmallTest
@RunWith(AndroidJUnit4.class)
@RunWith(ParameterizedAndroidJunit4.class)
public class InternetAdapterTest extends SysuiTestCase {

    private static final String WIFI_KEY = "Wi-Fi_Key";
@@ -75,6 +80,14 @@ public class InternetAdapterTest extends SysuiTestCase {
    private InternetAdapter mInternetAdapter;
    private InternetAdapter.InternetViewHolder mViewHolder;

    @Parameters(name = "isInDetailsView = {0}")
    public static Collection<Boolean> data() {
        return ImmutableList.of(true, false);
    }

    @Parameter
    public boolean isInDetailsView;

    @Before
    public void setUp() {
        mTestableResources = mContext.getOrCreateTestableResources();
@@ -86,7 +99,8 @@ public class InternetAdapterTest extends SysuiTestCase {
        when(mWifiEntry.getTitle()).thenReturn(WIFI_TITLE);
        when(mWifiEntry.getSummary(false)).thenReturn(WIFI_SUMMARY);

        mInternetAdapter = new InternetAdapter(mInternetDetailsContentController, mScope);
        mInternetAdapter = new InternetAdapter(mInternetDetailsContentController, mScope,
                isInDetailsView);
        mViewHolder = mInternetAdapter.onCreateViewHolder(new LinearLayout(mContext), 0);
        mInternetAdapter.setWifiEntries(Arrays.asList(mWifiEntry), 1 /* wifiEntriesCount */);
    }
+29 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright (C) 2025 The Android Open Source Project

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
  -->

<ripple xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
    android:color="?android:attr/colorControlHighlight">
    <item>
        <shape android:shape="rectangle">
            <solid android:color="@androidprv:color/materialColorPrimaryContainer"/>
            <corners
                android:bottomLeftRadius="@dimen/settingslib_switch_bar_radius"
                android:bottomRightRadius="@dimen/settingslib_switch_bar_radius"/>
        </shape>
    </item>
</ripple>
+26 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright (C) 2025 The Android Open Source Project

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
  -->

<ripple xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
    android:color="?android:attr/colorControlHighlight">
    <item>
        <shape android:shape="rectangle">
            <solid android:color="@androidprv:color/materialColorPrimaryContainer"/>
        </shape>
    </item>
</ripple>
+29 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright (C) 2025 The Android Open Source Project

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
  -->

<ripple xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
    android:color="?android:attr/colorControlHighlight">
    <item>
        <shape android:shape="rectangle">
            <solid android:color="@androidprv:color/materialColorPrimaryContainer"/>
            <corners
                android:topLeftRadius="@dimen/settingslib_switch_bar_radius"
                android:topRightRadius="@dimen/settingslib_switch_bar_radius"/>
        </shape>
    </item>
</ripple>
+2 −0
Original line number Diff line number Diff line
@@ -339,6 +339,8 @@
            <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">

Loading