Merge remote-tracking branch 'origin/master'

This commit is contained in:
zlzw 2022-11-09 18:30:59 +08:00
commit 2b0846f939
13 changed files with 294 additions and 114 deletions

View File

@ -9,6 +9,7 @@ import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.R;
import com.yunbao.common.bean.AnchorRecommendItemModel;
import com.yunbao.common.bean.CustomSidebarInfoModel;
import com.yunbao.common.views.DrawerRecommendViewHolder;
import com.yunbao.common.views.DrawerTaskViewHolder;
@ -30,6 +31,7 @@ public class CustomDrawerPopupAdapter extends RecyclerView.Adapter {
private final int FUN_GAMES = 3;
private final int RIGHTS_INTERESTS = 4;
private final int RECOMMEND = 5;
private List<AnchorRecommendItemModel> list = new ArrayList<>();
private List<CustomSidebarInfoModel> infoModels = new ArrayList<>();
@ -37,6 +39,11 @@ public class CustomDrawerPopupAdapter extends RecyclerView.Adapter {
this.mContext = mContext;
}
public CustomDrawerPopupAdapter setList(List<AnchorRecommendItemModel> list) {
this.list = list;
return this;
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
@ -64,15 +71,20 @@ public class CustomDrawerPopupAdapter extends RecyclerView.Adapter {
if (holder instanceof DrawerRecommendViewHolder) {
DrawerRecommendViewHolder recommendViewHolder = (DrawerRecommendViewHolder) holder;
recommendViewHolder.setData(infoModels.get(position));
}else if (holder instanceof DrawerTaskViewHolder) {
} else if (holder instanceof DrawerTaskViewHolder) {
DrawerTaskViewHolder taskViewHolder = (DrawerTaskViewHolder) holder;
taskViewHolder.setData(infoModels.get(position));
}else if (holder instanceof FunGamesViewHolder) {
} else if (holder instanceof FunGamesViewHolder) {
FunGamesViewHolder funGamesViewHolder = (FunGamesViewHolder) holder;
funGamesViewHolder.setData(infoModels.get(position));
}else if (holder instanceof RigtsInterestsViewHolder) {
} else if (holder instanceof RigtsInterestsViewHolder) {
RigtsInterestsViewHolder rigtsInterestsViewHolder = (RigtsInterestsViewHolder) holder;
rigtsInterestsViewHolder.setData(infoModels.get(position));
} else if (holder instanceof RecommendViewHolder) {
RecommendViewHolder recommendViewHolder = (RecommendViewHolder) holder;
recommendViewHolder.setData(infoModels.get(position));
recommendViewHolder.updateData(list);
}
}

View File

@ -0,0 +1,48 @@
package com.yunbao.common.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.R;
import com.yunbao.common.bean.AnchorRecommendItemModel;
import com.yunbao.common.views.RecommendChildViewHolder;
import java.util.ArrayList;
import java.util.List;
public class RecommendAdapter extends RecyclerView.Adapter {
private List<AnchorRecommendItemModel> list = new ArrayList<>();
private Context mContext;
public RecommendAdapter(Context mContext) {
this.mContext = mContext;
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new RecommendChildViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_sidebar_lives_new, parent, false));
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
RecommendChildViewHolder itemViewHolder = (RecommendChildViewHolder) holder;
itemViewHolder.setData(list.get(position));
}
@Override
public int getItemCount() {
return list.size();
}
public void updateData(List<AnchorRecommendItemModel> mList) {
list.clear();
list.addAll(mList);
notifyDataSetChanged();
}
}

View File

@ -687,7 +687,7 @@ public class IMLoginModel extends BaseModel {
* @return
*/
public boolean anchorUserType() {
return !TextUtils.equals("C", usersType);
return TextUtils.equals("C", usersType);
}
public IMLoginModel setUsersType(String usersType) {

View File

@ -9,10 +9,12 @@ import androidx.recyclerview.widget.RecyclerView;
import com.lxj.xpopup.core.DrawerPopupView;
import com.yunbao.common.R;
import com.yunbao.common.adapter.CustomDrawerPopupAdapter;
import com.yunbao.common.bean.AnchorRecommendItemModel;
import com.yunbao.common.bean.CustomSidebarInfoModel;
import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.utils.ToastUtil;
import java.util.ArrayList;
import java.util.List;
public class CustomDrawerPopupView extends DrawerPopupView {
@ -20,6 +22,12 @@ public class CustomDrawerPopupView extends DrawerPopupView {
private RecyclerView drawerList;
private CustomDrawerPopupAdapter adapter;
private List<AnchorRecommendItemModel> list = new ArrayList<>();
public CustomDrawerPopupView setList(List<AnchorRecommendItemModel> list) {
this.list = list;
return this;
}
public CustomDrawerPopupView(@NonNull Context context) {
super(context);
@ -43,6 +51,7 @@ public class CustomDrawerPopupView extends DrawerPopupView {
private void initView() {
drawerList = findViewById(R.id.drawerList);
adapter = new CustomDrawerPopupAdapter(mContext);
adapter.setList(list);
drawerList.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
drawerList.setAdapter(adapter);
}

View File

@ -0,0 +1,42 @@
package com.yunbao.common.views;
import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.squareup.picasso.Picasso;
import com.yunbao.common.R;
import com.yunbao.common.bean.AnchorRecommendItemModel;
import com.yunbao.common.glide.ImgLoader;
public class RecommendChildViewHolder extends RecyclerView.ViewHolder {
private ImageView cover;
private ImageView liveType;
private TextView name;
public RecommendChildViewHolder(@NonNull View itemView) {
super(itemView);
cover = itemView.findViewById(R.id.cover);
liveType = itemView.findViewById(R.id.live_type);
name = itemView.findViewById(R.id.name);
}
public void setData(AnchorRecommendItemModel bean) {
Context mContext = itemView.getContext();
if (bean.getContentPicSizeTwo() != null && !bean.getContentPicSizeTwo().equals("")) {
Picasso.with(mContext)
.load(bean.getContentPicSizeTwo())
.into(liveType);
} else if (bean.getContentPicSizeThree() != null && !bean.getContentPicSizeThree().equals("")) {
Picasso.with(mContext)
.load(bean.getContentPicSizeThree())
.into(liveType);
}
ImgLoader.display(itemView.getContext(), bean.getThumb(), cover);
name.setText(bean.getUserNicename());
}
}

View File

@ -1,13 +1,41 @@
package com.yunbao.common.views;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.R;
import com.yunbao.common.adapter.RecommendAdapter;
import com.yunbao.common.bean.AnchorRecommendItemModel;
import com.yunbao.common.bean.CustomSidebarInfoModel;
import java.util.List;
public class RecommendViewHolder extends RecyclerView.ViewHolder {
private TextView sendGoodGift, subtitle;
private RecyclerView childList;
private RecommendAdapter recommendAdapter;
public RecommendViewHolder(@NonNull View itemView) {
super(itemView);
sendGoodGift = itemView.findViewById(R.id.send_good_gift);
subtitle = itemView.findViewById(R.id.subtitle);
childList = itemView.findViewById(R.id.child_list);
recommendAdapter = new RecommendAdapter(itemView.getContext());
childList.setLayoutManager(new GridLayoutManager(itemView.getContext(), 3));
childList.setAdapter(recommendAdapter);
}
public void setData(CustomSidebarInfoModel model) {
sendGoodGift.setText(model.getTitle());
subtitle.setText(model.getSubtitle());
}
public void updateData(List<AnchorRecommendItemModel> list) {
recommendAdapter.updateData(list);
}
}

View File

@ -1,4 +1,4 @@
package com.yunbao.live.views;
package com.yunbao.common.views;
import android.content.Context;
import android.view.View;
@ -8,14 +8,11 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.CircleCrop;
import com.bumptech.glide.request.RequestOptions;
import com.jakewharton.rxbinding3.view.RxView;
import com.squareup.picasso.Picasso;
import com.yunbao.common.R;
import com.yunbao.common.bean.AnchorRecommendItemModel;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.live.R;
import java.util.concurrent.TimeUnit;
@ -58,7 +55,7 @@ public class SidebarLiveItemViewHolder extends RecyclerView.ViewHolder {
.load(bean.getContentPicSizeThree())
.into(liveType);
}
ImgLoader.display(itemView.getContext(),bean.getThumb(),mCover);
ImgLoader.display(itemView.getContext(), bean.getThumb(), mCover);
mName.setText(bean.getUserNicename());

View File

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="94dp"
android:layout_marginTop="4dp"
android:layout_marginStart="4dp"
android:orientation="vertical"
app:cardCornerRadius="4dp"
app:cardElevation="16dp">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/cover"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop" />
<ImageView
android:id="@+id/live_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:gravity="center" />
<View
android:layout_width="match_parent"
android:layout_height="25dp"
android:layout_gravity="bottom"
android:background="@mipmap/bg_main_item_bottom" />
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_margin="6dp"
android:textColor="#FFF6F7FB"
android:textSize="12sp" />
</FrameLayout>
</androidx.cardview.widget.CardView>

View File

@ -1,6 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="10dp"
android:background="@drawable/bg_drawer_popup"
android:orientation="vertical">
</androidx.constraintlayout.widget.ConstraintLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp">
<TextView
android:id="@+id/send_good_gift"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="任務中心"
android:textColor="#F6F7FB"
android:textSize="14sp" />
<TextView
android:id="@+id/subtitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:drawableStart="@mipmap/icon_change"
android:drawablePadding="3dp"
android:gravity="center_vertical"
android:text="查看更多"
android:textColor="#A1A7BE"
android:textSize="12sp" />
</FrameLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/child_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:layout_marginTop="6dp"
android:layout_marginEnd="10dp"
android:layout_marginBottom="16dp" />
</LinearLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -43,7 +43,6 @@ import com.yunbao.common.activity.WebViewActivity;
import com.yunbao.common.bean.AnchorRecommendItemModel;
import com.yunbao.common.bean.AnchorRecommendModel;
import com.yunbao.common.bean.CrashSaveBean;
import com.yunbao.common.bean.CustomSidebarInfoModel;
import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.bean.LiveGiftBean;
@ -59,7 +58,6 @@ import com.yunbao.common.http.CommonHttpConsts;
import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.HttpClient;
import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.http.main.MainNetManager;
import com.yunbao.common.interfaces.CommonCallback;
import com.yunbao.common.manager.IMLoginManager;
@ -84,7 +82,6 @@ import com.yunbao.live.dialog.LiveGameDialogFragment;
import com.yunbao.live.dialog.LiveGiftDialogFragment;
import com.yunbao.live.dialog.LiveHDDialogFragment;
import com.yunbao.live.dialog.LiveMicUserDialogFragment;
import com.yunbao.live.dialog.LiveTotalDialog;
import com.yunbao.live.dialog.LiveWishListDialogFragment4Audience;
import com.yunbao.live.dialog.SignDialogFragment;
import com.yunbao.live.event.LinkMicTxAccEvent;
@ -694,6 +691,7 @@ public class LiveAudienceActivity extends LiveActivity {
IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo();
switch (event.getType()) {
case SIDEBAR:
case BOTTOM_COLLECTION:
// int userIndex = -1;
// for (int i = 0; i < list.size(); i++) {
// if (TextUtils.equals(list.get(i).getUid(), PortraitLiveManager.liveID)) {
@ -730,24 +728,16 @@ public class LiveAudienceActivity extends LiveActivity {
// .setWidth(DeviceUtils.getScreenWidth(mContext)/6*5)
// .build()
// .show();
CustomDrawerPopupView drawerPopupView = new CustomDrawerPopupView(mContext);
new XPopup.Builder(mContext)
.hasShadowBg(false)
.isDestroyOnDismiss(true)
.isLightStatusBar(false)
.popupPosition(PopupPosition.Right)//右边
.hasStatusBarShadow(true) //启用状态栏阴影
.asCustom(drawerPopupView)
.asCustom(new CustomDrawerPopupView(mContext).setList(list))
.show();
break;
case BOTTOM_COLLECTION:
LiveTotalDialog liveTotalDialog = new LiveTotalDialog();
liveTotalDialog.setAnchorBean(mLiveBean);
Bundle liveBundle = new Bundle();
liveBundle.putBoolean("isActivity", event.isActivity());
liveTotalDialog.setArguments(liveBundle);
liveTotalDialog.show(getSupportFragmentManager(), "LiveTotalDialog");
break;
case GIFT_POPUP:
if (TextUtils.isEmpty(mLiveUid) || TextUtils.isEmpty(mStream)) {
return;
@ -1064,36 +1054,25 @@ public class LiveAudienceActivity extends LiveActivity {
private List<AnchorRecommendItemModel> list = new ArrayList<>();
private void getDrawer() {
LiveNetManager.get(mContext)
.getCustomSidebarInfo(new com.yunbao.common.http.base.HttpCallback<List<CustomSidebarInfoModel>>() {
@Override
public void onSuccess(List<CustomSidebarInfoModel> data) {
//推荐位
MainNetManager.get(mContext)
.anchorRecommend("12", new com.yunbao.common.http.base.HttpCallback<AnchorRecommendModel>() {
@Override
public void onSuccess(AnchorRecommendModel anchorRecommendModel) {
list.clear();
slideInfoModels.clear();
List<AnchorRecommendItemModel> models = anchorRecommendModel.getList();
models.add(0, new AnchorRecommendItemModel());
list.addAll(models);
slideInfoModels = anchorRecommendModel.getSlide();
}
@Override
public void onError(String error) {
}
});
// //推荐位
// MainNetManager.get(mContext)
// .anchorRecommend("12", new com.yunbao.common.http.base.HttpCallback<AnchorRecommendModel>() {
// @Override
// public void onSuccess(AnchorRecommendModel anchorRecommendModel) {
// list.clear();
// slideInfoModels.clear();
// List<AnchorRecommendItemModel> models = anchorRecommendModel.getList();
//
// models.add(0, new AnchorRecommendItemModel());
// list.addAll(models);
// slideInfoModels = anchorRecommendModel.getSlide();
// }
//
// @Override
// public void onError(String error) {
// }
// });
}
public void onFollowEvent(FollowEvent e) {

View File

@ -10,7 +10,7 @@ import com.yunbao.common.adapter.RefreshAdapter;
import com.yunbao.common.bean.AnchorRecommendItemModel;
import com.yunbao.common.bean.SlideInfoModel;
import com.yunbao.live.R;
import com.yunbao.live.views.SidebarLiveItemViewHolder;
import com.yunbao.common.views.SidebarLiveItemViewHolder;
import com.yunbao.live.views.SidebarViewHoler;
import java.util.ArrayList;

View File

@ -456,38 +456,18 @@ public class LiveTextRender {
private void renderTMP(Context context, final TextView textView, final LiveChatBean bean) {
final LevelBean levelBean = CommonAppConfig.getInstance().getLevel(bean.getLevel());
if (levelBean == null) {
if (textView != null) {
SpannableStringBuilder builder = createPrefix(null, bean);
int color = 0xffffdd00;
switch (bean.getType()) {
case LiveChatBean.GIFT:
builder = renderGift(color, builder, bean);
break;
default:
builder = renderChat(color, builder, bean);
break;
}
textView.setText(builder);
}
} else {
if (textView != null) {
getLevelImage(context, bean.getLevel(), new ImgLoader.DrawableCallback() {
@Override
public void onLoadSuccess(Drawable drawable) {
SpannableStringBuilder builder = createPrefix(drawable, bean);
int color = 0;
int color = Color.parseColor("#68F1F4");
if (bean.isAnchor()) {
color = 0xffffdd00;
} else {
try {
color = Color.parseColor(levelBean.getColor());
} catch (Exception e) {
color = Color.parseColor("#ffffff");
}
color = Color.parseColor("#68F1F4");
}
switch (bean.getType()) {
case LiveChatBean.GIFT:
@ -507,11 +487,7 @@ public class LiveTextRender {
if (bean.isAnchor()) {
color = 0xffffdd00;
} else {
try {
color = Color.parseColor(levelBean.getColor());
} catch (Exception e) {
color = Color.parseColor("#ffffff");
}
color = Color.parseColor("#68F1F4");
}
switch (bean.getType()) {
case LiveChatBean.GIFT:
@ -526,7 +502,7 @@ public class LiveTextRender {
});
}
}
}
/**