Fix setting the mode for items in a list
No visible bug due to this currently but will matter later.
Bug: 68378574
Test: none
Change-Id: I348ce5a92f51deb4647fead43af5daefddc2bab4
diff --git a/slices/view/src/main/java/androidx/app/slice/widget/LargeSliceAdapter.java b/slices/view/src/main/java/androidx/app/slice/widget/LargeSliceAdapter.java
index c84db5f..b64cd01 100644
--- a/slices/view/src/main/java/androidx/app/slice/widget/LargeSliceAdapter.java
+++ b/slices/view/src/main/java/androidx/app/slice/widget/LargeSliceAdapter.java
@@ -23,6 +23,8 @@
import static android.app.slice.SliceItem.FORMAT_INT;
import static android.app.slice.SliceItem.FORMAT_TEXT;
+import static androidx.app.slice.widget.SliceView.MODE_LARGE;
+
import android.annotation.TargetApi;
import android.app.slice.Slice;
import android.content.Context;
@@ -149,16 +151,21 @@
}
private View inflateForType(int viewType) {
+ View v = new RowView(mContext);
switch (viewType) {
case TYPE_GRID:
- return LayoutInflater.from(mContext).inflate(R.layout.abc_slice_grid, null);
+ v = LayoutInflater.from(mContext).inflate(R.layout.abc_slice_grid, null);
+ break;
case TYPE_MESSAGE:
- return LayoutInflater.from(mContext).inflate(R.layout.abc_slice_message, null);
+ v = LayoutInflater.from(mContext).inflate(R.layout.abc_slice_message, null);
+ break;
case TYPE_MESSAGE_LOCAL:
- return LayoutInflater.from(mContext).inflate(R.layout.abc_slice_message_local,
+ v = LayoutInflater.from(mContext).inflate(R.layout.abc_slice_message_local,
null);
+ break;
}
- return new RowView(mContext);
+ ((SliceChildView) v).setMode(MODE_LARGE);
+ return v;
}
protected static class SliceWrapper {