Switch and SwitchCompat are both CompoundButton.
Using CompoundButton in Java will helps migration in the future.
Bug: 306658427
Test: manual - check Settings pages
Change-Id: If2e08a9a9557ec66a3b31ef18cd2e15943098a59
To let fragment's view lifecycle owner passed in to controllers.
For UI usage, view lifecycle owner is the best choice, controller could
use this lifecycle owner to observe events and do UI related works.
Usage DataSaverController as first example.
Bug: 287005021
Test: Manually for DataSaverController
Change-Id: Id965ea3a24d61f4d0ec6735632944f41f72ba06a
DataSaverController currently used in 2 pages,
- Network & internet > Data Saver
- Apps > Special app access
This helps unify the logic, and instead of showing on "Special app
access", this summary shows on "Unrestricted data" is make more sense.
Bug: 280280596
Test: Manually on above pages
Test: Unit test
Change-Id: Ia151ed8179a250f8f20cc5041f9383fffebdab10
Use AppListRepository instead of ApplicationsState can achieve better
performance.
Fix: 280280596
Test: Manually on Data Saver page
Test: Unit test
Change-Id: I98cbae50500b90e7e7f6101fb064003339b082c1
This is because before fix mLoadAppRunnable is async run. And the
getContext() within it will return null when the Fragment in some not
ready lifecycle.
Use viewLifecycleOwner.lifecycleScope.launch to ensure the async
function will only be run when the view is ready, and automatically
canceled when out of scope.
Since this requires Kotlin Coroutine so migrate DataSaverSummary to
Kotlin, other functionality are keep no change.
Fix: 279863347
Test: Manual
Change-Id: I2e97a071c103e63b3306b801fc38f4704e3be0d2