use of com.tmall.wireless.tangram3.structure.BaseCell in project Tangram-Android by alibaba.
the class MVHelper method postMountView.
private void postMountView(BaseCell cell, View view) {
if (!cell.mIsExposed && cell.serviceManager != null) {
ExposureSupport exposureSupport = cell.serviceManager.getService(ExposureSupport.class);
if (exposureSupport != null) {
cell.mIsExposed = true;
exposureSupport.onExposure(view, cell, cell.pos);
}
}
if (view instanceof ITangramViewLifeCycle) {
((ITangramViewLifeCycle) view).postBindView(cell);
} else {
if (postBindMap.get(cell) != null) {
try {
postBindMap.get(cell).invoke(view, cell);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
use of com.tmall.wireless.tangram3.structure.BaseCell in project Tangram-Android by alibaba.
the class MVHelper method mountView.
public void mountView(BaseCell cell, View view) {
try {
mvResolver.register(cell, view);
if (view.getTag(R.id.TANGRAM_ENGINE_TAG) == null) {
view.setTag(R.id.TANGRAM_ENGINE_TAG, engineTag);
}
if (cell.serviceManager != null) {
if (cell.serviceManager.supportRx()) {
cell.emitNext(BDE.BIND);
}
CellSupport cellSupport = cell.serviceManager.getService(CellSupport.class);
if (cellSupport != null) {
cellSupport.bindView(cell, view);
}
}
boolean renderServiceSuccess = renderManager.mountView(cell, view);
if (!renderServiceSuccess) {
initView(cell, view);
}
renderStyle(cell, view);
postMountView(cell, view);
if (cell.serviceManager != null) {
CellSupport cellSupport = cell.serviceManager.getService(CellSupport.class);
if (cellSupport != null) {
cellSupport.postBindView(cell, view);
}
}
} catch (Exception e) {
e.printStackTrace();
if (cell.serviceManager != null) {
CellSupport cellSupport = cell.serviceManager.getService(CellSupport.class);
if (cellSupport != null) {
cellSupport.onBindViewException(cell, view, e);
}
}
}
}
use of com.tmall.wireless.tangram3.structure.BaseCell in project Tangram-Android by alibaba.
the class PojoDataParser method parseCell.
protected void parseCell(BaseCell cell, JSONObject json) {
if (json != null) {
cell.extras = json;
cell.id = json.getString(KEY_BIZ_ID);
if (TextUtils.isEmpty(cell.id) && json.containsKey(KEY_ID)) {
cell.id = json.getString(KEY_ID);
}
cell.stringType = parseCellType(json);
cell.typeKey = json.getString(KEY_TYPE_KEY);
String reuseId = json.getString(KEY_TYPE_REUSEID);
if (!TextUtils.isEmpty(reuseId)) {
cell.typeKey = reuseId;
}
Integer position = json.getInteger(KEY_POSITION);
if (position == null) {
position = -1;
}
cell.position = position;
JSONObject styleJson = json.getJSONObject(KEY_STYLE);
Style style = new Style();
cell.style = parseStyle(style, styleJson);
} else {
cell.extras = new JSONObject();
}
}
use of com.tmall.wireless.tangram3.structure.BaseCell in project Tangram-Android by alibaba.
the class PojoDataParser method parseCard.
protected void parseCard(Card card, JSONObject data, ServiceManager serviceManager, Map<String, ComponentInfo> componentInfoMap) {
card.id = data.getString(KEY_ID);
if (card.id == null) {
card.id = "";
}
// parsing header
JSONObject header = data.getJSONObject(KEY_HEADER);
BaseCell headerCell = parseSingleComponent(header, card, serviceManager, componentInfoMap);
parseHeaderCell(headerCell, card);
// parsing body
JSONArray componentArray = data.getJSONArray(KEY_ITEMS);
if (componentArray != null) {
final int cellLength = componentArray.size();
for (int i = 0; i < cellLength; i++) {
final JSONObject cellData = componentArray.getJSONObject(i);
parseSingleComponent(cellData, card, card.serviceManager, componentInfoMap);
}
}
// parsing footer
JSONObject footer = data.getJSONObject(KEY_FOOTER);
BaseCell footerCell = parseSingleComponent(footer, card, serviceManager, componentInfoMap);
parseFooterCell(footerCell, card);
}
use of com.tmall.wireless.tangram3.structure.BaseCell in project Tangram-Android by alibaba.
the class PojoDataParser method parseHeaderCell.
protected void parseHeaderCell(BaseCell headerCell, Card card) {
card.mHeader = headerCell;
if (card instanceof GridCard) {
GridCard gridCard = (GridCard) card;
gridCard.ensureBlock(card.mHeader);
} else if (card instanceof OnePlusNCard) {
OnePlusNCard onePlusNCard = (OnePlusNCard) card;
onePlusNCard.ensureBlock(card.mHeader);
}
}
Aggregations