mirror of
https://github.com/alibaba/Tangram-Android.git
synced 2026-10-17 05:07:05 +08:00
Merge pull request #44 from microjixl/master
fix: 修复baseCell内部引用view导致的内存泄漏
This commit is contained in:
+2
-2
@@ -35,7 +35,7 @@ Tangram是一套动态化构建 Native 页面的框架,它包含 Tangram Andro
|
||||
* 悬浮拖动布局卡片
|
||||
|
||||
# 接入教程
|
||||
详情见[上手教程](docs/TUTORIAL-ch.md)。
|
||||
详情见[上手教程](docs/Tutorial-ch.md)。
|
||||
|
||||
# Tangram 文档
|
||||
|
||||
@@ -46,4 +46,4 @@ Tangram是一套动态化构建 Native 页面的框架,它包含 Tangram Andro
|
||||
在提 Issue 或者 PR 之前,建议先阅读[Contributing Guide](CONTRIBUTING.md)。按照规范提建议。
|
||||
|
||||
# 开源许可证
|
||||
Tangram 遵循MIT开源许可证协议。
|
||||
Tangram 遵循MIT开源许可证协议。
|
||||
|
||||
@@ -34,7 +34,7 @@ Tangram is a modular UI solution for building native page dynamically including
|
||||
* Dragable Card
|
||||
|
||||
# Get started
|
||||
See details at [Tutorial](docs/TUTORIAL.md).
|
||||
See details at [Tutorial](docs/Tutorial.md).
|
||||
|
||||
# Tangram Documents
|
||||
|
||||
@@ -45,4 +45,4 @@ See complete [documents](http://tangram.pingguohe.net/) here.
|
||||
Before you open an issue or create a pull request, please read [Contributing Guide](CONTRIBUTING.md) first.
|
||||
|
||||
# LICENSE
|
||||
Tangram is available under the MIT license.
|
||||
Tangram is available under the MIT license.
|
||||
|
||||
@@ -125,7 +125,7 @@ public class BaseCell<V extends View> extends ComponentLifecycle implements View
|
||||
|
||||
private ArrayMap<String, Object> bizParaMap = new ArrayMap<>(32);
|
||||
|
||||
private ArrayMap<View, Integer> innerClickMap = new ArrayMap<>();
|
||||
private ArrayMap<Integer, Integer> innerClickMap = new ArrayMap<>();
|
||||
|
||||
@Nullable
|
||||
public ServiceManager serviceManager;
|
||||
@@ -156,7 +156,7 @@ public class BaseCell<V extends View> extends ComponentLifecycle implements View
|
||||
if (service != null) {
|
||||
int pos = this.pos;
|
||||
if (innerClickMap.containsKey(v)) {
|
||||
pos = innerClickMap.get(v).intValue();
|
||||
pos = innerClickMap.get(v.hashCode()).intValue();
|
||||
}
|
||||
service.onClick(v, this, pos);
|
||||
}
|
||||
@@ -165,7 +165,12 @@ public class BaseCell<V extends View> extends ComponentLifecycle implements View
|
||||
|
||||
public void setOnClickListener(View view, int eventType) {
|
||||
view.setOnClickListener(this);
|
||||
innerClickMap.put(view, Integer.valueOf(eventType));
|
||||
innerClickMap.put(view.hashCode(), Integer.valueOf(eventType));
|
||||
}
|
||||
|
||||
public void clearClickListener(View view, int eventType) {
|
||||
view.setOnClickListener(null);
|
||||
innerClickMap.remove(view.hashCode());
|
||||
}
|
||||
|
||||
public final void notifyDataChange() {
|
||||
@@ -286,7 +291,7 @@ public class BaseCell<V extends View> extends ComponentLifecycle implements View
|
||||
* for compatible
|
||||
*/
|
||||
public void unbindView(@NonNull V view) {
|
||||
|
||||
clearClickListener(view, 0);
|
||||
}
|
||||
|
||||
/***
|
||||
|
||||
Reference in New Issue
Block a user