Commit Graph

16 Commits

Author SHA1 Message Date
Peter_Liang
e1c4901ce8 Fix the inconsistent alignment of the main switch preference.
Remove the redundant function.

Bug: 232494666
Test: manual test
Change-Id: I1827d39b194048452b71c680e2bbf94e43bfcac5
2022-07-21 00:56:07 +08:00
Chaohui Wang
692068d535 Add the jank detection to Settings toggles
Add jank detection when click the following preferences,
 - SwitchPreference
   Single target, detect click in InstrumentedPreferenceFragment
 - PrimarySwitchPreference
   Two target, only detect click switch in switch's onClick()
 - MainSwitchPreference
   Single target, detect click in TogglePreferenceController
 - SettingsMainSwitchPreference
   Single target, detect click in its onSwitchChanged()

Bug: 230285829
Test: manual & robo tests
Change-Id: I97a13e05a601237b16cd2d903ba2fb6ec4a69a74
2022-05-19 12:28:16 +08:00
Peter_Liang
f659095c07 Fix that once the phone is rotated to portrait orientation, the "Use TalkBack" toggle is truncated.
Goals:
1. Extends the api of apply partner's customization padding style in the Settings widget "SettingsMainSwitchPreference" to dynamically adjust the padding depending on the SetupWizard library.
2. Use the function to avoid the button being truncated.

Bug: 231512916
Test: manual test
Change-Id: I951776185eb1616136d9caf3a60f9daea4da191a
2022-05-13 08:44:18 +00:00
Stanley Wang
10c9cf6cd5 Fixe the problem of invalid switch preference.
The source of this problem is that onBindViewHolder is called
after the user add the OnMainSwitchChangeListener. Then
preference gets a new MainSwitchBar in onBindViewHolder and
causes the listener to fail.

Bug: 223325900
Test: Manually test and observe the UI
Change-Id: I6e58c4cf035811bb8805e76bebb5fbb86c7a79da
2022-04-27 17:17:21 +08:00
Stanley Wang
031cda05c3 Fixe the problem of invalid switch preference
- SettingsMainSwithBar will be recreated after the page is resumed.
  We should keep the OnMainSwitchChangeListener for
  SettingsMainSwitchPreference and re-register the listeners after
  the page is resumed.

Fix: 228930107
Fix: 222384287
Test: Manually test and see the UI
Change-Id: I9b57053989e611288cf4814b2a0ecbf9e3c55145
2022-04-27 03:41:06 +00:00
Stanley Wang
b757a6e9f2 Fix the problem that when the MainSwitchPreference is gone,
there will be a blank area.

- Disable the visibility of preference when the the hide() method
  is invoked.

Fix: 192332931
Test: robotest and see the UI
Change-Id: Iec5a06ca689843ebb692b1b7040f1d2be9f45bc2
2021-07-02 16:43:21 +08:00
Stanley Wang
ec95ed2650 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
2021-06-29 14:55:15 +08:00
Stanley Wang
19056c229c Fix the problem that the "Turn off SIM" dialog will be displayed
when the MobileNetwork page is slid to to top.

- Update the onBindViewHolder method of
  SettingsMainSwitchPreference. The root cause is that the
  onBindViewHolder method reset the visibility state of the
  SwitchBar.

Fix: 190652161
Test: robotest and test MobileNetwork page manually.
Change-Id: If0a75579fd4bf0fe987ce5d11d2f11d10f4bc43c
2021-06-15 14:44:22 +08:00
Stanley Wang
481b3abe0d Fix NPE in SettingsMainSwitchPreference.
- Check if the RestrictedPreferenceHelper is null to avoid NPE.

Fix: 190135868
Test: run robotest and manually test that page.
Change-Id: I746099260d8f53dc30513ccbb30aec5cbe3657e7
2021-06-04 16:15:04 +08:00
Stanley Wang
9b6ead8de7 SettingsMainSwitchPreference should display the restricted icon
if it is restricted.

- Use the RestrictedPreferenceHelper to check the restricted state.

Fix: 179245126
Test: rebotest and see the UI
Change-Id: I3c0e3bd0f3596d6fa548b6f8f10e4d12e7e50c9a
2021-05-31 14:49:48 +08:00
menghanli
79889460ae Remove above divider of main switch
Problem: The main switch won't be the ceiling preference. It has chance to show the divider if another preference won't disable the below divider.
Solution: Remove the above divider.

Bug: 186066199
Test: Test: Manual testing
Change-Id: I49893fa71b016f82dce9f402d47c86ec3df20a54
2021-05-17 05:52:50 +00:00
Julia Reynolds
5166e3939d Allow SettingsMainSwitchBars to be disabled
Test: manual, looking at notification settings
Fixes: 182859292
Change-Id: I06db2a0984b0dcbf71a69fc8f58e54b4670652a8
2021-03-16 14:55:18 -04:00
Stanley Wang
b69896ae60 Fix that when scrolling to the top on Wi-Fi page, the "Turn off SIM"
notification will pop up.

The root cause of the problem is that the switch preference and
switch bar status are not sync when using setCheckedInternal API.

Fix: 179498532
Test: Run robotest and see the ui
Change-Id: Ib51dc2ef27ce49b9c8ba69eb32757bf6b9945baf
2021-03-04 15:50:47 +08:00
Stanley Wang
86cc0579f3 Replace the SwitchBar with MainSwitch.
- Update wi-fi calling switch.
- Update the switches in Accessibility

Fix: 178673860
Fix: 177968565
Test: Run robotest and apply the widget in Settings and see the ui
Change-Id: Id10e6a110f418ea500a2eaf3c54752bef4f36507
2021-02-23 16:21:52 +08:00
Stanley Wang
10b7a7d483 Use MainSwitchPreference to replace the button style switches.
Fix: 177967926
Fix: 177968295
Fix: 177967925
Fix: 177968078

Test: Run robotest and apply the widget in Settings and see the ui
Change-Id: Ie854de96e5495fa564fb8a097ed4547bbd2b10c5
2021-02-02 08:39:37 +00:00
Stanley Wang
b87ddba6cd Use SettingsLib's MainSwitchBar to replace SwitchBar in Settings.
To log Settings metrics, the MainSwitch extends MainSwitchBar and
replace the SwitchBar in SettingsActivity.

Bug: 175181773
Test: Run robotest and apply the widget in Settings and see the ui

Change-Id: I3add3702e9058ad9192b5172c7cf0e2ccfb55a70
2021-01-14 22:48:31 +08:00