Merge "Fix overlapping importance icons"

This commit is contained in:
TreeHugger Robot
2020-07-16 15:32:53 +00:00
committed by Android (Google) Code Review
3 changed files with 49 additions and 147 deletions

View File

@@ -68,10 +68,6 @@ public class ConversationPriorityPreferenceTest {
final LayoutInflater inflater = LayoutInflater.from(mContext);
PreferenceViewHolder holder = PreferenceViewHolder.createInstanceForTests(
inflater.inflate(preference.getLayoutResource(), null));
Drawable unselected = mock(Drawable.class);
Drawable selected = mock(Drawable.class);
preference.selectedBackground = selected;
preference.unselectedBackground = unselected;
preference.setConfigurable(false);
preference.setImportance(IMPORTANCE_DEFAULT);
@@ -81,35 +77,6 @@ public class ConversationPriorityPreferenceTest {
assertThat(holder.itemView.findViewById(R.id.silence).isEnabled()).isFalse();
assertThat(holder.itemView.findViewById(R.id.priority_group).isEnabled()).isFalse();
assertThat(holder.itemView.findViewById(R.id.alert).isEnabled()).isFalse();
assertThat(holder.itemView.findViewById(R.id.priority_group).getBackground())
.isEqualTo(selected);
assertThat(holder.itemView.findViewById(R.id.alert).getBackground()).isEqualTo(unselected);
assertThat(holder.itemView.findViewById(R.id.silence).getBackground())
.isEqualTo(unselected);
// other button
preference.setPriorityConversation(false);
holder = PreferenceViewHolder.createInstanceForTests(
inflater.inflate(preference.getLayoutResource(), null));
preference.onBindViewHolder(holder);
assertThat(holder.itemView.findViewById(R.id.alert).getBackground()).isEqualTo(selected);
assertThat(holder.itemView.findViewById(R.id.silence).getBackground())
.isEqualTo(unselected);
assertThat(holder.itemView.findViewById(R.id.priority_group).getBackground())
.isEqualTo(unselected);
// other other button
preference.setImportance(IMPORTANCE_LOW);
holder = PreferenceViewHolder.createInstanceForTests(
inflater.inflate(preference.getLayoutResource(), null));
preference.onBindViewHolder(holder);
assertThat(holder.itemView.findViewById(R.id.priority_group).getBackground())
.isEqualTo(unselected);
assertThat(holder.itemView.findViewById(R.id.alert).getBackground()).isEqualTo(unselected);
assertThat(holder.itemView.findViewById(R.id.silence).getBackground()).isEqualTo(selected);
}
@Test
@@ -119,10 +86,6 @@ public class ConversationPriorityPreferenceTest {
final LayoutInflater inflater = LayoutInflater.from(mContext);
final PreferenceViewHolder holder = PreferenceViewHolder.createInstanceForTests(
inflater.inflate(preference.getLayoutResource(), null));
Drawable unselected = mock(Drawable.class);
Drawable selected = mock(Drawable.class);
preference.selectedBackground = selected;
preference.unselectedBackground = unselected;
preference.setConfigurable(true);
preference.setImportance(IMPORTANCE_LOW);
@@ -130,12 +93,8 @@ public class ConversationPriorityPreferenceTest {
preference.onBindViewHolder(holder);
assertThat(holder.itemView.findViewById(R.id.priority_group).getBackground())
.isEqualTo(unselected);
assertThat(holder.itemView.findViewById(R.id.alert).getBackground()).isEqualTo(unselected);
assertThat(holder.itemView.findViewById(R.id.silence).getBackground())
.isEqualTo(selected);
assertThat(holder.itemView.findViewById(R.id.silence_summary).getVisibility())
assertThat(holder.itemView.findViewById(R.id.silence)
.findViewById(R.id.summary).getVisibility())
.isEqualTo(View.VISIBLE);
}
@@ -146,10 +105,6 @@ public class ConversationPriorityPreferenceTest {
final LayoutInflater inflater = LayoutInflater.from(mContext);
final PreferenceViewHolder holder = PreferenceViewHolder.createInstanceForTests(
inflater.inflate(preference.getLayoutResource(), null));
Drawable unselected = mock(Drawable.class);
Drawable selected = mock(Drawable.class);
preference.selectedBackground = selected;
preference.unselectedBackground = unselected;
preference.setConfigurable(true);
preference.setImportance(IMPORTANCE_DEFAULT);
@@ -161,12 +116,6 @@ public class ConversationPriorityPreferenceTest {
silenceButton.callOnClick();
assertThat(holder.itemView.findViewById(R.id.alert).getBackground()).isEqualTo(unselected);
assertThat(holder.itemView.findViewById(R.id.priority_group).getBackground())
.isEqualTo(unselected);
assertThat(holder.itemView.findViewById(R.id.silence).getBackground())
.isEqualTo(selected);
verify(preference, times(1)).callChangeListener(new Pair(IMPORTANCE_LOW, false));
}
}