當前位置: 首頁>>代碼示例>>Java>>正文


Java ListViewUtil類代碼示例

本文整理匯總了Java中com.netease.nim.uikit.common.ui.listview.ListViewUtil的典型用法代碼示例。如果您正苦於以下問題:Java ListViewUtil類的具體用法?Java ListViewUtil怎麽用?Java ListViewUtil使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ListViewUtil類屬於com.netease.nim.uikit.common.ui.listview包,在下文中一共展示了ListViewUtil類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: jumpToIndex

import com.netease.nim.uikit.common.ui.listview.ListViewUtil; //導入依賴的package包/類
/**
 * 跳轉到選中的公告
 *
 * @param list 群公告列表
 */
private void jumpToIndex(List<Announcement> list) {
    if (TextUtils.isEmpty(announceId)) {
        return;
    }

    int jumpIndex = -1;
    for (int i = 0; i < list.size(); i++) {
        if (list.get(i).getId().equals(announceId)) {
            jumpIndex = i;
            break;
        }
    }

    if (jumpIndex >= 0) {
        final int position = jumpIndex;
        uiHandler.postDelayed(new Runnable() {
            @Override
            public void run() {
                ListViewUtil.scrollToPosition(announceListView, position, 0);
            }
        }, 200);
    }
}
 
開發者ID:newDeepLearing,項目名稱:decoy,代碼行數:29,代碼來源:AdvancedTeamAnnounceActivity.java

示例2: refreshViewHolderByIndex

import com.netease.nim.uikit.common.ui.listview.ListViewUtil; //導入依賴的package包/類
/**
 * 刷新單條消息
 *
 * @param index
 */
private void refreshViewHolderByIndex(final int index) {
    container.activity.runOnUiThread(new Runnable() {

        @Override
        public void run() {
            if (index < 0) {
                return;
            }

            Object tag = ListViewUtil.getViewHolderByIndex(messageListView, index);
            if (tag instanceof MsgViewHolderBase) {
                MsgViewHolderBase viewHolder = (MsgViewHolderBase) tag;
                viewHolder.refreshCurrentItem();
            }
        }
    });
}
 
開發者ID:LegendKe,項目名稱:MyTravelingDiary,代碼行數:23,代碼來源:MessageListPanel.java

示例3: refreshViewHolder

import com.netease.nim.uikit.common.ui.listview.ListViewUtil; //導入依賴的package包/類
private void refreshViewHolder(final SystemMessage message) {
    final long messageId = message.getMessageId();

    int index = -1;
    for (int i = 0; i < items.size(); i++) {
        SystemMessage item = items.get(i);
        if (messageId == item.getMessageId()) {
            index = i;
            break;
        }
    }

    if (index < 0) {
        return;
    }

    final int m = index;
    runOnUiThread(new Runnable() {

        @Override
        public void run() {
            if (m < 0) {
                return;
            }

            Object tag = ListViewUtil.getViewHolderByIndex(listView, m);
            if (tag instanceof SystemMessageViewHolder) {
                ((SystemMessageViewHolder) tag).refreshDirectly(message);
            }
        }
    });
}
 
開發者ID:newDeepLearing,項目名稱:decoy,代碼行數:33,代碼來源:SystemMessageActivity.java

示例4: scrollToBottom

import com.netease.nim.uikit.common.ui.listview.ListViewUtil; //導入依賴的package包/類
public void scrollToBottom() {
    uiHandler.postDelayed(new Runnable() {
        @Override
        public void run() {
            ListViewUtil.scrollToBottom(messageListView);
        }
    }, 200);
}
 
開發者ID:LegendKe,項目名稱:MyTravelingDiary,代碼行數:9,代碼來源:MessageListPanel.java

示例5: scrollToItem

import com.netease.nim.uikit.common.ui.listview.ListViewUtil; //導入依賴的package包/類
public void scrollToItem(final int position) {
    uiHandler.postDelayed(new Runnable() {
        @Override
        public void run() {
            ListViewUtil.scrollToPosition(messageListView, position, 0);
        }
    }, 200);
}
 
開發者ID:LegendKe,項目名稱:MyTravelingDiary,代碼行數:9,代碼來源:MessageListPanel.java

示例6: onIncomingMessage

import com.netease.nim.uikit.common.ui.listview.ListViewUtil; //導入依賴的package包/類
public void onIncomingMessage(List<IMMessage> messages) {
    boolean needScrollToBottom = ListViewUtil.isLastMessageVisible(messageListView);
    boolean needRefresh = false;
    List<IMMessage> addedListItems = new ArrayList<>(messages.size());
    for (IMMessage message : messages) {
        if (isMyMessage(message)) {
            items.add(message);
            addedListItems.add(message);
            needRefresh = true;
        }
    }
    if (needRefresh) {
        adapter.notifyDataSetChanged();
    }

    adapter.updateShowTimeItem(addedListItems, false, true);

    // incoming messages tip
    IMMessage lastMsg = messages.get(messages.size() - 1);
    if (isMyMessage(lastMsg)) {
        if (needScrollToBottom) {
            ListViewUtil.scrollToBottom(messageListView);
        } else if (incomingMsgPrompt != null && lastMsg.getSessionType() != SessionTypeEnum.ChatRoom) {
            incomingMsgPrompt.show(lastMsg);
        }
    }
}
 
開發者ID:LegendKe,項目名稱:MyTravelingDiary,代碼行數:28,代碼來源:MessageListPanel.java

示例7: onMsgSend

import com.netease.nim.uikit.common.ui.listview.ListViewUtil; //導入依賴的package包/類
public void onMsgSend(IMMessage message) {
    // add to listView and refresh
    items.add(message);
    List<IMMessage> addedListItems = new ArrayList<>(1);
    addedListItems.add(message);
    adapter.updateShowTimeItem(addedListItems, false, true);

    adapter.notifyDataSetChanged();
    ListViewUtil.scrollToBottom(messageListView);
}
 
開發者ID:LegendKe,項目名稱:MyTravelingDiary,代碼行數:11,代碼來源:MessageListPanel.java

示例8: init

import com.netease.nim.uikit.common.ui.listview.ListViewUtil; //導入依賴的package包/類
private void init() {
    ViewGroup containerView = (ViewGroup) view.findViewById(R.id.message_activity_list_view_container);
    View.inflate(context, R.layout.nim_new_message_tip_layout, containerView);
    newMessageTipLayout = containerView.findViewById(R.id.new_message_tip_layout);
    newMessageTipLayout.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            ListViewUtil.scrollToBottom(messageListView);
            newMessageTipLayout.setVisibility(View.GONE);
        }
    });
    newMessageTipTextView = (TextView) newMessageTipLayout.findViewById(R.id.new_message_tip_text_view);
    newMessageTipHeadImageView = (HeadImageView) newMessageTipLayout.findViewById(R.id.new_message_tip_head_image_view);
}
 
開發者ID:LegendKe,項目名稱:MyTravelingDiary,代碼行數:16,代碼來源:IncomingMsgPrompt.java

示例9: refreshViewHolderByIndex

import com.netease.nim.uikit.common.ui.listview.ListViewUtil; //導入依賴的package包/類
protected void refreshViewHolderByIndex(final int index) {
    getActivity().runOnUiThread(new Runnable() {

        @Override
        public void run() {
            Object tag = ListViewUtil.getViewHolderByIndex(listView, index);
            if (tag instanceof RecentViewHolder) {
                RecentViewHolder viewHolder = (RecentViewHolder) tag;
                viewHolder.refreshCurrentItem();
            }
        }
    });
}
 
開發者ID:LegendKe,項目名稱:MyTravelingDiary,代碼行數:14,代碼來源:RecentContactsFragment.java

示例10: loadMessages

import com.netease.nim.uikit.common.ui.listview.ListViewUtil; //導入依賴的package包/類
/**
 * 加載曆史消息
 */
public void loadMessages() {
    listView.onRefreshStart(AutoRefreshListView.Mode.END);
    boolean loadCompleted; // 是否已經加載完成,後續沒有數據了or已經滿足本次請求數量
    int validMessageCount = 0; // 實際加載的數量(排除被過濾被合並的條目)
    List<String> messageFromAccounts = new ArrayList<>(LOAD_MESSAGE_COUNT);

    while (true) {
        List<SystemMessage> temps = NIMClient.getService(SystemMessageService.class)
                .querySystemMessagesBlock(loadOffset, LOAD_MESSAGE_COUNT);

        loadOffset += temps.size();
        loadCompleted = temps.size() < LOAD_MESSAGE_COUNT;

        int tempValidCount = 0;

        for (SystemMessage m : temps) {
            // 去重
            if (duplicateFilter(m)) {
                continue;
            }

            // 同一個賬號的好友申請僅保留最近一條
            if (addFriendVerifyFilter(m)) {
                continue;
            }

            // 保存有效消息
            items.add(m);
            tempValidCount++;
            if (!messageFromAccounts.contains(m.getFromAccount())) {
                messageFromAccounts.add(m.getFromAccount());
            }

            // 判斷是否達到請求數
            if (++validMessageCount >= LOAD_MESSAGE_COUNT) {
                loadCompleted = true;
                // 已經滿足要求,此時需要修正loadOffset
                loadOffset -= temps.size();
                loadOffset += tempValidCount;

                break;
            }
        }

        if (loadCompleted) {
            break;
        }
    }

    // 更新數據源,刷新界麵
    refresh();

    boolean first = firstLoad;
    firstLoad = false;
    if (first) {
        ListViewUtil.scrollToPosition(listView, 0, 0); // 第一次加載後顯示頂部
    }

    listView.onRefreshComplete(validMessageCount, LOAD_MESSAGE_COUNT, true);

    // 收集未知用戶資料的賬號集合並從遠程獲取
    collectAndRequestUnknownUserInfo(messageFromAccounts);
}
 
開發者ID:newDeepLearing,項目名稱:decoy,代碼行數:67,代碼來源:SystemMessageActivity.java


注:本文中的com.netease.nim.uikit.common.ui.listview.ListViewUtil類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。