Commit Graph

19 Commits

Author SHA1 Message Date
Jeff DeCew
5bfe1d3f9c Update NotificationChannelSettings Preferences in place to prevent re-layout.
(cherry picked from commit b409b64045)

Fixes: 110093185
Test: ChannelListPreferenceControllerTest
Change-Id: If6acf305c44085e502a3304ea57e409ce049b40f
Merged-In: If6acf305c44085e502a3304ea57e409ce049b40f
2020-10-12 20:06:48 -04:00
Arc Wang
0466c6e005 Ignore drag action on the switch button of MasterSwitchPreference
MasterSwitchPreference provides a toggle switch and it only
acts for clicking events. This fix consumes move events to
ignore drag actions.

Bug: 148770615
Test: make RunSettingsRoboTests ROBOTEST_FILTER=MasterSwitchPreferenceTest
      Manually drag the switch button of MasterSwitchPreference and
      observe the switch state is not changed.
Change-Id: I0d8b947b32d35b85403fc65605c18c09a4053135
2020-02-04 18:26:33 +08:00
Zhen Zhang
43b882c4e2 Let MasterSwitchPreference be restrictable
Let MasterSwitchPreference be restrictable by extending RestrictedPreference.
This is a prerequisite CL for "Hotspot & Tethering" in "Network & Internet" settings screen to be a MasterSwtichPreference.
Also changed MasterSwitchPreferenceTest perse.

Bug: 145922022
Test: SettingsRoboTests except StorageItemPreferenceControllerTest which
fails before this CL.
Change-Id: I54fa59d7adfce5f564c178c0db334974dbabf059
2019-12-10 17:37:41 -08:00
Jason Chiu
10e675d6b5 [Settings] Support master switch of inline toggle of Settings Injection v2
Allow developers to inject MasterSwitchPreference, a switch
preference with two tap targets, to Settings page.

Developers should declare keyhint and switch_uri for the activity
in AndroidManifest,and then implement a SwitchesProvider.

Bug: 132808482
Test: robotest
Change-Id: I64cdf18268be0cfcd38aab2c059144536dd79b32
2019-11-22 04:04:04 +00:00
Arc Wang
d1ea136cb8 [A11Y] Fix MasterSwitchPreference onClick not callback after TalkBack is enabled
TalkBack service dispatches onClick event to the Switch component
instead of the LinearLayout wrapping it. Do all the onClick tasks
for the Switch component instead of the LinearLayout wrapping it.

Bug: 142570671
Test: MasterSwitchPreferenceTest
      Manual click the toggle button for both TalkBack enabled case and disabled case.

Change-Id: I4b2f9df309d03a477863445cd187384cdb61314b
2019-11-14 09:59:35 +08:00
Fan Zhang
23f8d59d02 Sort imports
Having consistent import order will reduce chance of merge
conflict between internal and external master

Test: rebuild
Change-Id: I0b1a170967ddcce7f388603fd521f6ed1eeba30b
2018-08-28 22:13:15 +00:00
Fan Zhang
c7162cd24d Reorder and clean up imports.
Test: rebuild
Change-Id: I178485c84ae7146f991fd77b6d7504b029942a68
2018-06-18 15:45:09 -07:00
Aurimas Liutikas
e0069d332d Migrate Settings to androidx.
Test: make Settings
Bug: 76692459
Change-Id: I941dea40562170649bf056e675cc32e5163c0e39
2018-04-20 12:52:29 -07:00
Fan Zhang
928ddbe731 Merge sub pages for lock/unlock into 1 xml.
And create PreferenceControllers for each setting

The page is still pretty janky and controllers are invoked manually.
Next CL will clean these up.

Bug: 32953042
Test: TODO
Change-Id: I1d7478324f5de4fdb464d79f89086f7e79c0ee67
2018-01-04 15:02:36 -08:00
jackqdyulei
9891b74533 Remove the getSwitch() in SwitchWidgetController
IMHO we don't need to expose switch in SwitchWidgetController.
This controller already has enough API to control the switch.

Also rename mSwitchWidget to mSwitchController because it is not a
widget.

Bug: 69973752
Test: test still pass
Change-Id: I0ac247e34468a44109ab26019f1303c814e381f2
2017-11-30 13:58:57 -08:00
Doris Ling
e2ad415fdb Add content description to the master switch toggle button.
Set the preference title as the toggle button's content description, so
that when user focus on the button, it will read the lable as well on
top of just "switch on" or "switch off".

Change-Id: Id1954fd54b7d38cb4e75d8b3e49d05ee694e0e41
Fix: 37618855
Test: make RunSettingsRoboTests
2017-04-27 15:09:21 -07:00
Julia Reynolds
c68ae0b9fd Channel settings updates
- Update master switch preference to store enabled state in case
it's set before the view holder is bound
- Update master switch preference to prevent disabled switches
from being toggled
- Show an importance summary for max importance
- properly handle null notification sounds

Change-Id: I395b95b76d2a3c1c94b41d1c2720bb0cf1cae917
Fixes: 36920159
Fixes: 37421928
Fixes: 36939825
Test: RunSettingsRoboTests & manual
2017-04-17 14:42:09 -04:00
Doris Ling
aa805e70ed Allow settings preference title to span over multiple lines.
- add singleLineTitle=false to SettingsPreference style, so that it will
not confined the title to a single line.
- remove the custom multi line title from DividerPreference and
MasterSwitchPreference.

Change-Id: I5a78d2cd6ac00c4482e252b0789fd2d265bd9adf
Fix: 34886787
Test: manual
2017-04-11 13:17:38 -07:00
Fan Zhang
fe292515d8 Refactor the layout for MasterSwitch to a 2 target pref
And move the layout to settingslib.

The new TwoTargetPreference is a preference object that has a vertical
divider between main panel and widget (if it exists).

Converted master switch, restricted preference, gear preference to use
the new style

Change-Id: Ia3848cebb06b8edc4e60abf9b0caf13cdb29c22c
Fix: 36511169
Test: make RunSettingsRoboTests
2017-03-22 16:03:40 -07:00
Doris Ling
6467d2027e Extends the touch area for the switch in Master Switch preference.
- set view click listener on the entire widget view instead of only
listening to the switch button event.
- move the preference layout end padding into the widget frame, so that
clicking on the empty space at the end will send the click event to the
widget frame instead of the preference view.

Change-Id: I98025f723465f3941cebbbd03b812209c0240590
Fix: 35872094
Test: make RunSettingsRoboTests
2017-03-13 10:29:34 -07:00
Julia Reynolds
762a733afa Allow switch preferences to span lines.
Test: manual
Change-Id: Ifcc801873ed143c4d9ceb6fb928c276808a95f81
2017-02-28 16:30:48 -05:00
Fan Zhang
56199e9487 Misc fix on network & internet screen for developer preview
- Move wifi calling into wifi preference screen
- Update tethering setting title
- Ripple for master swtich preference only apply on the left half.
- Move network reset to action bar overflow menu

Fix: 34974598
Fix: 34976385
Test: RunSettingsRoboTests
Change-Id: I0e11843efc52a0042784a4da46b7ac81fcf16138
2017-02-06 18:14:14 -08:00
Doris Ling
c4c9f4d50e Update Network & internet->Wi-Fi to use MasterSwitchPreference.
- Add a preference controller for Network & internet->Wi-Fi to control
  the preference toggling and summary update.
- Refactor WifiSettings and WifiEnabler to share code between the new
  wifi preference controller and the wifi setting.
- Refactor BluetoothSummaryHelper to have a common base class with the
  WifiSummaryHelper.
- Rename the summary helper to summary updater.

Bug: 34280769
Test: make RunSettingsRoboTests
Change-Id: I00ebfc161bcef89331bb41ba405ed8cb8232d248
2017-01-25 10:43:01 -08:00
Doris Ling
1432cb8529 Add new preference class MasterSwitchPreference.
- Add a new preference type that has Title and optional summary on the
  left, and a toggle switch on the right. Clicking the left part of the
  preference will open a settings screen.
- Update Connected devices->Bluetooth to use this new preference.
- Refactor BluetoothSettings and BluetoothEnabler to share code between
  the new bluetooth preference controller and the bluetooth setting.

Bug: 34280769
Test: make RunSettingsRoboTests
Change-Id: I109ecdba640ecdd4748a6e5b2b4f4c47cbf653fd
2017-01-20 16:19:00 -08:00