本文整理汇总了Java中org.matrix.androidsdk.MXSession.isMessageId方法的典型用法代码示例。如果您正苦于以下问题:Java MXSession.isMessageId方法的具体用法?Java MXSession.isMessageId怎么用?Java MXSession.isMessageId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.matrix.androidsdk.MXSession
的用法示例。
在下文中一共展示了MXSession.isMessageId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateJumpToBanner
import org.matrix.androidsdk.MXSession; //导入方法依赖的package包/类
/**
* Check if we display "Jump to" banner
*/
private synchronized void updateJumpToBanner() {
//Log.d(LOG_TAG, "updateJumpToBanner");
boolean showJumpToView = false;
mReadMarkerEventId = mRoomSummary.getReadMarkerEventId();
if (mRoomSummary != null && mReadMarkerEventId != null && !mHasJumpedToFirstUnread) {
final String readReceiptEventId = mRoomSummary.getReadReceiptEventId();
if (!mReadMarkerEventId.equals(readReceiptEventId)) {
if (!MXSession.isMessageId(mReadMarkerEventId)) {
// Read marker is invalid, ignore it as it should not occur
Log.e(LOG_TAG, "updateJumpToBanner: Read marker event id is invalid, ignore it as it should not occur");
} else {
final Event readMarkerEvent = getEvent(mReadMarkerEventId);
if (readMarkerEvent == null) {
// Event is not in store so we assume it is further in the past
// Note: preview will be opened to the last read since we have no way to
// determine the event id of the first unread
showJumpToView = true;
} else {
// Last read event is in the store
Collection<Event> roomMessagesCol = mRoom.getDataHandler().getStore().getRoomMessages(mRoom.getRoomId());
if (roomMessagesCol == null) {
Log.e(LOG_TAG, "updateJumpToBanner getRoomMessages returned null instead of collection with event " + readMarkerEvent.eventId);
} else {
List<Event> roomMessages = new ArrayList<>(roomMessagesCol);
final int lastReadEventIndex = roomMessages.indexOf(readMarkerEvent);
final int firstUnreadEventIndex = lastReadEventIndex != -1 ? lastReadEventIndex + 1 : -1;
if (firstUnreadEventIndex != -1 && firstUnreadEventIndex < roomMessages.size()) {
final Event firstUnreadEvent = roomMessages.get(firstUnreadEventIndex);
if (mFirstVisibleEvent != null && firstUnreadEvent != null) {
if (firstUnreadEvent.getOriginServerTs() > mFirstVisibleEvent.getOriginServerTs()) {
// Beginning of first unread message is visible
showJumpToView = false;
} else if (firstUnreadEvent.getOriginServerTs() == mFirstVisibleEvent.getOriginServerTs()) {
// Check if beginning of first unread message is visible
final ListView listView = mVectorMessageListFragment.getMessageListView();
final View firstUnreadView = listView != null ? listView.getChildAt(0) : null;
showJumpToView = firstUnreadView != null && firstUnreadView.getTop() < 0;
if (mHasJumpedToFirstUnread && !showJumpToView) {
forgetReadMarker();
}
} else {
// Beginning of first unread message is hidden
showJumpToView = true;
}
}
}
}
}
}
}
if (mVectorMessageListFragment.getMessageAdapter() != null) {
mVectorMessageListFragment.getMessageAdapter().updateReadMarker(mReadMarkerEventId, readReceiptEventId);
}
}
// Update "jump to" view's visibility
if (isLiveMode() && showJumpToView) {
mJumpToUnreadViewSpinner.setVisibility(View.GONE);
mCloseJumpToUnreadView.setVisibility(View.VISIBLE);
mJumpToUnreadView.setVisibility(View.VISIBLE);
} else {
mJumpToUnreadView.setVisibility(View.GONE);
}
if (mHasJumpedToBottom) {
mHasJumpedToBottom = false;
checkUnreadMessage();
}
}