所谓基础层说得简单一点就是定义存储控件数据的类,这里直接给出源码
package com.datas.api;
/**
* Created by kitwit on 2017/9/11 0011.
*
*/
public class Locator {
private String buttonValue; //定位地址
private ByType byType; //定位方式
/**
* 定位类型枚举
**/
public enum ByType{
by, xpath, linkText, id, name, className
}
public Locator() {}
/**
* Locator构造器,默认定位类型By.id
* @param element
*/
public Locator(String buttonValue) {
this.buttonValue = buttonValue;
this.byType = ByType.id;
}
public Locator(String buttonValue, ByType byType) {
this.buttonValue = buttonValue;
this.byType = byType;
}
public String getButtonValue(){
return buttonValue;
}
// public ByType getBy() {
// return byType;
// }
public void setBy(ByType byType) {
this.byType = byType;
}
public ByType getByType() {
return byType;
}
}
后续用来保存控件的类型和值,本对象类网上参考的可根据需要自行修改
保存控件列表是用的xml文件,形式如下
<?xml version="1.0" encoding="UTF-8"?> <map> <!--locator of page map info --> <page pageName="channelPage"> <!--Locator lists 频道页面的id 统一放在这 --> <locator name="back_button" type="id" value="org.funlive:id/back_button">返回按钮</locator> <locator name="appname" type="id" value="org.funlive:id/appname">跳转后频道名字ID</locator> <locator name="closed_ad" type="id" value="org.funlive:id/close">首页误点击广告页的关闭按钮</locator> <locator name="change_btn" type="id" value="org.funlive:id/change_btn">央视频道的排序方式更换按钮</locator> <locator name="channellist" type="id" value="org.funlive:id/channellist">页面排序方式列表排序</locator> <locator name="channelgridlist" type="id" value="org.funlive:id/channelgridlist">页面排序方式网格排序</locator> </page> </map>