Commit Graph

146 Commits

Author SHA1 Message Date
Doris Ling
fe5259493d Hide the SelfAvailablePreference if it is not available.
- instead of removing it from the preference screen, set its visibility
to false, so that if it becomes available later, it will still be found
on the screen.

Bug: 119838520
Test: make RunSettingsRoboTests
Change-Id: Idc7079bb5846aef247dd87c0b0dba2546f2d8f8f
2018-11-27 14:58:55 -08:00
tmfang
dce94bb237 Use SettingsLib's LayoutPreference
- Remove LayoutPreference in Settings source code.
- Remove unused style, layout
- Replace old imports to com.android.settingslib.widget.LayoutPreference
- Replace old XML tag to com.android.settingslib.widget.LayoutPreference

Test: robotest, manual test
Bug: 120005054
Change-Id: I9ae1ae14a16f443e11ac5d75b6038c7c5e253844
2018-11-27 13:12:53 +08:00
tmfang
d5405cf49d Fix InstantiationException on fragment
Since we overrided the empty constructor,
it can't find a empty constructor when
Fragment tries to instantiate a fragment
in framework.

So, we can't override this constructor,
and then just use newInstance() to initialize
and setup a new Fragment.

Test: robotest
Change-Id: Ifcd1c1771bc69d947caeee5c5bc055c4f94365c2
Fixes: 115676209
2018-10-17 04:20:09 +08:00
Fan Zhang
ff6f6f6991 Merge "Clean up: delete unused methods" am: 41f9566da8 am: b371dea0cb
am: 88cbe51f27

Change-Id: Ib166230d692cc7a3973355239161ed88ffd6af60
2018-09-12 17:44:52 -07:00
Fan Zhang
b371dea0cb Merge "Clean up: delete unused methods"
am: 41f9566da8

Change-Id: I973b289c688c04c00f70a6c0ba15a5b205d6633a
2018-09-12 17:12:54 -07:00
Fan Zhang
409a5f8c98 Clean up: delete unused methods
Test: rebuild
Change-Id: I144ebbdaf137ee091af949a9e38f68d02941f705
2018-09-12 13:08:15 -07:00
Fan Zhang
de117046ad DO NOT MERGE Import clean up.
Reordered all imports according to Android codestyle.

Test: rebuild
Change-Id: I750f01f70f2114d51838bf652833aebdc4065c98
2018-09-04 13:54:46 -07:00
Aurimas Liutikas
03fcde338b Migrate Settings to androidx.
Test: make Settings
Bug: 76692459
Change-Id: I941dea40562170649bf056e675cc32e5163c0e39
Merged-In: I941dea40562170649bf056e675cc32e5163c0e39
(cherry picked from commit a290b873d0)
(cherry picked from commit b1af85d155)
2018-08-28 16:35:52 -07: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
Aurimas Liutikas
b1af85d155 Migrate Settings to androidx.
Test: make Settings
Bug: 76692459
Change-Id: I941dea40562170649bf056e675cc32e5163c0e39
Merged-In: I941dea40562170649bf056e675cc32e5163c0e39
(cherry picked from commit a290b873d0)
2018-08-28 11:48:56 -07:00
tmfang
27c84de325 Settings Fragment Migration (Build pass app)
This patch focused on fixing compile errors and some runtime errors.

Test: We can't test it now. But we will have an integration test later.
Bug: 110259478
Change-Id: I16c471ddcd0fa1460c665b7f74d86fcace5ee67b
2018-07-11 18:24:51 -07:00
tmfang
99cc23d0da Settings Fragment Migration (Change imports)
This commit *only* changes imports and optimize imports.
We don't do anything else.

This patch can't compile pass and run test case.
We will update other patches to fix these problem.

Change list.

1. import android.app.Fragment; ->
   import androidx.fragment.app.Fragment;
2. import android.app.DialogFragment; ->
   import androidx.fragment.app.DialogFragment;
3. import android.app.ListFragment; ->
   import androidx.fragment.app.ListFragment;
4. import android.app.LoaderManager; ->
   import androidx.loader.app.LoaderManager;
5. import android.content.AsyncTaskLoader; ->
   import androidx.loader.content.AsyncTaskLoader;
6. import android.content.Loader; ->
   import androidx.loader.content.Loader;
7. import android.app.FragmentTransaction; ->
   import androidx.fragment.app.FragmentTransaction;
8. import android.app.FragmentManager; ->
   import androidx.fragment.app.FragmentManager;
9. import android.app.LoaderManager.LoaderCallbacks; ->
    import androidx.loader.app.LoaderManager.LoaderCallbacks;

Bug: 110259478
Test: Can't test it.
Change-Id: I0a3f98fff34a3494a839c3c42aeabcec3df2c8b3
2018-07-11 18:23:51 -07:00
Fan Zhang
78ea7da54c Misc tweaks to Indexable usage and tests.
- Make SettingsPreferenceFragment implement Indexable directly
- Add existing fragments that are SettingsPrefFragment but not Indexable
  to grandfather list.
- Fix "font size" fragment so it shows up in search properly.
- Remove duplicates for "lock screen display", "Screen saver".

Bug: 70720645
Test: robotests
Change-Id: I44ce0cac0fdf5e882b315861bb4bebc45dbe01e6
2018-07-02 16:46:23 -07: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
Jan Nordqvist
9eb43ddddf Fall back to Wi-Fi data display in data usage screen with no SIM.
Bug: 70950124

Test: manual
Test: make RunSettingsRoboTests
Change-Id: I06bf78e54119819be87e15baca7e5b6a241958cb
2018-04-05 07:58:23 -07:00
Jan Nordqvist
cd3f9e2a5e Fall back to Wi-Fi data display in data usage screen with no SIM.
Bug: 70950124

Test: manual
Test: make RunSettingsRoboTests
Change-Id: I06bf78e54119819be87e15baca7e5b6a241958cb
Merged-In: I06bf78e54119819be87e15baca7e5b6a241958cb
2018-04-04 15:58:53 -07:00
Fan Zhang
3befdd2c54 Merge "Fix search highlight" 2018-02-20 23:38:46 +00:00
Fan Zhang
72456a9ea6 Fix search highlight
- Fragments should not have advanced button when coming from search.

Change-Id: I10a192216b7ff702e73b791acbcc1eb1d71cb407
Fixes: 73348428
Test: robotests
2018-02-20 13:19:26 -08:00
Fan Zhang
b1d6c76b53 Migrate more settings to SubSettingLauncher
Bug: 73250851
Test: robotest
Change-Id: Ifc27b90d68bf4a907f169e19338e9b52ea5f9922
2018-02-18 21:10:03 -08:00
Fan Zhang
a10004661c Fix NPE when instantiating SettingsPreferenceFragment
Change-Id: I3997d6436f358b802dff9be307c36031f4351ab4
Fixes: 72868191
Test: robotests
2018-02-02 12:18:39 -08:00
Fan Zhang
3d516e7607 Highlight row (instead of ripple) when come from search.
- Moved HighlightableAdapter to its own class
- Replaced ripple with blue background
- Bluebackground only stays for 5 seconds. After that it's replaced by
  ?attr/selectableBackground

Misc fixes.

- Fix NPE in UserSettings
- Update char limit on a new string

Change-Id: I4687e54e71fd7b9243f520b7630563df58be23d4
Fixes: 71715698
Fixes: 72761974
Test: robotests
2018-02-01 12:35:25 -08:00
Leif Hendrik Wilden
28dee1f086 Migrate to use instrumentation classes from settingslib.
Test: Compiles. Manually tested.
Change-Id: I70a6e76cc8440547746ecc008c32bd06a7de8161
2018-01-24 12:30:39 -08:00
Leif Wilden
cab0ee611d Revert "Migrate to use instrumentation classes from settingslib."
This reverts commit 1546cca529.

Reason for revert: Broke fingerprint setup flow. b/72267201

Change-Id: I8321265ae64732c526325882ddea51080decddf5
2018-01-22 20:57:36 +00:00
Leif Hendrik Wilden
1546cca529 Migrate to use instrumentation classes from settingslib.
Test: Compiles. Manually tested.
Change-Id: Ie5515bb0fe3e621fc7723a9b04ba23e4bfa9c401
2018-01-18 11:13:24 -08:00
Fan Zhang
681a4cdd47 Add search menu to all pages
Change-Id: I0910df3d26fe583deb70d7052bde28b64e7844a7
Fixes: 68814716
Test: robotests
2017-11-30 10:43:18 -08:00
Fan Zhang
e0b0e9f902 Refactor help menu stuff into a controller
This is a clean up to action bar menu item pattern, we will use the same
pattern to build search icon on all pages in a later change.

Bug: 68814716
Test: robotests
Change-Id: Iedd3ec263e8ccb63ed75ec7a95b28c00878b1de4
2017-11-29 15:51:04 -08:00
Doris Ling
9ff1d79ef6 Expand all preferences when launch from search.
- when the fragment is created, checks the argument to see if the extra
fragment arg key is set. If so, do not hide the preferences in the
preference screen inside the advanced button.

Change-Id: I80fa20672024fe702ed2ddab448232bdc92ce05f
Fixes: 68988454
Test: make RunSettingsRoboTests
2017-11-13 13:43:17 -08:00
Fan Zhang
9ce35ad023 Revert "Expand all preferences when launch from search."
This reverts commit 6589a07d59.
Bug: 68988454
Fixes: 69242304

Change-Id: Iec29dbe302064a6209fbb0a8e7901c9a0f8744c0
2017-11-13 18:57:46 +00:00
Doris Ling
6589a07d59 Expand all preferences when launch from search.
- when the fragment is created, checks the argument to see if the extra
fragment arg key is set. If so, do not hide the preferences in the
advanced button.

Change-Id: Id662ae1cec77edad7fcd5d6daa71929a8cb1402c
Fixes: 68988454
Test: make RunSettingsRoboTests
2017-11-09 15:18:09 -08:00
Fan Zhang
896f1b363c Reduce jank around loading view when opening data usage UI
Change-Id: I3d23d8160b046de8fe125ba0697b7b3d7786453c
Fix: 28181319
Test: robotests
2017-06-26 15:15:30 -07:00
Juan Lang
4482812cb1 Use SettingsLib's versions of Custom* classes.
Test: make RunSettingsRoboTests
Change-Id: I2584e820b72bb4672c53fd1a9f63c7f1662e0809
2017-06-21 12:07:50 -07:00
Matthew Fritze
824f25320a Merge "Search results always highlight proper results" into oc-dev
am: 2a32cb6a33

Change-Id: I1bc6297cc75aa833184a00598f5930aa3ca114dc
2017-06-09 01:23:39 +00:00
Matthew Fritze
33f3e3f4f7 Search results always highlight proper results
In fragments where preferences were being injected after
the super#onResume, the incorrect preference was
being highlighted as the selected result.

This is because the index of the preference is calculated
in SettingsPreferenceFragment#onResume, but the index is
not checked again before the item is highlighted.

Instead, we calculate index right before we highlight.

Change-Id: Idaa655f682a1a6186c1996fb51d352589bbeda0f
Fixes: 62179739
Test: runtest --path packages/apps/Settings/tests/app/src/com/android/settings/SettingsPreferenceFragmentTest.java
2017-06-08 16:25:52 -07:00
jackqdyulei
2b2abac714 Update updateEmptyView
Also consider the visiblity of list container, when list container
is invisible, we should show the empty view.

Bug: 62062415
Test: RunSettingsRoboTests
Change-Id: I065e70386242c425ef3cbfb2b703a5433dbe40c1
2017-05-26 10:53:53 -07:00
Fan Zhang
b84b9cc8e7 Merge "Recursively remove preference from screen." into oc-dev am: 7731b4244e
am: 4472d8af83

Change-Id: Ie8835c9789d959ce3d75b84b05d711f976bab56e
2017-05-25 03:28:15 +00:00
Fan Zhang
e84407f5c3 Recursively remove preference from screen.
The preference framework does not remove pref recursively. So when a
preference is nested in preference hierarchy, it's not safe to simply
call screen.removePreference(). We need to first find its parent and
remove pref from its parent.

Change-Id: Ic7fefa498ed71a8877d862845ddcc2d6d6034a55
Fix: 38507066
Test: make RunSettingsRoboTests
2017-05-24 21:21:00 +00:00
Juan Lang
777ed2535a Depend on SettingsLib's version of lifecycle and FooterMixin.
The implementations have been imported into SettingsLib. Setting's copy
can now be removed, which this change also does.

Test: Manually check battery status, which uses FooterMixin, looks OK.
make RunSettingsLibRobotTests && make RunSettingsRoboTests
     && make RunSettingsGoogleRoboTests
Change-Id: I6539605fdad80d156ff5ff249e68df4a1c412067
2017-05-12 11:10:46 -07:00
Daniel Nishi
e6740f740e Fix a bug where options menu was not showing.
There were two issues that stopped the options menu from
showing properly. First, the SettingsPreferenceFragment did
not call its super class, causing the Lifecycle methods to
never be called. Second, the options menu was not being
invalidated which also stopped the Lifecycle methods from
being called.

Change-Id: I29f2fc105c7ecae7adaccb2e4643e48646398d8d
Fixes: 37255835
Test: Robotest
2017-04-14 14:25:37 -07:00
Fan Zhang
c6ca314c0b Log source with visibility change
- Add a method in VisibilityLoggerMixin to log visible event using
  LogMaker, which allows logging additional FIELD_CONTEXT field.
- In Utils.startFragment, add current page's metricsCategory as an extra
  to next page.
- In next page's onResume(), extract the previous page's metricsCategory
  and send it to VisibilityLoggerMixin.visible()
- Update all caller with additional paramters

Change-Id: I8e1f2597fa465b7d3aa16fa1d21c052a3219694a
Fix: 35359289
Test: RunSettingsRoboTests
2017-02-15 17:17:19 -08:00
Fan Zhang
35692cf439 Full screen default app fragment
Fix: 34280137
Test: make RunSettingsRoboTests
Change-Id: Ib44e39589781d68c7952a2c16a44682791a422f1
2017-01-23 16:08:42 -08:00
Fan Zhang
d5b48454a3 Build a new FooterPreference UI.
- Create a new layout for footer prefs.
- Create a new FooterPreference type to use the layout
- Create a Mixin to create and add the pref to screen
- Create a new lifecycle observer type to invoke mixin at right time
- Switch SettingsPreferenceFragment to use footer mixin.
- Switch FingerprintSettings to use the new footer pref.

Bug: 33579394
Test: RunSettingsRoboTests
Change-Id: I548ac39a0d120196a7ffed09b4f98bd9a80bae90
2016-12-14 16:41:49 -08:00
Fan Zhang
2d0b344736 Add InstrumentFragment for non-PreferenceFragment types.
This allows app fragment use a less heavyweight fragment as super class
if they don't need PreferenceFragment. Using this class as base is
generally easier to set up robolectric tests too.

Bug: 33354536
Test: RunSettingsRoboTests
Change-Id: I91c4d242ea0333c76c8767c03c3f18dee6b6e104
2016-12-05 17:13:33 -08:00
Qi Ding
55cdee2738 Merge "Fix searched item isn't highlighted" am: 363c529dc6 am: 1d07de566d am: 85768b3723
am: 051c1b298d

Change-Id: Ib75d421f6b4a4ee97006a3427bb4b1111c5ece2f
2016-10-13 01:40:53 +00:00
Qi Ding
051c1b298d Merge "Fix searched item isn't highlighted" am: 363c529dc6 am: 1d07de566d
am: 85768b3723

Change-Id: I7bb1c3b3a5dbb1ee4e6d8934a7be542076d1e863
2016-10-13 01:34:08 +00:00
Qi Ding
c4772636db Fix searched item isn't highlighted
The searched item isn't highlighted.
To fix this issue, the highlight process should be posted
as Runnable object.

Bug: 31983855
Test: manual - search a item in Settings app

Change-Id: I0dcc5bb52b2faa0a23991459885d8dfcaed0f226
2016-10-06 09:22:00 +00:00
Fan Zhang
4fe7c0859f Fix a NPE when rotating dialog created by DialogCreatable.
Bug: 30088727
Test: make RunSettingsRoboTests
Change-Id: I775899809dfe920daa294f70d646b141da7c0706
2016-10-03 13:50:59 -07:00
Tony Mantler
0b825f5db0 Catch all data set changes
Test: Toggle wifi in settings
b/31649262

Change-Id: I303206f3b977707528e98dfe227b49835edc78f2
2016-09-27 14:48:50 -07:00
Fan Zhang
aa71afe597 Use MetricsFeatureProvider for logging in Settings.
Bug: 31664539
Test: make RunSettingsRoboTests for regression
Test: adb logcat -b events | egrep "(sysui_|notification_)" for
      verifying log

Change-Id: Id944be7c4ff9911aebee481c2df485542f1318f0
2016-09-23 08:37:37 -07:00
Fan Zhang
d65184faef Log visibility change for DialogCreatable in Settings.
Bug: 30681529
Test: adb logcat -b events | egrep "(sysui_|notification_)"
Test: make RunSettingsRoboTests
Change-Id: I51754d258ba1ddfae24323681f21cd02de4dbb4e
2016-09-21 16:30:32 -07:00