本文整理汇总了Java中org.microemu.android.device.AndroidInputMethod类的典型用法代码示例。如果您正苦于以下问题:Java AndroidInputMethod类的具体用法?Java AndroidInputMethod怎么用?Java AndroidInputMethod使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AndroidInputMethod类属于org.microemu.android.device包,在下文中一共展示了AndroidInputMethod类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onKeyDown
import org.microemu.android.device.AndroidInputMethod; //导入依赖的package包/类
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (MIDletBridge.getCurrentMIDlet() == null) {
return false;
}
// KEYCODE_SOFT_LEFT == menu key
if (keyCode == KeyEvent.KEYCODE_SOFT_LEFT) {
return false;
}
Device device = DeviceFactory.getDevice();
((AndroidInputMethod) device.getInputMethod()).buttonPressed(event);
return true;
}
示例2: onKeyUp
import org.microemu.android.device.AndroidInputMethod; //导入依赖的package包/类
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (MIDletBridge.getCurrentMIDlet() == null) {
return false;
}
// KEYCODE_SOFT_LEFT == menu key
if (keyCode == KeyEvent.KEYCODE_SOFT_LEFT) {
return false;
}
Device device = DeviceFactory.getDevice();
((AndroidInputMethod) device.getInputMethod()).buttonReleased(event);
return true;
}
示例3: onTouchEvent
import org.microemu.android.device.AndroidInputMethod; //导入依赖的package包/类
@Override
public boolean onTouchEvent(MotionEvent event) {
Device device = DeviceFactory.getDevice();
AndroidInputMethod inputMethod = (AndroidInputMethod) device.getInputMethod();
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN :
inputMethod.pointerPressed((int) event.getX(), (int) event.getY());
break;
case MotionEvent.ACTION_UP :
inputMethod.pointerReleased((int) event.getX(), (int) event.getY());
break;
case MotionEvent.ACTION_MOVE :
inputMethod.pointerDragged((int) event.getX(), (int) event.getY());
break;
default:
return false;
}
return true;
}
示例4: onTouchEvent
import org.microemu.android.device.AndroidInputMethod; //导入依赖的package包/类
@Override
public boolean onTouchEvent(MotionEvent event) {
if (overlay != null && overlay.onTouchEvent(event)) {
return true;
}
Device device = DeviceFactory.getDevice();
AndroidInputMethod inputMethod = (AndroidInputMethod) device.getInputMethod();
int x = (int) event.getX();
int y = (int) event.getY();
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN :
inputMethod.pointerPressed(x, y);
pressedX = x;
pressedY = y;
break;
case MotionEvent.ACTION_UP :
inputMethod.pointerReleased(x, y);
break;
case MotionEvent.ACTION_MOVE :
if (x > (pressedX - FIRST_DRAG_SENSITIVITY_X) && x < (pressedX + FIRST_DRAG_SENSITIVITY_X)
&& y > (pressedY - FIRST_DRAG_SENSITIVITY_Y) && y < (pressedY + FIRST_DRAG_SENSITIVITY_Y)) {
} else {
pressedX = -FIRST_DRAG_SENSITIVITY_X;
pressedY = -FIRST_DRAG_SENSITIVITY_Y;
inputMethod.pointerDragged(x, y);
}
break;
default:
return false;
}
return true;
}
示例5: onKeyUp
import org.microemu.android.device.AndroidInputMethod; //导入依赖的package包/类
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK && ignoreBackKeyUp) {
ignoreBackKeyUp = false;
return true;
}
MIDletAccess ma = MIDletBridge.getMIDletAccess();
if (ma == null) {
return false;
}
final DisplayAccess da = ma.getDisplayAccess();
if (da == null) {
return false;
}
AndroidDisplayableUI ui = (AndroidDisplayableUI) da.getDisplayableUI(da.getCurrent());
if (ui == null) {
return false;
}
if (ui instanceof AndroidCanvasUI) {
if (ignoreKey(keyCode)) {
return false;
}
Device device = DeviceFactory.getDevice();
((AndroidInputMethod) device.getInputMethod()).buttonReleased(event);
return true;
}
return super.onKeyUp(keyCode, event);
}
示例6: onKeyDown
import org.microemu.android.device.AndroidInputMethod; //导入依赖的package包/类
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
MIDletAccess ma = MIDletBridge.getMIDletAccess();
if (ma == null) {
return false;
}
final DisplayAccess da = ma.getDisplayAccess();
if (da == null) {
return false;
}
AndroidDisplayableUI ui = (AndroidDisplayableUI) da.getDisplayableUI(da.getCurrent());
if (ui == null) {
return false;
}
if (ui instanceof AndroidCanvasUI) {
if (ignoreKey(keyCode)) {
return false;
}
Device device = DeviceFactory.getDevice();
((AndroidInputMethod) device.getInputMethod()).buttonPressed(event);
return true;
}
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.ECLAIR
&& keyCode == KeyEvent.KEYCODE_BACK
&& event.getRepeatCount() == 0) {
// Take care of calling this method on earlier versions of
// the platform where it doesn't exist.
onBackPressed();
return true;
}
return super.onKeyDown(keyCode, event);
}
示例7: onKeyUp
import org.microemu.android.device.AndroidInputMethod; //导入依赖的package包/类
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK && ignoreBackKeyUp) {
ignoreBackKeyUp = false;
return true;
}
MIDletAccess ma = MIDletBridge.getMIDletAccess();
if (ma == null) {
return false;
}
final DisplayAccess da = ma.getDisplayAccess();
if (da == null) {
return false;
}
AndroidDisplayableUI ui = (AndroidDisplayableUI) da.getDisplayableUI(da.getCurrent());
if (ui == null) {
return false;
}
if (ui instanceof AndroidCanvasUI) {
if (ignoreKey(keyCode)) {
return false;
}
Device device = DeviceFactory.getDevice();
((AndroidInputMethod) device.getInputMethod()).buttonReleased(event);
return true;
}
return super.onKeyUp(keyCode, event);
}
示例8: onCreate
import org.microemu.android.device.AndroidInputMethod; //导入依赖的package包/类
@Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
// Query the activity property android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
TypedArray ta = getTheme().obtainStyledAttributes(new int[] { android.R.attr.windowFullscreen });
windowFullscreen = ta.getBoolean(0, false);
Drawable phoneCallIcon = getResources().getDrawable(android.R.drawable.stat_sys_phone_call);
int statusBarHeight = 0;
if (!windowFullscreen) {
statusBarHeight = phoneCallIcon.getIntrinsicHeight();
}
Display display = getWindowManager().getDefaultDisplay();
final int width = display.getWidth();
final int height = display.getHeight() - statusBarHeight;
emulatorContext = new EmulatorContext() {
private InputMethod inputMethod = new AndroidInputMethod();
private DeviceDisplay deviceDisplay = new AndroidDeviceDisplay(MicroEmulatorActivity.this, this, width, height);
private FontManager fontManager = new AndroidFontManager(getResources().getDisplayMetrics());
public DisplayComponent getDisplayComponent() {
// TODO consider removal of EmulatorContext.getDisplayComponent()
System.out.println("MicroEmulator.emulatorContext::getDisplayComponent()");
return null;
}
public InputMethod getDeviceInputMethod() {
return inputMethod;
}
public DeviceDisplay getDeviceDisplay() {
return deviceDisplay;
}
public FontManager getDeviceFontManager() {
return fontManager;
}
public InputStream getResourceAsStream(Class origClass, String name) {
try {
if (name.startsWith("/")) {
return MicroEmulatorActivity.this.getAssets().open(name.substring(1));
} else {
Package p = origClass.getPackage();
if (p == null) {
return MicroEmulatorActivity.this.getAssets().open(name);
} else {
String folder = origClass.getPackage().getName().replace('.', '/');
return MicroEmulatorActivity.this.getAssets().open(folder + "/" + name);
}
}
} catch (IOException e) {
Logger.debug(e);
return null;
}
}
public boolean platformRequest(String url) throws ConnectionNotFoundException
{
try {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
} catch (ActivityNotFoundException e) {
throw new ConnectionNotFoundException();
}
return true;
}
};
activityThread = Thread.currentThread();
}
示例9: onKeyDown
import org.microemu.android.device.AndroidInputMethod; //导入依赖的package包/类
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
MIDletAccess ma = MIDletBridge.getMIDletAccess();
if (ma == null) {
return false;
}
final DisplayAccess da = ma.getDisplayAccess();
if (da == null) {
return false;
}
AndroidDisplayableUI ui = (AndroidDisplayableUI) da.getDisplayableUI(da.getCurrent());
if (ui == null) {
return false;
}
if (keyCode == KeyEvent.KEYCODE_BACK) {
List<AndroidCommandUI> commands = ui.getCommandsUI();
CommandUI cmd = getFirstCommandOfType(commands, Command.BACK);
if (cmd != null) {
if (ui.getCommandListener() != null) {
ignoreBackKeyUp = true;
MIDletBridge.getMIDletAccess().getDisplayAccess().commandAction(cmd.getCommand(), da.getCurrent());
}
return true;
}
cmd = getFirstCommandOfType(commands, Command.EXIT);
if (cmd != null) {
if (ui.getCommandListener() != null) {
ignoreBackKeyUp = true;
MIDletBridge.getMIDletAccess().getDisplayAccess().commandAction(cmd.getCommand(), da.getCurrent());
}
return true;
}
cmd = getFirstCommandOfType(commands, Command.CANCEL);
if (cmd != null) {
if (ui.getCommandListener() != null) {
ignoreBackKeyUp = true;
MIDletBridge.getMIDletAccess().getDisplayAccess().commandAction(cmd.getCommand(), da.getCurrent());
}
return true;
}
}
if (ui instanceof AndroidCanvasUI) {
if (ignoreKey(keyCode)) {
return false;
}
Device device = DeviceFactory.getDevice();
((AndroidInputMethod) device.getInputMethod()).buttonPressed(event);
return true;
}
return super.onKeyDown(keyCode, event);
}