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

Commit 1bf069f8 authored by Yuchen Chang's avatar Yuchen Chang
Browse files

Request focus in wifi screen in add network and secure wifi

Request focus from parent view in controller. Based on framework
patch, it can be placed in a parent and focus will go to whatever view
is the default focusable in that hierarchy.

Fixes: 68776177
Fixes: 72882629
Test: RunSettingsRobotests and Manual test
Change-Id: I3bcdc4ec814f68079a00e40435f46bdfa53f4425
parent de08983d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
        android:scrollIndicators="top|bottom">

    <LinearLayout
            android:id="@+id/l_wifidialog"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
+3 −0
Original line number Diff line number Diff line
@@ -363,6 +363,9 @@ public class WifiConfigController implements TextWatcher,
        if (mConfigUi.getSubmitButton() != null) {
            enableSubmitIfAppropriate();
        }

        // After done view show and hide, request focus from parent view
        mView.findViewById(R.id.l_wifidialog).requestFocus();
    }

    @VisibleForTesting
+16 −0
Original line number Diff line number Diff line
@@ -230,6 +230,22 @@ public class WifiConfigControllerTest {
        // No Crash
    }

    @Test
    public void ssidGetFocus_addNewNetwork_shouldReturnTrue() {
        mController = new TestWifiConfigController(mConfigUiBase, mView, null /* accessPoint */,
                WifiConfigUiBase.MODE_CONNECT);
        final TextView ssid = mView.findViewById(R.id.ssid);
        // Verify ssid text get focus when add new network (accesspoint is null)
        assertThat(ssid.isFocused()).isTrue();
    }

    @Test
    public void passwordGetFocus_connectSecureWifi_shouldReturnTrue() {
        final TextView password = mView.findViewById(R.id.password);
        // Verify password get focus when connect to secure wifi without eap type
        assertThat(password.isFocused()).isTrue();
    }

    public class TestWifiConfigController extends WifiConfigController {

        private TestWifiConfigController(