本文整理汇总了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();
}
}
示例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();
}
}
示例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();
}
});
}
示例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);
}
示例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);
}
}
示例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();
}
}
示例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);
});
}
示例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();
}
}
示例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();
}
});
}