Ejemplo n.º 1
0
  @SuppressLint("UseSparseArrays")
  @Override
  public void onResume() {
    latestImageMessages = new HashMap<Integer, String>();
    message.addTextChangedListener(textWatcher);
    addVirtualKeyboardVisiblityListener();

    super.onResume();

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

    if (LinphoneActivity.isInstanciated()) {
      LinphoneActivity.instance().selectMenu(FragmentsAvailable.CHAT);
      LinphoneActivity.instance().updateChatFragment(this);

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

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

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

    displayMessages();
  }
Ejemplo n.º 2
0
  public void changeDisplayedChat(String newSipUri, String displayName, String 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);
    }

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

    displayChatHeader(displayName, pictureUri);
    displayMessages();
  }