新增粉丝团任务红点提示

This commit is contained in:
zlzw 2023-08-10 16:53:00 +08:00
parent 35917a5848
commit ec3722b7d0
13 changed files with 154 additions and 25 deletions

View File

@ -0,0 +1,19 @@
package com.yunbao.common.bean;
import com.google.gson.annotations.SerializedName;
public class FansCheckRed extends BaseModel{
@SerializedName("fans_level_upgrade_status")
private int status;
public FansCheckRed() {
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
}

View File

@ -12,6 +12,7 @@ import com.yunbao.common.bean.CustomSidebarInfoModel;
import com.yunbao.common.bean.DiscountsModel; import com.yunbao.common.bean.DiscountsModel;
import com.yunbao.common.bean.EnterRoomNewModel; import com.yunbao.common.bean.EnterRoomNewModel;
import com.yunbao.common.bean.FaceBookUpModel; import com.yunbao.common.bean.FaceBookUpModel;
import com.yunbao.common.bean.FansCheckRed;
import com.yunbao.common.bean.FansGroupGiftPack; import com.yunbao.common.bean.FansGroupGiftPack;
import com.yunbao.common.bean.FansGroupGiftPackInfo; import com.yunbao.common.bean.FansGroupGiftPackInfo;
import com.yunbao.common.bean.GiftAlreadyWallModel; import com.yunbao.common.bean.GiftAlreadyWallModel;
@ -953,6 +954,11 @@ public interface PDLiveApi {
*/ */
@GET("/api/public/?service=Fans.userFansExclusivePackList") @GET("/api/public/?service=Fans.userFansExclusivePackList")
Observable<ResponseModel<List<FansGroupGiftPack>>> userFansExclusivePackList(@Query("liveuid") String liveUid); Observable<ResponseModel<List<FansGroupGiftPack>>> userFansExclusivePackList(@Query("liveuid") String liveUid);
/**
* 获取粉丝团礼物包裹
*/
@GET("/api/public/?service=Fans.getCheckFansLevelUpgrade")
Observable<ResponseModel<FansCheckRed>> getCheckFansLevelUpgrade(@Query("liveuid") String liveUid);
} }

View File

@ -13,6 +13,7 @@ import com.yunbao.common.bean.CheckLiveModel;
import com.yunbao.common.bean.CustomSidebarInfoModel; import com.yunbao.common.bean.CustomSidebarInfoModel;
import com.yunbao.common.bean.DiscountsModel; import com.yunbao.common.bean.DiscountsModel;
import com.yunbao.common.bean.EnterRoomNewModel; import com.yunbao.common.bean.EnterRoomNewModel;
import com.yunbao.common.bean.FansCheckRed;
import com.yunbao.common.bean.FansGroupGiftPack; import com.yunbao.common.bean.FansGroupGiftPack;
import com.yunbao.common.bean.FansGroupGiftPackInfo; import com.yunbao.common.bean.FansGroupGiftPackInfo;
import com.yunbao.common.bean.GiftAlreadyWallModel; import com.yunbao.common.bean.GiftAlreadyWallModel;
@ -2137,6 +2138,27 @@ public class LiveNetManager {
} }
}).isDisposed(); }).isDisposed();
} }
public void getCheckFansLevelUpgrade(String liveUid, HttpCallback<FansCheckRed> callback) {
API.get().pdLiveApi(mContext)
.getCheckFansLevelUpgrade(liveUid)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<ResponseModel<FansCheckRed>>() {
@Override
public void accept(ResponseModel<FansCheckRed> listResponseModel) throws Exception {
if (callback != null) {
callback.onSuccess(listResponseModel.getData().getInfo());
}
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
if (callback != null) {
callback.onError(mContext.getString(R.string.net_error));
}
}
}).isDisposed();
}
/** /**
* 直播间取消网络请求 * 直播间取消网络请求

View File

@ -44,6 +44,7 @@ import com.yunbao.common.activity.WebViewActivity;
import com.yunbao.common.bean.AnchorRecommendItemModel; import com.yunbao.common.bean.AnchorRecommendItemModel;
import com.yunbao.common.bean.AnchorRecommendModel; import com.yunbao.common.bean.AnchorRecommendModel;
import com.yunbao.common.bean.CrashSaveBean; import com.yunbao.common.bean.CrashSaveBean;
import com.yunbao.common.bean.FansCheckRed;
import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.bean.LinkMicUserBean; import com.yunbao.common.bean.LinkMicUserBean;
import com.yunbao.common.bean.LiveBean; import com.yunbao.common.bean.LiveBean;
@ -1601,7 +1602,13 @@ public class LiveAudienceActivity extends LiveActivity {
} }
manager.mLiveAudienceViewHolder.mRedPoint.setVisibility(View.VISIBLE); manager.mLiveAudienceViewHolder.mRedPoint.setVisibility(View.VISIBLE);
} }
public void setShowCrownRed(boolean isShow){
if(isShow){
manager.mLiveAudienceViewHolder.mRedPointPrivilege.setVisibility(View.VISIBLE);
}else{
manager.mLiveAudienceViewHolder.mRedPointPrivilege.setVisibility(View.GONE);
}
}
public void closeRoom() { public void closeRoom() {
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {

View File

@ -25,8 +25,10 @@ import com.yunbao.common.utils.L;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.activity.LiveAudienceActivity; import com.yunbao.live.activity.LiveAudienceActivity;
import com.yunbao.live.event.LiveAudienceEvent;
import com.yunbao.live.views.LiveRoomViewHolder; import com.yunbao.live.views.LiveRoomViewHolder;
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;
@ -118,6 +120,8 @@ public class LiveFansFragment extends AbsDialogFragment {
public void onDestroy() { public void onDestroy() {
super.onDestroy(); super.onDestroy();
mContext = null; mContext = null;
EventBus.getDefault().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.UPDATE_FANS_TASK_STATUS));
} }
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)

View File

@ -2,6 +2,7 @@ package com.yunbao.live.dialog;
import android.os.Bundle; import android.os.Bundle;
import android.view.Gravity; import android.view.Gravity;
import android.view.View;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
@ -14,6 +15,8 @@ import com.yunbao.live.R;
import com.yunbao.live.event.LiveAudienceEvent; import com.yunbao.live.event.LiveAudienceEvent;
public class LiveRoleDialogFragment extends AbsDialogFragment { public class LiveRoleDialogFragment extends AbsDialogFragment {
View redPoint;
@Override @Override
protected int getLayoutId() { protected int getLayoutId() {
return R.layout.dialog_live_role; return R.layout.dialog_live_role;
@ -43,6 +46,11 @@ public class LiveRoleDialogFragment extends AbsDialogFragment {
@Override @Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) { public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState); super.onActivityCreated(savedInstanceState);
Bundle bundle = getArguments();
redPoint = findViewById(R.id.red_point);
if (bundle != null && bundle.getBoolean("showRed", false)) {
redPoint.setVisibility(View.VISIBLE);
}
//粉丝团 //粉丝团
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.fan_club), () -> { ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.fan_club), () -> {
Bus.get().post(new LiveAudienceEvent() Bus.get().post(new LiveAudienceEvent()

View File

@ -464,7 +464,8 @@ public class LiveAudienceEvent extends BaseModel {
RED_PACKET_SUPER_JACKPOT(70, "超级红包"), RED_PACKET_SUPER_JACKPOT(70, "超级红包"),
INPUT_DIALOG(71, "输入框"), INPUT_DIALOG(71, "输入框"),
IS_ATTENTION(72,"是否关注主播"), IS_ATTENTION(72,"是否关注主播"),
GIFT_WALL(73,"礼物墙"); GIFT_WALL(73,"礼物墙"),
UPDATE_FANS_TASK_STATUS(74,"更新粉丝任务状态");
private int type; private int type;
private String name; private String name;

View File

@ -17,7 +17,8 @@ import org.greenrobot.eventbus.EventBus;
public abstract class AbsLiveViewHolder extends AbsViewHolder implements View.OnClickListener { public abstract class AbsLiveViewHolder extends AbsViewHolder implements View.OnClickListener {
public TextView mRedPoint; public TextView mRedPoint;//消息上的红点
public View mRedPointPrivilege;//皇冠上的点
public AbsLiveViewHolder(Context context, ViewGroup parentView) { public AbsLiveViewHolder(Context context, ViewGroup parentView) {
super(context, parentView); super(context, parentView);
@ -28,6 +29,7 @@ public abstract class AbsLiveViewHolder extends AbsViewHolder implements View.On
findViewById(R.id.et_input).setOnClickListener(this); findViewById(R.id.et_input).setOnClickListener(this);
findViewById(R.id.btn_msg).setOnClickListener(this); findViewById(R.id.btn_msg).setOnClickListener(this);
mRedPoint = (TextView) findViewById(R.id.red_point); mRedPoint = (TextView) findViewById(R.id.red_point);
mRedPointPrivilege = findViewById(R.id.privilege_red_point);
} }

View File

@ -91,8 +91,6 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
} }
@Override @Override
protected int getLayoutId() { protected int getLayoutId() {
return R.layout.view_live_audience; return R.layout.view_live_audience;
@ -459,6 +457,9 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
*/ */
public void openRoleDialog() { public void openRoleDialog() {
LiveRoleDialogFragment fragment = new LiveRoleDialogFragment(); LiveRoleDialogFragment fragment = new LiveRoleDialogFragment();
Bundle bundle = new Bundle();
bundle.putBoolean("showRed", mRedPointPrivilege.getVisibility() == View.VISIBLE);
fragment.setArguments(bundle);
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveRoleDialogFragment"); fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveRoleDialogFragment");
} }

View File

@ -66,6 +66,7 @@ import com.yunbao.common.activity.AbsActivity;
import com.yunbao.common.bean.AiAutomaticSpeechModel; import com.yunbao.common.bean.AiAutomaticSpeechModel;
import com.yunbao.common.bean.BannerBean; import com.yunbao.common.bean.BannerBean;
import com.yunbao.common.bean.BaseModel; import com.yunbao.common.bean.BaseModel;
import com.yunbao.common.bean.FansCheckRed;
import com.yunbao.common.bean.GiftModel; import com.yunbao.common.bean.GiftModel;
import com.yunbao.common.bean.GuardUserModel; import com.yunbao.common.bean.GuardUserModel;
import com.yunbao.common.bean.HourRank; import com.yunbao.common.bean.HourRank;
@ -4576,8 +4577,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
int fount = event.getNums(); int fount = event.getNums();
mLiveChatAdapter.switchFount(fount); mLiveChatAdapter.switchFount(fount);
break; break;
case UPDATE_FANS_TASK_STATUS:
updateFansMessageRed();
break;
} }
} }
@ -5429,11 +5431,21 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
mLiveGiftAnimPresenter.setLiveUidStream(mLiveUid, mStream); mLiveGiftAnimPresenter.setLiveUidStream(mLiveUid, mStream);
} }
public void sendWelcomeFans() { public void updateFansMessageRed() {
LiveChatBean chatBean = new LiveChatBean(); if (mContext instanceof LiveAudienceActivity) {
chatBean.setContent("123123<font color='#FF8E43'>test</font>1243"); LiveNetManager.get(mContext)
chatBean.setType(LiveChatBean.SYSTEM3_COLOR); .getCheckFansLevelUpgrade(mLiveUid, new com.yunbao.common.http.base.HttpCallback<FansCheckRed>() {
chatBean.setBubble("https://downs.yaoulive.com/20230322/g2_.9.png"); @Override
insertChat(chatBean, 1); public void onSuccess(FansCheckRed data) {
((LiveAudienceActivity) mContext).setShowCrownRed(data.getStatus() == 1);
}
@Override
public void onError(String error) {
}
});
}
} }
} }

View File

@ -520,6 +520,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveRoomViewHolder.initTopBanner(); mLiveRoomViewHolder.initTopBanner();
mLiveRoomViewHolder.updateTopBanner(); mLiveRoomViewHolder.updateTopBanner();
mLiveRoomViewHolder.setVoteData(data.getEnterRoomInfo().getVoteModel()); mLiveRoomViewHolder.setVoteData(data.getEnterRoomInfo().getVoteModel());
mLiveRoomViewHolder.updateFansMessageRed();
isattention = Integer.parseInt(data.getEnterRoomInfo().getIsattention()); isattention = Integer.parseInt(data.getEnterRoomInfo().getIsattention());
if (isattention == 0) { if (isattention == 0) {

View File

@ -1,9 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@mipmap/img_pop_bg" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="171dp"> android:layout_height="171dp"
android:background="@mipmap/img_pop_bg">
<TextView <TextView
android:id="@+id/title" android:id="@+id/title"
@ -11,9 +12,9 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:layout_marginTop="24dp" android:layout_marginTop="24dp"
android:text="@string/live_role_title"
android:textColor="#F6F7FB" android:textColor="#F6F7FB"
android:textSize="14sp" android:textSize="14sp"
android:text="@string/live_role_title"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
@ -82,10 +83,31 @@
android:gravity="center" android:gravity="center"
android:orientation="vertical"> android:orientation="vertical">
<ImageView <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="40dp" android:layout_width="40dp"
android:layout_height="40dp" android:layout_height="40dp">
android:src="@mipmap/live_more_icon_fans" />
<ImageView
android:layout_width="0dp"
android:layout_height="0dp"
android:src="@mipmap/live_more_icon_fans"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/red_point"
android:layout_width="10dp"
android:layout_height="10dp"
android:background="@drawable/bg_red_point"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible" />
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"

View File

@ -3,6 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"> android:orientation="vertical">
<RelativeLayout <RelativeLayout
@ -391,12 +392,35 @@
android:background="@drawable/background_gift" android:background="@drawable/background_gift"
/> />
<!--特权--> <!--特权-->
<ImageView <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/live_privilege" android:layout_width="40dp"
android:layout_width="35dp" android:layout_height="40dp">
android:layout_height="35dp"
android:layout_marginEnd="8dp"
android:src="@mipmap/icon_privilege" />
<ImageView
android:id="@+id/live_privilege"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginEnd="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:src="@mipmap/icon_privilege" />
<View
android:id="@+id/privilege_red_point"
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="10dp"
android:background="@drawable/bg_red_point"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible" />
</androidx.constraintlayout.widget.ConstraintLayout>
<!--普通工具合集--> <!--普通工具合集-->
<ImageView <ImageView
android:id="@+id/total_image" android:id="@+id/total_image"