public void leaveGroup(String idRoom) { int n = 0; ChatScreen cs; TombolRoomField trf; for (n = 0; n < chatss.length; n++) { cs = chatss[n]; if (cs != null) if (cs.getIdRoom().equals(idRoom)) { this.chatss[n] = null; break; } } for (n = 0; n < AktifRoom.getFieldCount(); n++) { trf = (TombolRoomField) AktifRoom.getField(n); if (trf.getRoom().getIdRoom().equals(idRoom)) { AktifRoom.delete(trf); } } PushController.updateIndicator(false); InetConn.getWebData( Util.GetURLChat() + "inout.php?id=" + idRoom + "&pin=" + pin + "&in=false&nick=" + DBStor.get_setting().getNick(), new WebDataCallback() { public void callback(String data) {} }); cs = null; trf = null; }
public void addToActive(TombolRoomField tf) { if (!DBStor.get_setting().isTest() && !DeviceInfo.isSimulator()) { Dialog.alert("Please try Test Push, until get Success notification."); return; } PushController.updateIndicator(false); if (Integer.parseInt(tf.getTotalperson()) > 49) { Dialog.alert("Room Full!"); } 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++) { cs = chatss[n]; if (cs != null) { if (cs.getIdRoom().equals(tf.getRoom().getIdRoom())) { UiApplication.getUiApplication().pushScreen(cs); return; } } } TombolRoomField tfs = new TombolRoomField(tf.getRoom(), "0", USE_ALL_WIDTH); tfs.setChangeListener(this); tfs.setActive(true); AktifRoom.add(tfs); cs = new ChatScreen(tf.getRoom().getIdRoom(), tfs.getLabel(), this, tfs); for (n = 0; n < chatss.length; n++) { ChatScreen css = chatss[n]; if (css == null) { this.chatss[n] = cs; break; } } UiApplication.getUiApplication().pushScreen(cs); cs = null; } else { ChatScreen cs; for (n = 0; n < chatss.length; n++) { cs = chatss[n]; if (cs != null) { if (cs.getIdRoom().equals(tf.getRoom().getIdRoom())) { UiApplication.getUiApplication().pushScreen(cs); return; } } } Dialog.alert("Max 5 Active Room"); } }