diff --git a/common/src/main/java/com/yunbao/common/event/LiveAudienceEvent.java b/common/src/main/java/com/yunbao/common/event/LiveAudienceEvent.java index 1b6e747d8..1d70496b9 100644 --- a/common/src/main/java/com/yunbao/common/event/LiveAudienceEvent.java +++ b/common/src/main/java/com/yunbao/common/event/LiveAudienceEvent.java @@ -35,7 +35,8 @@ public class LiveAudienceEvent extends BaseModel { LIVE_WKS(7, "周星榜"), NOBLE(8, "贵族"), LIAN_MAI(9, "连麦"), - EFFECTS_SETTINGS(10, "特效設置"); + EFFECTS_SETTINGS(10, "特效設置"), + WISH_LIST(11,"心愿单"); private int type; diff --git a/config.gradle b/config.gradle index 492fa93ba..3f66756b1 100644 --- a/config.gradle +++ b/config.gradle @@ -9,9 +9,9 @@ ext { ] manifestPlaceholders = [ //正式 - serverHost : "https://napi.yaoulive.com", +// serverHost : "https://napi.yaoulive.com", //測試 -// serverHost : "https://ceshi.yaoulive.com", + serverHost : "https://ceshi.yaoulive.com", //腾讯地图 txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB", diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java index 4dfeec4ae..ba78e8cf5 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -33,6 +33,7 @@ import com.adjust.sdk.Adjust; import com.adjust.sdk.AdjustEvent; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.blankj.utilcode.util.GsonUtils; import com.ms.banner.Banner; import com.opensource.svgaplayer.SVGAImageView; import com.tencent.imsdk.v2.V2TIMCallback; @@ -80,12 +81,14 @@ import com.yunbao.live.bean.LiveBean; import com.yunbao.live.bean.LiveGuardInfo; import com.yunbao.live.bean.LivePKUserListBean; import com.yunbao.live.bean.LiveUserGiftBean; +import com.yunbao.live.bean.WishlistModel; import com.yunbao.live.dialog.BlowkissDialog; import com.yunbao.live.dialog.LiveFansFragment; import com.yunbao.live.dialog.LiveGiftDialogFragment; import com.yunbao.live.dialog.LiveGuardDialogFragment; import com.yunbao.live.dialog.LiveHDDialogFragment; import com.yunbao.live.dialog.LiveMicUserDialogFragment; +import com.yunbao.live.dialog.LiveWishListDialogFragment4Audience; import com.yunbao.live.dialog.NewUserDialog; import com.yunbao.live.event.LinkMicTxAccEvent; import com.yunbao.live.event.LiveRoomChangeEvent; @@ -257,6 +260,7 @@ public class LiveAudienceActivity extends LiveActivity { btnSmallScreen.setVisibility(View.GONE); ((LiveAudienceActivity) mContext).mLivePlayViewHolder.smallScreen(); }); + mContainer.removeAllViews(); mLiveRoomViewHolder = new LiveRoomViewHolder(false, 1, mContext, mContainer, (GifImageView) mSecondPage.findViewById(R.id.gift_gif), (SVGAImageView) mSecondPage.findViewById(R.id.gift_svga), mContainerWrap, getWindowManager()); mLiveRoomViewHolder.addToParent(); mLiveRoomViewHolder.subscribeActivityLifeCycle(); @@ -426,8 +430,21 @@ public class LiveAudienceActivity extends LiveActivity { } }); + //心愿单 + LiveHttpUtil.getWishList(mLiveUid, new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + if (info.length > 0) { + String json = info[0]; + WishlistModel model = GsonUtils.fromJson(json, WishlistModel.class); + mLiveRoomViewHolder.initWishList(model.getWishlist()); + } + } - + @Override + public void onFinish() { + } + }); } //定时器 @@ -1493,6 +1510,14 @@ public class LiveAudienceActivity extends LiveActivity { EffectsSettingsDialog effectsSettingsDialog = new EffectsSettingsDialog(); effectsSettingsDialog.show(getSupportFragmentManager(), "EffectsSettingsDialog"); break; + case WISH_LIST: + LiveWishListDialogFragment4Audience fragment4Audience = new LiveWishListDialogFragment4Audience(); + bundle.putString(Constants.LIVE_UID, mLiveUid); + fragment4Audience.setArguments(bundle); + if (mContext instanceof LiveAudienceActivity) { + fragment4Audience.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveWishListDialogFragmentAudience"); + } + break; } diff --git a/live/src/main/java/com/yunbao/live/bean/WishlistItemModel.java b/live/src/main/java/com/yunbao/live/bean/WishlistItemModel.java new file mode 100644 index 000000000..2ff070c13 --- /dev/null +++ b/live/src/main/java/com/yunbao/live/bean/WishlistItemModel.java @@ -0,0 +1,118 @@ +package com.yunbao.live.bean; + +import com.google.gson.annotations.SerializedName; +import com.yunbao.common.bean.BaseModel; + +public class WishlistItemModel extends BaseModel { + /** + * create_time : 1660790600 + * dtime : 20220818 + * id : 101478 + * lid : 1353 + * luid : 97711 + * wishlist_icon : https://qny.shayucm.com/4yueliwu/%E8%93%9D%E8%89%B2%E7%88%B1%E6%83%85%E6%B5%B7.png + * wishlist_name : 藍色愛情海 + * wishlist_num : 1 + * wishlist_progress : 0 + */ + + @SerializedName("create_time") + private String createTime = ""; + @SerializedName("dtime") + private String dtime = ""; + @SerializedName("id") + private String id = ""; + @SerializedName("lid") + private String lid = ""; + @SerializedName("luid") + private String luid = ""; + @SerializedName("wishlist_icon") + private String wishlistIcon = ""; + @SerializedName("wishlist_name") + private String wishlistName = ""; + @SerializedName("wishlist_num") + private String wishlistNum = ""; + @SerializedName("wishlist_progress") + private String wishlistProgress = ""; + + public String getCreateTime() { + return createTime; + } + + public WishlistItemModel setCreateTime(String createTime) { + this.createTime = createTime; + return this; + } + + public String getDtime() { + return dtime; + } + + public WishlistItemModel setDtime(String dtime) { + this.dtime = dtime; + return this; + } + + public String getId() { + return id; + } + + public WishlistItemModel setId(String id) { + this.id = id; + return this; + } + + public String getLid() { + return lid; + } + + public WishlistItemModel setLid(String lid) { + this.lid = lid; + return this; + } + + public String getLuid() { + return luid; + } + + public WishlistItemModel setLuid(String luid) { + this.luid = luid; + return this; + } + + public String getWishlistIcon() { + return wishlistIcon; + } + + public WishlistItemModel setWishlistIcon(String wishlistIcon) { + this.wishlistIcon = wishlistIcon; + return this; + } + + public String getWishlistName() { + return wishlistName; + } + + public WishlistItemModel setWishlistName(String wishlistName) { + this.wishlistName = wishlistName; + return this; + } + + public String getWishlistNum() { + return wishlistNum; + } + + public WishlistItemModel setWishlistNum(String wishlistNum) { + this.wishlistNum = wishlistNum; + return this; + } + + public String getWishlistProgress() { + return wishlistProgress; + } + + public WishlistItemModel setWishlistProgress(String wishlistProgress) { + this.wishlistProgress = wishlistProgress; + return this; + } +} diff --git a/live/src/main/java/com/yunbao/live/bean/WishlistModel.java b/live/src/main/java/com/yunbao/live/bean/WishlistModel.java new file mode 100644 index 000000000..8a3d9638b --- /dev/null +++ b/live/src/main/java/com/yunbao/live/bean/WishlistModel.java @@ -0,0 +1,41 @@ +package com.yunbao.live.bean; + +import com.google.gson.annotations.SerializedName; +import com.yunbao.common.bean.BaseModel; + +import java.util.ArrayList; +import java.util.List; + +/** + * 主播心愿单 + */ +public class WishlistModel extends BaseModel { + + /** + * img : https://qny.shayucm.com/Live_icon%2FBTN_XINYUAN%403x.png + * wishlist : [{"create_time":"1660790600","dtime":20220818,"id":101478,"lid":1353,"luid":97711,"wishlist_icon":"https://qny.shayucm.com/4yueliwu/%E8%93%9D%E8%89%B2%E7%88%B1%E6%83%85%E6%B5%B7.png","wishlist_name":"藍色愛情海","wishlist_num":1,"wishlist_progress":0},{"create_time":"1660790602","dtime":20220818,"id":101479,"lid":1330,"luid":97711,"wishlist_icon":"https://qny.shayucm.com/4yueliwu/%E6%A2%A6%E5%B9%BB%E7%83%AD%E6%B0%94%E7%90%83.png","wishlist_name":"夢幻熱氣球","wishlist_num":1,"wishlist_progress":0},{"create_time":"1660790603","dtime":20220818,"id":101480,"lid":224,"luid":97711,"wishlist_icon":"https://qny.shayucm.com/603f27dc4b777.png","wishlist_name":"玫瑰花束","wishlist_num":1,"wishlist_progress":0},{"create_time":"1660790605","dtime":20220818,"id":101481,"lid":1334,"luid":97711,"wishlist_icon":"https://qny.shayucm.com/4yueliwu/%E6%B5%AA%E6%BC%AB%E6%9C%A8%E9%A9%AC.png","wishlist_name":"旋轉木馬","wishlist_num":1,"wishlist_progress":0},{"create_time":"1660790606","dtime":20220818,"id":101482,"lid":218,"luid":97711,"wishlist_icon":"https://qny.shayucm.com/603f26a290a50.png","wishlist_name":"百合","wishlist_num":1,"wishlist_progress":0},{"create_time":"1660790609","dtime":20220818,"id":101483,"lid":1333,"luid":97711,"wishlist_icon":"https://qny.shayucm.com/4yueliwu/%E6%B5%AA%E6%BC%AB%E5%90%AF%E8%88%AA.png","wishlist_name":"浪漫啟航","wishlist_num":1,"wishlist_progress":0}] + */ + + @SerializedName("img") + private String img = ""; + @SerializedName("wishlist") + private List wishlist = new ArrayList<>(); + + public String getImg() { + return img; + } + + public WishlistModel setImg(String img) { + this.img = img; + return this; + } + + public List getWishlist() { + return wishlist; + } + + public WishlistModel setWishlist(List wishlist) { + this.wishlist = wishlist; + return this; + } +} diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java index 2b2cfaffc..dca0a8cc1 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -1,5 +1,6 @@ package com.yunbao.live.views; +import android.app.Activity; import android.app.Dialog; import android.content.Context; import android.os.Bundle; @@ -8,6 +9,7 @@ import android.os.Message; import android.os.SystemClock; import android.text.TextUtils; import android.util.Log; +import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.WindowManager; @@ -16,6 +18,7 @@ import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; +import android.widget.ViewFlipper; import androidx.annotation.Nullable; import androidx.recyclerview.widget.LinearLayoutManager; @@ -75,6 +78,7 @@ import com.yunbao.live.bean.LiveLuckGiftWinBean; import com.yunbao.live.bean.LivePKUserListBean; import com.yunbao.live.bean.LiveReceiveGiftBean; import com.yunbao.live.bean.LiveUserGiftBean; +import com.yunbao.live.bean.WishlistItemModel; import com.yunbao.live.custom.LiveLightView; import com.yunbao.live.custom.TopGradual; import com.yunbao.live.dialog.LiveFansMedalDialogFragment; @@ -153,7 +157,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis public TextView room_hot; public String touid, gotoroom; public static TextView fans; - public LinearLayout fans_btn; + public LinearLayout fans_btn, wishListLayout; public static View d_pk_view; public static int isAttention = 0;//是否关注 0=没关注, public static String mNameText; @@ -626,6 +630,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis room_hot = (TextView) findViewById(R.id.room_hot); fans = (TextView) findViewById(R.id.fans); fans_btn = (LinearLayout) findViewById(R.id.fans_btn); + wishListLayout = (LinearLayout) findViewById(R.id.wish_list_layout); if (LivePushTxViewHolder.mTRTCCloud != null || LivePushRyViewHolder.rtcRoom != null) { fans_btn.setVisibility(View.GONE); @@ -793,6 +798,36 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis findViewById(R.id.ft_hot_add).setOnClickListener(this); ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.open_sidebar), () -> Bus.get().post(new LiveAudienceEvent() .setType(LiveAudienceEvent.LiveAudienceType.SIDEBAR))); + //点击心愿单 + ViewClicksAntiShake.clicksAntiShake(wishListLayout, () -> Bus.get().post(new LiveAudienceEvent() + .setType(LiveAudienceEvent.LiveAudienceType.WISH_LIST))); + + + } + + /** + * 初始化心愿单列表轮播 + */ + public void initWishList(List wishlist) { + if (wishlist.size() > 0) { + wishListLayout.setVisibility(View.VISIBLE); + } else { + wishListLayout.setVisibility(View.GONE); + } + ((Activity) mContext).runOnUiThread(() -> { + ViewFlipper wishListFlipper = (ViewFlipper) findViewById(R.id.wish_list); + for (int i = 0; i < wishlist.size(); i++) { + View wish = LayoutInflater.from(mContext).inflate(R.layout.view_wish_list, null); + ImageView wishPic = wish.findViewById(R.id.wish_pic); + TextView wishIndex = wish.findViewById(R.id.wish_index); + ImgLoader.display(mContext, wishlist.get(i).getWishlistIcon(), wishPic); + wishIndex.setText((i + 1) + "/" + wishlist.size()); + wishListFlipper.addView(wish); + } + wishListFlipper.startFlipping(); + }); + + } //点击头像 diff --git a/live/src/main/res/anim/anim_marquee_in.xml b/live/src/main/res/anim/anim_marquee_in.xml new file mode 100644 index 000000000..9fded3ca9 --- /dev/null +++ b/live/src/main/res/anim/anim_marquee_in.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/live/src/main/res/anim/anim_marquee_out.xml b/live/src/main/res/anim/anim_marquee_out.xml new file mode 100644 index 000000000..b8d9cc11c --- /dev/null +++ b/live/src/main/res/anim/anim_marquee_out.xml @@ -0,0 +1,6 @@ + + + ; + \ No newline at end of file diff --git a/live/src/main/res/layout/view_live_audience.xml b/live/src/main/res/layout/view_live_audience.xml index e5b5d6ed7..deeef0d45 100644 --- a/live/src/main/res/layout/view_live_audience.xml +++ b/live/src/main/res/layout/view_live_audience.xml @@ -173,7 +173,7 @@ android:layout_height="55dp" android:layout_gravity="right" android:layout_marginRight="10dp" - android:layout_marginBottom="20dp" + android:layout_marginBottom="50dp" android:gravity="center_horizontal" android:orientation="vertical" android:visibility="gone"> diff --git a/live/src/main/res/layout/view_live_room.xml b/live/src/main/res/layout/view_live_room.xml index 273280ae4..bd9e2d8d4 100644 --- a/live/src/main/res/layout/view_live_room.xml +++ b/live/src/main/res/layout/view_live_room.xml @@ -254,6 +254,36 @@ android:textColor="#FFFFFFFF" android:textSize="10sp" /> + + + + + + + diff --git a/live/src/main/res/layout/view_wish_list.xml b/live/src/main/res/layout/view_wish_list.xml new file mode 100644 index 000000000..432c7212a --- /dev/null +++ b/live/src/main/res/layout/view_wish_list.xml @@ -0,0 +1,21 @@ + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/mipmap-xxxhdpi/live_icon_wishlist.png b/live/src/main/res/mipmap-xxxhdpi/live_icon_wishlist.png new file mode 100644 index 000000000..c59e917c5 Binary files /dev/null and b/live/src/main/res/mipmap-xxxhdpi/live_icon_wishlist.png differ