Merge "Hide entire hidden field for non-hidden networks" into pi-dev am: 2c793dfeff

am: 1a2153e6ab

Change-Id: Id5dc0b1855520c9071ce3b8c2897f2b69d3b3791
This commit is contained in:
Daichi Ueura
2018-05-23 16:05:02 -07:00
committed by android-build-merger
3 changed files with 6 additions and 21 deletions

View File

@@ -604,6 +604,7 @@
<LinearLayout android:id="@+id/hidden_settings_field"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
style="@style/wifi_item">
<TextView android:id="@+id/hidden_settings_title"

View File

@@ -220,8 +220,6 @@ public class WifiConfigController implements TextWatcher,
mMeteredSettingsSpinner = mView.findViewById(R.id.metered_settings);
mHiddenSettingsSpinner = mView.findViewById(R.id.hidden_settings);
mHiddenSettingsSpinner.setOnItemSelectedListener(this);
mHiddenSettingsSpinner.setVisibility(View.GONE);
mHiddenSettingsSpinner.setEnabled(false);
mHiddenWarningView = mView.findViewById(R.id.hidden_settings_warning);
mHiddenWarningView.setVisibility(
mHiddenSettingsSpinner.getSelectedItemPosition() == NOT_HIDDEN_NETWORK
@@ -241,8 +239,7 @@ public class WifiConfigController implements TextWatcher,
showProxyFields();
mView.findViewById(R.id.wifi_advanced_toggle).setVisibility(View.VISIBLE);
// Hidden option can be changed only when the user adds a network manually.
mHiddenSettingsSpinner.setVisibility(View.VISIBLE);
mHiddenSettingsSpinner.setEnabled(true);
mView.findViewById(R.id.hidden_settings_field).setVisibility(View.VISIBLE);
((CheckBox) mView.findViewById(R.id.wifi_advanced_togglebox))
.setOnCheckedChangeListener(this);

View File

@@ -259,26 +259,13 @@ public class WifiConfigControllerTest {
}
@Test
public void hiddenView_isDisabledWhenAppropriate() {
View hiddenSpinner = mView.findViewById(R.id.hidden_settings);
assertThat(hiddenSpinner.isEnabled()).isFalse();
public void hiddenField_visibilityUpdatesCorrectly() {
View hiddenField = mView.findViewById(R.id.hidden_settings_field);
assertThat(hiddenField.getVisibility()).isEqualTo(View.GONE);
mController = new TestWifiConfigController(mConfigUiBase, mView, null /* accessPoint */,
WifiConfigUiBase.MODE_CONNECT);
assertThat(hiddenSpinner.isEnabled()).isTrue();
}
@Test
public void hiddenSpinner_visibilityUpdatesCorrectly() {
View hiddenSpinner = mView.findViewById(R.id.hidden_settings);
assertThat(hiddenSpinner.isEnabled()).isFalse();
assertThat(hiddenSpinner.getVisibility()).isEqualTo(View.GONE);
mController = new TestWifiConfigController(mConfigUiBase, mView, null /* accessPoint */,
WifiConfigUiBase.MODE_CONNECT);
assertThat(hiddenSpinner.isEnabled()).isTrue();
assertThat(hiddenSpinner.getVisibility()).isEqualTo(View.VISIBLE);
assertThat(hiddenField.getVisibility()).isEqualTo(View.VISIBLE);
}
public class TestWifiConfigController extends WifiConfigController {