Beispiel #1
0
  public void setBuffer(int bufferId) {
    Log.d(TAG, "Setting buffer and chat is visible: " + getUserVisibleHint());
    this.bufferId = bufferId;
    if (adapter != null && networks != null) {
      if (adapter.buffer != null && bufferId != adapter.buffer.getInfo().id) {
        updateMarkerLine();
      }
      adapter.clearBuffer();
      Buffer buffer = networks.getBufferById(bufferId);
      if (buffer != null) {
        adapter.setBuffer(buffer, networks);
        nickCompletionHelper = new NickCompletionHelper(buffer.getUsers().getUniqueUsers());
        autoCompleteButton.setEnabled(true);
        inputField.setEnabled(true);
        if (getUserVisibleHint() == true) buffer.setDisplayed(true);
        BusProvider.getInstance()
            .post(new ManageChannelEvent(buffer.getInfo().id, ChannelAction.HIGHLIGHTS_READ));

        // Move list to correct position
        if (adapter.buffer.getTopMessageShown() == 0) {
          backlogList.setSelection(adapter.getCount() - 1);
        } else {
          adapter.setListTopMessage(adapter.buffer.getTopMessageShown());
        }
      } else {
        resetFragment();
      }
    }
  }
Beispiel #2
0
 public void clearBuffer() {
   if (buffer != null) {
     buffer.deleteObserver(this);
     buffer.setDisplayed(false);
     buffer = null;
     notifyDataSetChanged();
   }
 }