public void pointerPressed(int x, int y) { pressedField = true; if (x <= getWidth() / 2 && y > 0 && y <= getHeight() / 2) { selected = Main.STATION_LIST_VIEW; repaint(); serviceRepaints(); midlet.setView(selected); } else if (x > getWidth() / 2 && y > 0 && y <= getHeight() / 2) { selected = Main.FAVORITE_LIST_VIEW; repaint(); serviceRepaints(); midlet.setView(selected); } else if (x <= getWidth() / 2 && y > getHeight() / 2 && y <= getHeight()) { selected = Main.MAP_SEARCH_VIEW; repaint(); serviceRepaints(); ((MapSearchView) midlet.getView(selected)).isChangeOriginHome(true); midlet.setView(selected); } else if (x > getWidth() / 2 && y > getHeight() / 2 && y <= getHeight()) { selected = Main.GEOCODING_SEARCH_VIEW; repaint(); serviceRepaints(); midlet.setView(selected); } }
public void keyPressed(int keyCode) { if (keyCode == Canvas.KEY_NUM5 || keyCode == Canvas.FIRE) { pressedField = true; repaint(); serviceRepaints(); midlet.setView(selected); } else if (keyCode == Canvas.KEY_NUM2 || keyCode == Canvas.UP || keyCode == Canvas.KEY_NUM8 || keyCode == Canvas.DOWN) { if (selected == Main.STATION_LIST_VIEW) { selected = Main.MAP_SEARCH_VIEW; } else if (selected == Main.FAVORITE_LIST_VIEW) { selected = Main.GEOCODING_SEARCH_VIEW; } else if (selected == Main.MAP_SEARCH_VIEW) { selected = Main.STATION_LIST_VIEW; } else if (selected == Main.GEOCODING_SEARCH_VIEW) { selected = Main.FAVORITE_LIST_VIEW; } repaint(); } else if (keyCode == Canvas.KEY_NUM4 || keyCode == Canvas.LEFT || keyCode == Canvas.KEY_NUM6 || keyCode == Canvas.RIGHT) { if (selected == Main.STATION_LIST_VIEW) { selected = Main.FAVORITE_LIST_VIEW; } else if (selected == Main.FAVORITE_LIST_VIEW) { selected = Main.STATION_LIST_VIEW; } else if (selected == Main.MAP_SEARCH_VIEW) { selected = Main.GEOCODING_SEARCH_VIEW; } else if (selected == Main.GEOCODING_SEARCH_VIEW) { selected = Main.MAP_SEARCH_VIEW; } repaint(); } }
public void commandAction(Command c, Displayable d) { if (c == help1Command) { midlet.getFavoriteList().removeAllFavorites(); Alert alert = new Alert("Info", "Ihre Favoriten wurden entfernt!", null, AlertType.INFO); alert.setTimeout(Alert.FOREVER); midlet.getDisplay().setCurrent(alert); } else if (c == help2Command) { midlet.setView(Main.INFO_VIEW); } else if (c == itemCommand) { pressedField = true; repaint(); serviceRepaints(); midlet.setView(selected); } else if (c == exitCommand) { midlet.destroyApp(false); midlet.notifyDestroyed(); } }