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


Java AndroidDisplayableUI类代码示例

本文整理汇总了Java中org.microemu.android.device.ui.AndroidDisplayableUI的典型用法代码示例。如果您正苦于以下问题:Java AndroidDisplayableUI类的具体用法?Java AndroidDisplayableUI怎么用?Java AndroidDisplayableUI使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AndroidDisplayableUI类属于org.microemu.android.device.ui包,在下文中一共展示了AndroidDisplayableUI类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onOptionsItemSelected

import org.microemu.android.device.ui.AndroidDisplayableUI; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
	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;
	}

	int commandIndex = item.getItemId() - Menu.FIRST;
	List<AndroidCommandUI> commands = ui.getCommandsUI();
	CommandUI c = commands.get(commandIndex);

	if (c != null) {
		MIDletBridge.getMIDletAccess().getDisplayAccess().commandAction(c.getCommand(), da.getCurrent());
		return true;
	}

	return false;
}
 
开发者ID:Helltar,项目名称:AMPASIDE,代码行数:27,代码来源:MicroEmulator.java

示例2: onOptionsItemSelected

import org.microemu.android.device.ui.AndroidDisplayableUI; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    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;
    }

    int commandIndex = item.getItemId() - Menu.FIRST;
    List<AndroidCommandUI> commands = ui.getCommandsUI();
    CommandUI c = commands.get(commandIndex);

    if (c != null) {
        MIDletBridge.getMIDletAccess().getDisplayAccess().commandAction(c.getCommand(), da.getCurrent());
        return true;
    }

    return false;
}
 
开发者ID:BombusMod,项目名称:BombusMod,代码行数:27,代码来源:BombusModActivity.java

示例3: onKeyUp

import org.microemu.android.device.ui.AndroidDisplayableUI; //导入依赖的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

示例4: onPrepareOptionsMenu

import org.microemu.android.device.ui.AndroidDisplayableUI; //导入依赖的package包/类
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
	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;
	}		
	
	menu.clear();	
	boolean result = false;
	List<AndroidCommandUI> commands = ui.getCommandsUI();
	for (int i = 0; i < commands.size(); i++) {
		result = true;
		AndroidCommandUI cmd = commands.get(i);
		if (cmd.getCommand().getCommandType() != Command.BACK && cmd.getCommand().getCommandType() != Command.EXIT) {
			SubMenu item = menu.addSubMenu(Menu.NONE, i + Menu.FIRST, Menu.NONE, cmd.getCommand().getLabel());
			item.setIcon(cmd.getDrawable());
		}
	}

	return result;
}
 
开发者ID:Helltar,项目名称:AMPASIDE,代码行数:30,代码来源:MicroEmulator.java

示例5: onPrepareOptionsMenu

import org.microemu.android.device.ui.AndroidDisplayableUI; //导入依赖的package包/类
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
	MIDletAccess ma = MIDletBridge.getMIDletAccess();
	if (ma == null) {
		return false;
	}
	final DisplayAccess da = ma.getDisplayAccess();
	if (da == null) {
		return false;
	}
	AndroidDisplayableUI ui = (AndroidDisplayableUI) da.getCurrentUI();
	if (ui == null) {
		return false;
	}		
	
	menu.clear();	
	boolean result = false;
	final CommandListener l = ui.getCommandListener();
	ArrayList commands = new ArrayList(ui.getCommands());
	for (Iterator it = commands.iterator(); it.hasNext(); ) {
		result = true;
		final Command cmd = (Command) it.next();
		menu.add(0, 0, cmd.getLabel(), new Runnable() {
			public void run() {
				if (l != null) {
					l.commandAction(cmd, da.getCurrent());
				}
			}				
		});
	}

	return result;
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:34,代码来源:MicroEmulator.java

示例6: onBackPressed

import org.microemu.android.device.ui.AndroidDisplayableUI; //导入依赖的package包/类
@Override
public void onBackPressed() {
    MIDletAccess ma = MIDletBridge.getMIDletAccess();
    if (ma == null) {
        return;
    }
    final DisplayAccess da = ma.getDisplayAccess();
    if (da == null) {
        return;
    }
    AndroidDisplayableUI ui = (AndroidDisplayableUI) da.getDisplayableUI(da.getCurrent());
    if (ui == null) {
        return;
    }

    List<AndroidCommandUI> commands = ui.getCommandsUI();

    CommandUI cmd = getFirstCommandOfType(commands, Command.BACK);
    if (cmd == null) {
        cmd = getFirstCommandOfType(commands, Command.EXIT);
    }
    if (cmd == null) {
        cmd = getFirstCommandOfType(commands, Command.CANCEL);
    }
    if (cmd == null) {
        return;
    }

    if (ui.getCommandListener() != null) {
        ignoreBackKeyUp = true;

        MIDletBridge.getMIDletAccess().getDisplayAccess().commandAction(cmd.getCommand(), da.getCurrent());
    }
}
 
开发者ID:BombusMod,项目名称:BombusMod,代码行数:35,代码来源:BombusModActivity.java

示例7: onKeyDown

import org.microemu.android.device.ui.AndroidDisplayableUI; //导入依赖的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

示例8: onKeyUp

import org.microemu.android.device.ui.AndroidDisplayableUI; //导入依赖的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

示例9: onPrepareOptionsMenu

import org.microemu.android.device.ui.AndroidDisplayableUI; //导入依赖的package包/类
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    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;
    }

    menu.clear();
    boolean result = false;
    List<AndroidCommandUI> commands = ui.getCommandsUI();
    for (int i = 0; i < commands.size(); i++) {
        result = true;
        AndroidCommandUI cmd = commands.get(i);
        if (cmd.getCommand().getCommandType() == Command.SCREEN) {
            SubMenu item = menu.addSubMenu(Menu.NONE, i + Menu.FIRST, Menu.NONE, cmd.getCommand().getLabel());
            item.setIcon(cmd.getDrawable());
        }
    }

    return result;
}
 
开发者ID:BombusMod,项目名称:BombusMod,代码行数:30,代码来源:BombusModActivity.java

示例10: onKeyDown

import org.microemu.android.device.ui.AndroidDisplayableUI; //导入依赖的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

示例11: onTrackballEvent

import org.microemu.android.device.ui.AndroidDisplayableUI; //导入依赖的package包/类
@Override
public boolean onTrackballEvent(MotionEvent event) {
	if (event.getAction() == MotionEvent.ACTION_MOVE) {
		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 instanceof AndroidCanvasUI) {
			float x = event.getX();
			float y = event.getY();
			if ((x > 0 && accumulatedTrackballX < 0) || (x < 0 && accumulatedTrackballX > 0)) {
				accumulatedTrackballX = 0;
			}
			if ((y > 0 && accumulatedTrackballY < 0) || (y < 0 && accumulatedTrackballY > 0)) {
				accumulatedTrackballY = 0;
			}
			if (accumulatedTrackballX + x > TRACKBALL_THRESHOLD) {
				accumulatedTrackballX -= TRACKBALL_THRESHOLD;
				KEY_RIGHT_DOWN_EVENT.dispatch(this);
				KEY_RIGHT_UP_EVENT.dispatch(this);
			} else if (accumulatedTrackballX + x < -TRACKBALL_THRESHOLD) {
				accumulatedTrackballX += TRACKBALL_THRESHOLD;
				KEY_LEFT_DOWN_EVENT.dispatch(this);
				KEY_LEFT_UP_EVENT.dispatch(this);
			}
			if (accumulatedTrackballY + y > TRACKBALL_THRESHOLD) {
				accumulatedTrackballY -= TRACKBALL_THRESHOLD;
				KEY_DOWN_DOWN_EVENT.dispatch(this);
				KEY_DOWN_UP_EVENT.dispatch(this);
			} else if (accumulatedTrackballY + y < -TRACKBALL_THRESHOLD) {
				accumulatedTrackballY += TRACKBALL_THRESHOLD;
				KEY_UP_DOWN_EVENT.dispatch(this);
				KEY_UP_UP_EVENT.dispatch(this);
			}
			accumulatedTrackballX += x;
			accumulatedTrackballY += y;
			
			return true;
		}
	}
	
	return super.onTrackballEvent(event);
}
 
开发者ID:Helltar,项目名称:AMPASIDE,代码行数:49,代码来源:MicroEmulator.java

示例12: onTrackballEvent

import org.microemu.android.device.ui.AndroidDisplayableUI; //导入依赖的package包/类
@Override
public boolean onTrackballEvent(MotionEvent event) {
    if (event.getAction() == MotionEvent.ACTION_MOVE) {
        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 instanceof AndroidCanvasUI) {
            float x = event.getX();
            float y = event.getY();
            if ((x > 0 && accumulatedTrackballX < 0) || (x < 0 && accumulatedTrackballX > 0)) {
                accumulatedTrackballX = 0;
            }
            if ((y > 0 && accumulatedTrackballY < 0) || (y < 0 && accumulatedTrackballY > 0)) {
                accumulatedTrackballY = 0;
            }
            if (accumulatedTrackballX + x > TRACKBALL_THRESHOLD) {
                accumulatedTrackballX -= TRACKBALL_THRESHOLD;
                KEY_RIGHT_DOWN_EVENT.dispatch(this);
                KEY_RIGHT_UP_EVENT.dispatch(this);
            } else if (accumulatedTrackballX + x < -TRACKBALL_THRESHOLD) {
                accumulatedTrackballX += TRACKBALL_THRESHOLD;
                KEY_LEFT_DOWN_EVENT.dispatch(this);
                KEY_LEFT_UP_EVENT.dispatch(this);
            }
            if (accumulatedTrackballY + y > TRACKBALL_THRESHOLD) {
                accumulatedTrackballY -= TRACKBALL_THRESHOLD;
                KEY_DOWN_DOWN_EVENT.dispatch(this);
                KEY_DOWN_UP_EVENT.dispatch(this);
            } else if (accumulatedTrackballY + y < -TRACKBALL_THRESHOLD) {
                accumulatedTrackballY += TRACKBALL_THRESHOLD;
                KEY_UP_DOWN_EVENT.dispatch(this);
                KEY_UP_UP_EVENT.dispatch(this);
            }
            accumulatedTrackballX += x;
            accumulatedTrackballY += y;

            return true;
        }
    }

    return super.onTrackballEvent(event);
}
 
开发者ID:BombusMod,项目名称:BombusMod,代码行数:49,代码来源:BombusModActivity.java


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