perf(icon): 升级 iconloader 1.0.3 并避免重复创建图标加载任务
- 依赖升级到 com.ttstd:iconloader:1.0.3 - 列表图标缓存未命中时,仅在 Loader 不存在时重建,避免重复触发加载
This commit is contained in:
1 parent
b850d0e65b
commit
064af2f80f
4 files changed
+21
-18
No files matched your search
@@ -80,7 +80,9 @@ public class AppAdapter extends RecyclerView.Adapter<AppAdapter.AppHolder> imple
|
||||
if (drawable != null) {
|
||||
holder.iv_icon.setImageDrawable(drawable);
|
||||
} else {
|
||||
mLoaderManager.restartLoader(position, null, this).forceLoad();
|
||||
if (mLoaderManager.getLoader(position) == null) {
|
||||
mLoaderManager.restartLoader(position, null, this).forceLoad();
|
||||
}
|
||||
}
|
||||
holder.tv_app_name.setText(appInfo.getLabel());
|
||||
holder.root.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
@@ -94,7 +94,9 @@ public class AppGridAdapter extends RecyclerView.Adapter<AppGridAdapter.ViewHold
|
||||
if (drawable != null) {
|
||||
holder.iv_icon.setImageDrawable(drawable);
|
||||
} else {
|
||||
mLoaderManager.restartLoader(position, null, this).forceLoad();
|
||||
if (mLoaderManager.getLoader(position) == null) {
|
||||
mLoaderManager.restartLoader(position, null, this).forceLoad();
|
||||
}
|
||||
}
|
||||
holder.tv_app_name.setText(appInfo.getLabel());
|
||||
|
||||
|
||||
@@ -101,7 +101,9 @@ public class MoreAppAdapter extends RecyclerView.Adapter<MoreAppAdapter.AppHolde
|
||||
if (drawable != null) {
|
||||
holder.iv_icon.setImageDrawable(drawable);
|
||||
} else {
|
||||
mLoaderManager.restartLoader(position, null, this).forceLoad();
|
||||
if (mLoaderManager.getLoader(position) == null) {
|
||||
mLoaderManager.restartLoader(position, null, this).forceLoad();
|
||||
}
|
||||
}
|
||||
holder.tv_app_name.setText(appInfo.getLabel());
|
||||
holder.root.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
Reference in new issue
Block a user