Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Commit

Permalink
fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
longerian committed Sep 20, 2018
2 parents 2ef6344 + 57f76da commit 65e10a8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 26 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ org.gradle.jvmargs=-Xmx1536M
GROUP=com.alibaba.android
ARTIFACT=tangram
VERSION=1
VERSION_NAME=3.1.5
VERSION_NAME=3.1.6
PACKAGING_TYPE=aar
systemProp.compileSdkVersion=25
systemProp.targetSdkVersion=25
Expand Down
13 changes: 1 addition & 12 deletions tangram/src/main/java/com/tmall/wireless/tangram/MVHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ public class MVHelper {
private ArrayMap<BaseCell, Method> postBindMap = new ArrayMap<>(128);
private ArrayMap<BaseCell, Method> postUnBindMap = new ArrayMap<>(128);
private ArrayMap<BaseCell, Method> cellInitedMap = new ArrayMap<>(128);
private ArrayMap<BaseCell, String> cellFlareIdMap = new ArrayMap<>(128);

public MVHelper(MVResolver mvResolver) {
this.mvResolver = mvResolver;
Expand Down Expand Up @@ -98,7 +97,6 @@ public void reset() {
postBindMap.clear();
postUnBindMap.clear();
cellInitedMap.clear();
cellFlareIdMap.clear();
mvResolver.reset();
}

Expand All @@ -114,7 +112,7 @@ public boolean isValid(BaseCell cell, ServiceManager serviceManager) {

public void mountView(BaseCell cell, View view) {
try {
mvResolver.register(getCellUniqueId(cell), cell, view);
mvResolver.register(cell, view);
if (cell.serviceManager != null) {
if (cell.serviceManager.supportRx()) {
cell.emitNext(BDE.BIND);
Expand Down Expand Up @@ -160,15 +158,6 @@ public void mountView(BaseCell cell, View view) {
}
}

public String getCellUniqueId(BaseCell cell) {
String flareId = cellFlareIdMap.get(cell);
if (flareId == null) {
flareId = String.format("%s_%s", cell.parent == null ? "null" : cell.parent.id, cell.pos);
cellFlareIdMap.put(cell, flareId);
}
return flareId;
}

public void unMountView(BaseCell cell, View view) {
if (view instanceof IContainer) {
ViewBase vb = ((IContainer)view).getVirtualView();
Expand Down
25 changes: 12 additions & 13 deletions tangram/src/main/java/com/tmall/wireless/tangram/MVResolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.json.JSONException;
import org.json.JSONObject;

import java.util.HashMap;
import java.util.Iterator;
import java.util.List;

Expand Down Expand Up @@ -67,15 +68,12 @@ public class MVResolver {

private ArrayMap<String, Class<? extends BaseCell>> typeCellMap = new ArrayMap(64);

private ArrayMap<String, Card> idCardMap = new ArrayMap<>();
private HashMap<String, Card> idCardMap = new HashMap<>();

private ArrayMap<BaseCell, View> mvMap = new ArrayMap<>(128);

private ArrayMap<View, BaseCell> vmMap = new ArrayMap<>(128);

@Deprecated
private ArrayMap<String, View> idViewMap = new ArrayMap<>(128);

private ServiceManager mServiceManager;

public void setServiceManager(ServiceManager serviceManager) {
Expand All @@ -98,29 +96,30 @@ public Class<? extends BaseCell> getCellClass(String type) {
return typeCellMap.get(type);
}

public void register(String cellId, BaseCell cell, View view) {
public void register(BaseCell cell, View view) {
mvMap.put(cell, view);
vmMap.put(view, cell);

idViewMap.put(cellId, view);
}

public void setCards(List<Card> list) {
for (Card card : list) {
if (!TextUtils.isEmpty(card.id)) {
idCardMap.put(card.id, card);
synchronized (idCardMap) {
for (Card card : list) {
if (!TextUtils.isEmpty(card.id)) {
idCardMap.put(card.id, card);
}
}
}
}

public Card findCardById(String id) {
return idCardMap.get(id);
synchronized (idCardMap) {
return idCardMap.get(id);
}
}

public void reset() {
mvMap.clear();
vmMap.clear();
idViewMap.clear();
}

public View getView(BaseCell cell) {
Expand All @@ -129,7 +128,7 @@ public View getView(BaseCell cell) {

@Deprecated
public View getView(String uniqueId) {
return idViewMap.get(uniqueId);
return null;
}

public BaseCell getCell(View view) {
Expand Down

0 comments on commit 65e10a8

Please sign in to comment.