예제 #1
0
  // there's relay now
  private void attachToBufferOrClose() {
    if (DEBUG_LIFECYCLE) logger.warn("{} attachToBufferOrClose()", fullName);
    relay.addRelayConnectionHandler(this); // connect/disconnect watcher

    buffer = relay.getBufferByFullName(fullName);
    if (buffer == null) {
      // no buffer? it might happen if:
      //  * the buffer was closed in weechat. if so, close here as well
      //    (post so that closing doesn't get executed on current loop to avoid issues)
      //  * we are not yet connected, e.g., after service shutdown. if so,
      //    wait for onBuffersListed event
      if (relay.isConnection(RelayService.BUFFERS_LISTED)) onBufferClosed();
      return;
    }
    shortName = buffer.shortName;
    buffer.setBufferEye(
        this); // buffer watcher TODO: java.lang.NullPointerException if run in thread ?!?!

    linesAdapter = new ChatLinesAdapter(activity, buffer, uiLines);
    linesAdapter.setFont(prefs.getString(PREF_BUFFER_FONT, PREF_BUFFER_FONT_D));
    linesAdapter.readLinesFromBuffer();

    activity.runOnUiThread(
        new Runnable() {
          @Override
          public void run() {
            activity.updateCutePagerTitleStrip();
            uiLines.setAdapter(linesAdapter);
          }
        });
    maybeChangeVisibilityState();
  }
예제 #2
0
  private void attachToBuffer() {
    logger.debug("attachToBuffer()");

    buffer.setBufferEye(this);

    linesAdapter = new ChatLinesAdapter(activity, buffer, uiLines);
    linesAdapter.setFont(P.bufferFont);
    linesAdapter.readLinesFromBuffer();

    activity.runOnUiThread(
        new Runnable() {
          @Override
          public void run() {
            activity.updateCutePagerTitleStrip();
            uiLines.setAdapter(linesAdapter);
            maybeChangeHeader();
          }
        });
    maybeChangeVisibilityState();
  }