Fix overlapping importance icons
We can't re-use the same background because not all of the buttons are the same size Test: manual Bug: 161297551 Change-Id: I8583cb2fbbcb971ab5819eefd84dde3f7c3b4bdf
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user