コード例 #1
0
  @Override
  public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    getView()
        .findViewById(R.id.rejoin_button)
        .setOnClickListener(
            new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                mChannel.join();
              }
            });
  }
コード例 #2
0
  @Override
  public void onPrepareOptionsMenu(android.view.Menu menu) {
    super.onPrepareOptionsMenu(menu);
    boolean isJoined = (mChannel != null) && mChannel.isJoined();
    menu.findItem(R.id.info).setVisible(isJoined);
    menu.findItem(R.id.members).setVisible(isJoined);
    menu.findItem(R.id.part_channel).setVisible(isJoined);

    // User must part channel before archiving/deleting
    for (int id : new int[] {R.id.archive, R.id.delete}) {
      MenuItem item = menu.findItem(id);
      item.setVisible(item.isVisible() && (!isJoined));
    }
  }
コード例 #3
0
  @Subscribe
  @Override
  public void onServiceStateChanged(ServiceStateChangedEvent event) {
    super.onServiceStateChanged(event);

    TapchatService service = event.getService();

    if (service.getConnectionState() == TapchatService.STATE_LOADED) {
      mChannel = (ChannelBuffer) mBuffer;
    } else {
      mChannel = null;
    }

    updateUI();
  }
コード例 #4
0
  public static BufferFragment create(int type, long connectionId, long bufferId) {
    BufferFragment fragment;

    switch (type) {
      case Buffer.CHANNEL_TYPE:
        fragment = new ChannelBufferFragment();
        break;

      case Buffer.CONVERSATION_TYPE:
        fragment = new QueryBufferFragment();
        break;

      default:
        fragment = new BufferFragment();
        break;
    }

    Bundle args = new Bundle();
    args.putLong(BufferFragment.ARG_CONNECTION_ID, connectionId);
    args.putLong(BufferFragment.ARG_BUFFER_ID, bufferId);
    fragment.setArguments(args);

    return fragment;
  }
コード例 #5
0
  @Override
  protected void updateUI() {
    super.updateUI();
    if (getView() == null) {
      // View not yet created.
      return;
    }

    boolean isConnected =
        (mConnection != null && mConnection.getState() == Connection.STATE_CONNECTED);
    boolean isJoined = (mChannel != null && mChannel.isJoined());

    View notInChannelView = getView().findViewById(R.id.not_in_channel);
    notInChannelView.setVisibility((!isConnected) || isJoined ? View.GONE : View.VISIBLE);

    getActivity().invalidateOptionsMenu();
  }
コード例 #6
0
 @Override
 public void onCreateOptionsMenu(android.view.Menu menu, android.view.MenuInflater inflater) {
   super.onCreateOptionsMenu(menu, inflater);
   inflater.inflate(R.menu.buffer_channel, menu);
 }
コード例 #7
0
 @Subscribe
 @Override
 public void onBufferRemoved(BufferRemovedEvent event) {
   super.onBufferRemoved(event);
 }
コード例 #8
0
 @Subscribe
 @Override
 public void onBufferLineAdded(BufferLineAddedEvent event) {
   super.onBufferLineAdded(event);
 }
コード例 #9
0
 @Subscribe
 @Override
 public void onConnectionChanged(ConnectionChangedEvent event) {
   super.onConnectionChanged(event);
 }