Use if instead of switch for resources
Converting to Soong will move some code from directly compiled into the app to compiled into an Android library and then shared between the app and the tests. This will cause resource IDs in the library to become non-final, which means they can no longer be used in case statements. Convert affect case statements to if blocks. Test: m RunSettingsRoboTests Change-Id: I25742a374f06d3fa4decbfc0d223a350acc50881
This commit is contained in:
@@ -105,13 +105,11 @@ public class ContextualCardsAdapter extends RecyclerView.Adapter<RecyclerView.Vi
|
||||
@Override
|
||||
public int getSpanSize(int position) {
|
||||
final int viewType = mContextualCards.get(position).getViewType();
|
||||
switch (viewType) {
|
||||
case ConditionContextualCardRenderer.VIEW_TYPE_HALF_WIDTH:
|
||||
case SliceContextualCardRenderer.VIEW_TYPE_HALF_WIDTH:
|
||||
return HALF_WIDTH;
|
||||
default:
|
||||
return FULL_WIDTH;
|
||||
if (viewType == ConditionContextualCardRenderer.VIEW_TYPE_HALF_WIDTH
|
||||
|| viewType == SliceContextualCardRenderer.VIEW_TYPE_HALF_WIDTH) {
|
||||
return HALF_WIDTH;
|
||||
}
|
||||
return FULL_WIDTH;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user