@@ -182,6 +182,14 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements
182182 /** The reference to the parent of the RecyclerView */
183183 private View mParent ;
184184
185+ /**
186+ * if mFillAllItemsForced == true fixes all issues with "not all items displayed when wrap_content"
187+ * issues: #349 #336 #339
188+ */
189+ private Boolean mSetAllItemsForced = false ;
190+
191+
192+
185193 /**
186194 * Indicates the position that the view position that the flex line which has the view having
187195 * this position needs to be recomputed before the next layout.
@@ -312,6 +320,14 @@ public void setFlexWrap(@FlexWrap int flexWrap) {
312320 }
313321 }
314322
323+ public Boolean getmSetAllItemsForced () {
324+ return mSetAllItemsForced ;
325+ }
326+
327+ public void setmSetAllItemsForced (Boolean mSetAllItemsForced ) {
328+ this .mSetAllItemsForced = mSetAllItemsForced ;
329+ }
330+
315331 @ JustifyContent
316332 @ Override
317333 public int getJustifyContent () {
@@ -874,7 +890,8 @@ private void updateFlexLines(int childCount) {
874890 // passed as 0 from the RecyclerView)
875891 // Set the upper limit as the height of the device in order to prevent computing all
876892 // items in the adapter
877- needsToFill = mLayoutState .mInfinite ?
893+ // or set the mSetAllItemsForced to true to force all items to show
894+ needsToFill = mSetAllItemsForced ? 999999999 : mLayoutState .mInfinite ?
878895 mContext .getResources ().getDisplayMetrics ().heightPixels
879896 : mLayoutState .mAvailable ;
880897 } else {
@@ -885,7 +902,8 @@ private void updateFlexLines(int childCount) {
885902 // passed as 0 from the RecyclerView)
886903 // Set the upper limit as the width of the device in order to prevent computing all
887904 // items in the adapter
888- needsToFill = mLayoutState .mInfinite ?
905+ // or set the mSetAllItemsForced to true to force all items to show
906+ needsToFill = mSetAllItemsForced ? 999999999 : mLayoutState .mInfinite ?
889907 mContext .getResources ().getDisplayMetrics ().widthPixels
890908 : mLayoutState .mAvailable ;
891909 }
0 commit comments