主要類
GoAction 節點的子節點 goto/type/containerActivity/name/kind
StubClassRef 類映射
UIComDesc 節點 (activity/fragment)
UIFlowManager 核心類,結合其他形成邏輯
UITransition 跳轉動畫架構
思路: 将app 中所有的fragment 和 activity 進行統一管理, 基于dom 解析。将
xml 中聲明的activity 和 fragment 進行解析。存入固定的bean,和map中
留待調用,
"<?xml version=""1.0"" encoding=""utf-8""?>
<UIFlow package=""com.lepu.tm51""> <Fragment name=""com.lepu.app.fun.chat.controller.HistoryChatingFragment""/>
<!--//聲明-->
<Fragment name=""com.lepu.app.fun.chat.controller.album.AlbumFragment"">
<Goto name=""gotoAlbumList""
target=""com.lepu.app.fun.chat.controller.album.AlbumListFragment"" />
<Goto name=""gotoPhotoPreview""
target=""com.lepu.app.fun.chat.controller.album.PhotoPreviewFragment"" />
</Fragment> <Activity name=""com.lepu.app.fun.zhiyuan.activity.BottleGrabEdActivity"">
<Goto name=""gotoChatting"" container-activity=""common""
target=""com.lepu.app.fun.chat.controller.ChattingFragment"" />
</Activity>
</UIFlow>"
dom: Document dom = XmlManager.createDomByString(content);
String defPackage = dom.getDocumentElement().getAttribute("package");
NodeList nl = dom.getDocumentElement().getChildNodes();
for (int i = 0; i < nl.getLength(); i++) {
if (nl.item(i).getNodeType() != Node.ELEMENT_NODE)
continue;
Element ele = (Element) nl.item(i);
UIComDesc uicom = new UIComDesc();
uicom.init(ele, defPackage);
NodeList gonl = ele.getChildNodes();
for (int j = 0; j < gonl.getLength(); j++) {
if (gonl.item(j).getNodeType() != Node.ELEMENT_NODE)
continue;
Element goele = (Element) gonl.item(j);
GoAction goAction = new GoAction();
goAction.init(goele, defPackage);
uicom.addGoAction(goAction.getName(), goAction);
}
uiflowMap.put(uicom.getName(), uicom);
}