diff --git a/common/src/main/java/com/yunbao/common/adapter/MonthGiftNamingAdapter.java b/common/src/main/java/com/yunbao/common/adapter/MonthGiftNamingAdapter.java new file mode 100644 index 000000000..ed15f7b54 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/adapter/MonthGiftNamingAdapter.java @@ -0,0 +1,43 @@ +package com.yunbao.common.adapter; + +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.yunbao.common.R; +import com.yunbao.common.bean.GiftWallModel; +import com.yunbao.common.views.MonthGiftNamingViewHolder; + +import java.util.ArrayList; +import java.util.List; + +public class MonthGiftNamingAdapter extends RecyclerView.Adapter { + private List giftWall = new ArrayList<>(); + + @NonNull + @Override + public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + View herdView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_month_gift_naming, parent, false); + return new MonthGiftNamingViewHolder(herdView); + } + + @Override + public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { + MonthGiftNamingViewHolder monthGiftNamingViewHolder = (MonthGiftNamingViewHolder) holder; + monthGiftNamingViewHolder.showData(giftWall.get(position)); + } + + @Override + public int getItemCount() { + return giftWall.size(); + } + + public void addAllData(List mGiftWall) { + giftWall.clear(); + giftWall.addAll(mGiftWall); + notifyDataSetChanged(); + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/GiftWallGiftDetail.java b/common/src/main/java/com/yunbao/common/bean/GiftWallGiftDetail.java new file mode 100644 index 000000000..7c069265f --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/GiftWallGiftDetail.java @@ -0,0 +1,51 @@ +package com.yunbao.common.bean; + +import com.google.gson.annotations.SerializedName; + +public class GiftWallGiftDetail extends BaseModel { + + @SerializedName("uid") + private int uid; + @SerializedName("user_nicename") + private String userNicename; + @SerializedName("avatar") + private String avatar; + @SerializedName("naming_coin") + private int namingCoin; + + public int getUid() { + return uid; + } + + public GiftWallGiftDetail setUid(int uid) { + this.uid = uid; + return this; + } + + public String getUserNicename() { + return userNicename; + } + + public GiftWallGiftDetail setUserNicename(String userNicename) { + this.userNicename = userNicename; + return this; + } + + public String getAvatar() { + return avatar; + } + + public GiftWallGiftDetail setAvatar(String avatar) { + this.avatar = avatar; + return this; + } + + public int getNamingCoin() { + return namingCoin; + } + + public GiftWallGiftDetail setNamingCoin(int namingCoin) { + this.namingCoin = namingCoin; + return this; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/GiftWallModel.java b/common/src/main/java/com/yunbao/common/bean/GiftWallModel.java index 83cbb6359..38484a554 100644 --- a/common/src/main/java/com/yunbao/common/bean/GiftWallModel.java +++ b/common/src/main/java/com/yunbao/common/bean/GiftWallModel.java @@ -63,6 +63,39 @@ public class GiftWallModel extends BaseModel { private String gifticonTotal; @SerializedName("gift_count_number") private String giftCountNumber; + @SerializedName("user_nicename") + private String userNicename; + @SerializedName("avatar") + private String avatar; + @SerializedName("naming_coin_max") + private String namingCoinMax; + + public String getNamingCoinMax() { + return namingCoinMax; + } + + public GiftWallModel setNamingCoinMax(String namingCoinMax) { + this.namingCoinMax = namingCoinMax; + return this; + } + + public String getAvatar() { + return avatar; + } + + public GiftWallModel setAvatar(String avatar) { + this.avatar = avatar; + return this; + } + + public String getUserNicename() { + return userNicename; + } + + public GiftWallModel setUserNicename(String userNicename) { + this.userNicename = userNicename; + return this; + } public String getId() { return id; diff --git a/common/src/main/java/com/yunbao/common/dialog/GiftWallItemPopup.java b/common/src/main/java/com/yunbao/common/dialog/GiftWallItemPopup.java deleted file mode 100644 index c3a09ee04..000000000 --- a/common/src/main/java/com/yunbao/common/dialog/GiftWallItemPopup.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.yunbao.common.dialog; - - -import android.content.Context; - -import androidx.annotation.NonNull; - -import com.lxj.xpopup.core.CenterPopupView; -import com.yunbao.common.R; - -public class GiftWallItemPopup extends CenterPopupView { - public GiftWallItemPopup(@NonNull Context context) { - super(context); - } - - @Override - protected int getImplLayoutId() { - return R.layout.popup_gift_wall_item; - } - - @Override - protected void onCreate() { - super.onCreate(); - } -} diff --git a/common/src/main/java/com/yunbao/common/event/GiftWallItemEvent.java b/common/src/main/java/com/yunbao/common/event/GiftWallItemEvent.java new file mode 100644 index 000000000..301d46608 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/event/GiftWallItemEvent.java @@ -0,0 +1,27 @@ +package com.yunbao.common.event; + +import com.yunbao.common.bean.BaseModel; +import com.yunbao.common.bean.GiftWallModel; + +public class GiftWallItemEvent extends BaseModel { + private GiftWallModel giftWallModel; + private boolean unlit; + + public GiftWallModel getGiftWallModel() { + return giftWallModel; + } + + public GiftWallItemEvent setGiftWallModel(GiftWallModel giftWallModel) { + this.giftWallModel = giftWallModel; + return this; + } + + public boolean isUnlit() { + return unlit; + } + + public GiftWallItemEvent setUnlit(boolean unlit) { + this.unlit = unlit; + return this; + } +} diff --git a/common/src/main/java/com/yunbao/common/fragment/AllServiceChampionFragment.java b/common/src/main/java/com/yunbao/common/fragment/AllServiceChampionFragment.java new file mode 100644 index 000000000..8f6501212 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/fragment/AllServiceChampionFragment.java @@ -0,0 +1,73 @@ +package com.yunbao.common.fragment; + +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +import androidx.fragment.app.FragmentTransaction; + +import com.yunbao.common.R; +import com.yunbao.common.views.weight.ViewClicksAntiShake; + +public class AllServiceChampionFragment extends BaseFragment { + private TextView winnerOfTheMonth, lastMonthWinner; + private String mStream, mLiveUid; + @Override + public View createView(LayoutInflater layoutInflater, ViewGroup viewGroup) { + return layoutInflater.inflate(R.layout.fragment_all_service_champion, viewGroup, false); + } + + @Override + protected void initVariables(Bundle bundle) { + mStream = bundle.getString("mStream"); + mLiveUid = bundle.getString("mLiveUid"); + } + + @Override + protected void initViews(Bundle savedInstanceState, View contentView) { + winnerOfTheMonth = contentView.findViewById(R.id.winner_of_the_month); + lastMonthWinner = contentView.findViewById(R.id.last_month_winner); + winnerOfTheMonth.setSelected(true); + lastMonthWinner.setSelected(false); + + FragmentTransaction transaction = getChildFragmentManager().beginTransaction(); + transaction.replace(R.id.context_layout_gift, CurrentMonthGiftNamingFragment.newInstance(mStream, mLiveUid)); + transaction.commit(); + ViewClicksAntiShake.clicksAntiShake(winnerOfTheMonth, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + winnerOfTheMonth.setSelected(true); + lastMonthWinner.setSelected(false); + + FragmentTransaction transaction = getChildFragmentManager().beginTransaction(); + transaction.replace(R.id.context_layout_gift, CurrentMonthGiftNamingFragment.newInstance(mStream, mLiveUid)); + transaction.commit(); + } + }); + ViewClicksAntiShake.clicksAntiShake(lastMonthWinner, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + lastMonthWinner.setSelected(true); + winnerOfTheMonth.setSelected(false); + FragmentTransaction transaction = getChildFragmentManager().beginTransaction(); + transaction.replace(R.id.context_layout_gift, LastMonthGiftNamingFragment.newInstance(mStream, mLiveUid)); + transaction.commit(); + } + }); + } + + @Override + protected void loadData() { + + } + public static AllServiceChampionFragment newInstance(String mStream, String mLiveUid) { + AllServiceChampionFragment allServiceChampionFragment = new AllServiceChampionFragment(); + Bundle bundle = new Bundle(); + bundle.putString("mStream", mStream); + bundle.putString("mLiveUid", mLiveUid); + allServiceChampionFragment.setArguments(bundle); + return allServiceChampionFragment; + } +} diff --git a/common/src/main/java/com/yunbao/common/fragment/CurrentMonthGiftNamingFragment.java b/common/src/main/java/com/yunbao/common/fragment/CurrentMonthGiftNamingFragment.java new file mode 100644 index 000000000..53364a780 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/fragment/CurrentMonthGiftNamingFragment.java @@ -0,0 +1,79 @@ +package com.yunbao.common.fragment; + +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import androidx.recyclerview.widget.GridLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import com.yunbao.common.R; +import com.yunbao.common.adapter.MonthGiftNamingAdapter; +import com.yunbao.common.bean.GiftWallModel; +import com.yunbao.common.http.base.HttpCallback; +import com.yunbao.common.http.live.LiveNetManager; +import com.yunbao.common.utils.ToastUtil; + +import java.util.List; + +public class CurrentMonthGiftNamingFragment extends BaseFragment { + private String mStream, mLiveUid; + private RecyclerView giftList; + private MonthGiftNamingAdapter monthGiftNamingAdapter; + private View noData; + + @Override + public View createView(LayoutInflater layoutInflater, ViewGroup viewGroup) { + return layoutInflater.inflate(R.layout.fragment_current_month_gift_naming, viewGroup, false); + } + + + @Override + protected void initVariables(Bundle bundle) { + mStream = bundle.getString("mStream"); + mLiveUid = bundle.getString("mLiveUid"); + } + + @Override + protected void initViews(Bundle savedInstanceState, View contentView) { + giftList = contentView.findViewById(R.id.gift_list); + noData = contentView.findViewById(R.id.no_data); + monthGiftNamingAdapter = new MonthGiftNamingAdapter(); + giftList.setLayoutManager(new GridLayoutManager(getContext(), 3, GridLayoutManager.VERTICAL, false)); + giftList.setAdapter(monthGiftNamingAdapter); + } + + @Override + protected void loadData() { + LiveNetManager.get(getContext()). + currentMonthGiftNaming(new HttpCallback>() { + @Override + public void onSuccess(List data) { + if (data.size() > 0) { + giftList.setVisibility(View.VISIBLE); + noData.setVisibility(View.GONE); + monthGiftNamingAdapter.addAllData(data); + } else { + giftList.setVisibility(View.GONE); + noData.setVisibility(View.VISIBLE); + + } + } + + @Override + public void onError(String error) { + ToastUtil.show(error); + } + }); + } + + public static CurrentMonthGiftNamingFragment newInstance(String mStream, String mLiveUid) { + CurrentMonthGiftNamingFragment currentMonthGiftNamingFragment = new CurrentMonthGiftNamingFragment(); + Bundle bundle = new Bundle(); + bundle.putString("mStream", mStream); + bundle.putString("mLiveUid", mLiveUid); + currentMonthGiftNamingFragment.setArguments(bundle); + return currentMonthGiftNamingFragment; + } +} diff --git a/common/src/main/java/com/yunbao/common/fragment/LastMonthGiftNamingFragment.java b/common/src/main/java/com/yunbao/common/fragment/LastMonthGiftNamingFragment.java new file mode 100644 index 000000000..7aaabb134 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/fragment/LastMonthGiftNamingFragment.java @@ -0,0 +1,79 @@ +package com.yunbao.common.fragment; + +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import androidx.recyclerview.widget.GridLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import com.yunbao.common.R; +import com.yunbao.common.adapter.MonthGiftNamingAdapter; +import com.yunbao.common.bean.GiftWallModel; +import com.yunbao.common.http.base.HttpCallback; +import com.yunbao.common.http.live.LiveNetManager; +import com.yunbao.common.utils.ToastUtil; + +import java.util.List; + +public class LastMonthGiftNamingFragment extends BaseFragment { + private String mStream, mLiveUid; + private RecyclerView giftList; + private MonthGiftNamingAdapter monthGiftNamingAdapter; + private View noData; + + @Override + public View createView(LayoutInflater layoutInflater, ViewGroup viewGroup) { + return layoutInflater.inflate(R.layout.fragment_last_month_gift_naming, viewGroup, false); + } + + + @Override + protected void initVariables(Bundle bundle) { + mStream = bundle.getString("mStream"); + mLiveUid = bundle.getString("mLiveUid"); + } + + @Override + protected void initViews(Bundle savedInstanceState, View contentView) { + giftList = contentView.findViewById(R.id.gift_list); + noData = contentView.findViewById(R.id.no_data); + monthGiftNamingAdapter = new MonthGiftNamingAdapter(); + giftList.setLayoutManager(new GridLayoutManager(getContext(), 3, GridLayoutManager.VERTICAL, false)); + giftList.setAdapter(monthGiftNamingAdapter); + } + + @Override + protected void loadData() { + LiveNetManager.get(getContext()). + lastMonthGiftNaming(new HttpCallback>() { + @Override + public void onSuccess(List data) { + if (data.size() > 0) { + giftList.setVisibility(View.VISIBLE); + noData.setVisibility(View.GONE); + monthGiftNamingAdapter.addAllData(data); + } else { + giftList.setVisibility(View.GONE); + noData.setVisibility(View.VISIBLE); + + } + } + + @Override + public void onError(String error) { + ToastUtil.show(error); + } + }); + } + + public static LastMonthGiftNamingFragment newInstance(String mStream, String mLiveUid) { + LastMonthGiftNamingFragment lastMonthGiftNamingFragment = new LastMonthGiftNamingFragment(); + Bundle bundle = new Bundle(); + bundle.putString("mStream", mStream); + bundle.putString("mLiveUid", mLiveUid); + lastMonthGiftNamingFragment.setArguments(bundle); + return lastMonthGiftNamingFragment; + } +} diff --git a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java index 248c73191..54573f999 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -13,6 +13,8 @@ import com.yunbao.common.bean.DiscountsModel; import com.yunbao.common.bean.EnterRoomNewModel; import com.yunbao.common.bean.FaceBookUpModel; import com.yunbao.common.bean.GiftAlreadyWallModel; +import com.yunbao.common.bean.GiftWallGiftDetail; +import com.yunbao.common.bean.GiftWallModel; import com.yunbao.common.bean.HourRank; import com.yunbao.common.bean.HttpCallbackModel; import com.yunbao.common.bean.IMLoginModel; @@ -847,4 +849,29 @@ public interface PDLiveApi { @Query("liveuid") String liveUid ); + /** + * 礼物墙选中礼物详情 + */ + @GET("/api/public/?service=Gift.giftDetail") + Observable> giftDetail( + @Query("liveuid") String liveUid, + @Query("gift_id") String giftId + ); + + /** + * 礼物墙本月冠名礼物 + * + * @return + */ + @GET("/api/public/?service=Gift.currentMonthGiftNaming") + Observable>> currentMonthGiftNaming(); + + /** + * 礼物墙上月冠名 + * + * @return + */ + @GET("/api/public/?service=Gift.lastMonthGiftNaming") + Observable>> lastMonthGiftNaming(); + } diff --git a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java index 39959de77..6ee8b6508 100644 --- a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java +++ b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java @@ -14,6 +14,8 @@ import com.yunbao.common.bean.CustomSidebarInfoModel; import com.yunbao.common.bean.DiscountsModel; import com.yunbao.common.bean.EnterRoomNewModel; import com.yunbao.common.bean.GiftAlreadyWallModel; +import com.yunbao.common.bean.GiftWallGiftDetail; +import com.yunbao.common.bean.GiftWallModel; import com.yunbao.common.bean.HttpCallbackModel; import com.yunbao.common.bean.LinkMicUserBean; import com.yunbao.common.bean.LinkMicUserBeanV2; @@ -1818,6 +1820,7 @@ public class LiveNetManager { } }).isDisposed(); } + public void giftWithoutWall(String liveUid, HttpCallback callback) { API.get().pdLiveApi(mContext) .giftWithoutWall(liveUid) @@ -1840,6 +1843,72 @@ public class LiveNetManager { }).isDisposed(); } + public void giftDetail(String liveUid, String giftId, HttpCallback callback) { + API.get().pdLiveApi(mContext) + .giftDetail(liveUid, giftId) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>() { + @Override + public void accept(ResponseModel giftWallGiftDetailResponseModel) throws Exception { + if (callback != null) { + callback.onSuccess(giftWallGiftDetailResponseModel.getData().getInfo()); + } + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + } + + public void currentMonthGiftNaming(HttpCallback> callback) { + API.get().pdLiveApi(mContext) + .currentMonthGiftNaming() + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>>() { + @Override + public void accept(ResponseModel> listResponseModel) throws Exception { + if (callback != null) { + callback.onSuccess(listResponseModel.getData().getInfo()); + } + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + } + + public void lastMonthGiftNaming(HttpCallback> callback) { + API.get().pdLiveApi(mContext) + .lastMonthGiftNaming() + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>>() { + @Override + public void accept(ResponseModel> listResponseModel) throws Exception { + if (callback != null) { + callback.onSuccess(listResponseModel.getData().getInfo()); + } + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + } + /** * 直播间取消网络请求 */ diff --git a/common/src/main/java/com/yunbao/common/views/GiftAlreadyWallViewHolder.java b/common/src/main/java/com/yunbao/common/views/GiftAlreadyWallViewHolder.java index b7244cd9b..e19c54ad6 100644 --- a/common/src/main/java/com/yunbao/common/views/GiftAlreadyWallViewHolder.java +++ b/common/src/main/java/com/yunbao/common/views/GiftAlreadyWallViewHolder.java @@ -9,7 +9,10 @@ import androidx.recyclerview.widget.RecyclerView; import com.yunbao.common.R; import com.yunbao.common.bean.GiftWallModel; +import com.yunbao.common.event.GiftWallItemEvent; import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.utils.Bus; +import com.yunbao.common.views.weight.ViewClicksAntiShake; public class GiftAlreadyWallViewHolder extends RecyclerView.ViewHolder { private ImageView giftImg; @@ -24,5 +27,11 @@ public class GiftAlreadyWallViewHolder extends RecyclerView.ViewHolder { public void showData(GiftWallModel giftWallModel) { giftTitle.setText(giftWallModel.getGiftname()); ImgLoader.display(itemView.getContext(), giftWallModel.getGifticon(), giftImg); + ViewClicksAntiShake.clicksAntiShake(itemView, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + Bus.get().post(new GiftWallItemEvent().setGiftWallModel(giftWallModel).setUnlit(true)); + } + }); } } diff --git a/common/src/main/java/com/yunbao/common/views/GiftWithoutWallViewHolder.java b/common/src/main/java/com/yunbao/common/views/GiftWithoutWallViewHolder.java index 4685e441d..9cd0d6f9e 100644 --- a/common/src/main/java/com/yunbao/common/views/GiftWithoutWallViewHolder.java +++ b/common/src/main/java/com/yunbao/common/views/GiftWithoutWallViewHolder.java @@ -7,11 +7,11 @@ import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; -import com.lxj.xpopup.XPopup; import com.yunbao.common.R; import com.yunbao.common.bean.GiftWallModel; -import com.yunbao.common.dialog.GiftWallItemPopup; +import com.yunbao.common.event.GiftWallItemEvent; import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.utils.Bus; import com.yunbao.common.views.weight.ViewClicksAntiShake; public class GiftWithoutWallViewHolder extends RecyclerView.ViewHolder { @@ -30,9 +30,7 @@ public class GiftWithoutWallViewHolder extends RecyclerView.ViewHolder { ViewClicksAntiShake.clicksAntiShake(itemView, new ViewClicksAntiShake.ViewClicksCallBack() { @Override public void onViewClicks() { - new XPopup.Builder(itemView.getContext()) - .asCustom(new GiftWallItemPopup(itemView.getContext())) - .show(); + Bus.get().post(new GiftWallItemEvent().setGiftWallModel(giftWallModel).setUnlit(false)); } }); } diff --git a/common/src/main/java/com/yunbao/common/views/MonthGiftNamingViewHolder.java b/common/src/main/java/com/yunbao/common/views/MonthGiftNamingViewHolder.java new file mode 100644 index 000000000..35da55a3a --- /dev/null +++ b/common/src/main/java/com/yunbao/common/views/MonthGiftNamingViewHolder.java @@ -0,0 +1,35 @@ +package com.yunbao.common.views; + +import android.view.View; +import android.widget.ImageView; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.yunbao.common.R; +import com.yunbao.common.bean.GiftWallModel; +import com.yunbao.common.glide.ImgLoader; + +public class MonthGiftNamingViewHolder extends RecyclerView.ViewHolder { + private ImageView giftImg, avatar; + private TextView giftTitle, namingCoin, userName; + + public MonthGiftNamingViewHolder(@NonNull View itemView) { + super(itemView); + giftImg = itemView.findViewById(R.id.gift_img); + avatar = itemView.findViewById(R.id.avatar); + giftTitle = itemView.findViewById(R.id.gift_title); + namingCoin = itemView.findViewById(R.id.naming_coin); + userName = itemView.findViewById(R.id.user_name); + } + + public void showData(GiftWallModel giftWallModel) { + giftTitle.setText(giftWallModel.getGiftname()); + namingCoin.setText(giftWallModel.getNamingCoinMax()); + userName.setText(giftWallModel.getUserNicename()); + ImgLoader.display(itemView.getContext(), giftWallModel.getGifticon(), giftImg); + ImgLoader.display(itemView.getContext(), giftWallModel.getAvatar(), avatar); + + } +} diff --git a/common/src/main/java/com/yunbao/common/views/weight/ViewClicksAntiShake.java b/common/src/main/java/com/yunbao/common/views/weight/ViewClicksAntiShake.java index b2474695e..c59283b42 100644 --- a/common/src/main/java/com/yunbao/common/views/weight/ViewClicksAntiShake.java +++ b/common/src/main/java/com/yunbao/common/views/weight/ViewClicksAntiShake.java @@ -8,7 +8,7 @@ import java.util.concurrent.TimeUnit; import io.reactivex.Observer; import io.reactivex.disposables.Disposable; -import kotlin.*; +import kotlin.Unit; /** * View防抖 diff --git a/common/src/main/res/drawable/background_select_all_service.xml b/common/src/main/res/drawable/background_select_all_service.xml new file mode 100644 index 000000000..aab1d1cb8 --- /dev/null +++ b/common/src/main/res/drawable/background_select_all_service.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/fragment_all_service_champion.xml b/common/src/main/res/layout/fragment_all_service_champion.xml new file mode 100644 index 000000000..6e2e6ffb5 --- /dev/null +++ b/common/src/main/res/layout/fragment_all_service_champion.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/fragment_current_month_gift_naming.xml b/common/src/main/res/layout/fragment_current_month_gift_naming.xml new file mode 100644 index 000000000..37a78bbb7 --- /dev/null +++ b/common/src/main/res/layout/fragment_current_month_gift_naming.xml @@ -0,0 +1,24 @@ + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/fragment_gift_already_wall.xml b/common/src/main/res/layout/fragment_gift_already_wall.xml index 55ebffda9..846998445 100644 --- a/common/src/main/res/layout/fragment_gift_already_wall.xml +++ b/common/src/main/res/layout/fragment_gift_already_wall.xml @@ -74,6 +74,7 @@ android:textSize="12sp" /> + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/item_month_gift_naming.xml b/common/src/main/res/layout/item_month_gift_naming.xml new file mode 100644 index 000000000..ea267bc88 --- /dev/null +++ b/common/src/main/res/layout/item_month_gift_naming.xml @@ -0,0 +1,65 @@ + + + + + + + + +a + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/popup_gift_wall_item.xml b/common/src/main/res/layout/popup_gift_wall_item.xml index 02b2826d6..d7fd2c668 100644 --- a/common/src/main/res/layout/popup_gift_wall_item.xml +++ b/common/src/main/res/layout/popup_gift_wall_item.xml @@ -1,10 +1,158 @@ + android:orientation="vertical" + app:cardCornerRadius="10dp" + app:cardElevation="0dp"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/mipmap-hdpi/background_gift_wall_item.png b/common/src/main/res/mipmap-xxhdpi/background_gift_wall_item.png similarity index 100% rename from live/src/main/res/mipmap-hdpi/background_gift_wall_item.png rename to common/src/main/res/mipmap-xxhdpi/background_gift_wall_item.png diff --git a/common/src/main/res/mipmap-xxhdpi/icon_vacant_position_awaits.png b/common/src/main/res/mipmap-xxhdpi/icon_vacant_position_awaits.png new file mode 100644 index 000000000..bc47926ff Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/icon_vacant_position_awaits.png differ diff --git a/common/src/main/res/values-en-rUS/string.xml b/common/src/main/res/values-en-rUS/string.xml index 96bd3694f..3cbc3365f 100644 --- a/common/src/main/res/values-en-rUS/string.xml +++ b/common/src/main/res/values-en-rUS/string.xml @@ -1272,7 +1272,7 @@ Limited ride And limited avatar frame When the gift in the guidebook is the same as the gift in the gift wall, give the same gift Objects, first point the gift on the gift wall, and then light up the gift in the guidebook. Honor achievement Medal of Achievement Medal of achievement - Currently, there are three achievements, namely A cloud of good friends,Very rich, + Currently, there are three achievements, namely A cloud of good friends, A rich party, Very rich, A cloud of good friends: When the number of gifts received reaches 20, 30, 50, 100When it comes to 200 models, light up the corresponding achievements separately;Rich and capriciou A rich party: When the price of a single gift received exceeds 50000 diamonds, it is sufficient Illuminate the achievement; Very rich: When receiving 100 gifts priced over 3000 diamonds, i.e This achievement can be illuminated. diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index 4faaf5e62..60af067da 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -1270,7 +1270,7 @@ Limited ride And limited avatar frame When the gift in the guidebook is the same as the gift in the gift wall, give the same gift Objects, first point the gift on the gift wall, and then light up the gift in the guidebook. Honor achievement Medal of Achievement Medal of achievement - Currently, there are three achievements, namely A cloud of good friends,Very rich, + Currently, there are three achievements, namely A cloud of good friends, A rich party, Very rich, A cloud of good friends: When the number of gifts received reaches 20, 30, 50, 100When it comes to 200 models, light up the corresponding achievements separately;Rich and capriciou A rich party: When the price of a single gift received exceeds 50000 diamonds, it is sufficient Illuminate the achievement; Very rich: When receiving 100 gifts priced over 3000 diamonds, i.e This achievement can be illuminated. @@ -1283,5 +1283,13 @@ Limited ride And limited avatar frame Illustrated book Honorary achievement Lit + 規則介紹 + 禮物詳情 + 虛位以待 + 距離冠名還需%s鑽 + 送TA + 本月得主 + 上月得主 + 上月奪得最終禮物冠名權用戶將獲得該禮物一個月專屬冠名皮膚 diff --git a/live/src/main/java/com/yunbao/live/dialog/GiftWallDialog.java b/live/src/main/java/com/yunbao/live/dialog/GiftWallDialog.java index 37b88a0d5..6e518a59d 100644 --- a/live/src/main/java/com/yunbao/live/dialog/GiftWallDialog.java +++ b/live/src/main/java/com/yunbao/live/dialog/GiftWallDialog.java @@ -16,7 +16,9 @@ import com.lxj.xpopup.XPopup; import com.makeramen.roundedimageview.RoundedImageView; import com.yunbao.common.Constants; import com.yunbao.common.dialog.AbsDialogFragment; -import com.yunbao.common.fragment.GiftAlreadyWallFragment; +import com.yunbao.common.event.GiftWallItemEvent; +import com.yunbao.common.fragment.AllServiceChampionFragment; +import com.yunbao.live.views.GiftAlreadyWallFragment; import com.yunbao.common.fragment.GiftWithoutWallFragment; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.CommonHttpUtil; @@ -26,8 +28,8 @@ import com.yunbao.common.utils.Bus; import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.live.R; import com.yunbao.live.activity.LiveActivity; -import com.yunbao.live.event.GiftTitleEvent; import com.yunbao.live.event.LiveAudienceEvent; +import com.yunbao.live.event.LiveGiftDialogEvent; import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; @@ -97,6 +99,10 @@ public class GiftWallDialog extends AbsDialogFragment { @Override public void onViewClicks() { selectTab(textAllServiceChampion, viewAllServiceChampion); + + FragmentTransaction transaction = getChildFragmentManager().beginTransaction(); + transaction.replace(R.id.context_layout_gift, AllServiceChampionFragment.newInstance(mStream, mLiveUid)); + transaction.commit(); } }); ViewClicksAntiShake.clicksAntiShake(attention, new ViewClicksAntiShake.ViewClicksCallBack() { @@ -196,7 +202,14 @@ public class GiftWallDialog extends AbsDialogFragment { * 关于点击礼物分类的通知 */ @Subscribe(threadMode = ThreadMode.MAIN) - public void onGiftTitleEvent(GiftTitleEvent event) { + public void onGiftWallItemEvent(GiftWallItemEvent event) { + new XPopup.Builder(getActivity()) + .asCustom(new GiftWallItemPopup(getActivity(), event.getGiftWallModel(), event.isUnlit(), mLiveUid, mStream)) + .show(); + } + @Subscribe(threadMode = ThreadMode.MAIN) + public void onLiveGiftDialogEvent(LiveGiftDialogEvent event) { + dismiss(); } } diff --git a/live/src/main/java/com/yunbao/live/dialog/GiftWallItemPopup.java b/live/src/main/java/com/yunbao/live/dialog/GiftWallItemPopup.java new file mode 100644 index 000000000..bec97cd32 --- /dev/null +++ b/live/src/main/java/com/yunbao/live/dialog/GiftWallItemPopup.java @@ -0,0 +1,110 @@ +package com.yunbao.live.dialog; + + +import android.content.Context; +import android.widget.ImageView; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.cardview.widget.CardView; + +import com.lxj.xpopup.core.CenterPopupView; +import com.yunbao.common.R; +import com.yunbao.common.bean.GiftWallGiftDetail; +import com.yunbao.common.bean.GiftWallModel; +import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.http.base.HttpCallback; +import com.yunbao.common.http.live.LiveNetManager; +import com.yunbao.common.utils.Bus; +import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.views.weight.ViewClicksAntiShake; +import com.yunbao.live.event.LiveAudienceEvent; +import com.yunbao.live.event.LiveGiftDialogEvent; + +public class GiftWallItemPopup extends CenterPopupView { + private CardView layout; + private ImageView giftImg, avatar; + private TextView price, giftDetailsBtn, distanceNaming, vacantPositionAwaits, giftDetails, vacantPosition; + private GiftWallModel giftWallModel; + private boolean unlit; + private String mLiveUid, mStream; + + public GiftWallItemPopup(@NonNull Context context, GiftWallModel giftWallModel, + boolean unlit, String mLiveUid, String mStream) { + super(context); + this.giftWallModel = giftWallModel; + this.unlit = unlit; + this.mLiveUid = mLiveUid; + this.mStream = mStream; + } + + @Override + protected int getImplLayoutId() { + return R.layout.popup_gift_wall_item; + } + + @Override + protected void onCreate() { + super.onCreate(); + layout = findViewById(R.id.layout); + giftImg = findViewById(R.id.gift_img); + price = findViewById(R.id.price); + giftDetails = findViewById(R.id.gift_details); + giftDetailsBtn = findViewById(R.id.gift_details_btn); + distanceNaming = findViewById(R.id.distance_naming); + vacantPositionAwaits = findViewById(R.id.vacant_position_awaits); + vacantPosition = findViewById(R.id.vacant_position); + avatar = findViewById(R.id.avatar); + if (unlit) { + giftDetailsBtn.setText(getContext().getText(R.string.send_hem)); + } else { + giftDetailsBtn.setText(getContext().getText(R.string.instant_light)); + } + ImgLoader.display(getContext(), giftWallModel.getGifticon(), giftImg); + giftDetails.setText(giftWallModel.getGiftname()); + price.setText(giftWallModel.getNeedcoin()); + loadData(); + ViewClicksAntiShake.clicksAntiShake(giftDetailsBtn, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + Bus.get().post(new LiveAudienceEvent() + .setType(LiveAudienceEvent.LiveAudienceType.GIFT_POPUP) + .setmLiveUid(mLiveUid) + .setmStream(mStream) + .setmWishGiftId(giftWallModel.getId())); + Bus.get().post(new LiveGiftDialogEvent()); + dialog.dismiss(); + } + }); + + } + + public void loadData() { + LiveNetManager.get(getContext()). + giftDetail(mLiveUid, String.valueOf(giftDetails.getId()), new HttpCallback() { + @Override + public void onSuccess(GiftWallGiftDetail data) { + if (data.getUid() == 0) { + ImgLoader.display(getContext(), R.mipmap.icon_vacant_position_awaits, avatar); + vacantPositionAwaits.setText(getContext().getText(R.string.vacant_position_awaits)); + vacantPosition.setText("?"); + } else { + ImgLoader.display(getContext(), data.getAvatar(), avatar); + vacantPositionAwaits.setText(data.getUserNicename()); + vacantPosition.setText(giftWallModel.getGiftname()); + } + if (data.getNamingCoin() == 0) { + distanceNaming.setVisibility(GONE); + } else { + distanceNaming.setVisibility(VISIBLE); + distanceNaming.setText(String.format(getContext().getString(R.string.distance_naming), String.valueOf(data.getNamingCoin()))); + } + } + + @Override + public void onError(String error) { + ToastUtil.show(error); + } + }); + } +} diff --git a/live/src/main/java/com/yunbao/live/dialog/RegularIntroducePopup.java b/live/src/main/java/com/yunbao/live/dialog/RegularIntroducePopup.java index b1f992dc3..68d143009 100644 --- a/live/src/main/java/com/yunbao/live/dialog/RegularIntroducePopup.java +++ b/live/src/main/java/com/yunbao/live/dialog/RegularIntroducePopup.java @@ -2,17 +2,24 @@ package com.yunbao.live.dialog; import android.content.Context; +import android.graphics.Color; +import android.text.Spannable; +import android.text.SpannableStringBuilder; +import android.widget.TextView; import androidx.annotation.NonNull; import com.lxj.xpopup.impl.FullScreenPopupView; import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.live.R; +import com.yunbao.live.utils.LinearGradientFontSpan; /** * 礼物冠名规则 */ public class RegularIntroducePopup extends FullScreenPopupView { + private TextView regularTitle; + public RegularIntroducePopup(@NonNull Context context) { super(context); } @@ -25,6 +32,13 @@ public class RegularIntroducePopup extends FullScreenPopupView { @Override protected void onCreate() { super.onCreate(); + regularTitle = findViewById(R.id.regular_title); + String title = getContext().getString(R.string.rule_introduction); + SpannableStringBuilder builder = new SpannableStringBuilder(); + builder.append(title); + builder.setSpan(new LinearGradientFontSpan(Color.parseColor("#ffffff"), + Color.parseColor("#F7FDFF")), 0, title.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + regularTitle.setText(builder); //初始化 ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.close_btn), new ViewClicksAntiShake.ViewClicksCallBack() { @Override diff --git a/common/src/main/java/com/yunbao/common/fragment/GiftAlreadyWallFragment.java b/live/src/main/java/com/yunbao/live/views/GiftAlreadyWallFragment.java similarity index 77% rename from common/src/main/java/com/yunbao/common/fragment/GiftAlreadyWallFragment.java rename to live/src/main/java/com/yunbao/live/views/GiftAlreadyWallFragment.java index ae1d4f378..ddf30f143 100644 --- a/common/src/main/java/com/yunbao/common/fragment/GiftAlreadyWallFragment.java +++ b/live/src/main/java/com/yunbao/live/views/GiftAlreadyWallFragment.java @@ -1,4 +1,4 @@ -package com.yunbao.common.fragment; +package com.yunbao.live.views; import android.os.Bundle; import android.view.LayoutInflater; @@ -13,8 +13,13 @@ import androidx.recyclerview.widget.RecyclerView; import com.yunbao.common.R; import com.yunbao.common.adapter.GiftAlreadyWallAdapter; import com.yunbao.common.bean.GiftAlreadyWallModel; +import com.yunbao.common.fragment.BaseFragment; import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.live.LiveNetManager; +import com.yunbao.common.utils.Bus; +import com.yunbao.common.views.weight.ViewClicksAntiShake; +import com.yunbao.live.event.LiveAudienceEvent; +import com.yunbao.live.event.LiveGiftDialogEvent; /** * 已点亮礼物墙 @@ -24,7 +29,8 @@ public class GiftAlreadyWallFragment extends BaseFragment { private LinearLayout giftWallNoData, giftWallData; private RecyclerView alreadyList; private GiftAlreadyWallAdapter alreadyWallAdapter; - private TextView litIcon,giftAll; + private TextView litIcon, giftAll; + @Override public View createView(LayoutInflater layoutInflater, ViewGroup viewGroup) { return layoutInflater.inflate(R.layout.fragment_gift_already_wall, viewGroup, false); @@ -47,6 +53,16 @@ public class GiftAlreadyWallFragment extends BaseFragment { alreadyWallAdapter = new GiftAlreadyWallAdapter(); alreadyList.setLayoutManager(new GridLayoutManager(getContext(), 3, GridLayoutManager.VERTICAL, false)); alreadyList.setAdapter(alreadyWallAdapter); + ViewClicksAntiShake.clicksAntiShake(contentView.findViewById(R.id.instant_light), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + Bus.get().post(new LiveAudienceEvent() + .setType(LiveAudienceEvent.LiveAudienceType.GIFT_POPUP) + .setmLiveUid(mLiveUid) + .setmStream(mStream)); + Bus.get().post(new LiveGiftDialogEvent()); + } + }); } @Override @@ -60,7 +76,7 @@ public class GiftAlreadyWallFragment extends BaseFragment { giftWallData.setVisibility(View.VISIBLE); alreadyWallAdapter.addAllData(data.getGiftWall()); litIcon.setText(data.getGiftWallLightenNumber()); - giftAll.setText("/"+data.getGiftWallLightenTotal()); + giftAll.setText("/" + data.getGiftWallLightenTotal()); } else { giftWallNoData.setVisibility(View.VISIBLE); giftWallData.setVisibility(View.GONE); diff --git a/live/src/main/res/layout/rogular_introduce_popup.xml b/live/src/main/res/layout/rogular_introduce_popup.xml index 8b354e0cc..b8214a611 100644 --- a/live/src/main/res/layout/rogular_introduce_popup.xml +++ b/live/src/main/res/layout/rogular_introduce_popup.xml @@ -173,18 +173,22 @@ + android:background="@mipmap/background_regular_title" + android:gravity="center" + android:textSize="16sp" + android:textStyle="bold" /> \ No newline at end of file diff --git a/live/src/main/res/mipmap-xxxhdpi/background_regular_title.png b/live/src/main/res/mipmap-xxxhdpi/background_regular_title.png index 536cf6788..1c2e03194 100644 Binary files a/live/src/main/res/mipmap-xxxhdpi/background_regular_title.png and b/live/src/main/res/mipmap-xxxhdpi/background_regular_title.png differ