-
Notifications
You must be signed in to change notification settings - Fork 1.8k
force set all items to adapter when wrap_content is set to RV, issues… #507
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -182,6 +182,14 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements | |
/** The reference to the parent of the RecyclerView */ | ||
private View mParent; | ||
|
||
/** | ||
* if mFillAllItemsForced == true fixes all issues with "not all items displayed when wrap_content" | ||
* issues: #349 #336 #339 | ||
*/ | ||
private Boolean mSetAllItemsForced = false; | ||
|
||
|
||
|
||
/** | ||
* Indicates the position that the view position that the flex line which has the view having | ||
* this position needs to be recomputed before the next layout. | ||
|
@@ -312,6 +320,14 @@ public void setFlexWrap(@FlexWrap int flexWrap) { | |
} | ||
} | ||
|
||
public Boolean getmSetAllItemsForced() { | ||
return mSetAllItemsForced; | ||
} | ||
|
||
public void setmSetAllItemsForced(Boolean mSetAllItemsForced) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above, naming needs correction. |
||
this.mSetAllItemsForced = mSetAllItemsForced; | ||
} | ||
|
||
@JustifyContent | ||
@Override | ||
public int getJustifyContent() { | ||
|
@@ -874,7 +890,8 @@ private void updateFlexLines(int childCount) { | |
// passed as 0 from the RecyclerView) | ||
// Set the upper limit as the height of the device in order to prevent computing all | ||
// items in the adapter | ||
needsToFill = mLayoutState.mInfinite ? | ||
// or set the mSetAllItemsForced to true to force all items to show | ||
needsToFill = mSetAllItemsForced ? 999999999 : mLayoutState.mInfinite ? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe instead this 999999999 let's put Integer.MAX_VALUE ? |
||
mContext.getResources().getDisplayMetrics().heightPixels | ||
: mLayoutState.mAvailable; | ||
} else { | ||
|
@@ -885,7 +902,8 @@ private void updateFlexLines(int childCount) { | |
// passed as 0 from the RecyclerView) | ||
// Set the upper limit as the width of the device in order to prevent computing all | ||
// items in the adapter | ||
needsToFill = mLayoutState.mInfinite ? | ||
// or set the mSetAllItemsForced to true to force all items to show | ||
needsToFill = mSetAllItemsForced ? 999999999 : mLayoutState.mInfinite ? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe instead this 999999999 let's put Integer.MAX_VALUE ? |
||
mContext.getResources().getDisplayMetrics().widthPixels | ||
: mLayoutState.mAvailable; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better would be to have it here
areAllItemsForced()
or something similar.