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);
|
||||
}
|
||||
}
|
||||
|
@@ -117,7 +117,7 @@ public class DashboardDataTest {
|
||||
final DashboardData.SuggestionConditionHeaderData data =
|
||||
new DashboardData.SuggestionConditionHeaderData(
|
||||
mDashboardDataWithOneConditions.getConditions(), 0);
|
||||
final Object[] expectedObjects = {null, data,
|
||||
final Object[] expectedObjects = {data,
|
||||
mDashboardDataWithOneConditions.getSuggestions(),
|
||||
mDashboardDataWithOneConditions.getConditions(),
|
||||
null, mDashboardCategory, mTestCategoryTile};
|
||||
@@ -196,11 +196,11 @@ public class DashboardDataTest {
|
||||
// Item in position 1 is the header, which contains the number of conditions, changed from
|
||||
// 1 to 2
|
||||
testResultData.add(new ListUpdateResult.ResultData(
|
||||
ListUpdateResult.ResultData.TYPE_OPERATION_CHANGE, 1, 1));
|
||||
ListUpdateResult.ResultData.TYPE_OPERATION_CHANGE, 0, 1));
|
||||
// Item in position 3 is the condition container containing the list of conditions, which
|
||||
// gets 1 more item
|
||||
testResultData.add(new ListUpdateResult.ResultData(
|
||||
ListUpdateResult.ResultData.TYPE_OPERATION_CHANGE, 3, 1));
|
||||
ListUpdateResult.ResultData.TYPE_OPERATION_CHANGE, 2, 1));
|
||||
|
||||
testDiffUtil(mDashboardDataWithOneConditions,
|
||||
mDashboardDataWithTwoConditions, testResultData);
|
||||
@@ -211,7 +211,7 @@ public class DashboardDataTest {
|
||||
//Build testResultData
|
||||
final List<ListUpdateResult.ResultData> testResultData = new ArrayList<>();
|
||||
testResultData.add(new ListUpdateResult.ResultData(
|
||||
ListUpdateResult.ResultData.TYPE_OPERATION_REMOVE, 1, 6));
|
||||
ListUpdateResult.ResultData.TYPE_OPERATION_REMOVE, 0, 6));
|
||||
|
||||
testDiffUtil(mDashboardDataWithOneConditions, mDashboardDataWithNoItems, testResultData);
|
||||
}
|
||||
|
Reference in New Issue
Block a user