update 聊天页面顶部信息
This commit is contained in:
parent
f4210bf136
commit
ee8f6baf02
@ -255,6 +255,16 @@ public class IMLoginModel extends BaseModel {
|
|||||||
|
|
||||||
@SerializedName("guard_type")
|
@SerializedName("guard_type")
|
||||||
private String guardType = "";
|
private String guardType = "";
|
||||||
|
@SerializedName("isAttention")
|
||||||
|
private int attention;
|
||||||
|
|
||||||
|
public int getAttention() {
|
||||||
|
return attention;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAttention(int attention) {
|
||||||
|
this.attention = attention;
|
||||||
|
}
|
||||||
|
|
||||||
public String getCreateTime() {
|
public String getCreateTime() {
|
||||||
return createTime;
|
return createTime;
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
package com.yunbao.common.bean;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
public class MessageChatIsAnchor extends BaseModel{
|
||||||
|
@SerializedName("is_anchor")
|
||||||
|
private int isAnchor;//是否是主播 0否 1是
|
||||||
|
|
||||||
|
public int getIsAnchor() {
|
||||||
|
return isAnchor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsAnchor(int isAnchor) {
|
||||||
|
this.isAnchor = isAnchor;
|
||||||
|
}
|
||||||
|
}
|
@ -83,10 +83,43 @@ public class MessageUserInfoBean extends BaseModel{
|
|||||||
private String area;
|
private String area;
|
||||||
private int is_hello;
|
private int is_hello;
|
||||||
private String star_name;
|
private String star_name;
|
||||||
|
private String career;
|
||||||
|
private String height;
|
||||||
|
private String age;
|
||||||
|
|
||||||
|
public String getAge() {
|
||||||
|
if(StringUtil.isEmpty(age)){
|
||||||
|
age="0";
|
||||||
|
}
|
||||||
|
return age;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAge(String age) {
|
||||||
|
this.age = age;
|
||||||
|
}
|
||||||
|
|
||||||
public UserInfo() {
|
public UserInfo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getCareer() {
|
||||||
|
return career;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCareer(String career) {
|
||||||
|
this.career = career;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHeight() {
|
||||||
|
if(StringUtil.isEmpty(height)){
|
||||||
|
height="0";
|
||||||
|
}
|
||||||
|
return height;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHeight(String height) {
|
||||||
|
this.height = height;
|
||||||
|
}
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@ -445,5 +478,6 @@ public class MessageUserInfoBean extends BaseModel{
|
|||||||
public void setWealth_icon(String wealth_icon) {
|
public void setWealth_icon(String wealth_icon) {
|
||||||
this.wealth_icon = wealth_icon;
|
this.wealth_icon = wealth_icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,7 @@ import com.yunbao.common.bean.LiveStetUpStatusModel;
|
|||||||
import com.yunbao.common.bean.LiveTaskModel;
|
import com.yunbao.common.bean.LiveTaskModel;
|
||||||
import com.yunbao.common.bean.LiveUserMailBoxModel;
|
import com.yunbao.common.bean.LiveUserMailBoxModel;
|
||||||
import com.yunbao.common.bean.MedalAchievementModel;
|
import com.yunbao.common.bean.MedalAchievementModel;
|
||||||
|
import com.yunbao.common.bean.MessageChatIsAnchor;
|
||||||
import com.yunbao.common.bean.MessageChatUserBean;
|
import com.yunbao.common.bean.MessageChatUserBean;
|
||||||
import com.yunbao.common.bean.MessageUserInfoBean;
|
import com.yunbao.common.bean.MessageUserInfoBean;
|
||||||
import com.yunbao.common.bean.MsgSwitchDetailModel;
|
import com.yunbao.common.bean.MsgSwitchDetailModel;
|
||||||
@ -1176,4 +1177,9 @@ public interface PDLiveApi {
|
|||||||
Observable<ResponseModel<List<MessageChatUserBean>>> addressBookSearch(@Query("user_nicename") String key);
|
Observable<ResponseModel<List<MessageChatUserBean>>> addressBookSearch(@Query("user_nicename") String key);
|
||||||
@GET("/api/public/?service=Pdlinfos.getOtherInfo")
|
@GET("/api/public/?service=Pdlinfos.getOtherInfo")
|
||||||
Observable<ResponseModel<MessageUserInfoBean>> getOtherInfo(@Query("tuid") String tuid);
|
Observable<ResponseModel<MessageUserInfoBean>> getOtherInfo(@Query("tuid") String tuid);
|
||||||
|
@GET("/api/public/?service=Userhome.getUserHomeBanner")
|
||||||
|
Observable<ResponseModel<List<String>>> getUserHomeBanner(@Query("select_uid") String tuid);
|
||||||
|
@GET("/api/public/?service=Pdlinfos.getIsAnchor")
|
||||||
|
Observable<ResponseModel<MessageChatIsAnchor>> getIsAnchor();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,7 @@ import com.yunbao.common.bean.LiveStetUpStatusModel;
|
|||||||
import com.yunbao.common.bean.LiveTaskModel;
|
import com.yunbao.common.bean.LiveTaskModel;
|
||||||
import com.yunbao.common.bean.LiveUserMailBoxModel;
|
import com.yunbao.common.bean.LiveUserMailBoxModel;
|
||||||
import com.yunbao.common.bean.MedalAchievementModel;
|
import com.yunbao.common.bean.MedalAchievementModel;
|
||||||
|
import com.yunbao.common.bean.MessageChatIsAnchor;
|
||||||
import com.yunbao.common.bean.MessageChatUserBean;
|
import com.yunbao.common.bean.MessageChatUserBean;
|
||||||
import com.yunbao.common.bean.MessageUserInfoBean;
|
import com.yunbao.common.bean.MessageUserInfoBean;
|
||||||
import com.yunbao.common.bean.NobleRankHideUserListModel;
|
import com.yunbao.common.bean.NobleRankHideUserListModel;
|
||||||
@ -3028,6 +3029,45 @@ public class LiveNetManager {
|
|||||||
}
|
}
|
||||||
}).isDisposed();
|
}).isDisposed();
|
||||||
}
|
}
|
||||||
|
public void getUserHomeBanner(String search,HttpCallback<List<String>> callback) {
|
||||||
|
API.get().pdLiveApi(mContext)
|
||||||
|
.getUserHomeBanner(search)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(roomMicStatusModelResponseModel -> {
|
||||||
|
if (callback != null) {
|
||||||
|
callback.onSuccess(roomMicStatusModelResponseModel.getData().getInfo());
|
||||||
|
}
|
||||||
|
}, new Consumer<Throwable>() {
|
||||||
|
@Override
|
||||||
|
public void accept(Throwable throwable) throws Exception {
|
||||||
|
throwable.printStackTrace();
|
||||||
|
if (callback != null) {
|
||||||
|
callback.onError(mContext.getString(R.string.net_error));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).isDisposed();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getIsAnchor(HttpCallback<MessageChatIsAnchor> callback) {
|
||||||
|
API.get().pdLiveApi(mContext)
|
||||||
|
.getIsAnchor()
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(roomMicStatusModelResponseModel -> {
|
||||||
|
if (callback != null) {
|
||||||
|
callback.onSuccess(roomMicStatusModelResponseModel.getData().getInfo());
|
||||||
|
}
|
||||||
|
}, new Consumer<Throwable>() {
|
||||||
|
@Override
|
||||||
|
public void accept(Throwable throwable) throws Exception {
|
||||||
|
throwable.printStackTrace();
|
||||||
|
if (callback != null) {
|
||||||
|
callback.onError(mContext.getString(R.string.net_error));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).isDisposed();
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 直播间取消网络请求
|
* 直播间取消网络请求
|
||||||
*/
|
*/
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
package com.yunbao.common.utils;
|
||||||
|
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
public class ViewUtils {
|
||||||
|
public static <T extends View> T findViewById(View view,int id,Class<T> clazz){
|
||||||
|
return view.findViewById(id);
|
||||||
|
}
|
||||||
|
}
|
@ -16,6 +16,7 @@ import android.view.WindowManager;
|
|||||||
import android.view.animation.Animation;
|
import android.view.animation.Animation;
|
||||||
import android.view.animation.AnimationUtils;
|
import android.view.animation.AnimationUtils;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
|
import android.widget.Button;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
@ -24,6 +25,7 @@ import androidx.core.app.ActivityCompat;
|
|||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
import androidx.fragment.app.FragmentTransaction;
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.blankj.utilcode.util.GsonUtils;
|
import com.blankj.utilcode.util.GsonUtils;
|
||||||
import com.yunbao.common.activity.AbsActivity;
|
import com.yunbao.common.activity.AbsActivity;
|
||||||
@ -31,8 +33,11 @@ import com.yunbao.common.activity.SelectImageActivity;
|
|||||||
import com.yunbao.common.bean.IMLoginModel;
|
import com.yunbao.common.bean.IMLoginModel;
|
||||||
import com.yunbao.common.bean.ImageEntity;
|
import com.yunbao.common.bean.ImageEntity;
|
||||||
import com.yunbao.common.bean.MessageChatUserBean;
|
import com.yunbao.common.bean.MessageChatUserBean;
|
||||||
|
import com.yunbao.common.bean.MessageUserInfoBean;
|
||||||
import com.yunbao.common.bean.NoviceInstructorModel;
|
import com.yunbao.common.bean.NoviceInstructorModel;
|
||||||
|
import com.yunbao.common.bean.SetAttentsModel;
|
||||||
import com.yunbao.common.event.PDChatInputModeEvent;
|
import com.yunbao.common.event.PDChatInputModeEvent;
|
||||||
|
import com.yunbao.common.glide.ImgLoader;
|
||||||
import com.yunbao.common.http.base.HttpCallback;
|
import com.yunbao.common.http.base.HttpCallback;
|
||||||
import com.yunbao.common.http.live.LiveNetManager;
|
import com.yunbao.common.http.live.LiveNetManager;
|
||||||
import com.yunbao.common.interfaces.OnSendMessageListener;
|
import com.yunbao.common.interfaces.OnSendMessageListener;
|
||||||
@ -41,7 +46,10 @@ import com.yunbao.common.manager.NoviceInstructorManager;
|
|||||||
import com.yunbao.common.manager.imrongcloud.MessageIMManager;
|
import com.yunbao.common.manager.imrongcloud.MessageIMManager;
|
||||||
import com.yunbao.common.message.content.MessageChatTipsContent;
|
import com.yunbao.common.message.content.MessageChatTipsContent;
|
||||||
import com.yunbao.common.utils.DpUtil;
|
import com.yunbao.common.utils.DpUtil;
|
||||||
|
import com.yunbao.common.utils.StringUtil;
|
||||||
import com.yunbao.common.utils.ToastUtil;
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
|
import com.yunbao.common.utils.ViewUtils;
|
||||||
|
import com.yunbao.common.utils.WordUtil;
|
||||||
import com.yunbao.live.bean.SearchUserBean;
|
import com.yunbao.live.bean.SearchUserBean;
|
||||||
import com.yunbao.live.dialog.MenuPopuwWindow;
|
import com.yunbao.live.dialog.MenuPopuwWindow;
|
||||||
import com.yunbao.live.event.InputPanelViewHolderEvent;
|
import com.yunbao.live.event.InputPanelViewHolderEvent;
|
||||||
@ -49,12 +57,16 @@ import com.yunbao.live.utils.WindowSoftModeAdjustResizeExecutor;
|
|||||||
import com.yunbao.live.views.InputPanelViewHolder;
|
import com.yunbao.live.views.InputPanelViewHolder;
|
||||||
import com.yunbao.live.views.PDLiveConversationFragment;
|
import com.yunbao.live.views.PDLiveConversationFragment;
|
||||||
import com.yunbao.main.R;
|
import com.yunbao.main.R;
|
||||||
|
import com.yunbao.main.adapter.MessageChatTopImageListAdapter;
|
||||||
|
import com.yunbao.main.adapter.MessageChatTopTopListAdapter;
|
||||||
|
import com.yunbao.main.fragment.MyAddressBookFragment;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
import org.greenrobot.eventbus.Subscribe;
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
import org.greenrobot.eventbus.ThreadMode;
|
import org.greenrobot.eventbus.ThreadMode;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import io.rong.imkit.IMCenter;
|
import io.rong.imkit.IMCenter;
|
||||||
import io.rong.imkit.conversation.extension.InputMode;
|
import io.rong.imkit.conversation.extension.InputMode;
|
||||||
@ -80,6 +92,7 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl
|
|||||||
private String targetId = "";
|
private String targetId = "";
|
||||||
private View card;
|
private View card;
|
||||||
private View mContainer;
|
private View mContainer;
|
||||||
|
private MessageUserInfoBean userInfoBean;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -172,9 +185,10 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl
|
|||||||
|
|
||||||
//绑定聊天用户id
|
//绑定聊天用户id
|
||||||
inputPanel.setTargetId(targetId);
|
inputPanel.setTargetId(targetId);
|
||||||
ToastUtil.show("id:"+targetId);
|
ToastUtil.show("id:" + targetId);
|
||||||
//获取用户信息
|
//获取用户信息
|
||||||
UserInfo userInfo = RongUserInfoManager.getInstance().getUserInfo(targetId);
|
UserInfo userInfo = RongUserInfoManager.getInstance().getUserInfo(targetId);
|
||||||
|
setUserCard();
|
||||||
if (null != userInfo) {
|
if (null != userInfo) {
|
||||||
titleView.setText(userInfo.getName());
|
titleView.setText(userInfo.getName());
|
||||||
if (!TextUtils.isEmpty(userInfo.getExtra())) {
|
if (!TextUtils.isEmpty(userInfo.getExtra())) {
|
||||||
@ -193,10 +207,6 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl
|
|||||||
inputPanel.setAdmin(isAdmin);
|
inputPanel.setAdmin(isAdmin);
|
||||||
Log.e("PDLiveConversation", userInfo.getExtra());
|
Log.e("PDLiveConversation", userInfo.getExtra());
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
/* titleView.setText("系統消息");
|
|
||||||
inputPanel.setVisibility(View.GONE);*/
|
|
||||||
setUserCard();
|
|
||||||
}
|
}
|
||||||
getDraft();
|
getDraft();
|
||||||
|
|
||||||
@ -248,17 +258,83 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl
|
|||||||
|
|
||||||
private void setUserCard() {
|
private void setUserCard() {
|
||||||
LiveNetManager.get(mContext)
|
LiveNetManager.get(mContext)
|
||||||
.getOtherInfo(targetId, new HttpCallback<MessageChatUserBean>() {
|
.getOtherInfo(targetId, new HttpCallback<MessageUserInfoBean>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(MessageChatUserBean data) {
|
public void onSuccess(MessageUserInfoBean data) {
|
||||||
|
userInfoBean = data;
|
||||||
|
titleView.setText(data.getUser().getUserNicename() + "_");
|
||||||
|
ImgLoader.display(mContext, data.getUser().getAvatar(), ViewUtils.findViewById(card, R.id.rc_conversation_portrait, ImageView.class));
|
||||||
|
ViewUtils.findViewById(card, R.id.userName, TextView.class).setText(data.getUser().getUserNicename());
|
||||||
|
ViewUtils.findViewById(card, R.id.sign, TextView.class).setText(data.getUser().getSignature());
|
||||||
|
showBanner();
|
||||||
|
showTag();
|
||||||
|
if(data.getUser().getAttention()==0){
|
||||||
|
ViewUtils.findViewById(card,R.id.follow, Button.class).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
follow((Button) view,userInfoBean.getUser().getId()+"");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}else{
|
||||||
|
ViewUtils.findViewById(card,R.id.follow, Button.class).setVisibility(View.INVISIBLE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(String error) {
|
public void onError(String error) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
private void showBanner() {
|
||||||
|
LiveNetManager.get(mContext)
|
||||||
|
.getUserHomeBanner(targetId, new HttpCallback<List<String>>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(List<String> data) {
|
||||||
|
List<String> urls = new ArrayList<>();
|
||||||
|
urls.add(userInfoBean.getUser().getAvatar());
|
||||||
|
urls.addAll(data);
|
||||||
|
RecyclerView avatarList = ViewUtils.findViewById(card, R.id.avatar_list, RecyclerView.class);
|
||||||
|
MessageChatTopImageListAdapter adapter = new MessageChatTopImageListAdapter();
|
||||||
|
avatarList.setAdapter(adapter);
|
||||||
|
adapter.setUrls(urls);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(String error) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
private void showTag(){
|
||||||
|
List<String> tags=new ArrayList<>();
|
||||||
|
tags.add(userInfoBean.getInfo().getAge());
|
||||||
|
if(!StringUtil.isEmpty(userInfoBean.getInfo().getCareer())){
|
||||||
|
tags.add(userInfoBean.getInfo().getCareer());
|
||||||
|
}
|
||||||
|
if(!StringUtil.isEmpty(userInfoBean.getInfo().getHeight())&&!userInfoBean.getInfo().getHeight().equals("0")) {
|
||||||
|
tags.add(userInfoBean.getInfo().getHeight());
|
||||||
|
}
|
||||||
|
List<String> t;
|
||||||
|
if(WordUtil.isNewZh()) {
|
||||||
|
t=userInfoBean.getInfo().getCn_label();
|
||||||
|
}else{
|
||||||
|
t=userInfoBean.getInfo().getEn_label();
|
||||||
|
}
|
||||||
|
if(t!=null){
|
||||||
|
for (String tag : t) {
|
||||||
|
if(!StringUtil.isEmpty(tag)){
|
||||||
|
tags.add(tag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MessageChatTopTopListAdapter adapter=new MessageChatTopTopListAdapter();
|
||||||
|
RecyclerView avatarList = ViewUtils.findViewById(card, R.id.tag_list, RecyclerView.class);
|
||||||
|
avatarList.setAdapter(adapter);
|
||||||
|
adapter.setUrls(tags);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -342,7 +418,20 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private void follow(Button btn, String id) {
|
||||||
|
LiveNetManager.get(btn.getContext())
|
||||||
|
.setAttents(id, new HttpCallback<SetAttentsModel>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(SetAttentsModel data) {
|
||||||
|
btn.setVisibility(View.INVISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(String error) {
|
||||||
|
ToastUtil.show(error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
@ -366,7 +455,7 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl
|
|||||||
//消息中心
|
//消息中心
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
public void onInputPanelViewHolderEvent(InputPanelViewHolderEvent event) {
|
public void onInputPanelViewHolderEvent(InputPanelViewHolderEvent event) {
|
||||||
// ((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(this.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
|
// ((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(this.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
|
||||||
inputPanel.hidePluginList();
|
inputPanel.hidePluginList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -376,5 +465,4 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl
|
|||||||
hideUserCard();
|
hideUserCard();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,55 @@
|
|||||||
|
package com.yunbao.main.adapter;
|
||||||
|
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.yunbao.common.glide.ImgLoader;
|
||||||
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
|
import com.yunbao.main.R;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class MessageChatTopImageListAdapter extends RecyclerView.Adapter<com.yunbao.main.adapter.MessageChatTopImageListAdapter.ViewHolder> {
|
||||||
|
List<String> urls = new ArrayList<>();
|
||||||
|
|
||||||
|
public void setUrls(List<String> urls) {
|
||||||
|
ToastUtil.show("照片数量:"+urls.size());
|
||||||
|
this.urls = urls;
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public com.yunbao.main.adapter.MessageChatTopImageListAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
return new ViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.view_msg_chat_top_image, parent, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull com.yunbao.main.adapter.MessageChatTopImageListAdapter.ViewHolder holder, int position) {
|
||||||
|
holder.show(urls.get(position));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return urls.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
ImageView imageView;
|
||||||
|
|
||||||
|
public ViewHolder(@NonNull View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
imageView = itemView.findViewById(R.id.cover);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void show(String url) {
|
||||||
|
ImgLoader.display(itemView.getContext(), url, imageView);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,55 @@
|
|||||||
|
package com.yunbao.main.adapter;
|
||||||
|
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.yunbao.common.glide.ImgLoader;
|
||||||
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
|
import com.yunbao.main.R;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class MessageChatTopTopListAdapter extends RecyclerView.Adapter<MessageChatTopTopListAdapter.ViewHolder> {
|
||||||
|
List<String> urls = new ArrayList<>();
|
||||||
|
|
||||||
|
public void setUrls(List<String> urls) {
|
||||||
|
this.urls = urls;
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public MessageChatTopTopListAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
return new ViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.view_msg_chat_top_tag, parent, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull MessageChatTopTopListAdapter.ViewHolder holder, int position) {
|
||||||
|
holder.show(urls.get(position));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return urls.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
TextView tagView;
|
||||||
|
|
||||||
|
public ViewHolder(@NonNull View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
tagView = itemView.findViewById(R.id.tag);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void show(String tag) {
|
||||||
|
tagView.setText(String.format("#%s", tag));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
9
main/src/main/res/drawable/view_chat_top_tag.xml
Normal file
9
main/src/main/res/drawable/view_chat_top_tag.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:width="63dp" android:height="23dp">
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<solid android:color="#fffff6e8" />
|
||||||
|
<corners android:topLeftRadius="20dp" android:topRightRadius="20dp" android:bottomLeftRadius="20dp" android:bottomRightRadius="20dp" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</selector>
|
@ -102,7 +102,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="50dp"
|
android:layout_marginStart="50dp"
|
||||||
android:layout_marginTop="70dp"
|
android:layout_marginTop="60dp"
|
||||||
android:text="TextView"
|
android:text="TextView"
|
||||||
android:textColor="#333333"
|
android:textColor="#333333"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
@ -126,7 +126,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:text="TextView"
|
android:text="@string/activity_msg_chat_top_tip1"
|
||||||
android:textColor="#777777"
|
android:textColor="#777777"
|
||||||
android:textSize="11sp"
|
android:textSize="11sp"
|
||||||
app:layout_constraintStart_toStartOf="@+id/userName"
|
app:layout_constraintStart_toStartOf="@+id/userName"
|
||||||
@ -157,6 +157,7 @@
|
|||||||
android:id="@+id/follow"
|
android:id="@+id/follow"
|
||||||
android:layout_width="69dp"
|
android:layout_width="69dp"
|
||||||
android:layout_height="38dp"
|
android:layout_height="38dp"
|
||||||
|
android:layout_marginTop="-10dp"
|
||||||
android:background="@drawable/bg_msg_address_book_user_btn_fan"
|
android:background="@drawable/bg_msg_address_book_user_btn_fan"
|
||||||
android:drawableLeft="@mipmap/bg_msg_chat_title_follow"
|
android:drawableLeft="@mipmap/bg_msg_chat_title_follow"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
@ -168,8 +169,8 @@
|
|||||||
android:textColor="#FFFFFF"
|
android:textColor="#FFFFFF"
|
||||||
android:textSize="13sp"
|
android:textSize="13sp"
|
||||||
app:autoSizeMaxTextSize="13sp"
|
app:autoSizeMaxTextSize="13sp"
|
||||||
app:autoSizeMinTextSize="3sp"
|
|
||||||
|
|
||||||
|
app:autoSizeMinTextSize="3sp"
|
||||||
app:autoSizeStepGranularity="1sp"
|
app:autoSizeStepGranularity="1sp"
|
||||||
app:autoSizeTextType="uniform"
|
app:autoSizeTextType="uniform"
|
||||||
app:layout_constraintEnd_toEndOf="@+id/constraintLayout6"
|
app:layout_constraintEnd_toEndOf="@+id/constraintLayout6"
|
||||||
@ -183,6 +184,10 @@
|
|||||||
android:layout_marginStart="50dp"
|
android:layout_marginStart="50dp"
|
||||||
android:layout_marginEnd="50dp"
|
android:layout_marginEnd="50dp"
|
||||||
android:layout_marginBottom="60dp"
|
android:layout_marginBottom="60dp"
|
||||||
|
tools:listitem="@layout/view_msg_chat_top_image"
|
||||||
|
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||||
|
tools:itemCount="9"
|
||||||
|
android:orientation="horizontal"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="@+id/imageView"
|
app:layout_constraintEnd_toEndOf="@+id/imageView"
|
||||||
app:layout_constraintStart_toStartOf="parent" />
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
@ -191,9 +196,14 @@
|
|||||||
android:id="@+id/tag_list"
|
android:id="@+id/tag_list"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="25dp"
|
android:layout_height="25dp"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/avatar_list"
|
app:layout_constraintBottom_toTopOf="@+id/avatar_list"
|
||||||
app:layout_constraintEnd_toEndOf="@+id/avatar_list"
|
app:layout_constraintEnd_toEndOf="@+id/avatar_list"
|
||||||
app:layout_constraintStart_toStartOf="@+id/avatar_list" />
|
app:layout_constraintStart_toStartOf="@+id/avatar_list"
|
||||||
|
tools:itemCount="9"
|
||||||
|
tools:listitem="@layout/view_msg_chat_top_tag" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
15
main/src/main/res/layout/view_msg_chat_top_image.xml
Normal file
15
main/src/main/res/layout/view_msg_chat_top_image.xml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="75dp"
|
||||||
|
android:layout_height="75dp"
|
||||||
|
android:layout_marginEnd="5dp"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
|
<com.makeramen.roundedimageview.RoundedImageView
|
||||||
|
android:id="@+id/cover"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:src="@mipmap/icon_beauty_filter_natural_8"
|
||||||
|
app:riv_corner_radius="10dp" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
25
main/src/main/res/layout/view_msg_chat_top_tag.xml
Normal file
25
main/src/main/res/layout/view_msg_chat_top_tag.xml
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="63dp"
|
||||||
|
android:layout_height="23dp"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_marginEnd="5dp"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:gravity="start|center"
|
||||||
|
android:paddingStart="6dp"
|
||||||
|
android:paddingEnd="6dp"
|
||||||
|
android:textColor="#C38764"
|
||||||
|
android:textSize="11sp"
|
||||||
|
android:id="@+id/tag"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@drawable/view_chat_top_tag"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
tools:text="#标签" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -36,4 +36,5 @@
|
|||||||
<string name="activity_msg_addressbook_tab_fan">粉絲</string>
|
<string name="activity_msg_addressbook_tab_fan">粉絲</string>
|
||||||
<string name="activity_msg_addressbook_tab_fan2">回關</string>
|
<string name="activity_msg_addressbook_tab_fan2">回關</string>
|
||||||
<string name="activity_msg_addressbook_tab_mutual">互相關注</string>
|
<string name="activity_msg_addressbook_tab_mutual">互相關注</string>
|
||||||
|
<string name="activity_msg_chat_top_tip1">赠送礼物陪伴TA~</string>
|
||||||
</resources>
|
</resources>
|
@ -36,4 +36,5 @@
|
|||||||
<string name="activity_msg_addressbook_tab_fan">Fan</string>
|
<string name="activity_msg_addressbook_tab_fan">Fan</string>
|
||||||
<string name="activity_msg_addressbook_tab_fan2">Return</string>
|
<string name="activity_msg_addressbook_tab_fan2">Return</string>
|
||||||
<string name="activity_msg_addressbook_tab_mutual">Mutual</string>
|
<string name="activity_msg_addressbook_tab_mutual">Mutual</string>
|
||||||
|
<string name="activity_msg_chat_top_tip1">Present a gift to accompany him/her~</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user