Skip to content
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

feat(react,vue,ios,android): add waterfall component for hippy #933

Merged
merged 21 commits into from
Aug 18, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat(android): change the water fall view padding logic
  • Loading branch information
hengyangji authored and zoomchan-cxj committed Aug 18, 2021
commit 3d46aa221c8766ccf7ad198ec77cadfcfd8343a1
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,16 @@ public class HippyWaterfallView extends HippyListView implements HippyViewBase,
private boolean mHasRemovePreDraw = false;
private ViewTreeObserver.OnPreDrawListener mPreDrawListener = null;
private ViewTreeObserver mViewTreeObserver = null;
private WaterfallEndChecker mEndChecker = new WaterfallEndChecker();
private int mItemViewPaddingLeft;
private int mItemViewPaddingRight;

// for auto test >>>
private boolean mHasLoadMore = false;
private boolean mHasScrollToIndex = false;
private boolean mHasScrollToContentOffset = false;
private boolean mHasStartRefresh = false;
private boolean mHasCompeleteRefresh = false;
private WaterfallEndChecker mEndChecker = new WaterfallEndChecker();
// for auto test <<<

public HippyWaterfallView(Context context) {
Expand Down Expand Up @@ -165,6 +168,7 @@ public void run() {
}

public void startLoadMore() {
mHasLoadMore = true;
mAdapter.setLoadingStatus(IRecyclerViewFooter.LOADING_STATUS_LOADING);
}

Expand All @@ -175,6 +179,11 @@ public void handleInTraversal(int traversalPurpose, int position, View contentVi
}
}

public void setItemViewPadding(int paddingLeft, int paddingRight) {
mItemViewPaddingLeft = paddingLeft;
mItemViewPaddingRight = paddingRight;
}

private void traversalChildViewForSkinChange(View view) {
if (view instanceof ViewGroup) {
int childCount = ((ViewGroup) view).getChildCount();
Expand Down Expand Up @@ -463,6 +472,10 @@ public ContentHolder onCreateContentViewWithPos(ViewGroup parent, int position,

contentHolder.mBindNode = contentViewRenderNode;
contentHolder.isCreated = true;
if (viewType != ViewHolder.TYPE_CUSTOM_FOOTER) {
contentHolder.mItemPaddingLeft = mItemViewPaddingLeft;
contentHolder.mItemPaddingRight = mItemViewPaddingRight;
}
return contentHolder;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,9 @@ public void setContainBannerView(HippyWaterfallView listview, boolean containBan
@HippyControllerProps(name = WaterFallComponentName.PROPERTY_CONTENT_INSET, defaultType = HippyControllerProps.NUMBER, defaultNumber = 0)
public void setContentInset(HippyWaterfallView listview, HippyMap data) {
int left = dpToPx(data.getInt("left"));
int top = dpToPx(data.getInt("top"));
int right = dpToPx(data.getInt("right"));
int bottom = dpToPx(data.getInt("bottom"));

listview.setPadding(left, top, right, bottom);
listview.setItemViewPadding(left, right);
}

protected int dpToPx(int dp) {
Expand Down