示例#1
0
 public void callbackLBSError(String error) {
   setShowLoader(false);
   if (Dialog.ask(Dialog.D_YES_NO, error + ", Try again?") == Dialog.YES) {
     setShowLoader(true);
     LBS.getLocation(this);
   }
 }
示例#2
0
  public void callback(String data) {
    Util.Log("rooms" + data);
    setShowLoader(false);
    if (data.startsWith("Exception")) {
      Dialog.alert("Failed to connect to server.");
    } else if (data.startsWith("room:")) {
      String[] temps = Util.split(data.substring(5), "<room>");
      for (int n = 0; n < temps.length; n++) {
        String[] temp = Util.split(temps[n], "||");
        reloadActive(new RoomChat(temp[1], temp[0]));
      }
      // reloadActive();

      setShowLoader(true);
      if (DeviceInfo.isSimulator()) {
        callbackLBS(DBStor.get_setting().getLat(), DBStor.get_setting().getLon());
      } else {
        LBS.getLocation(this);
      }
    } else if (data.startsWith("empty")) {
      if (DeviceInfo.isSimulator()) {
        callbackLBS(DBStor.get_setting().getLat(), DBStor.get_setting().getLon());
      } else {
        LBS.getLocation(this);
      }
    } else if (data.startsWith("done:")) {
      ChatRoom.deleteAll();
      String temps[] = Util.split(data.substring(5), "<<>>");
      String temp[];
      for (int n = 0; n < temps.length; n++) {
        temp = Util.split(temps[n], "||");
        TombolRoomField tl =
            new TombolRoomField(new RoomChat(temp[1], temp[0]), temp[2], USE_ALL_WIDTH);
        tl.setChangeListener(this);
        ChatRoom.add(tl);
      }
    }
  }
示例#3
0
 public void fieldChanged(Field f, int context) {
   if (f == showmaps) {
     UiApplication.getUiApplication().pushScreen(new MapScreen());
   } else if (f == settinng) {
     UiApplication.getUiApplication().pushScreen(new SettingScreen());
   } else if (f == addroom) {
     if (PersistentStorage.isRegistered()) {
       if (DBStor.get_setting().isTest()) {
         UiApplication.getUiApplication().pushScreen(new addRoomChat());
       } else {
         Dialog.alert("Please try Test Push, until get Success notification.");
       }
     } else {
       Dialog.alert("Please Activate room Chat");
     }
   } else if (f == refresh) {
     if (DeviceInfo.isSimulator()) {
       callbackLBS(DBStor.get_setting().getLat(), DBStor.get_setting().getLon());
     }
     if (PersistentStorage.isRegistered()) {
       if (DBStor.get_setting().isTest()) {
         GetActiveRoom();
         LBS.getLocation(this);
         setShowLoader(true);
       } else {
         Dialog.alert("Please try Test Push, until get Success notification.");
       }
     } else {
       Dialog.alert("Please Activate room Chat");
     }
   } else if (f instanceof TombolRoomField) {
     try {
       TombolRoomField tf = (TombolRoomField) f;
       addToActive(tf);
     } catch (Exception e) {
     }
   }
 }