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


Java LQRAdapterForRecyclerView類代碼示例

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


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

示例1: setAdapter

import com.lqr.adapter.LQRAdapterForRecyclerView; //導入依賴的package包/類
private void setAdapter() {
    if (mAdapter == null) {
        mAdapter = new LQRAdapterForRecyclerView<Groups>(mContext, mData, R.layout.item_contact) {
            @Override
            public void convert(LQRViewHolderForRecyclerView helper, Groups item, int position) {
                LQRNineGridImageView ngvi = helper.setViewVisibility(R.id.ngiv, View.VISIBLE)
                        .setViewVisibility(R.id.ivHeader, View.GONE)
                        .setText(R.id.tvName, item.getName())
                        .getView(R.id.ngiv);
                ngvi.setAdapter(mNgivAdapter);
                List<GroupMember> groupMembers = DBManager.getInstance().getGroupMembers(item.getGroupId());
                ngvi.setImagesData(groupMembers);
            }
        };
        mAdapter.setOnItemClickListener((lqrViewHolder, viewGroup, view, i) -> {
            Intent intent = new Intent(mContext, SessionActivity.class);
            intent.putExtra("sessionId", mData.get(i).getGroupId());
            intent.putExtra("sessionType", SessionActivity.SESSION_TYPE_GROUP);
            mContext.jumpToActivity(intent);
            mContext.finish();
        });
        getView().getRvGroupList().setAdapter(mAdapter);
    } else {
        mAdapter.notifyDataSetChangedWrapper();
    }
}
 
開發者ID:starryxp,項目名稱:LQRWeChat-master,代碼行數:27,代碼來源:GroupListAtPresenter.java

示例2: setAdapter

import com.lqr.adapter.LQRAdapterForRecyclerView; //導入依賴的package包/類
private void setAdapter() {
    if (mAdapter == null) {
        mAdapter = new LQRAdapterForRecyclerView<Geo2AddressResultObject.ReverseAddressResult.Poi>(mContext, mData, R.layout.item_location_poi) {
            @Override
            public void convert(LQRViewHolderForRecyclerView helper, Geo2AddressResultObject.ReverseAddressResult.Poi item, int position) {
                helper.setText(R.id.tvTitle, item.title).setText(R.id.tvDesc, item.address)
                        .setViewVisibility(R.id.ivSelected, mSelectedPosi == position ? View.VISIBLE : View.GONE);
            }
        };
        getView().getRvPOI().setAdapter(mAdapter);
        mAdapter.setOnItemClickListener((helper, parent, itemView, position) -> {
            mSelectedPosi = position;
            setAdapter();
        });
    } else {
        mAdapter.notifyDataSetChangedWrapper();
    }
}
 
開發者ID:starryxp,項目名稱:LQRWeChat-master,代碼行數:19,代碼來源:MyLocationAtPresenter.java

示例3: initListener

import com.lqr.adapter.LQRAdapterForRecyclerView; //導入依賴的package包/類
@Override
public void initListener() {
    mHeaderView.findViewById(R.id.llNewFriend).setOnClickListener(v -> {
        ((MainActivity) getActivity()).jumpToActivity(NewFriendActivity.class);
        ((MainActivity) getActivity()).mTvContactRedDot.setVisibility(View.GONE);
        mTvNewFriendUnread.setVisibility(View.GONE);
    });
    mHeaderView.findViewById(R.id.llGroup).setOnClickListener(v -> ((MainActivity) getActivity()).jumpToActivity(GroupListActivity.class));
    mQib.setOnLetterUpdateListener(new QuickIndexBar.OnLetterUpdateListener() {
        @Override
        public void onLetterUpdate(String letter) {
            //顯示對話框
            showLetter(letter);
            //滑動到第一個對應字母開頭的聯係人
            if ("↑".equalsIgnoreCase(letter)) {
                mRvContacts.moveToPosition(0);
            } else if ("☆".equalsIgnoreCase(letter)) {
                mRvContacts.moveToPosition(0);
            } else {
                List<Friend> data = ((LQRAdapterForRecyclerView) ((LQRHeaderAndFooterAdapter) mRvContacts.getAdapter()).getInnerAdapter()).getData();
                for (int i = 0; i < data.size(); i++) {
                    Friend friend = data.get(i);
                    String c = friend.getDisplayNameSpelling().charAt(0) + "";
                    if (c.equalsIgnoreCase(letter)) {
                        mRvContacts.moveToPosition(i);
                        break;
                    }
                }
            }
        }

        @Override
        public void onLetterCancel() {
            //隱藏對話框
            hideLetter();
        }
    });
}
 
開發者ID:starryxp,項目名稱:LQRWeChat-master,代碼行數:39,代碼來源:ContactsFragment.java

示例4: setAdapter

import com.lqr.adapter.LQRAdapterForRecyclerView; //導入依賴的package包/類
private void setAdapter() {
    if (mAdapter == null) {
        mAdapter = new LQRAdapterForRecyclerView<UserRelationshipResponse.ResultEntity>(mContext, mData, R.layout.item_new_friends) {
            @Override
            public void convert(LQRViewHolderForRecyclerView helper, UserRelationshipResponse.ResultEntity item, int position) {

                ImageView ivHeader = helper.getView(R.id.ivHeader);
                helper.setText(R.id.tvName, item.getUser().getNickname())
                        .setText(R.id.tvMsg, item.getMessage());

                if (item.getStatus() == 20) {//已經是好友
                    helper.setViewVisibility(R.id.tvAdded, View.VISIBLE)
                            .setViewVisibility(R.id.tvWait, View.GONE)
                            .setViewVisibility(R.id.btnAck, View.GONE);
                } else if (item.getStatus() == 11) {//別人發來的添加好友請求
                    helper.setViewVisibility(R.id.tvAdded, View.GONE)
                            .setViewVisibility(R.id.tvWait, View.GONE)
                            .setViewVisibility(R.id.btnAck, View.VISIBLE);
                } else if (item.getStatus() == 10) {//我發起的添加好友請求
                    helper.setViewVisibility(R.id.tvAdded, View.GONE)
                            .setViewVisibility(R.id.tvWait, View.VISIBLE)
                            .setViewVisibility(R.id.btnAck, View.GONE);
                }

                String portraitUri = item.getUser().getPortraitUri();
                if (TextUtils.isEmpty(portraitUri)) {
                    portraitUri = DBManager.getInstance().getPortraitUri(item.getUser().getNickname(), item.getUser().getId());
                }
                Glide.with(mContext).load(portraitUri).centerCrop().into(ivHeader);
                helper.getView(R.id.btnAck).setOnClickListener(v -> agreeFriends(item.getUser().getId(), helper));

            }
        };
    }
    getView().getRvNewFriend().setAdapter(mAdapter);
}
 
開發者ID:starryxp,項目名稱:LQRWeChat-master,代碼行數:37,代碼來源:NewFriendAtPresenter.java

示例5: setSelectedAdapter

import com.lqr.adapter.LQRAdapterForRecyclerView; //導入依賴的package包/類
private void setSelectedAdapter() {
    if (mSelectedAdapter == null) {
        mSelectedAdapter = new LQRAdapterForRecyclerView<Friend>(mContext, mSelectedData, R.layout.item_selected_contact) {
            @Override
            public void convert(LQRViewHolderForRecyclerView helper, Friend item, int position) {
                ImageView ivHeader = helper.getView(R.id.ivHeader);
                Glide.with(mContext).load(item.getPortraitUri()).centerCrop().into(ivHeader);
            }
        };
        getView().getRvSelectedContacts().setAdapter(mSelectedAdapter);
    }
}
 
開發者ID:starryxp,項目名稱:LQRWeChat-master,代碼行數:13,代碼來源:CreateGroupAtPresenter.java

示例6: setAdapter

import com.lqr.adapter.LQRAdapterForRecyclerView; //導入依賴的package包/類
private void setAdapter() {
    if (mAdapter == null) {
        mAdapter = new LQRAdapterForRecyclerView<GroupMember>(mContext, mData, R.layout.item_member_info) {
            @Override
            public void convert(LQRViewHolderForRecyclerView helper, GroupMember item, int position) {
                ImageView ivHeader = helper.getView(R.id.ivHeader);
                if (mIsManager && position >= mData.size() - 2) {//+和-
                    if (position == mData.size() - 2) {//+
                        ivHeader.setImageResource(R.mipmap.ic_add_team_member);
                    } else {//-
                        ivHeader.setImageResource(R.mipmap.ic_remove_team_member);
                    }
                    helper.setText(R.id.tvName, "");
                } else if (!mIsManager && position >= mData.size() - 1) {//+
                    ivHeader.setImageResource(R.mipmap.ic_add_team_member);
                    helper.setText(R.id.tvName, "");
                } else {
                    Glide.with(mContext).load(item.getPortraitUri()).centerCrop().into(ivHeader);
                    helper.setText(R.id.tvName, item.getName());
                }
            }
        };
        mAdapter.setOnItemClickListener((helper, parent, itemView, position) -> {
            if (mIsManager && position >= mData.size() - 2) {//+和-
                if (position == mData.size() - 2) {//+
                    addMember(mConversationType == Conversation.ConversationType.GROUP);
                } else {//-
                    removeMember();
                }
            } else if (!mIsManager && position >= mData.size() - 1) {//+
                addMember(mConversationType == Conversation.ConversationType.GROUP);
            } else {
                seeUserInfo(DBManager.getInstance().getUserInfo(mData.get(position).getUserId()));
            }
        });
        getView().getRvMember().setAdapter(mAdapter);
    } else {
        mAdapter.notifyDataSetChangedWrapper();
    }
}
 
開發者ID:starryxp,項目名稱:LQRWeChat-master,代碼行數:41,代碼來源:SessionInfoAtPresenter.java

示例7: setAdapter

import com.lqr.adapter.LQRAdapterForRecyclerView; //導入依賴的package包/類
private void setAdapter() {
    if (mAdapter == null) {
        LQRAdapterForRecyclerView adapter = new LQRAdapterForRecyclerView<Friend>(mContext, mData, R.layout.item_contact) {
            @Override
            public void convert(LQRViewHolderForRecyclerView helper, Friend item, int position) {
                helper.setText(R.id.tvName, item.getDisplayName());
                ImageView ivHeader = helper.getView(R.id.ivHeader);
                Glide.with(mContext).load(item.getPortraitUri()).centerCrop().into(ivHeader);

                String str = "";
                //得到當前字母
                String currentLetter = item.getDisplayNameSpelling().charAt(0) + "";
                if (position == 0) {
                    str = currentLetter;
                } else {
                    //得到上一個字母
                    String preLetter = mData.get(position - 1).getDisplayNameSpelling().charAt(0) + "";
                    //如果和上一個字母的首字母不同則顯示字母欄
                    if (!preLetter.equalsIgnoreCase(currentLetter)) {
                        str = currentLetter;
                    }
                }
                int nextIndex = position + 1;
                if (nextIndex < mData.size() - 1) {
                    //得到下一個字母
                    String nextLetter = mData.get(nextIndex).getDisplayNameSpelling().charAt(0) + "";
                    //如果和下一個字母的首字母不同則隱藏下劃線
                    if (!nextLetter.equalsIgnoreCase(currentLetter)) {
                        helper.setViewVisibility(R.id.vLine, View.INVISIBLE);
                    } else {
                        helper.setViewVisibility(R.id.vLine, View.VISIBLE);
                    }
                } else {
                    helper.setViewVisibility(R.id.vLine, View.INVISIBLE);
                }
                if (position == mData.size() - 1) {
                    helper.setViewVisibility(R.id.vLine, View.GONE);
                }

                //根據str是否為空決定字母欄是否顯示
                if (TextUtils.isEmpty(str)) {
                    helper.setViewVisibility(R.id.tvIndex, View.GONE);
                } else {
                    helper.setViewVisibility(R.id.tvIndex, View.VISIBLE);
                    helper.setText(R.id.tvIndex, str);
                }
            }
        };
        adapter.addHeaderView(getView().getHeaderView());
        adapter.addFooterView(getView().getFooterView());
        mAdapter = adapter.getHeaderAndFooterAdapter();
        getView().getRvContacts().setAdapter(mAdapter);
    }
    ((LQRAdapterForRecyclerView) mAdapter.getInnerAdapter()).setOnItemClickListener((lqrViewHolder, viewGroup, view, i) -> {
        Intent intent = new Intent(mContext, UserInfoActivity.class);
        intent.putExtra("userInfo", DBManager.getInstance().getUserInfo(mData.get(i - 1).getUserId()));//-1是因為有頭部
        mContext.jumpToActivity(intent);
    });
}
 
開發者ID:starryxp,項目名稱:LQRWeChat-master,代碼行數:60,代碼來源:ContactsFgPresenter.java

示例8: setAdapter

import com.lqr.adapter.LQRAdapterForRecyclerView; //導入依賴的package包/類
private void setAdapter() {
    if (mAdapter == null) {
        mAdapter = new LQRAdapterForRecyclerView<GroupMember>(this, mData, R.layout.item_contact) {
            @Override
            public void convert(LQRViewHolderForRecyclerView helper, GroupMember item, int position) {
                helper.setText(R.id.tvName, item.getName()).setViewVisibility(R.id.cb, View.VISIBLE);
                ImageView ivHeader = helper.getView(R.id.ivHeader);
                Glide.with(RemoveGroupMemberActivity.this).load(item.getPortraitUri()).centerCrop().into(ivHeader);

                CheckBox cb = helper.getView(R.id.cb);
                cb.setClickable(true);
                cb.setChecked(mSelectedData.contains(item) ? true : false);
                cb.setOnClickListener(v -> {
                    if (cb.isChecked()) {
                        mSelectedData.add(item);
                    } else {
                        mSelectedData.remove(item);
                    }
                    if (mSelectedData.size() > 0) {
                        mBtnToolbarSend.setEnabled(true);
                        mBtnToolbarSend.setText(UIUtils.getString(R.string.delete) + "(" + mSelectedData.size() + ")");
                    } else {
                        mBtnToolbarSend.setEnabled(false);
                        mBtnToolbarSend.setText(UIUtils.getString(R.string.delete));
                    }
                });
            }
        };
        mAdapter.setOnItemClickListener((helper, parent, itemView, position) -> {
            UserInfo userInfo = DBManager.getInstance().getUserInfo(mData.get(position).getUserId());
            if (userInfo != null) {
                Intent intent = new Intent(RemoveGroupMemberActivity.this, UserInfoActivity.class);
                intent.putExtra("userInfo", userInfo);
                jumpToActivity(intent);
            }
        });
        mRvMember.setAdapter(mAdapter);
    } else {
        mAdapter.notifyDataSetChangedWrapper();
    }
}
 
開發者ID:starryxp,項目名稱:LQRWeChat-master,代碼行數:42,代碼來源:RemoveGroupMemberActivity.java

示例9: initListener

import com.lqr.adapter.LQRAdapterForRecyclerView; //導入依賴的package包/類
@Override
public void initListener() {
    mBtnToolbarSend.setOnClickListener(v -> {
        if (mSelectedTeamMemberAccounts == null) {
            mPresenter.createGroup();
        } else {
            //添加群成員
            mPresenter.addGroupMembers();
        }
    });
    mHeaderView.findViewById(R.id.tvSelectOneGroup).setOnClickListener(v -> UIUtils.showToast("選擇一個群"));
    mQib.setOnLetterUpdateListener(new QuickIndexBar.OnLetterUpdateListener() {
        @Override
        public void onLetterUpdate(String letter) {
            //顯示對話框
            showLetter(letter);
            //滑動到第一個對應字母開頭的聯係人
            if ("↑".equalsIgnoreCase(letter)) {
                mRvContacts.moveToPosition(0);
            } else if ("☆".equalsIgnoreCase(letter)) {
                mRvContacts.moveToPosition(0);
            } else {
                List<Friend> data = ((LQRAdapterForRecyclerView) ((LQRHeaderAndFooterAdapter) mRvContacts.getAdapter()).getInnerAdapter()).getData();
                for (int i = 0; i < data.size(); i++) {
                    Friend friend = data.get(i);
                    String c = friend.getDisplayNameSpelling().charAt(0) + "";
                    if (c.equalsIgnoreCase(letter)) {
                        mRvContacts.moveToPosition(i);
                        break;
                    }
                }
            }
        }

        @Override
        public void onLetterCancel() {
            //隱藏對話框
            hideLetter();
        }
    });
}
 
開發者ID:starryxp,項目名稱:LQRWeChat-master,代碼行數:42,代碼來源:CreateGroupActivity.java


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