6.5.4礼物冠名

This commit is contained in:
18401019693 2023-08-02 13:23:37 +08:00
parent 54458bd0c0
commit 5afa3bd30b
31 changed files with 1034 additions and 45 deletions

View File

@ -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<GiftWallModel> 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<GiftWallModel> mGiftWall) {
giftWall.clear();
giftWall.addAll(mGiftWall);
notifyDataSetChanged();
}
}

View File

@ -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;
}
}

View File

@ -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;

View File

@ -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();
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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<List<GiftWallModel>>() {
@Override
public void onSuccess(List<GiftWallModel> 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;
}
}

View File

@ -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<List<GiftWallModel>>() {
@Override
public void onSuccess(List<GiftWallModel> 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;
}
}

View File

@ -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<ResponseModel<GiftWallGiftDetail>> giftDetail(
@Query("liveuid") String liveUid,
@Query("gift_id") String giftId
);
/**
* 礼物墙本月冠名礼物
*
* @return
*/
@GET("/api/public/?service=Gift.currentMonthGiftNaming")
Observable<ResponseModel<List<GiftWallModel>>> currentMonthGiftNaming();
/**
* 礼物墙上月冠名
*
* @return
*/
@GET("/api/public/?service=Gift.lastMonthGiftNaming")
Observable<ResponseModel<List<GiftWallModel>>> lastMonthGiftNaming();
}

View File

@ -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<GiftAlreadyWallModel> callback) {
API.get().pdLiveApi(mContext)
.giftWithoutWall(liveUid)
@ -1840,6 +1843,72 @@ public class LiveNetManager {
}).isDisposed();
}
public void giftDetail(String liveUid, String giftId, HttpCallback<GiftWallGiftDetail> callback) {
API.get().pdLiveApi(mContext)
.giftDetail(liveUid, giftId)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<ResponseModel<GiftWallGiftDetail>>() {
@Override
public void accept(ResponseModel<GiftWallGiftDetail> giftWallGiftDetailResponseModel) throws Exception {
if (callback != null) {
callback.onSuccess(giftWallGiftDetailResponseModel.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();
}
public void currentMonthGiftNaming(HttpCallback<List<GiftWallModel>> callback) {
API.get().pdLiveApi(mContext)
.currentMonthGiftNaming()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<ResponseModel<List<GiftWallModel>>>() {
@Override
public void accept(ResponseModel<List<GiftWallModel>> 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();
}
public void lastMonthGiftNaming(HttpCallback<List<GiftWallModel>> callback) {
API.get().pdLiveApi(mContext)
.lastMonthGiftNaming()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<ResponseModel<List<GiftWallModel>>>() {
@Override
public void accept(ResponseModel<List<GiftWallModel>> 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

@ -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));
}
});
}
}

View File

@ -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));
}
});
}

View File

@ -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);
}
}

View File

@ -8,7 +8,7 @@ import java.util.concurrent.TimeUnit;
import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;
import kotlin.*;
import kotlin.Unit;
/**
* View防抖

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="false">
<shape android:shape="rectangle">
<corners android:radius="6dp" />
<solid android:color="#FFFFFF" />
</shape>
</item>
<item android:state_selected="true">
<shape android:shape="rectangle">
<corners android:radius="6dp" />
<solid android:color="#F0DBFF" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp">
<TextView
android:id="@+id/winner_of_the_month"
android:layout_width="90dp"
android:layout_height="25dp"
android:layout_marginStart="55dp"
android:background="@drawable/background_select_all_service"
android:gravity="center"
android:text="@string/winner_of_the_month"
android:textColor="#FF8331"
android:textSize="12sp" />
<TextView
android:id="@+id/last_month_winner"
android:layout_width="90dp"
android:layout_height="25dp"
android:layout_gravity="end"
android:layout_marginEnd="55dp"
android:background="@drawable/background_select_all_service"
android:gravity="center"
android:text="@string/last_month_winner"
android:textColor="#FF8331"
android:textSize="12sp" />
</FrameLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="12dp"
android:text="@string/last_month_winner_hint"
android:textColor="#807CFF"
android:textSize="10sp" />
<FrameLayout
android:id="@+id/context_layout_gift"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/gift_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingStart="5dp"
android:paddingTop="15dp"
android:paddingEnd="5dp"
android:paddingBottom="15dp"
android:visibility="gone" />
<ImageView
android:id="@+id/no_data"
android:layout_width="140dp"
android:layout_height="95dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="80dp"
android:background="@drawable/icon_gift_wall_no_data" />
</LinearLayout>

View File

@ -74,6 +74,7 @@
android:textSize="12sp" />
<TextView
android:id="@+id/instant_light"
android:layout_width="100dp"
android:layout_height="28dp"
android:layout_gravity="center_horizontal"

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/gift_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingStart="5dp"
android:paddingTop="15dp"
android:paddingEnd="5dp"
android:paddingBottom="15dp"
android:visibility="gone" />
<ImageView
android:id="@+id/no_data"
android:layout_width="140dp"
android:layout_height="95dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="80dp"
android:background="@drawable/icon_gift_wall_no_data" />
</LinearLayout>

View File

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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="wrap_content"
android:layout_margin="5dp"
android:background="@mipmap/background_gift_already_wall"
android:orientation="vertical">
<ImageView
android:id="@+id/gift_img"
android:layout_width="65dp"
android:layout_height="65dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="6dp" />
<TextView
android:id="@+id/gift_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="2dp"
android:text="@string/instant_light"
android:textColor="#FFFFFF"
android:textSize="12sp" />
<TextView
android:id="@+id/naming_coin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="2dp"
android:text="@string/instant_light"
android:textColor="#FFFFFF"
android:textSize="14sp" />
a
<LinearLayout
android:layout_width="wrap_content"
android:layout_marginStart="9dp"
android:layout_marginEnd="9dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="9dp"
android:gravity="center_vertical"
android:paddingBottom="5dp">
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/avatar"
android:layout_width="19dp"
android:layout_height="19dp"
android:scaleType="centerCrop"
android:src="@drawable/m_chu_xia"
app:riv_oval="true" />
<TextView
android:id="@+id/user_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginStart="4dp"
android:text="@string/instant_light"
android:textColor="#4F00F9"
android:textSize="11sp" />
</LinearLayout>
</LinearLayout>

View File

@ -1,10 +1,158 @@
<?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"
app:cardCornerRadius="10dp"
app:cardElevation="0dp"
android:layout_width="315dp"
android:id="@+id/layout"
android:layout_width="match_parent"
android:layout_height="315dp"
android:orientation="vertical">
android:orientation="vertical"
app:cardCornerRadius="10dp"
app:cardElevation="0dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="18dp"
android:text="@string/gift_details_hint"
android:textColor="#5665FF"
android:textSize="14sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="18dp">
<LinearLayout
android:layout_width="107dp"
android:layout_height="wrap_content"
android:layout_marginStart="18dp"
android:orientation="vertical">
<FrameLayout
android:layout_width="107dp"
android:layout_height="107dp"
android:background="@mipmap/background_gift_wall_item">
<ImageView
android:id="@+id/gift_img"
android:layout_width="66dp"
android:layout_height="66dp"
android:layout_gravity="center" />
</FrameLayout>
<TextView
android:id="@+id/gift_details"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="8dp"
android:text="@string/gift_details_hint"
android:textColor="#5665FF"
android:textSize="14sp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="8dp"
android:gravity="center_vertical">
<ImageView
android:layout_width="14dp"
android:layout_height="14dp"
android:src="@mipmap/diamond" />
<TextView
android:id="@+id/price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:text="0"
android:textColor="#5665FF"
android:textSize="13sp" />
</LinearLayout>
</LinearLayout>
<View
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_weight="1" />
<LinearLayout
android:layout_width="107dp"
android:layout_height="wrap_content"
android:layout_marginEnd="18dp"
android:orientation="vertical">
<FrameLayout
android:layout_width="107dp"
android:layout_height="107dp"
android:background="@mipmap/background_gift_wall_item">
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/avatar"
android:layout_width="66dp"
android:layout_height="66dp"
android:layout_gravity="center"
android:scaleType="centerCrop"
android:src="@drawable/m_chu_xia"
app:riv_oval="true" />
</FrameLayout>
<TextView
android:id="@+id/vacant_position_awaits"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="8dp"
android:text="@string/vacant_position_awaits"
android:textColor="#454976"
android:textSize="14sp" />
<TextView
android:id="@+id/vacant_position"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="8dp"
android:text="?"
android:textColor="#454976"
android:textSize="14sp" />
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/gift_details_btn"
android:layout_width="100dp"
android:layout_height="28dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="23dp"
android:background="@drawable/background_skip_button"
android:gravity="center"
android:text="@string/regular_bubble"
android:textColor="#F16D00"
android:textSize="14sp"
android:textStyle="bold" />
<View
android:layout_width="1dp"
android:layout_height="0dp"
android:layout_weight="1" />
<TextView
android:id="@+id/distance_naming"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="19dp"
android:text="@string/distance_naming" />
</LinearLayout>
</androidx.cardview.widget.CardView>

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -1272,7 +1272,7 @@ Limited ride And limited avatar frame</string>
<string name="gift_wall_entrance6">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</string>
<string name="gift_wall_entrance7">Medal of Achievement</string>
<string name="gift_wall_entrance8_1">Medal of achievement</string>
<string name="gift_wall_entrance8_2">Currently, there are three achievements, namely A cloud of good friendsVery rich</string>
<string name="gift_wall_entrance8_2">Currently, there are three achievements, namely A cloud of good friends A rich party, Very rich</string>
<string name="gift_wall_entrance8_3">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</string>
<string name="gift_wall_entrance8_4">A rich party: When the price of a single gift received exceeds 50000 diamonds, it is sufficient Illuminate the achievement;</string>
<string name="gift_wall_entrance8_5">Very rich: When receiving 100 gifts priced over 3000 diamonds, i.e This achievement can be illuminated.</string>

View File

@ -1270,7 +1270,7 @@ Limited ride And limited avatar frame</string>
<string name="gift_wall_entrance6">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</string>
<string name="gift_wall_entrance7">Medal of Achievement</string>
<string name="gift_wall_entrance8_1">Medal of achievement</string>
<string name="gift_wall_entrance8_2">Currently, there are three achievements, namely A cloud of good friendsVery rich</string>
<string name="gift_wall_entrance8_2">Currently, there are three achievements, namely A cloud of good friends A rich party, Very rich</string>
<string name="gift_wall_entrance8_3">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</string>
<string name="gift_wall_entrance8_4">A rich party: When the price of a single gift received exceeds 50000 diamonds, it is sufficient Illuminate the achievement;</string>
<string name="gift_wall_entrance8_5">Very rich: When receiving 100 gifts priced over 3000 diamonds, i.e This achievement can be illuminated.</string>
@ -1283,5 +1283,13 @@ Limited ride And limited avatar frame</string>
<string name="codex">Illustrated book</string>
<string name="honorary_achievement">Honorary achievement</string>
<string name="lit_icon">Lit</string>
<string name="rule_introduction">規則介紹</string>
<string name="gift_details_hint">禮物詳情</string>
<string name="vacant_position_awaits">虛位以待</string>
<string name="distance_naming">距離冠名還需%s鑽</string>
<string name="send_hem">送TA</string>
<string name="winner_of_the_month">本月得主</string>
<string name="last_month_winner">上月得主</string>
<string name="last_month_winner_hint">上月奪得最終禮物冠名權用戶將獲得該禮物一個月專屬冠名皮膚</string>
</resources>

View File

@ -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();
}
}

View File

@ -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<GiftWallGiftDetail>() {
@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);
}
});
}
}

View File

@ -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

View File

@ -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);

View File

@ -173,18 +173,22 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:text="@string/gift_wall_entrance8_10"
android:textColor="#7480FF"
android:layout_marginBottom="20dp"
android:textSize="13sp" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
<TextView
android:id="@+id/regular_title"
android:layout_width="142dp"
android:layout_height="42dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="28dp"
android:background="@mipmap/background_regular_title" />
android:background="@mipmap/background_regular_title"
android:gravity="center"
android:textSize="16sp"
android:textStyle="bold" />
</FrameLayout>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 28 KiB