Merge "Adjust layout for Slice InputRange" into rvc-dev am: af4d55e7dd
am: 84fb219cb0
Change-Id: I386afb206d77142fc93ba0454d5f09df05f5aaab
This commit is contained in:
@@ -156,4 +156,9 @@ public class MediaOutputGroupPanel implements PanelContent, LocalMediaManager.De
|
||||
public int getMetricsCategory() {
|
||||
return SettingsEnums.PANEL_MEDIA_OUTPUT_GROUP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getViewType() {
|
||||
return PanelContent.VIEW_TYPE_SLIDER;
|
||||
}
|
||||
}
|
||||
|
@@ -240,4 +240,9 @@ public class MediaOutputPanel implements PanelContent, LocalMediaManager.DeviceC
|
||||
mLocalMediaManager.unregisterCallback(this);
|
||||
mLocalMediaManager.stopScan();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getViewType() {
|
||||
return PanelContent.VIEW_TYPE_SLIDER;
|
||||
}
|
||||
}
|
||||
|
@@ -30,6 +30,8 @@ import java.util.List;
|
||||
*/
|
||||
public interface PanelContent extends Instrumentable {
|
||||
|
||||
int VIEW_TYPE_SLIDER = 1;
|
||||
|
||||
/**
|
||||
* @return a icon for the title of the Panel.
|
||||
*/
|
||||
@@ -101,4 +103,11 @@ public interface PanelContent extends Instrumentable {
|
||||
* @param callback the callback to add.
|
||||
*/
|
||||
default void registerCallback(PanelContentCallback callback) {}
|
||||
|
||||
/**
|
||||
* @return a view type to customized it. 0 for default layout.
|
||||
*/
|
||||
default int getViewType() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@@ -417,6 +417,10 @@ public class PanelFragment extends Fragment {
|
||||
};
|
||||
}
|
||||
|
||||
int getPanelViewType() {
|
||||
return mPanel.getViewType();
|
||||
}
|
||||
|
||||
class LocalPanelCallback implements PanelContentCallback {
|
||||
|
||||
@Override
|
||||
|
@@ -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.
|
||||
|
@@ -73,4 +73,9 @@ public class VolumePanel implements PanelContent {
|
||||
public int getMetricsCategory() {
|
||||
return SettingsEnums.PANEL_VOLUME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getViewType() {
|
||||
return PanelContent.VIEW_TYPE_SLIDER;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user