Commit Graph

82 Commits

Author SHA1 Message Date
Fan Zhang
cd7b13bba5 Plumb SuggestionControllerMixin to DismissController.
- The SuggestionControllerMixin is needed to dismiss a suggestion.
- When swipe a suggestion, SuggestionControllerMixin is called, which
  then calls API in SuggestionService to dismiss a suggestion.

Bug: 65065268
Test: robotests
Change-Id: I6a0c5823d60b995ab4a36b1c91777f5cd31a500d
2017-09-26 14:09:22 -07:00
Fan Zhang
82cb5a5cc8 Load suggestions through SettingsIntelligence.
- Add flag to switch between old/new implementation
- Add SuggestionLoader to load using Loader (instead of AsyncTask)
- Update DashboardAdapater/SuggestionAdapter to take List<Suggestion>
- Marked old getter/setters as @Deprecated and added comment
- Update tests to cover suggestionV2 adapter changes.

TODO:
- Handler for dismissing suggestion not set up yet.
- Suggestion data structure is incomplete (missing icon, remote view, etc)
- Need to extend Suggestion data strcture to support icon and
  remote view binding

Bug: 65065268
Test: robotests
Change-Id: I2378ef4c9edee972d5de93c3868068e2cde23f56
2017-09-19 11:56:54 -07:00
Soroosh Mariooryad
5ba0f51bcd Log smart settings suggestion enabled/disabled state for A/B experiments
Test: RunSettingsRoboTests
Bug: 64121058

Change-Id: Iadfa575b9a21caecb515b9975d388ee0d0480c11
2017-09-14 10:43:56 -07:00
Fan Zhang
3ed509cb35 Some code cleanup
- Formatting
- Remove unused code

Test: robotests
Change-Id: If259c7c3893df96744f3c0ad62a378ef6ce01de7
2017-09-07 10:48:45 -07:00
Doris Ling
97da51876b Fix null pointer exception when logging suggestions.
In monkey test, the suggestions list can become null. So, add check
for valid suggestions list before trying to iterate through the
suggestions.

Fixes: 64757618
Test: make RunSettingsRoboTests
Change-Id: Ib670808a4f222187b9cd53d7d939e71b5ce8dbae
2017-08-16 15:26:03 -07:00
Doris Ling
9f90680456 Fix crash when dismissing suggestions.
When the suggestions are in default mode and the number of suggestions
are more than the default count, we set the sublist of the suggestions
list as the suggestion adapter data. In this case, operation on the list
should be done in the sublist instead of the original list to maintain
the list consistency check.

Hence, when dismissing the suggestion, change to remove the suggestion
from the suggestion adapter instead of from the dashboard adapter, so
that any following interaction with the suggestions will not trigger the
concurrent modification exception.

Bug: 64279080
Test: make RunSettingsRoboTests
Change-Id: I970b6af8a1c72bc0c3ee89fef890ae6a669c71d2
2017-08-03 15:12:36 -07:00
Doris Ling
4940539479 Limit the suggestions to be shown to 5.
- when creating the dashboard data, pass the sublist of suggestions to
cap the total number of suggestions to be shown to 5.
- if user swipe away the suggestion, it will only remove the suggestion
from the suggestion adapater, and will not trigger rebuilding the whole
UI.

Bug: 64072051
Change-Id: I1efabeb2a805c670007c631d3ccb0fdfbde7b55a
Fix: 63309218
Test: make RunSettingsRoboTests
2017-07-27 10:45:30 -07:00
Doris Ling
87eb423564 Merge "Update spacing in suggestion/condition header and footer." into oc-dr1-dev am: ef8e2db876
am: fb64a7f74c

Change-Id: Ib3d86ef233acea8b2f090941a8bc11480ed78ef0
2017-07-15 01:17:18 +00:00
TreeHugger Robot
ef8e2db876 Merge "Update spacing in suggestion/condition header and footer." into oc-dr1-dev 2017-07-15 01:05:41 +00:00
Doris Ling
01fe5b45b4 Fix crash on expanding settings conditions.
Check for non-empty suggestions instead of non-null suggestions when
trying to determine whether to show conditions or suggestions list.

Change-Id: Icdb8ad485af436f5d84ce0a746081fc59bd613db
Merged-In: Icdb8ad485af436f5d84ce0a746081fc59bd613db
Fix: 63674269
Test: make RunSettingsRoboTests
2017-07-14 13:04:30 -07:00
Doris Ling
0018f1680f Update spacing in suggestion/condition header and footer.
Adjust the top/bottom padding for the header and footer so that the
content is center-aligned.

Change-Id: I01c0baf770abf3a8767a016a758ee1794403598b
Fix: 63670820
Test: Visual
2017-07-14 12:31:12 -07:00
Doris Ling
11f4619816 Fix crash on expanding settings conditions.
Check for non-empty suggestions instead of non-null suggestions when
trying to determine whether to show conditions or suggestions list.

Change-Id: Icdb8ad485af436f5d84ce0a746081fc59bd613db
Fix: 63674269
Test: make RunSettingsRoboTests
2017-07-13 16:16:12 -07:00
Doris Ling
df055c8655 Update spacing and background color for condition/suggestion.
- changed suggestion/condition and searchbox background color to
  #F2F2F2
- changed condition card background color to #F8F8F8
- removed Suggestion header
- reduced space above condition header/footer by 9dp

Fix: 63393599
Test: visual
Change-Id: I4317781c93e23c6d019928b9fe9af16177f81c07
Merged-In: I268934e3a573b542480c0b21dbab68b7217295b5
2017-07-11 15:50:48 -07:00
Doris Ling
78e08f0f0a Update spacing and background color for condition/suggestion.
- changed suggestion/condition and searchbox background color to
  #F2F2F2
- changed condition card background color to #F8F8F8
- removed Suggestion header
- reduced space above condition header/footer by 9dp

Bug: 63393599
Test: make RunSettingsRoboTests
Change-Id: I268934e3a573b542480c0b21dbab68b7217295b5
2017-07-11 15:22:53 -07:00
Fan Zhang
b487fae5d8 Code cleanup: DashboardAdapter.category is no longer a list
We only ever display a single DashboardCategory in homepaeg, so the
category doesn't need to be a list in DashboardData/Adapter

Change-Id: I57db02bb45cbc511f0fce1bf33043b51ef9db15c
Fix: 33861822
Test: updated robotests
2017-06-30 15:30:51 -07:00
TreeHugger Robot
a1bf76a69d Merge "Also tint the settings icon in DashboardAdapter.setCategory()." 2017-06-30 20:07:40 +00:00
Doris Ling
067122a8e4 Also tint the settings icon in DashboardAdapter.setCategory().
When suggestion loader takes longer time to complete, we will first show
the dashboard with just the categories, and refresh the UI when the
suggestion is ready. However, we only tint the icon when we update both
the categories and suggestions, and hence in some case, some tile
results with icon not being tinted.

Change-Id: I023d50655349731b03c7d7aff153d2cbbd8c63e0
Fix: 37456962
Test: make RunSettingsRoboTests
2017-06-28 16:12:38 -07:00
Doris Ling
b99af0e4a2 Change to use new suggestion/condition UI.
Change to always use the new UI that combines the suggestion and conditions,
and remove all codes relating to the old UI.

Fix: 37645754
Fix: 62621808
Test: make RunSettingsRoboTests

Merged-In: I3421a9e5182f6606843392d6fae8b9f07c5f2e46
Change-Id: I5ef169a563166520dad0ac44f6780da814e2f1f7
2017-06-28 12:22:34 -07:00
Doris Ling
631893f582 Change to use new suggestion/condition UI.
Change to always use the new UI that combines the suggestion and conditions,
and remove all codes relating to the old UI.

Bug: 37645754
Bug: 62621808
Test: make RunSettingsRoboTests
Change-Id: I3421a9e5182f6606843392d6fae8b9f07c5f2e46
2017-06-28 11:22:44 -07:00
Doris Ling
d5d4ae7348 Merge "Fix crash when initializing Settings suggestions." into oc-dr1-dev am: c074c1c8fe
am: da9d206916

Change-Id: Ia2d3416b079c617450562eb0daf3ab3625b83d0f
2017-06-28 01:50:20 +00:00
Doris Ling
8233ab5fe5 Fix crash when initializing Settings suggestions.
The dashboard spacer has been removed, but the remaining indexing is not
modified correspondingly, which results in mismatched dashboard types.
Set the dashboard header position back to 0.

Change-Id: I732c4ada556d5d4325e357b8325f66ded5cbe952
Fix: 63052534
Test: make RunSettingsRoboTests
2017-06-27 14:26:03 -07:00
Andrew Sapperstein
40be7df5df Dashboard search bar polish
Various tweaks to match redlines:
- background is now grey all the time
- the search icon is aligned with the other icons
- the title text is primary colored instead of accent colored
- the background of search bar doesn't scroll anymore

Deletes a bunch of logic to add an initial view that would be
colored based on the first view. It never quite worked right.
Now it's consistent and never moves.

Bug: 37477506
Fixes: 62267378
Fixes: 62379978
Fixes: 62361213
Test: robotests
Change-Id: Iddfd45a64a0a8d0365397a207889d7225d1ebb70
Merged-In: I82c584e8f8ecc6fc298c5cdbce08516c6a069a39
2017-06-26 10:28:49 -07:00
Andrew Sapperstein
c217464dca Dashboard search bar polish
Various tweaks to match redlines:
- background is now grey all the time
- the search icon is aligned with the other icons
- the title text is primary colored instead of accent colored
- the background of search bar doesn't scroll anymore

Deletes a bunch of logic to add an initial view that would be
colored based on the first view. It never quite worked right.
Now it's consistent and never moves.

Bug: 37477506
Change-Id: I82c584e8f8ecc6fc298c5cdbce08516c6a069a39
Fixes: 62267378
Fixes: 62379978
Fixes: 62361213
Test: robotests
2017-06-26 10:08:44 -07:00
Maurice Lam
9534677b9e Merge "Tint suggestion icons" into oc-dr1-dev am: c1ab582fae
am: a1130d5d12

Change-Id: Ia355e3fb4026afae6f8582053cc07e1fb9728a93
2017-06-22 21:58:54 +00:00
Maurice Lam
992fa86d52 Tint suggestion icons
If the suggestion is marked as isIconTintable, tint the icon with
colorControlNormal.

Test: cd tests/robotests && mma
Bug: 62258845
Change-Id: I2a76181d9b8b4d9fbf496a8fc605cb762bba87c0
2017-06-22 11:40:34 -07:00
Doris Ling
c225ee4e0a Merge "Refresh the dashboard UI when swiping away the only suggestion." into oc-dr1-dev am: ee947e9a31
am: 11a93be4a7

Change-Id: Ib7b082644764d0dd43d29417f5076e99b37e856f
2017-06-22 01:43:56 +00:00
Doris Ling
fa58cfca6e Refresh the dashboard UI when swiping away the only suggestion.
In the new suggestion UI, the suggestions are listed inside the
suggestion container instead of individual dashboard items. When there
is only a single suggestion shown, and that is being swiped away, the
actual list for the suggestions will handle the swipe and remove that
list item from the list. However, the top level container will remain
until next time the dashboard list is being refreshed. Explicitly set
the suggestions to null to force refreshing of the dashboard UI.

Change-Id: I37f8c8f5a813a5c56f4f2f46103fdbb66ce97fcd
Fix: 62639824
Test: make RunSettingsRoboTests
2017-06-21 15:37:31 -07:00
Fan Zhang
b3eea29141 Remove some dead code
DashboardCategory is no longer rendered in the dashboard ui

Bug: 33861822
Test: make RunSettingsRoboTests existing tests still pass
Change-Id: I0479967b0099f76f8c0c7894643d50b655de2892
2017-06-15 14:58:25 -07:00
Doris Ling
83a6621b38 Combine settings suggestion and condition.
- Add a flag in dashboard feature provider to specify whether to use the
combined UI for suggestions and conditions.
- Move Conditions below Suggestions.
- Add dashboard entity for condition and suggestion container, and
  wrap the condition and suggestion list inside the container. The
  container itself will be a single dashboard item, and within it will
  be the list of suggestion or condition.
- Add suggestion/condition header that will show the combined info for
  the conditions and suggestion data, and have the expand button to
  control expanding both the suggestion and condition list.
- Change the individual condition card to be always expanded, and
remove the logic to collapse/expand individual condition card.
- Remove the divider between the action button and condition detail
  within each condition card.
- Add suggestion/condition footer for collapsing the whole suggestion and
  condition list.

Bug: 37645754
Test: make RunSettingsRoboTests
Change-Id: I86df75f7e4551778f79d730851c03121fd0dcbdf
2017-06-02 14:59:48 -07:00
Andrew Sapperstein
048f6fb8b3 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

Bug: 37477506
Test: make RunSettingsRoboTests
Change-Id: Id7477b90fbaf30eb5cac1ee244c847bddb95b3fd
2017-05-31 15:24:25 -07:00
Fan Zhang
0a257ee1ba Add flag to control whether or not we should tint icons
Fix: 34365726
Test: robotests
Change-Id: Ic08d8590c9867fb0383da03f05237f74644a77ff
2017-04-28 09:54:33 -07:00
Maurice Lam
ca022e2b9b Merge "Fix suggested action custom view binding" 2017-04-03 21:38:20 +00:00
Maurice Lam
cbf797e65c Rebuild suggestions when suggestions are dismissed
When suggestions are swiped away, refresh the suggestion categories
so that suggestions previously suppressed because it's lower priority
or because there is an exclusive suggestion now has a chance to be
shown.

Test: cd tests/robotests && mma
Bug: 36811621
Change-Id: I1a1ae1624c2f69153d95d238b2143ac9273e117d
2017-03-31 17:13:39 -07:00
Maurice Lam
58c14f7596 Fix suggested action custom view binding
Remove all the views before adding the remote views again, so the
card will not have multiple custom views on top of each other.

Test: cd tests/robotests && mma
Change-Id: Id41bfb962c08e8d1ee6534e0cf44d173a1f1910f
2017-03-30 21:52:01 -07:00
Maurice Lam
fc972a75a9 Allow remote views to be used in Tiles
If a suggeested action Tile has a remote view defined, inflate a card
layout to contain the remote view, instead of showing the default
title-summary layout.

Additionally, if the remote view has a view with ID
@android:id/primary, that will be used as the click target rather
than the entire card.

Test: cd tests/robotests && mma
Bug: 35668836
Change-Id: I0fd1b9c637b6d7a3d7d2f6268669917408a882eb
2017-03-27 20:32:20 -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