当前位置: 首页>>代码示例>>Java>>正文


Java AndroidInputMethod类代码示例

本文整理汇总了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;
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:17,代码来源:AndroidCanvasUI.java

示例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;
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:17,代码来源:AndroidCanvasUI.java

示例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;
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:21,代码来源:AndroidCanvasUI.java

示例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;
}
 
开发者ID:Helltar,项目名称:AMPASIDE,代码行数:34,代码来源:AndroidCanvasUI.java

示例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);
}
 
开发者ID:Helltar,项目名称:AMPASIDE,代码行数:34,代码来源:MicroEmulator.java

示例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);
}
 
开发者ID:BombusMod,项目名称:BombusMod,代码行数:35,代码来源:BombusModActivity.java

示例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);
}
 
开发者ID:BombusMod,项目名称:BombusMod,代码行数:33,代码来源:BombusModActivity.java

示例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();
}
 
开发者ID:Helltar,项目名称:AMPASIDE,代码行数:79,代码来源:MicroEmulatorActivity.java

示例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);
}
 
开发者ID:Helltar,项目名称:AMPASIDE,代码行数:60,代码来源:MicroEmulator.java


注:本文中的org.microemu.android.device.AndroidInputMethod类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。