alibaba / alibaba/weex

[Android] weex waterfall 组件支持ViewHolder复用吗

Open
#3,268 0 comments 0 reactions 0 assignees View on GitHub
android
Dominant language
C++
Stars
18.5k
Forks
2.1k
PR merge metrics
No merged PRs in 30d

Description

版本:安卓 org.apache.weex:sdk_legacy:0.28.0
使用waterfall时发现内存占用很高,查看BaseListComponent的源码发现有这样一段代码:
checkRecycledViewPool中对RecycledViewPool的大小设置为了0,是不是意味着weex吧recyclerView的复用给静止了,所以就导致每次加载更多item时,都是重新创建了ViewHolder,没有复用viewHolder
```
private void checkRecycledViewPool(int viewType) {
try {
if (mViewTypes.size() > MAX_VIEWTYPE_ALLOW_CACHE)
mAllowCacheViewHolder = false;

if (mDownForBidCacheViewHolder)
if (getHostView() != null && getHostView().getInnerView() != null)
getHostView().getInnerView().getRecycledViewPool().setMaxRecycledViews(viewType, 0);

if (!mDownForBidCacheViewHolder) {
if (!mAllowCacheViewHolder) {
if (getHostView() != null && getHostView().getInnerView() != null) {
for (int i = 0; i < mViewTypes.size(); i++) {
getHostView().getInnerView().getRecycledViewPool().setMaxRecycledViews(mViewTypes.keyAt(i), 0);
}
mDownForBidCacheViewHolder = true;
}
}
}
} catch (Exception e) {
WXLogUtils.e(TAG, "Clear recycledViewPool error!");
}
}
```

Contributor guide

Open the contributing guide

Research direction

Start by reading BaseListComponent.checkRecycledViewPool and the surrounding RecycledViewPool handling in the Android SDK version org.apache.weex:sdk_legacy:0.28.0. Reproduce the waterfall memory behavior and verify whether setting the pool size to zero affects ViewHolder reuse; document the finding and identify the appropriate fix or clarification.

Written by the indexing model from the issue text.

Assessment

Tech stack
android
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
22/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.