给于 dom 解析的跳转框架
2015-12-02 20:00
239 查看
主要类
GoAction 节点的子节点 goto/type/containerActivity/name/kind
StubClassRef 类映射
UIComDesc 节点 (activity/fragment)
UIFlowManager 核心类,结合其他形成逻辑
UITransition 跳转动画框架
思路: 将app 中所有的fragment 和 activity 进行统一管理, 基于dom 解析。将
xml 中声明的activity 和 fragment 进行解析。存入固定的bean,和map中
留待调用,
知识点 dom 解析的运用,hashmap的使用。设置模式。依赖注入,解耦等
xml 格式:
GoAction 节点的子节点 goto/type/containerActivity/name/kind
StubClassRef 类映射
UIComDesc 节点 (activity/fragment)
UIFlowManager 核心类,结合其他形成逻辑
UITransition 跳转动画框架
思路: 将app 中所有的fragment 和 activity 进行统一管理, 基于dom 解析。将
xml 中声明的activity 和 fragment 进行解析。存入固定的bean,和map中
留待调用,
知识点 dom 解析的运用,hashmap的使用。设置模式。依赖注入,解耦等
xml 格式:
"<?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); }
相关文章推荐
- 文章标题
- hibernate连接数据库,进行操作的步骤
- PCL—低层次视觉—点云分割(超体聚类)
- DataGrid( 数据表格) 组件[2]
- FMDB简单介绍
- 1046. Shortest Distance (20)
- 南大软院大神养成计划——第十七天
- 聚合分析:二进制计数器
- TortoiseSVN SPREADSHEET COMPARE 比较表格
- HDU 4545-魔法串-字符串
- jade模板引擎(一)
- ASP.NET login控件
- 编译原理(九) LR(0)文法分析法(算法描述和C++代码实现)
- Leetcode题解(五)
- 杭电校赛(游乐场)
- C语言_指针函数
- <拦截>所有调用某方法的地方--黑魔法
- 计算机如何表示浮点数(小数)
- windows复制文件到Linux或Windows,有关FTP的配置与使用
- 计算机世界的道(C/ASM)生一(OS),一生二(API),二生万象(MFC/COM)——学包装技术的程序员将来会损失比较大,因为不了解本质,一旦包装过时就会被淘汰