Fix switch bar in location settings

When user rotates the device in location settings, the swtich bar with
"Use Location" is gone. This change fixes the problem.

Also, remove override getInitialExpandedChildCount() in
LocationSettings. We will use nested PreferenceCategory instead once the
support is ready.

Bug: 73872033
Bug: 70843646
Test: Manual
Change-Id: I343b549398ef2b3d64ca7962b5f2a4ef0441c7f5
This commit is contained in:
Maggie
2018-03-02 09:56:19 -08:00
parent 46d6ecc2b1
commit 601054ce6a
4 changed files with 62 additions and 19 deletions

View File

@@ -71,19 +71,17 @@ public class LocationSwitchBarControllerTest {
}
@Test
public void onStart_shouldShowSwitchBarAndAddOnSwitchChangeListener() {
public void onStart_shouldAddOnSwitchChangeListener() {
mController.onStart();
verify(mSwitchBar).show();
verify(mSwitchBar).addOnSwitchChangeListener(mController);
}
@Test
public void onStop_shouldHideSwitchBarAndRemoveOnSwitchChangeListener() {
public void onStop_shouldRemoveOnSwitchChangeListener() {
mController.onStart();
mController.onStop();
verify(mSwitchBar).hide();
verify(mSwitchBar).removeOnSwitchChangeListener(mController);
}