Add a separate line at the bottom of list area in output switcher
-Bottom divider is not showed when there are more than 7 devices exist in output switcher -Check panel type in isDividerAllowedBelow() -Hide the Slice bottom divider of Output switcher panel -Show divider in panel layout only for output switcher panel Bug: 159177275 Test: make -j42 RunSettingsRoboTests Change-Id: I49396a0ee0543b494a2b3d714ec248ebab08e7ba
This commit is contained in:
@@ -22,6 +22,7 @@ import static com.android.settings.panel.PanelSlicesAdapter.MAX_NUM_OF_SLICES;
|
||||
import static com.android.settings.slices.CustomSliceRegistry.MEDIA_OUTPUT_GROUP_SLICE_URI;
|
||||
import static com.android.settings.slices.CustomSliceRegistry.MEDIA_OUTPUT_INDICATOR_SLICE_URI;
|
||||
import static com.android.settings.slices.CustomSliceRegistry.MEDIA_OUTPUT_SLICE_URI;
|
||||
import static com.android.settings.slices.CustomSliceRegistry.VOLUME_MEDIA_URI;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
@@ -142,6 +143,53 @@ public class PanelSlicesAdapterTest {
|
||||
assertThat(viewHolder.isDividerAllowedAbove()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void sliderLargeIconPanel_shouldNotAllowDividerBelow() {
|
||||
addTestLiveData(MEDIA_OUTPUT_SLICE_URI);
|
||||
mFakePanelContent.setViewType(PanelContent.VIEW_TYPE_SLIDER_LARGE_ICON);
|
||||
|
||||
final PanelSlicesAdapter adapter =
|
||||
new PanelSlicesAdapter(mPanelFragment, mData, 0 /* metrics category */);
|
||||
final int position = 0;
|
||||
final ViewGroup view = new FrameLayout(mContext);
|
||||
final SliceRowViewHolder viewHolder =
|
||||
adapter.onCreateViewHolder(view, PanelContent.VIEW_TYPE_SLIDER_LARGE_ICON);
|
||||
adapter.onBindViewHolder(viewHolder, position);
|
||||
|
||||
assertThat(viewHolder.isDividerAllowedBelow()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void sliderPanelType_shouldAllowDividerBelow() {
|
||||
addTestLiveData(VOLUME_MEDIA_URI);
|
||||
mFakePanelContent.setViewType(PanelContent.VIEW_TYPE_SLIDER);
|
||||
|
||||
final PanelSlicesAdapter adapter =
|
||||
new PanelSlicesAdapter(mPanelFragment, mData, 0 /* metrics category */);
|
||||
final int position = 0;
|
||||
final ViewGroup view = new FrameLayout(mContext);
|
||||
final SliceRowViewHolder viewHolder =
|
||||
adapter.onCreateViewHolder(view, PanelContent.VIEW_TYPE_SLIDER);
|
||||
adapter.onBindViewHolder(viewHolder, position);
|
||||
|
||||
assertThat(viewHolder.isDividerAllowedBelow()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void defaultPanelType_shouldAllowDividerBelow() {
|
||||
addTestLiveData(VOLUME_MEDIA_URI);
|
||||
mFakePanelContent.setViewType(0 /* viewType */);
|
||||
|
||||
final PanelSlicesAdapter adapter =
|
||||
new PanelSlicesAdapter(mPanelFragment, mData, 0 /* metrics category */);
|
||||
final int position = 0;
|
||||
final ViewGroup view = new FrameLayout(mContext);
|
||||
final SliceRowViewHolder viewHolder = adapter.onCreateViewHolder(view, 0/* viewType */);
|
||||
adapter.onBindViewHolder(viewHolder, position);
|
||||
|
||||
assertThat(viewHolder.isDividerAllowedBelow()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void outputSwitcherSlice_shouldAddFirstItemPadding() {
|
||||
addTestLiveData(MEDIA_OUTPUT_SLICE_URI);
|
||||
@@ -151,7 +199,7 @@ public class PanelSlicesAdapterTest {
|
||||
final int position = 0;
|
||||
final ViewGroup view = new FrameLayout(mContext);
|
||||
final SliceRowViewHolder viewHolder =
|
||||
adapter.onCreateViewHolder(view, PanelContent.VIEW_TYPE_SLIDER);
|
||||
adapter.onCreateViewHolder(view, PanelContent.VIEW_TYPE_SLIDER_LARGE_ICON);
|
||||
|
||||
adapter.onBindViewHolder(viewHolder, position);
|
||||
|
||||
@@ -169,7 +217,7 @@ public class PanelSlicesAdapterTest {
|
||||
final int position = 0;
|
||||
final ViewGroup view = new FrameLayout(mContext);
|
||||
final SliceRowViewHolder viewHolder =
|
||||
adapter.onCreateViewHolder(view, PanelContent.VIEW_TYPE_SLIDER);
|
||||
adapter.onCreateViewHolder(view, PanelContent.VIEW_TYPE_SLIDER_LARGE_ICON);
|
||||
|
||||
adapter.onBindViewHolder(viewHolder, position);
|
||||
|
||||
|
Reference in New Issue
Block a user