本文整理汇总了Java中com.android.chimpchat.core.TouchPressType类的典型用法代码示例。如果您正苦于以下问题:Java TouchPressType类的具体用法?Java TouchPressType怎么用?Java TouchPressType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TouchPressType类属于com.android.chimpchat.core包,在下文中一共展示了TouchPressType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: press
import com.android.chimpchat.core.TouchPressType; //导入依赖的package包/类
@Override
public void press(String keyName, TouchPressType type) {
try {
switch (type) {
case DOWN_AND_UP:
manager.press(keyName);
break;
case DOWN:
manager.keyDown(keyName);
break;
case UP:
manager.keyUp(keyName);
break;
}
} catch (IOException e) {
LOG.log(Level.SEVERE, "Error sending press event: " + keyName + " " + type, e);
}
}
示例2: touch
import com.android.chimpchat.core.TouchPressType; //导入依赖的package包/类
@Override
public void touch(int x, int y, TouchPressType type) {
try {
switch (type) {
case DOWN:
manager.touchDown(x, y);
break;
case UP:
manager.touchUp(x, y);
break;
case DOWN_AND_UP:
manager.tap(x, y);
break;
}
} catch (IOException e) {
LOG.log(Level.SEVERE, "Error sending touch event: " + x + " " + y + " " + type, e);
}
}
示例3: touch
import com.android.chimpchat.core.TouchPressType; //导入依赖的package包/类
/**
*
* @param xRate
* @param yRate
* @param pressType
*/
private void touch(float xRate, float yRate, TouchPressType pressType) {
Dimension screenSize = getScreenSize();
int x = (int) (screenSize.width * xRate);
int y = (int) (screenSize.height * yRate);
if (pressType != null) {
chimpDevice.touch(x, y, pressType);
} else {
try {
chimpDevice.getManager().touchMove(x, y);
} catch (IOException e) {
// TODO: improve exception handling
e.printStackTrace();
}
}
}
示例4: sendEventToDevice
import com.android.chimpchat.core.TouchPressType; //导入依赖的package包/类
@Override
synchronized public void sendEventToDevice(String keyCode, KeyAction keyAction) {
if (!isAlive()) {
disconnect();
connect();
return;
}
switch (keyAction) {
case UP:
log("Key up:\t\t "+keyCode);
device.press(keyCode, TouchPressType.UP);
break;
case DOWN:
log("Key down:\t "+keyCode);
device.press(keyCode, TouchPressType.DOWN);
break;
}
if (!isAlive()) {
disconnect();
connect();
}
}
示例5: sendTextToDevice
import com.android.chimpchat.core.TouchPressType; //导入依赖的package包/类
@Override
synchronized public void sendTextToDevice(String text, KeyAction keyAction) {
if (!isAlive()) {
disconnect();
connect();
return;
}
switch (keyAction) {
case UP:
device.press(text, TouchPressType.UP);
break;
case DOWN:
device.press(text, TouchPressType.DOWN);
break;
}
if (!isAlive()) {
disconnect();
connect();
}
}
示例6: press
import com.android.chimpchat.core.TouchPressType; //导入依赖的package包/类
@MonkeyRunnerExported(doc = "Send a key event to the specified key",
args = { "name", "type" },
argDocs = { "the keycode of the key to press (see android.view.KeyEvent)",
"touch event type as returned by TouchPressType(). To simulate typing a key, " +
"send DOWN_AND_UP"})
public void press(String name, String touchType) {
// The old docs had this string, and so in favor of maintaining
// backwards compatibility, let's special case it to the new one.
if (touchType.equals("DOWN_AND_UP")){
touchType = "downAndUp";
}
TouchPressType type = TouchPressType.fromIdentifier(touchType);
if (type == null) {
LOG.warning(String.format("Invalid TouchPressType specified (%s) default used instead",
touchType));
type = TouchPressType.DOWN_AND_UP;
}
impl.press(name, type);
}
示例7: deserializeCommand
import com.android.chimpchat.core.TouchPressType; //导入依赖的package包/类
public boolean deserializeCommand(String data) {
String[] tokens =
data.split(TestDemultiplexerConstants.SERIAL_SEPARATOR);
if (tokens.length != NUM_SERIAL_TOKENS) {
return false;
} else if (!tokens[0].equals(SERIALIZED_KEY)) {
return false;
}
if (tokens[1].equals("null")) {
button = null;
} else {
button = PhysicalButton.valueOf(tokens[1]);
}
buttonName = tokens[2];
if (buttonName.equals("null")) {
buttonName = null;
}
touchType = TouchPressType.fromIdentifier(tokens[3]);
return true;
}
示例8: deserializeCommand
import com.android.chimpchat.core.TouchPressType; //导入依赖的package包/类
public boolean deserializeCommand(String data) {
String[] tokens =
data.split(TestDemultiplexerConstants.SERIAL_SEPARATOR);
if (tokens.length != NUM_SERIAL_TOKENS) {
return false;
} else if (!tokens[0].equals(SERIALIZED_KEY)) {
return false;
}
xScale = Float.valueOf(tokens[1]);
yScale = Float.valueOf(tokens[2]);
pressType = TouchPressType.fromIdentifier(tokens[3]);
uniqueUiAutomationId = tokens[4];
if (uniqueUiAutomationId.equals(NULL_STRING)) {
uniqueUiAutomationId = null;
}
return true;
}
示例9: keyUp
import com.android.chimpchat.core.TouchPressType; //导入依赖的package包/类
/**
*
* @param key
*/
public void keyUp(Keys key) {
if (key == Keys.POWER) {
chimpDevice.wake();
}
pressKey(key.toString(), TouchPressType.UP);
}
示例10: execute
import com.android.chimpchat.core.TouchPressType; //导入依赖的package包/类
public void execute(TestDevice device) {
// Try first by installing ToggleAirplaneMode.apk if not already
// installed.
// Then run ToggleAirplaneMode to change the airplane mode setting.
String result = device.getIChimpDevice().shell(
"pm path com.ebay.toggleairplanemode");
if (result.equals("")) {
device.getIChimpDevice().installPackage("ToggleAirplaneMode.apk");
}
device.getIChimpDevice().startActivity(
null,
null,
null,
null,
new ArrayList<String>(),
new HashMap<String, Object>(),
"com.ebay.toggleairplanemode/.ToggleAirplaneModeActivity",
0);
// Wait for the activity to launch.
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
device.getIChimpDevice().press("KEYCODE_BACK", TouchPressType.DOWN_AND_UP);
}
示例11: PressCommand
import com.android.chimpchat.core.TouchPressType; //导入依赖的package包/类
/**
* Create a new Press command.
* @param button Physical button to press.
* @param touchType Type of button press.
*/
public PressCommand(PhysicalButton button, TouchPressType touchType) {
this.button = button;
this.buttonName = null;
this.touchType = touchType;
}
示例12: execute
import com.android.chimpchat.core.TouchPressType; //导入依赖的package包/类
public void execute(TestDevice device) {
// Try first by installing DeviceUnlock.apk if not already installed.
// Then run DeviceUnlock to unlock the device.
// Then try unlocking any pin security. Expect pin to be 1234.
String result = device.getIChimpDevice().shell(
"pm path com.ebay.deviceunlock");
if (result.equals("")) {
device.getIChimpDevice().installPackage("DeviceUnlock.apk");
}
device.getIChimpDevice().startActivity(
null,
null,
null,
null,
new ArrayList<String>(),
new HashMap<String, Object>(),
"com.ebay.deviceunlock/.MainActivity",
0);
// Wait for the activity to launch.
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
device.getIChimpDevice().press("KEYCODE_BACK", TouchPressType.DOWN_AND_UP);
device.getIChimpDevice().shell("input text 1234");
device.getIChimpDevice().shell("input keyevent 66");
}
示例13: execute
import com.android.chimpchat.core.TouchPressType; //导入依赖的package包/类
@Override
public void execute(IChimpDevice device) {
device.press(key, TouchPressType.fromIdentifier(downUpFlag));
}
示例14: pressKey
import com.android.chimpchat.core.TouchPressType; //导入依赖的package包/类
/**
*
* @param key
* @param pressType
*/
private void pressKey(String key, TouchPressType pressType) {
if (isOnline()) {
chimpDevice.press(key, pressType);
}
}
示例15: touch
import com.android.chimpchat.core.TouchPressType; //导入依赖的package包/类
public void touch(int x, int y, String typeStr) {
TouchPressType type = TouchPressType.fromIdentifier(typeStr);
if (type == null)
type = TouchPressType.DOWN_AND_UP;
impl.touch(x, y, type);
}