Fix the problem that the ToggleSubscriptionDialogActivity

appears twice when switch changed.

- Don't trigger the switch change event if the state of Switch and
  SwitchSettingsMainSwitchPreference are the same.

Fix: 190767461
Test: robotest and operate the switch preference manually

Change-Id: I6ab4b7e5ca1455948ca9118bb4a674fdc4fdbd50
This commit is contained in:
Stanley Wang
2021-06-24 21:58:28 +08:00
parent 416a24d821
commit ec95ed2650
3 changed files with 14 additions and 16 deletions

View File

@@ -59,8 +59,8 @@ public class SettingsMainSwitchPreferenceTest {
}
@Test
public void updateStatus_isRestricted_restrictIconShouldDisplay() {
mPreference.updateStatus(true);
public void onBindViewHolder_isRestricted_restrictIconShouldDisplay() {
mPreference.onBindViewHolder(mHolder);
final SettingsMainSwitchBar switchBar = mPreference.getSwitchBar();
final ImageView restrictedIcon = switchBar.findViewById(