在Android层实现触摸屏校验
2010-05-31 14:35:00 来源:WEB开发网//once edit
static final String CALIBRATION_FILE = "/data/etc/pointercal";
//edit ends
final int id;
final int classes;
final String name;
final AbsoluteInfo absX;
final AbsoluteInfo absY;
final AbsoluteInfo absPressure;
final AbsoluteInfo absSize;
//once edit
static TransformInfo tInfo;
//edit ends
long mDownTime = 0;
int mMetaKeysState = 0;
static File desFile;
final MotionState mAbs = new MotionState(0, 0);
final MotionState mRel = new MotionState(TRACKBALL_MOVEMENT_THRESHOLD,
TRACKBALL_MOVEMENT_THRESHOLD);
static class MotionState {
int xPrecision;
int yPrecision;
float xMoveScale;
float yMoveScale;
MotionEvent currentMove = null;
boolean changed = false;
boolean down = false;
boolean lastDown = false;
long downTime = 0;
int x = 0;
int y = 0;
int pressure = 1;
int size = 0;
MotionState(int mx, int my) {
xPrecision = mx;
yPrecision = my;
xMoveScale = mx != 0 ? (1.0f/mx) : 1.0f;
yMoveScale = my != 0 ? (1.0f/my) : 1.0f;
}
MotionEvent generateMotion(InputDevice device, long curTime,
boolean isAbs, Display display, int orientation,
int metaState) {
if (!changed) {
return null;
}
//once edit
//String prop = System.getProperty("ts.config.calibrate", "noset");
String prop = SystemProperties.get("ts.config.calibrate", "noset");
if (prop.equalsIgnoreCase("start")){
Log.i("XXW prop", prop);
Log.i("XXW", "prop.equalsIgnoreCase start");
device.tInfo = null;
}else if (prop.equalsIgnoreCase("done")){
更多精彩
赞助商链接