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

Commit 2b439cd4 authored by Zoey Chen's avatar Zoey Chen Committed by Android (Google) Code Review
Browse files

Merge "[Provider Model] Under the APM on, should set the sub-title to keep the...

Merge "[Provider Model] Under the APM on, should set the sub-title to keep the same height and avoid the jumpy" into sc-v2-dev
parents 02507e9c fd251b13
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@
            android:ellipsize="end"
            android:gravity="center_vertical|center_horizontal"
            android:layout_width="wrap_content"
            android:layout_height="32dp"
            android:layout_height="wrap_content"
            android:textAppearance="@style/TextAppearance.InternetDialog"
            android:textSize="24sp"/>

@@ -45,7 +45,7 @@
            android:id="@+id/internet_dialog_subtitle"
            android:gravity="center_vertical|center_horizontal"
            android:layout_width="wrap_content"
            android:layout_height="20dp"
            android:layout_height="wrap_content"
            android:layout_marginTop="4dp"
            android:ellipsize="end"
            android:maxLines="1"
@@ -150,6 +150,7 @@
                        android:gravity="start|center_vertical">
                        <TextView
                            android:id="@+id/mobile_title"
                            android:maxLines="1"
                            style="@style/InternetDialog.NetworkTitle"/>
                        <TextView
                            android:id="@+id/mobile_summary"
+2 −6
Original line number Diff line number Diff line
@@ -316,15 +316,11 @@ public class InternetDialogController implements AccessPointController.AccessPoi
    }

    CharSequence getSubtitleText(boolean isProgressBarVisible) {
        if (isAirplaneModeEnabled()) {
            return null;
        }

        if (mCanConfigWifi && !mWifiManager.isWifiEnabled()) {
            // When the airplane mode is off and Wi-Fi is disabled.
            // When Wi-Fi is disabled.
            //   Sub-Title: Wi-Fi is off
            if (DEBUG) {
                Log.d(TAG, "Airplane mode off + Wi-Fi off.");
                Log.d(TAG, "Wi-Fi off.");
            }
            return mContext.getText(SUBTITLE_TEXT_WIFI_IS_OFF);
        }
+10 −2
Original line number Diff line number Diff line
@@ -235,10 +235,18 @@ public class InternetDialogControllerTest extends SysuiTestCase {
    }

    @Test
    public void getSubtitleText_withAirplaneModeOn_returnNull() {
    public void getSubtitleText_withApmOnAndWifiOff_returnWifiIsOff() {
        fakeAirplaneModeEnabled(true);
        when(mWifiManager.isWifiEnabled()).thenReturn(false);

        assertThat(mInternetDialogController.getSubtitleText(false)).isNull();
        assertThat(mInternetDialogController.getSubtitleText(false))
                .isEqualTo(getResourcesString("wifi_is_off"));

        // if the Wi-Fi disallow config, then don't return Wi-Fi related string.
        mInternetDialogController.mCanConfigWifi = false;

        assertThat(mInternetDialogController.getSubtitleText(false))
                .isNotEqualTo(getResourcesString("wifi_is_off"));
    }

    @Test