Skip to content

Commit

Permalink
fix(android): update pull header LayoutParams in updateLayout
Browse files Browse the repository at this point in the history
  • Loading branch information
siguangli2018 committed Nov 8, 2024
1 parent b9006fa commit 1672efe
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import com.tencent.mtt.hippy.annotation.HippyController;
import com.tencent.mtt.hippy.common.HippyArray;
import com.tencent.mtt.hippy.uimanager.ControllerManager;
import com.tencent.mtt.hippy.uimanager.ControllerRegistry;
import com.tencent.mtt.hippy.uimanager.HippyViewController;
import com.tencent.renderer.node.PullHeaderRenderNode;
import com.tencent.renderer.node.RenderNode;
Expand Down Expand Up @@ -102,6 +103,26 @@ public void run() {
}
}


@Override
public void updateLayout(int rootId, int id, int x, int y, int width, int height,
ControllerRegistry componentHolder) {
super.updateLayout(rootId, id, x, y, width, height, componentHolder);
View view = componentHolder.getView(rootId, id);
if (view instanceof HippyPullHeaderView && view.getParent() instanceof ViewGroup) {
int w = view.getWidth();
int h = view.getHeight();
ViewGroup.LayoutParams lp = view.getLayoutParams();
if (lp != null) {
LogUtils.d(TAG, "updateLayout: id " + id + ", w " + w + ", h " + h
+ ", width " + width + ", height " + height + ", lp.width " + lp.width + ", lp.height "
+ lp.height);
lp.width = width;
lp.height = height;
}
}
}

@Override
public void dispatchFunction(@NonNull HippyPullHeaderView pullHeaderView,
@NonNull String functionName, @NonNull HippyArray params) {
Expand Down

0 comments on commit 1672efe

Please sign in to comment.