protected void paint(Graphics g) { g.setColor(Theme.TWITTER_BLUE_COLOR); g.fillRect(0, 0, getWidth(), getHeight()); if (menu.isActive() == false && statusMenu.isActive() == false) { statusList.draw( g, statuses, menuBar.getHeight() + verticalScroll + TalkBalloon.textFont.getHeight() / 2); menuBar.draw(g, 0); } else if (menu.isActive()) { menu.draw(g); } else if (statusMenu.isActive()) { statusMenu.draw(g); } }
public void keyPressed(int keyCode) { int gameAction = this.getGameAction(keyCode); String keyName = this.getKeyName(keyCode); if (gameAction == Canvas.LEFT) { menuBar.selectPreviousTab(); handleTabChange(); repaint(); return; } else if (gameAction == Canvas.RIGHT) { menuBar.selectNextTab(); handleTabChange(); repaint(); return; } else if (gameAction == Canvas.FIRE) { if (menu.isActive()) { menu.deactivate(); activateMenuItem(); } else if (statusMenu.isActive()) { statusMenu.deactivate(); activateStatusMenuItem(); } else if (statusList.getSelected() != null) { statusMenu.activate(); } } else if (keyName.indexOf("SOFT") >= 0 && keyName.indexOf("1") > 0 || (Device.isNokia() && keyCode == -6) || keyCode == TimelineCanvas.KEY_STAR) { /** Left soft key pressed */ if (menu.isActive()) { menu.deactivate(); activateMenuItem(); } else { menu.activate(); } } else if (((keyName.indexOf("SOFT") >= 0 && keyName.indexOf("2") > 0) || (Device.isNokia() && keyCode == -7) || keyCode == TimelineCanvas.KEY_POUND)) { /** Right soft key pressed */ if (menu.isActive()) { menu.deactivate(); activateMenuItem(); } else { menu.activate(); } } handleUpAndDownKeys(keyCode); repaint(); }
private void handleUpAndDownKeys(int keyCode) { int gameAction = this.getGameAction(keyCode); if (gameAction == Canvas.UP) { if (menu.isActive()) { menu.selectPrevious(); } else if (statusMenu.isActive()) { statusMenu.selectPrevious(); } else { verticalScroll += getHeight() / 6; // menuBar.getHeight(); if (verticalScroll > 0) { verticalScroll = 0; } } } else if (gameAction == Canvas.DOWN) { if (menu.isActive()) { menu.selectNext(); } else if (statusMenu.isActive()) { statusMenu.selectNext(); } else { verticalScroll -= getHeight() / 6; // menuBar.getHeight(); } } }