Merge "[Wi-Fi] Hide the Advanced Option after expanding the advanced option fields."
This commit is contained in:
@@ -1956,8 +1956,6 @@
|
|||||||
<string name="wifi_show_advanced">Advanced options</string>
|
<string name="wifi_show_advanced">Advanced options</string>
|
||||||
<!-- Message for talkback to say when focus on Advanced Options[CHAR LIMIT=NONE] -->
|
<!-- Message for talkback to say when focus on Advanced Options[CHAR LIMIT=NONE] -->
|
||||||
<string name="wifi_advanced_toggle_description">Drop down list Advanced Options</string>
|
<string name="wifi_advanced_toggle_description">Drop down list Advanced Options</string>
|
||||||
<!-- Extended message for talkback to say when Advanced Options is expanded. (e.g., Double-tap to collapse) [CHAR LIMIT=NONE] -->
|
|
||||||
<string name="wifi_advanced_toggle_description_expanded">collapse</string>
|
|
||||||
<!-- Extended message for talkback to say when Advanced Options is collapsed. (e.g., Double-tap to expand) [CHAR LIMIT=NONE] -->
|
<!-- Extended message for talkback to say when Advanced Options is collapsed. (e.g., Double-tap to expand) [CHAR LIMIT=NONE] -->
|
||||||
<string name="wifi_advanced_toggle_description_collapsed">expand</string>
|
<string name="wifi_advanced_toggle_description_collapsed">expand</string>
|
||||||
<!-- Label for the SSID of the network -->
|
<!-- Label for the SSID of the network -->
|
||||||
|
@@ -347,9 +347,13 @@ public class WifiConfigController implements TextWatcher,
|
|||||||
showProxyFields();
|
showProxyFields();
|
||||||
final CheckBox advancedTogglebox =
|
final CheckBox advancedTogglebox =
|
||||||
(CheckBox) mView.findViewById(R.id.wifi_advanced_togglebox);
|
(CheckBox) mView.findViewById(R.id.wifi_advanced_togglebox);
|
||||||
|
if (!showAdvancedFields) {
|
||||||
|
// Need to show Advanced Option button.
|
||||||
|
mView.findViewById(R.id.wifi_advanced_toggle).setVisibility(View.VISIBLE);
|
||||||
advancedTogglebox.setOnCheckedChangeListener(this);
|
advancedTogglebox.setOnCheckedChangeListener(this);
|
||||||
advancedTogglebox.setChecked(showAdvancedFields);
|
advancedTogglebox.setChecked(showAdvancedFields);
|
||||||
setAdvancedOptionAccessibilityString(showAdvancedFields);
|
setAdvancedOptionAccessibilityString();
|
||||||
|
}
|
||||||
mView.findViewById(R.id.wifi_advanced_fields)
|
mView.findViewById(R.id.wifi_advanced_fields)
|
||||||
.setVisibility(showAdvancedFields ? View.VISIBLE : View.GONE);
|
.setVisibility(showAdvancedFields ? View.VISIBLE : View.GONE);
|
||||||
}
|
}
|
||||||
@@ -1553,17 +1557,10 @@ public class WifiConfigController implements TextWatcher,
|
|||||||
((EditText) mPasswordView).setSelection(pos);
|
((EditText) mPasswordView).setSelection(pos);
|
||||||
}
|
}
|
||||||
} else if (view.getId() == R.id.wifi_advanced_togglebox) {
|
} else if (view.getId() == R.id.wifi_advanced_togglebox) {
|
||||||
final int toggleVisibility;
|
|
||||||
final int stringID;
|
|
||||||
if (isChecked) {
|
|
||||||
toggleVisibility = View.VISIBLE;
|
|
||||||
// Hide the SoftKeyboard temporary to let user can see most of the expanded items.
|
// Hide the SoftKeyboard temporary to let user can see most of the expanded items.
|
||||||
hideSoftKeyboard(mView.getWindowToken());
|
hideSoftKeyboard(mView.getWindowToken());
|
||||||
} else {
|
view.setVisibility(View.GONE);
|
||||||
toggleVisibility = View.GONE;
|
mView.findViewById(R.id.wifi_advanced_fields).setVisibility(View.VISIBLE);
|
||||||
}
|
|
||||||
mView.findViewById(R.id.wifi_advanced_fields).setVisibility(toggleVisibility);
|
|
||||||
setAdvancedOptionAccessibilityString(isChecked);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1673,7 +1670,7 @@ public class WifiConfigController implements TextWatcher,
|
|||||||
((CheckBox) mView.findViewById(R.id.wifi_advanced_togglebox))
|
((CheckBox) mView.findViewById(R.id.wifi_advanced_togglebox))
|
||||||
.setOnCheckedChangeListener(this);
|
.setOnCheckedChangeListener(this);
|
||||||
// Set correct accessibility strings.
|
// Set correct accessibility strings.
|
||||||
setAdvancedOptionAccessibilityString(false /* showAdvancedFields */);
|
setAdvancedOptionAccessibilityString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1765,7 +1762,7 @@ public class WifiConfigController implements TextWatcher,
|
|||||||
inputMethodManager.hideSoftInputFromWindow(windowToken, 0 /* flags */);
|
inputMethodManager.hideSoftInputFromWindow(windowToken, 0 /* flags */);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setAdvancedOptionAccessibilityString(boolean showAdvancedFields) {
|
private void setAdvancedOptionAccessibilityString() {
|
||||||
final CheckBox advancedToggleBox = mView.findViewById(R.id.wifi_advanced_togglebox);
|
final CheckBox advancedToggleBox = mView.findViewById(R.id.wifi_advanced_togglebox);
|
||||||
advancedToggleBox.setAccessibilityDelegate(new AccessibilityDelegate() {
|
advancedToggleBox.setAccessibilityDelegate(new AccessibilityDelegate() {
|
||||||
@Override
|
@Override
|
||||||
@@ -1776,12 +1773,10 @@ public class WifiConfigController implements TextWatcher,
|
|||||||
info.setCheckable(false /* checkable */);
|
info.setCheckable(false /* checkable */);
|
||||||
// To let TalkBack don't pronounce CheckBox.
|
// To let TalkBack don't pronounce CheckBox.
|
||||||
info.setClassName(null /* className */);
|
info.setClassName(null /* className */);
|
||||||
final CharSequence accessibilityDoubleTapExtend = mContext.getString(
|
|
||||||
showAdvancedFields ? R.string.wifi_advanced_toggle_description_expanded
|
|
||||||
: R.string.wifi_advanced_toggle_description_collapsed);
|
|
||||||
// Customize TalkBack's pronunciation which been appended to "Double-tap to".
|
// Customize TalkBack's pronunciation which been appended to "Double-tap to".
|
||||||
final AccessibilityAction customClick = new AccessibilityAction(
|
final AccessibilityAction customClick = new AccessibilityAction(
|
||||||
AccessibilityNodeInfo.ACTION_CLICK, accessibilityDoubleTapExtend);
|
AccessibilityNodeInfo.ACTION_CLICK,
|
||||||
|
mContext.getString(R.string.wifi_advanced_toggle_description_collapsed));
|
||||||
info.addAction(customClick);
|
info.addAction(customClick);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@@ -348,9 +348,13 @@ public class WifiConfigController2 implements TextWatcher,
|
|||||||
showProxyFields();
|
showProxyFields();
|
||||||
final CheckBox advancedTogglebox =
|
final CheckBox advancedTogglebox =
|
||||||
(CheckBox) mView.findViewById(R.id.wifi_advanced_togglebox);
|
(CheckBox) mView.findViewById(R.id.wifi_advanced_togglebox);
|
||||||
|
if (!showAdvancedFields) {
|
||||||
|
// Need to show Advanced Option button.
|
||||||
|
mView.findViewById(R.id.wifi_advanced_toggle).setVisibility(View.VISIBLE);
|
||||||
advancedTogglebox.setOnCheckedChangeListener(this);
|
advancedTogglebox.setOnCheckedChangeListener(this);
|
||||||
advancedTogglebox.setChecked(showAdvancedFields);
|
advancedTogglebox.setChecked(showAdvancedFields);
|
||||||
setAdvancedOptionAccessibilityString(showAdvancedFields);
|
setAdvancedOptionAccessibilityString();
|
||||||
|
}
|
||||||
mView.findViewById(R.id.wifi_advanced_fields)
|
mView.findViewById(R.id.wifi_advanced_fields)
|
||||||
.setVisibility(showAdvancedFields ? View.VISIBLE : View.GONE);
|
.setVisibility(showAdvancedFields ? View.VISIBLE : View.GONE);
|
||||||
}
|
}
|
||||||
@@ -1554,17 +1558,10 @@ public class WifiConfigController2 implements TextWatcher,
|
|||||||
((EditText) mPasswordView).setSelection(pos);
|
((EditText) mPasswordView).setSelection(pos);
|
||||||
}
|
}
|
||||||
} else if (view.getId() == R.id.wifi_advanced_togglebox) {
|
} else if (view.getId() == R.id.wifi_advanced_togglebox) {
|
||||||
final int toggleVisibility;
|
|
||||||
final int stringID;
|
|
||||||
if (isChecked) {
|
|
||||||
toggleVisibility = View.VISIBLE;
|
|
||||||
// Hide the SoftKeyboard temporary to let user can see most of the expanded items.
|
// Hide the SoftKeyboard temporary to let user can see most of the expanded items.
|
||||||
hideSoftKeyboard(mView.getWindowToken());
|
hideSoftKeyboard(mView.getWindowToken());
|
||||||
} else {
|
view.setVisibility(View.GONE);
|
||||||
toggleVisibility = View.GONE;
|
mView.findViewById(R.id.wifi_advanced_fields).setVisibility(View.VISIBLE);
|
||||||
}
|
|
||||||
mView.findViewById(R.id.wifi_advanced_fields).setVisibility(toggleVisibility);
|
|
||||||
setAdvancedOptionAccessibilityString(isChecked);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1674,7 +1671,7 @@ public class WifiConfigController2 implements TextWatcher,
|
|||||||
((CheckBox) mView.findViewById(R.id.wifi_advanced_togglebox))
|
((CheckBox) mView.findViewById(R.id.wifi_advanced_togglebox))
|
||||||
.setOnCheckedChangeListener(this);
|
.setOnCheckedChangeListener(this);
|
||||||
// Set correct accessibility strings.
|
// Set correct accessibility strings.
|
||||||
setAdvancedOptionAccessibilityString(false /* showAdvancedFields */);
|
setAdvancedOptionAccessibilityString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1766,7 +1763,7 @@ public class WifiConfigController2 implements TextWatcher,
|
|||||||
inputMethodManager.hideSoftInputFromWindow(windowToken, 0 /* flags */);
|
inputMethodManager.hideSoftInputFromWindow(windowToken, 0 /* flags */);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setAdvancedOptionAccessibilityString(boolean showAdvancedFields) {
|
private void setAdvancedOptionAccessibilityString() {
|
||||||
final CheckBox advancedToggleBox = mView.findViewById(R.id.wifi_advanced_togglebox);
|
final CheckBox advancedToggleBox = mView.findViewById(R.id.wifi_advanced_togglebox);
|
||||||
advancedToggleBox.setAccessibilityDelegate(new AccessibilityDelegate() {
|
advancedToggleBox.setAccessibilityDelegate(new AccessibilityDelegate() {
|
||||||
@Override
|
@Override
|
||||||
@@ -1777,12 +1774,10 @@ public class WifiConfigController2 implements TextWatcher,
|
|||||||
info.setCheckable(false /* checkable */);
|
info.setCheckable(false /* checkable */);
|
||||||
// To let TalkBack don't pronounce CheckBox.
|
// To let TalkBack don't pronounce CheckBox.
|
||||||
info.setClassName(null /* className */);
|
info.setClassName(null /* className */);
|
||||||
final CharSequence accessibilityDoubleTapExtend = mContext.getString(
|
|
||||||
showAdvancedFields ? R.string.wifi_advanced_toggle_description_expanded
|
|
||||||
: R.string.wifi_advanced_toggle_description_collapsed);
|
|
||||||
// Customize TalkBack's pronunciation which been appended to "Double-tap to".
|
// Customize TalkBack's pronunciation which been appended to "Double-tap to".
|
||||||
final AccessibilityAction customClick = new AccessibilityAction(
|
final AccessibilityAction customClick = new AccessibilityAction(
|
||||||
AccessibilityNodeInfo.ACTION_CLICK, accessibilityDoubleTapExtend);
|
AccessibilityNodeInfo.ACTION_CLICK,
|
||||||
|
mContext.getString(R.string.wifi_advanced_toggle_description_collapsed));
|
||||||
info.addAction(customClick);
|
info.addAction(customClick);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@@ -549,4 +549,13 @@ public class WifiConfigControllerTest {
|
|||||||
assertThat(advButton.getContentDescription()).isEqualTo(
|
assertThat(advButton.getContentDescription()).isEqualTo(
|
||||||
mContext.getString(R.string.wifi_advanced_toggle_description));
|
mContext.getString(R.string.wifi_advanced_toggle_description));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getVisibility_whenAdvancedOptionClicked_shouldBeGone() {
|
||||||
|
final CheckBox advButton = mView.findViewById(R.id.wifi_advanced_togglebox);
|
||||||
|
|
||||||
|
advButton.performClick();
|
||||||
|
|
||||||
|
assertThat(advButton.getVisibility()).isEqualTo(View.GONE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user