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
This commit is contained in:
Andrew Sapperstein
2017-05-28 12:20:10 -07:00
parent 82b92cadd5
commit 048f6fb8b3
11 changed files with 249 additions and 51 deletions

View File

@@ -45,7 +45,8 @@ public class DashboardData {
public static final int DEFAULT_SUGGESTION_COUNT = 2;
// id namespace for different type of items.
private static final int NS_SPACER = 0;
private static final int NS_HEADER_SPACER = 0;
private static final int NS_SPACER = 1000;
private static final int NS_ITEMS = 2000;
private static final int NS_CONDITION = 3000;
@@ -234,6 +235,9 @@ public class DashboardData {
* and mIsShowingAll, mSuggestionMode flag.
*/
private void buildItemsData() {
// add the view that goes under the search bar
countItem(null, R.layout.dashboard_header_spacer, true, NS_HEADER_SPACER);
resetCount();
boolean hasConditions = false;
for (int i = 0; mConditions != null && i < mConditions.size(); i++) {
boolean shouldShow = mConditions.get(i).shouldShow();