Adjust layout for Slice InputRange

-Make title to slider aligned
-Add test cases

Bug: 147462114
Test: make -j50 RunSettingsRoboTests
Change-Id: Ib1d076f77eae75e4f861a80873117b6254729fe5
This commit is contained in:
Tim Peng
2020-03-01 11:34:16 +08:00
parent 5a4257deb4
commit db7d61d0a2
10 changed files with 145 additions and 3 deletions

View File

@@ -69,7 +69,12 @@ public class PanelSlicesAdapter
public SliceRowViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int viewType) {
final Context context = viewGroup.getContext();
final LayoutInflater inflater = LayoutInflater.from(context);
final View view = inflater.inflate(R.layout.panel_slice_row, viewGroup, false);
View view;
if (viewType == PanelContent.VIEW_TYPE_SLIDER) {
view = inflater.inflate(R.layout.panel_slice_slider_row, viewGroup, false);
} else {
view = inflater.inflate(R.layout.panel_slice_row, viewGroup, false);
}
return new SliceRowViewHolder(view);
}
@@ -87,6 +92,11 @@ public class PanelSlicesAdapter
return Math.min(mSliceLiveData.size(), MAX_NUM_OF_SLICES);
}
@Override
public int getItemViewType(int position) {
return mPanelFragment.getPanelViewType();
}
/**
* Return the available data from the adapter. If the number of Slices over the max number
* allowed, the list will only have the first MAX_NUM_OF_SLICES of slices.