Ejemplo n.º 1
0
  public void changeDisplayedChat(String newSipUri, String displayName, String pictureUri) {
    this.sipUri = newSipUri;
    this.displayName = displayName;
    this.pictureUri = pictureUri;

    if (!message.getText().toString().equals("") && LinphoneActivity.isInstanciated()) {
      ChatStorage chatStorage = LinphoneActivity.instance().getChatStorage();
      if (chatStorage.getDraft(sipUri) == null) {
        chatStorage.saveDraft(sipUri, message.getText().toString());
      } else {
        chatStorage.updateDraft(sipUri, message.getText().toString());
      }
    } else if (LinphoneActivity.isInstanciated()) {
      LinphoneActivity.instance().getChatStorage().deleteDraft(sipUri);
    }

    if (LinphoneActivity.isInstanciated()) {
      String draft = LinphoneActivity.instance().getChatStorage().getDraft(sipUri);
      if (draft == null) draft = "";
      message.setText(draft);
    }

    LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
    if (lc != null) {
      chatRoom = lc.getOrCreateChatRoom(sipUri);
      // Only works if using liblinphone storage
      chatRoom.markAsRead();
    }

    displayChatHeader(displayName, pictureUri);
    dispayMessageList();
  }
Ejemplo n.º 2
0
  @SuppressLint("UseSparseArrays")
  @Override
  public void onResume() {
    message.addTextChangedListener(textWatcher);
    addVirtualKeyboardVisiblityListener();

    LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
    if (lc != null) {
      lc.addListener(mListener);
    }

    if (LinphoneActivity.isInstanciated()) {
      if (getResources().getBoolean(R.bool.show_statusbar_only_on_dialer)) {
        LinphoneActivity.instance().hideStatusBar();
      }
      LinphoneActivity.instance().updateChatFragment(this);
    }

    String draft = getArguments().getString("messageDraft");
    message.setText(draft);

    remoteComposing.setVisibility(chatRoom.isRemoteComposing() ? View.VISIBLE : View.GONE);
    dispayMessageList();

    super.onResume();
  }
Ejemplo n.º 3
0
 private void displayMessages() {
   dispayMessageList();
 }