Example #1
0
 private void goIntent(ChatInfoBean chatInfoBean) {
   // TODO Auto-generated method stub
   chatInfoBean.setSubjectType("1");
   chatInfoBean.setStatus(true);
   DBUtilsHelper.getInstance().saveChatinfo(chatInfoBean);
   Intent i = new Intent();
   i.setClass(context, GroupChatActivity.class);
   Bundle bundle = new Bundle();
   bundle.putSerializable("chatInfoBean", chatInfoBean);
   i.putExtras(bundle);
   context.startActivity(i);
 }
Example #2
0
  private void analyzeJson(String json) {
    // TODO Auto-generated method stub
    try {
      JSONObject jsonObject = new JSONObject(json);
      JSONObject data = jsonObject.getJSONObject("Data");
      SubjectID = data.getString("SubjectID");
      // SharedPrefsUtil.putValue(Constants.SUBJECTID, SubjectID);
      String responser = data.getString("responser");
      if (null == responser || responser.equals("") || responser.equals("null")) {
        ToastUtil.showMessage("当前没有医生在线...");
        return;
      }
      TimerService.count = 0;
      docInfoBean = new Gson().fromJson(responser, DocInfoBean.class);
      saveDoc(docInfoBean);
      final ChatInfoBean chatInfoBean = new ChatInfoBean();
      chatInfoBean.setSubjectID(SubjectID);
      chatInfoBean.setDocInfoBeanId(docInfoBean.getVoipAccount());
      // SharedPrefsUtil.putValue(Constants.CHATINFO,
      // chatInfoBean.toString());
      if (CCPHelper.getInstance().getDevice() == null) {
        myProgressDialog = new MyProgressDialog(context);
        myProgressDialog.setMessage("正在连接对话....");
        myProgressDialog.show();
        CCPHelper.getInstance()
            .registerCCP(
                new CCPHelper.RegistCallBack() {
                  @Override
                  public void onRegistResult(int reason, String msg) {
                    // Log.i("XXX", String.format("%d, %s",
                    // reason, msg));
                    if (reason == 8192) {
                      LogUtil.i(TAG, "通讯云登录成功");
                      myProgressDialog.dismiss();
                      goIntent(chatInfoBean);
                    } else {
                      LogUtil.i(TAG, "通讯云登录失败");
                      myProgressDialog.dismiss();
                      ToastUtil.showMessage("对话连接失败....");
                    }
                  }
                });
      } else {

        goIntent(chatInfoBean);
      }
    } catch (JSONException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
Example #3
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.chat_comment);
    dbUtils = DBUtilsHelper.getInstance().getDb();
    Intent i = getIntent();
    if (null != i) {
      subjectID = i.getExtras().getString("subjectId");
      try {
        chatInfoBean =
            dbUtils.findFirst(Selector.from(ChatInfoBean.class).where("SubjectID", "=", subjectID));

        if (null != chatInfoBean) {
          subjectType = chatInfoBean.getSubjectType();
        }
      } catch (DbException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
    initView();
    initListener();
    listenET();
  }