Commit Graph

48 Commits

Author SHA1 Message Date
Andrew Sapperstein
14934599dd Initial search bar implementation.
Replaces the default Toolbar in SettingsActivity with one that looks
like a search bar. It uses a Toolbar inside a CardView with some custom
styling.

Since the search bar is a floating element, the new toolbar lives in the
content frame of the dashboard. A FrameLayout is used to provide the
layering that is desired.

Since the search bar is on top, an additional spacer view is added to
the list of items in the dashboard. Its color changes based on what
the first view is so that it always matches.

Adds android-support-v7-cardview as a dependency (and reorders the
other deps to be in alphabetical order).

Remaining work (in future CLs):
- remove search menu option?
- clean up initial window
- remove the line between the header and the first condition
       when there's a condition

Change-Id: I627b406735c8e2280ac08f44ca32f7098621a830
Merged-In: Id7477b90fbaf30eb5cac1ee244c847bddb95b3fd
Bug: 37477506
Test: make RunSettingsRoboTests
2017-05-31 14:03:26 -07:00
Fan Zhang
264c0c2bbe Fix NPE when building suggestion identifier.
And refactored the getIdent logic into feature provider.

Change-Id: Id6f66a6942cbaf6d26ae4dca62037a6cf01179a5
Fix: 36314240
Test: make RunSettingsRoboTests
2017-03-16 17:12:22 -07:00
Fan Zhang
a5b620e738 Swipe to dismiss suggestions
- Move dismiss suggestion logic into feature provider
- In DashboardData, use hashcode as suggestion's stable id. This is much
  more likely to provide a truely stable id for each suggestion card.
  Eventually I want to use hash for all tiles to provide stable id.
- Add a SuggestionDismissionController to handle swipe to dismiss
  callbacks

Change-Id: If3770f07a90c5469a0b86fc28f3eb5e4c17227cd
Fix: 35159816
Test: make RunSettingsRoboTests
2017-03-13 14:39:00 -07:00
TreeHugger Robot
e0b65fce67 Merge "Remove code that check for dashboard feature." 2017-03-07 20:57:28 +00:00
Doris Ling
f2cf2aea37 Remove code that check for dashboard feature.
- remove DashboardFeatureProvider.isEnabled() and all relating code
and tests.

Bug: 35764802
Test: make RunSettingsRoboTests
Change-Id: If7796677abc8904b7436525836d50cdef38e37a4
2017-03-07 11:15:03 -08:00
Soroosh Mariooryad
606cb64097 Fixing a bug in suggestion logging and adding more tests.
Test: RunSettingsRoboTests
Fixes: b/35802845

Change-Id: I216b3ff344ccdffd038d924649109483e80f5437
2017-03-03 10:18:52 -08:00
Soroosh Mariooryad
e457e35ec0 Add ranking to SuggestionFeatureProvider interface.
Test: RunSettingsRoboTests
Fixes: b/35363662

Change-Id: Ib786e6b2733e2b151f73fb68e174a21aedb2b20a
2017-02-20 17:34:36 -08:00
Soroosh Mariooryad
25d8049bb2 Modifying setting suggestion logging to only log the shown items.
Previously if there was three suggestions in the suggestions view, all
three would be logged as shown, although by default only two of them are
shown and the third one is shown only if the view is expanded. Now, only
the actual shown items will be logged.

Test: RunSettingsRoboTests
Fixes: b/35348496

Change-Id: Ic3af7961b4713f48e63c51ac599cb55bf69975ff
2017-02-20 12:40:15 -08:00
Fan Zhang
efba6b4e14 Skip redundant SuggestionLoader run during app start.
also skip DiffUtil when drawing first frame.


Fix: 34103984
Test: make RunSettingsRoboTests
Change-Id: I4891d1bca1f17c437444761eaf3002624934014d
2017-02-15 02:06:08 +00:00
Fan Zhang
628b3cb76e Deprecate SettingsDrawerActivity.openTile.
Use DashboardFeatureProvider to open tile instead. This makes logic more
centralized in one place, and makes logging easier in the future.

Bug: 30137094
Test: RunSettingsRoboTests
Change-Id: I8a028bb7cac8f70f6c237f253be8668cc3ef257e
2017-02-13 14:41:27 -08:00
Soroosh Mariooryad
81adc530d9 Adding the dismiss logic for setting smart suggestions.
Test: make RunSettingsLibRoboTests
Fixes: 35059823
Change-Id: I48a71ff525f6dded6f0b505280f5678a554f7183
2017-02-06 15:25:35 -08:00
Doris Ling
990460b442 Update icon color tint for tiles not in settings package.
Set the icon tint color to colorControlNormal for components not in
settings package.

Change-Id: I6b822b355eb706693a0af4e5832407064cd2b2c2
Fix: 34192209
Test: Visual
2017-01-13 11:21:02 -08:00
jackqdyulei
0bb598c4d0 Fix the animation issue in DashboardSummary
1. When condition is inserted, only scroll to top when previous
position is at the top.

2. Clean condition status after it is removed. So the next time
you insert a condition view, it will always be collapsed.

Bug: 33839780
Bug: 34115341
Test: make -j40 RunSettingsRoboTests
Change-Id: I7f48524917c3119ec24b2f67ba506f381573a391
2017-01-09 12:30:57 -08:00
Salvador Martinez
179e16445e Added logging to pinpoint source of bug
Sometimes the airplane mode banner will show up even
though airplane mode is not on. Logging has been added
to several areas around this condition in addition to
where the actual view is created. This will be used
to try and get a better handle on what the source of
the bug is.

Test: manual
Bug: 30860132
Change-Id: I7213aa7e187c5a8c0e94a5ce7a3269e6667cd61b
2016-12-05 15:32:14 -08:00
jackqdyulei
fa45aee813 Add DashboardItemAnimator to stop flash
When there is no offset change for identical holder in
animateChange, simply return and don't invoke the
resetAnimation.

Bug: 33198024
Test: make RunSettingsRoboTests
Change-Id: Ib83363873bc5f51e5bd71af5a013ee0756728d1a
2016-11-30 16:39:28 -08:00
Tamas Berghammer
265d3c2a0c Update package names to work with the proto3 compiler
Bug: b/28974522
Change-Id: I5f3adf4946ee4ba1e09e4f40afe83c151405972a
2016-11-08 14:06:17 +00:00
jackqdyulei
f6979e257c update summary change no matter whether summary is equal
Since the method parameter tile and tile in adpater is the same
instance, it is useless to check whether summary has changed.

Test: Run SettingsRoboTests
The function used in notifySummaryChanged already has testcases
in DashboardDataTest

Change-Id: I8c8969fcd2c89f368ca507808910fc7a9852f192
2016-11-02 16:45:57 -07:00
jackqdyulei
a44fdda438 Store Tile in view tag, not position
The position(used to find the tile) is not up-to-date when recyclerview
changes, so store tile instead.

Bug: 32370624
Test: make -j40 SettingsTests
Change-Id: I10d29b3137ecb1c37b6a8468c6f2709b8497caa6
2016-10-24 14:44:37 -07:00
jackqdyulei
0b818b79db Elicit ItemsData class and add DiffUtil.Callback
In the previous version, when there is a minor change in data, we
will refresh the whole screen(and data) by invoking "recountItems"
and "notifyDataSetChanged", which did lots of unnecessary works.

In this new cl, I elicit ItemsData class, which encapsulates the list
data used in adapter. When data changed, I build another ItemsData and
use the DiffUtil.Callback to calculate diffs between ItemsDatas. In
this way we can only refresh the items that changed in adapter.

Since I cannot find usage of see_all.xml anymore, I delete the relevant
code as well as the resource files.

Bug: 30319913
Test: make RunSettingsRoboTests
Change-Id: I4f753a26f624affea6c6c35d49cfb9c43fb74fe6
2016-10-21 11:02:29 -07:00
Fan Zhang
fabbfb435e Refactor SummaryLoader to set summary on subsetting pages.
- Make a SummaryConsumer interface. Things that needs latest summary
  should implement this interface (DashboardAdapter for homepage,
  DashboardFragment for subsettings). This also decouples SummaryLoader
  from relying on SettingsDrawerActivity.
- Make DashboardFeatureProvider more generic to load DashboardCategory
  by key.

Bug: 31781480
Test: RunSettingsRoboTests
Change-Id: I9c65456fb433a74c352498251e0ccf65da0be1f0
2016-10-07 14:52:06 -07:00
Fan Zhang
c6540cfb57 Add search provider for system dashboard fragment.
Bug: 31801428
Test: manual
Test:make RunSettingsRoboTests
Change-Id: I6a80d64ed9755f4ddcfde33a82be04cfcbf0495b
2016-10-04 11:10:36 -07:00
Matthew Fritze
f3b1d7b580 Settings suggestions now describes expand and collapse in talkback am: 62cf9efd9b am: d522eff9e5
am: a7b7f86f1e

Change-Id: Icac895f280eb02b5cedebfec4d6b809431ea04f7
2016-09-28 23:21:51 +00:00
Matthew Fritze
62cf9efd9b Settings suggestions now describes expand and collapse in talkback
Bug: 30314874
Change-Id: I2231148594c8e878111a754e5806c20dd4e289af
2016-09-27 13:31:15 -07:00
Fan Zhang
c93d18e29c Use MetricsFeatureProvider for condition/suggestion/search.
Bug: 31664539
Test: make RunSettingsRoboTests

This allows different metric clients to listen to these events.

Change-Id: Ib19c8099b16ff78d9aa4901278e0ff33eeefd4a8
2016-09-22 13:22:26 -07:00
Fan Zhang
011362d9f1 Update summary correctly in Settings dashboard.
Bug: 30490325

SummaryLoader needs DashboardCategory to update summary and it currently
ask for it from DashboardAdapter. But DashboardCategory is not always
available in DashboardAdapter. When SummaryLoader wants to get category
from adapter before adapter is ready, it won't have it, causing summary
to appear blank sometimes.

The fix is to get category from data source directly.

Change-Id: I9d7f676954d1cece42d6e03748ab7aa35357f8b7
2016-08-03 15:50:39 -07:00
Fan Zhang
d9057df872 Remove spacer above dashboard tiles.
Bug: 30467152

- UX is better without the spacer.
- It also causes animation issues in recycler view during cold start.

Change-Id: I3aab330ea60bba69962132a54e432943e81ff985
2016-07-28 12:51:44 -07:00
Doris Ling
38d8582abe Combine setCategories() and setSuggestions() in DashboardAdapter.
In DashboardSummary.rebuildUI(), we first update the adapter with the
current categories, then run the async task to update the adapter with
the suggestions. This causes the adapter to first layout the existing
categories, and relayout when the suggestions is available. This causes
the suggestions view and categories view to overlap before the
relayout is complete.

Since categories and suggestions are borh set each time we try to
rebuild the UI, delaying the update for categories until the suggestions
are ready will avoid the unnecessary relayout of the list elements.

Ran app launch test for Settings app with the change and launch time is
between 412ms and 486ms in 10 runs, which does not show much delay in
app launch time with delaying updating the categories.

Bug: 29318104
Change-Id: I03ae2386392315f28fe2c361682f2f3252e9f827
2016-07-15 13:08:56 -07:00
Doris Ling
08d34b6a99 Revert equal check in DashboardAdapter.setCondition().
1. Remove the equality check for the conditions list which causes
"Airplane mode is on" to be shown always even when airplane mode is
turned off.
2. Also add mIsShowingAll and mSuggestionMode to instance state.

Bug: 30055644
Change-Id: I0709e9a1b0139e80cdb834cb76a9334dce753e14
2016-07-13 16:17:13 -07:00
Doris Ling
b76de265a2 Reduce the number of times that dataset changed is triggerd in DashboardAdapter
1. Save the suggestion list and the category list into the instance
state so that it will be available on warm start, and avoid the need
to reload the data.
2. Add the condition list to the constructor parameters for
DashboardAdapter, so that it does not need to setConditions()
separately which will trigger notifyDataSetChanged()

Bug: 30055644
Change-Id: Ia04fa3a25b13d2dacf6baf5f412d662a595fb6dd
2016-07-12 18:02:22 -07:00
Adrian Roos
1d1ca8e590 Merge "Allow DPMs to restrict Remote Input on Keyguard" into nyc-dev
am: ef505d628a

* commit 'ef505d628ae96f175fca871013da8c24271667dc':
  Allow DPMs to restrict Remote Input on Keyguard

Change-Id: I5746a924564e8eb866b0c0e0a1e0205a38896f89
2016-05-12 20:59:47 +00:00
Adrian Roos
ef505d628a Merge "Allow DPMs to restrict Remote Input on Keyguard" into nyc-dev 2016-05-12 20:52:25 +00:00
Adrian Roos
059b0fa060 Allow DPMs to restrict Remote Input on Keyguard
Change-Id: I84b90b4047129794f1397351f9c8624f0048ad41
Fixes: 26981262
2016-05-12 19:12:17 +00:00
Fan Zhang
50cde75ef7 Update suggestion/support UI to use more negative space.
Bug: 28435214

-- Tweaked layout and padding in suggestions and support tab.
-- Added support to show different text color in SlidingTabLayout.

Change-Id: If5d90ec5360e35565176aae7475e355c27fcef7c
2016-05-12 11:14:59 -07:00
Jason Monk
a41a8d05ab Make sure TileAdapter always has a SuggestionParser
Since it expects to have one

Change-Id: Ic0dccd2271c011cf7dc877e341af5a8bfea90c37
Fixes: 28689801
2016-05-10 13:03:35 -04:00
Jason Monk
2386dfc18d Dashboard performance work
Push more stuff to backround threads (this will cause conditions/suggestions
to load slightly slower than normal content) and cache more info.

Fixes: 28613950
Bug: 28435146
Change-Id: I1080930e8f31c7f12a2d89f266bfd3236979cf40
2016-05-06 13:17:47 -04:00
Jason Monk
5673ced93c Work on settings startup speed
- Cut down on amount stored in conditions xml
 - Remove extra work from dashboard startup
 - Move summary to min priority

Change-Id: I51ca3828e4446632d6faa60dcfbab3446d19d335
Fixes: 28134360
2016-04-12 15:19:50 -04:00
Jason Monk
c064573265 Fix missing summaries
Handle non-cached tiles by doing lookup from component name.

Change-Id: I979e2df2eed4a065f290c5c0e66276d08b4fb0af
Fixes: 27942733
2016-03-31 13:59:46 -04:00
Jason Monk
45fda2734a Add metrics for suggestions
Bug: 27851236
Change-Id: Ia5aa1d42a40ba09a19db3c3790f0a7342660e613
2016-03-30 16:05:29 -04:00
Jason Monk
f20c718f19 Add metrics for settings conditionals
Bug: 27851236
Change-Id: I400716457d3f628419410a02c2a457d41d19a067
2016-03-30 15:46:26 -04:00
Ido Ofir
3867df4256 mark categories as complete when disabled.
Change-Id: I0a50adf254d28653c8740ad892507db29cd9b0a8
2016-03-03 14:21:22 -08:00
Jason Monk
322cfe8be0 Settings Visuals
Update the layouts to be more final, and support tablets better.

Move about to always be last.

Always see everything.

Change-Id: I4b804c9bfcd4d3b7f978a2617d5c2c2b1cdfa6e4
2016-02-04 14:37:35 -05:00
Jason Monk
4a60c8876e Add DND Suggestion after 30 days
Suggest users setup automatic rules if they haven't after 30 days

Also fix the id labeling for the RV adapter, so that it can handle
removing of suggestions properly.

Change-Id: I0cce76f3db1d444011f7d8a31348714d102650cf
2016-01-26 17:29:59 -05:00
Jason Monk
91ca519a0f Support changes to SuggestionParser
Change-Id: I002e10cfe2a058f934d2c6218c88c2588654733f
2016-01-26 13:58:25 -05:00
Jason Monk
d4f03ec86f Add suggestions to settings
Use an XML to define the categories that Settings will look for,
and surface enabled activities under those categories as suggestions.

When clicked on the activity will be started for result.  If the result
is not cancelled, then the operation is assumed successful and the
suggestion is disabled.  Users can also use an overflow -> remove
flow to get rid of unwanted suggestions.

Change-Id: I767abf8efe103af0509bc6b6b55888ae82643512
2016-01-07 16:25:34 -05:00
Jason Monk
fa4813783f Avoid RecyclerView causing items to blink on update
Change-Id: Ic0bd70ec3f2a5e195cc0924c98c589f90e27afe9
2015-12-16 16:43:02 -05:00
Jason Monk
db4ed191de Add conditionals to Settings
Also add Airplane Mode and Hotspot conditionals (more to come soon)

Change-Id: I11f206db59f7c715f416fb5852b8f0fcb857a247
2015-12-14 10:29:12 -05:00
Jason Monk
8c4ca41d25 Make sure the dashboard is up to date
Bug: 25794089
Change-Id: I65eaa8e14b3c998ec122eaa9fc4dbbe3749c568c
2015-11-30 15:43:34 -05:00
Jason Monk
3069581512 Summary support for Settings Home
Also add summaries to a few of the major items.

Change-Id: I17924f14941fe095d819e142cdd21cf4b4e9ffd1
2015-11-17 13:51:45 -05:00