public void removeFromFav(RoomChat rc, TombolRoomField field) { int n = 0; RoomChat tf2; for (n = 0; n < favRomm.size(); n++) { tf2 = (RoomChat) favRomm.elementAt(n); if (tf2.getIdRoom().equals(rc.getIdRoom())) { favRomm.removeElementAt(n); favRomm.trimToSize(); DBStor.set_roomFav(favRomm); break; } } Favourite.delete(field); }
public void addToFav(TombolRoomField tf) { int n = 0; RoomChat tf2; boolean ada = false; for (n = 0; n < favRomm.size(); n++) { tf2 = (RoomChat) favRomm.elementAt(n); if (tf2.getIdRoom().equals(tf.getRoom().getIdRoom())) { ada = true; break; } } if (ada) { Dialog.alert("Room Chat exist"); } else { favRomm.addElement(tf.getRoom()); DBStor.set_roomFav(favRomm); TombolRoomField tfs = new TombolRoomField(tf.getRoom(), "0", USE_ALL_WIDTH); tfs.setChangeListener(this); tfs.setFavourite(true); Favourite.add(tfs); } }
public void reloadActive(RoomChat tf) { int n = 0, a = 0; for (n = 0; n < chatss.length; n++) { ChatScreen css = chatss[n]; if (css != null) { a++; } } if (a < 5) { ChatScreen cs; for (n = 0; n < chatss.length; n++) { ChatScreen f2 = chatss[n]; if (f2 != null) if (f2.getIdRoom().equals(tf.getIdRoom())) { return; } } TombolRoomField tfs = new TombolRoomField(tf, "0", USE_ALL_WIDTH); tfs.setChangeListener(this); tfs.setActive(true); AktifRoom.add(tfs); cs = new ChatScreen(tf.getIdRoom(), tf.getNamaRoom(), this, tfs); // UiApplication.getUiApplication().pushScreen(cs); for (n = 0; n < chatss.length; n++) { ChatScreen css = chatss[n]; if (css == null) { this.chatss[n] = cs; break; } } cs = null; } else { // Dialog.alert("Max 5 Room active"); } }