com.zulip.android.ZulipApp.getMaxMessageId()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(2.9k)|赞(0)|评价(0)|浏览(73)

本文整理了Java中com.zulip.android.ZulipApp.getMaxMessageId()方法的一些代码示例,展示了ZulipApp.getMaxMessageId()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZulipApp.getMaxMessageId()方法的具体详情如下:
包路径:com.zulip.android.ZulipApp
类名称:ZulipApp
方法名:getMaxMessageId

ZulipApp.getMaxMessageId介绍

暂无

代码示例

代码示例来源:origin: zulip/zulip-android

private Boolean listHasMostRecent() {
  return lastMessageId == app.getMaxMessageId();
}

代码示例来源:origin: zulip/zulip-android

public static void updateNewMessagesRange(ZulipApp app, int maxId) {
  synchronized (app.updateRangeLock) {
    RuntimeExceptionDao<MessageRange, Integer> rangeDao = app
        .getDao(MessageRange.class);
    MessageRange currentRange = MessageRange.getRangeContaining(
        app.getMaxMessageId(), rangeDao);
    if (currentRange == null) {
      currentRange = new MessageRange(app.getMaxMessageId(),
          app.getMaxMessageId());
    }
    if (currentRange.high <= maxId) {
      currentRange.high = maxId;
      rangeDao.createOrUpdate(currentRange);
    }
  }
  app.setMaxMessageId(maxId);
}

代码示例来源:origin: zulip/zulip-android

@Override
protected void onPostExecute(String result) {
  if (receivedMessages != null) {
    Log.v("poll", "Processing messages received.");
    if ((position == LoadPosition.BELOW || position == LoadPosition.INITIAL)
        && app.getMaxMessageId() == rangeHigh) {
      noFurtherMessages = true;
    }
    listener.onMessages(receivedMessages.toArray(new Message[receivedMessages.size()]),
        position, recursedAbove, recursedBelow, noFurtherMessages);
    callback.onTaskComplete(receivedMessages.size() + "", null);
  } else {
    listener.onMessageError(position);
    Log.v("poll", "No messages returned.");
    callback.onTaskFailure("");
  }
}

代码示例来源:origin: zulip/zulip-android

public void showLatestMessages() {
  if (listHasMostRecent()) {
    recyclerView.scrollToPosition(adapter.getItemCount() - 1);
  } else {
    loadMessageId(app.getMaxMessageId());
  }
}

代码示例来源:origin: zulip/zulip-android

public boolean isScrolledToLastMessage() {
  int index = stickyLayoutManager.findLastVisibleItemPosition();
  if (index == -1) return false;
  Object object = adapter.getItem(index);
  if (object instanceof Integer) {
    /**
     * A Loading Indicator (see here {@link RecyclerMessageAdapter#getItemViewType})
     * Therefore before this should be a message
     */
    object = adapter.getItem(index - 1);
  }
  return object instanceof Message && (((Message) object).getId() >= app.getMaxMessageId() - 2);
}

代码示例来源:origin: zulip/zulip-android

if (after > 0 && rng.high != app.getMaxMessageId()) {
  this.recurse(LoadPosition.BELOW, after, rng,
      afterAnchor);

代码示例来源:origin: zulip/zulip-android

+ app.getMaxMessageId());
return;

代码示例来源:origin: zulip/zulip-android

@Before
public void setUp() {
  app = ZulipApp.get();
  if (ZulipApp.get().getApiKey() == null) {
    BaseTest baseTest = new BaseTest();
    baseTest.login();
    sleep(4000);
  }
  //This is to make sure the latest recieved messages will be added to the list!
  app.setPointer(app.getMaxMessageId());
  setTestMessageStream((testMessageStream == null) ? RandomStringUtils.randomAlphanumeric(10) : testMessageStream);
  setTestMessagePrivate((testMessagePrivate == null) ? RandomStringUtils.randomAlphanumeric(15) : testMessagePrivate);
}

相关文章