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
This commit is contained in:
@@ -123,53 +123,6 @@ public class DashboardAdapterTest {
|
||||
when(mView.getTag()).thenReturn(mCondition);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOnBindViewHolder_spacer_noSuggestions_noConditions() {
|
||||
makeCategory();
|
||||
DashboardAdapter.DashboardItemHolder holder = setupSpacer();
|
||||
|
||||
mDashboardAdapter.onBindViewHolder(holder, 0);
|
||||
|
||||
assertThat(holder.itemView.getBackground()).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOnBindViewHolder_spacer_suggestion_noConditions() {
|
||||
setupSuggestions(makeSuggestions("pkg1"));
|
||||
makeCategory();
|
||||
DashboardAdapter.DashboardItemHolder holder = setupSpacer();
|
||||
|
||||
mDashboardAdapter.onBindViewHolder(holder, 0);
|
||||
|
||||
assertThat(holder.itemView.getBackground()).isNotNull();
|
||||
assertThat(holder.itemView.getBackground()).isInstanceOf(ColorDrawable.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOnBindViewHolder_spacer_noSuggestion_condition() {
|
||||
makeCondition();
|
||||
makeCategory();
|
||||
DashboardAdapter.DashboardItemHolder holder = setupSpacer();
|
||||
|
||||
mDashboardAdapter.onBindViewHolder(holder, 0);
|
||||
|
||||
assertThat(holder.itemView.getBackground()).isNotNull();
|
||||
assertThat(holder.itemView.getBackground()).isInstanceOf(ColorDrawable.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOnBindViewHolder_spacer_suggestion_condition() {
|
||||
setupSuggestions(makeSuggestions("pkg1"));
|
||||
makeCondition();
|
||||
makeCategory();
|
||||
DashboardAdapter.DashboardItemHolder holder = setupSpacer();
|
||||
|
||||
mDashboardAdapter.onBindViewHolder(holder, 0);
|
||||
|
||||
assertThat(holder.itemView.getBackground()).isNotNull();
|
||||
assertThat(holder.itemView.getBackground()).isInstanceOf(ColorDrawable.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuggestionsLogs_NotExpanded() {
|
||||
setupSuggestions(makeSuggestions("pkg1", "pkg2", "pkg3"));
|
||||
@@ -388,7 +341,7 @@ public class DashboardAdapterTest {
|
||||
new FrameLayout(RuntimeEnvironment.application),
|
||||
R.layout.suggestion_tile_card);
|
||||
|
||||
mDashboardAdapter.onBindViewHolder(mSuggestionHolder, 2);
|
||||
mDashboardAdapter.onBindViewHolder(mSuggestionHolder, 1);
|
||||
assertThat(textView.getParent()).isSameAs(mSuggestionHolder.itemView);
|
||||
mSuggestionHolder.itemView.performClick();
|
||||
|
||||
@@ -413,7 +366,7 @@ public class DashboardAdapterTest {
|
||||
new FrameLayout(context),
|
||||
R.layout.suggestion_tile_card);
|
||||
|
||||
mDashboardAdapter.onBindViewHolder(mSuggestionHolder, 2);
|
||||
mDashboardAdapter.onBindViewHolder(mSuggestionHolder, 1);
|
||||
|
||||
mSuggestionHolder.itemView.performClick();
|
||||
assertThat(ShadowApplication.getInstance().getNextStartedActivity()).isNull();
|
||||
@@ -442,8 +395,8 @@ public class DashboardAdapterTest {
|
||||
new FrameLayout(context),
|
||||
R.layout.suggestion_tile_card);
|
||||
|
||||
mDashboardAdapter.onBindViewHolder(mSuggestionHolder, 2);
|
||||
mDashboardAdapter.onBindViewHolder(mSuggestionHolder, 2);
|
||||
mDashboardAdapter.onBindViewHolder(mSuggestionHolder, 1);
|
||||
mDashboardAdapter.onBindViewHolder(mSuggestionHolder, 1);
|
||||
|
||||
ViewGroup itemView = (ViewGroup) mSuggestionHolder.itemView;
|
||||
assertThat(itemView.getChildCount()).isEqualTo(1);
|
||||
@@ -509,25 +462,4 @@ public class DashboardAdapterTest {
|
||||
new FrameLayout(RuntimeEnvironment.application),
|
||||
mDashboardAdapter.getItemViewType(1));
|
||||
}
|
||||
|
||||
private void makeCondition() {
|
||||
final List<Condition> conditions = new ArrayList<>();
|
||||
Condition condition = mock(Condition.class);
|
||||
when(condition.shouldShow()).thenReturn(true);
|
||||
conditions.add(condition);
|
||||
mDashboardAdapter.setConditions(conditions);
|
||||
}
|
||||
|
||||
private void makeCategory() {
|
||||
List<DashboardCategory> categories = new ArrayList<>();
|
||||
categories.add(new DashboardCategory());
|
||||
mDashboardAdapter.setCategory(categories);
|
||||
}
|
||||
|
||||
private DashboardAdapter.DashboardItemHolder setupSpacer() {
|
||||
Context context = RuntimeEnvironment.application;
|
||||
final View view = LayoutInflater.from(context)
|
||||
.inflate(R.layout.dashboard_header_spacer, new LinearLayout(context), false);
|
||||
return new DashboardAdapter.DashboardItemHolder(view);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user