Esempio n. 1
0
  /** @return 退出应用操作 */
  public void exitApp() {
    try {
      log.debug("exit app and disconnect xmpp..");
      hasLogined = false;
      notificationService.disconnect(getChatManager());
    } catch (Exception e) {
      log.error("disconnect xmpp error!", e);
    }
    new AsyncTask<String, Integer, String>() {

      @Override
      protected String doInBackground(String... params) {
        MucManager.getInstanse(Application.this).offLine();
        return null;
      }
    }.execute();

    ThreadPlatformUtils.shutdownAllTask();
    IMModelManager.instance().clear();
    boolean outline = Preferences.getOutLine(Application.sharePref);
    if (!outline) {
      CubeApplication application = getCubeApplication();
      application.save(application);
    }
    LoginModel.instance().clear();
    activityManager.popAllActivity();
  }
Esempio n. 2
0
  /** 用户注销 */
  public void logOff() {
    try {
      log.debug("exit app and disconnect xmpp..");
      hasLogined = false;
      notificationService.disconnect(getChatManager());
    } catch (Exception e) {
      log.error("disconnect xmpp error!", e);
    }
    MucManager.getInstanse(this).offLine();
    showTopWindow(a);
    ThreadPlatformUtils.shutdownAllTask();
    Intent in = new Intent(BroadcastConstans.CANCEELDIOLOG);
    sendBroadcast(in);
    IMModelManager.instance().clear();

    boolean outline = Preferences.getOutLine(Application.sharePref);
    if (!outline) {
      CubeApplication application = getCubeApplication();
      application.save(application);
    }
    LoginModel.instance().clear();
    Intent i = null;
    if (PadUtils.isPad(this)) {
      i = new Intent();
      i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
      i.setClass(this, FacadeActivity.class);
      i.putExtra("direction", 1);
      i.putExtra("type", "web");
      i.putExtra("isPad", true);
      i.putExtra("value", "file:///android_asset/www/pad/login.html");
    } else {

      // i = new Intent();
      // i.setClass(this, LoginActivity.class);
      // i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
      // i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
      i = new Intent();
      i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
      i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
      i.setClass(this, FacadeActivity.class);
      i.putExtra("value", URL.PHONE_LOGIN_URL);
      i.putExtra("isPad", false);
    }
    activityManager.popAllActivity();
    // activityManager.popAllActivityExceptOne(FacadeActivity.class);
    startActivity(i);
  }