Merge branch 'dev_prank'
# Conflicts: # common/src/main/java/com/yunbao/common/http/PDLiveApi.java # common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java
This commit is contained in:
commit
fdbf5aee04
@ -0,0 +1,59 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class PrankGiftBean extends BaseModel{
|
||||
@SerializedName("prank_content")
|
||||
private String title;
|
||||
@SerializedName("gift_name")
|
||||
private String name;
|
||||
@SerializedName("gift_icon")
|
||||
private String icon;
|
||||
@SerializedName("gift_num")
|
||||
private int num;
|
||||
@SerializedName("gift_id")
|
||||
private String giftId;
|
||||
|
||||
public PrankGiftBean() {
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getNum() {
|
||||
return num;
|
||||
}
|
||||
|
||||
public void setNum(int num) {
|
||||
this.num = num;
|
||||
}
|
||||
|
||||
public String getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
public void setIcon(String icon) {
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
public String getGiftId() {
|
||||
return giftId;
|
||||
}
|
||||
|
||||
public void setGiftId(String giftId) {
|
||||
this.giftId = giftId;
|
||||
}
|
||||
}
|
@ -0,0 +1,121 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
|
||||
public class PrankHttpTurntableBean extends BaseModel {
|
||||
@SerializedName("id")
|
||||
private int id;
|
||||
@SerializedName("anchor_id")
|
||||
private String anchor_id;
|
||||
@SerializedName("coin")
|
||||
private long coin = 1000;
|
||||
@SerializedName("hope_coin")
|
||||
private long hopeCoin = 1000;
|
||||
@SerializedName("turntable_one")
|
||||
private String turntable1;
|
||||
@SerializedName("turntable_two")
|
||||
private String turntable2;
|
||||
@SerializedName("turntable_three")
|
||||
private String turntable3;
|
||||
@SerializedName("turntable_four")
|
||||
private String turntable4;
|
||||
@SerializedName("turntable_five")
|
||||
private String turntable5;
|
||||
@SerializedName("turntable_six")
|
||||
private String turntable6;
|
||||
@SerializedName("status")
|
||||
private int status;
|
||||
|
||||
public PrankHttpTurntableBean() {
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getAnchor_id() {
|
||||
return anchor_id;
|
||||
}
|
||||
|
||||
public void setAnchor_id(String anchor_id) {
|
||||
this.anchor_id = anchor_id;
|
||||
}
|
||||
|
||||
public long getCoin() {
|
||||
return coin;
|
||||
}
|
||||
|
||||
public void setCoin(long coin) {
|
||||
this.coin = coin;
|
||||
}
|
||||
|
||||
public long getHopeCoin() {
|
||||
return hopeCoin;
|
||||
}
|
||||
|
||||
public void setHopeCoin(long hopeCoin) {
|
||||
this.hopeCoin = hopeCoin;
|
||||
}
|
||||
|
||||
public String getTurntable1() {
|
||||
return turntable1;
|
||||
}
|
||||
|
||||
public void setTurntable1(String turntable1) {
|
||||
this.turntable1 = turntable1;
|
||||
}
|
||||
|
||||
public String getTurntable2() {
|
||||
return turntable2;
|
||||
}
|
||||
|
||||
public void setTurntable2(String turntable2) {
|
||||
this.turntable2 = turntable2;
|
||||
}
|
||||
|
||||
public String getTurntable3() {
|
||||
return turntable3;
|
||||
}
|
||||
|
||||
public void setTurntable3(String turntable3) {
|
||||
this.turntable3 = turntable3;
|
||||
}
|
||||
|
||||
public String getTurntable4() {
|
||||
return turntable4;
|
||||
}
|
||||
|
||||
public void setTurntable4(String turntable4) {
|
||||
this.turntable4 = turntable4;
|
||||
}
|
||||
|
||||
public String getTurntable5() {
|
||||
return turntable5;
|
||||
}
|
||||
|
||||
public void setTurntable5(String turntable5) {
|
||||
this.turntable5 = turntable5;
|
||||
}
|
||||
|
||||
public String getTurntable6() {
|
||||
return turntable6;
|
||||
}
|
||||
|
||||
public void setTurntable6(String turntable6) {
|
||||
this.turntable6 = turntable6;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
|
||||
public class PrankTurntableBean extends BaseModel {
|
||||
private int id;
|
||||
private String context;
|
||||
|
||||
public PrankTurntableBean() {
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
public void setContext(String context) {
|
||||
this.context = context;
|
||||
}
|
||||
}
|
@ -20,6 +20,8 @@ import com.yunbao.common.bean.NobleTrumpetModel;
|
||||
import com.yunbao.common.bean.PkRankBean;
|
||||
import com.yunbao.common.bean.RandomPkUserBean;
|
||||
import com.yunbao.common.bean.RankPkInfoBean;
|
||||
import com.yunbao.common.bean.PrankGiftBean;
|
||||
import com.yunbao.common.bean.PrankHttpTurntableBean;
|
||||
import com.yunbao.common.bean.SearchModel;
|
||||
import com.yunbao.common.bean.SetAttentsModel;
|
||||
import com.yunbao.common.bean.SlideInBannerModel;
|
||||
@ -393,4 +395,61 @@ public interface PDLiveApi {
|
||||
*/
|
||||
@GET("/api/public/?service=Ranking.getRankingInfo")
|
||||
Observable<ResponseModel<RankPkInfoBean>> getRankingInfo();
|
||||
|
||||
/**
|
||||
* 获取转盘整蛊列表
|
||||
*/
|
||||
@GET("/api/public/?service=Prank.getAnchorPrankTurntable")
|
||||
Observable<ResponseModel<PrankHttpTurntableBean>> getAnchorPrankTurntable(
|
||||
@Query("anchor_id") String anchor_id
|
||||
);
|
||||
/**
|
||||
* 提交整蛊
|
||||
*/
|
||||
@GET("/api/public/?service=Prank.setAnchorPrankTurntable")
|
||||
Observable<ResponseModel<List<BaseModel>>> setAnchorPrankTurntable(
|
||||
@Query("anchor_id") String anchor_id,
|
||||
@Query("coin") String coin,
|
||||
@Query("turntable_one") String turntable_one,
|
||||
@Query("turntable_two") String turntable_two,
|
||||
@Query("turntable_three") String turntable_three,
|
||||
@Query("turntable_four") String turntable_four,
|
||||
@Query("turntable_five") String turntable_five,
|
||||
@Query("turntable_six") String turntable_six,
|
||||
@Query("status") String status
|
||||
);
|
||||
/**
|
||||
* 转盘整蛊结束后调用的接口
|
||||
*/
|
||||
@GET("/api/public/?service=Prank.endPrankTurntable")
|
||||
Observable<ResponseModel<List<BaseModel>>> endPrankTurntable(
|
||||
@Query("anchor_id") String anchor_id
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* 获取整蛊列表
|
||||
*/
|
||||
@GET("/api/public/?service=Prank.prankList")
|
||||
Observable<ResponseModel<List<PrankGiftBean>>> prankList( @Query("anchor_id") String anchor_id);
|
||||
|
||||
/**
|
||||
* 设置礼物整蛊
|
||||
*/
|
||||
@GET("/api/public/?service=Prank.setPrank")
|
||||
Observable<ResponseModel<List<BaseModel>>> setPrank(
|
||||
@Query("anchor_id") String anchor_id,
|
||||
@Query("gift_id") String gift_id,
|
||||
@Query("gift_num") String gift_num,
|
||||
@Query("prank_content") String prank_content
|
||||
);
|
||||
/**
|
||||
* 删除礼物整蛊
|
||||
*/
|
||||
@GET("/api/public/?service=Prank.deletePrank")
|
||||
Observable<ResponseModel<List<BaseModel>>> deletePrank(
|
||||
@Query("anchor_id") String anchor_id,
|
||||
@Query("prank_index") String prank_index
|
||||
);
|
||||
|
||||
}
|
||||
|
@ -19,6 +19,9 @@ import com.yunbao.common.bean.LiveRoomActivityBanner;
|
||||
import com.yunbao.common.bean.NobleRankHideUserListModel;
|
||||
import com.yunbao.common.bean.NobleTrumpetModel;
|
||||
import com.yunbao.common.bean.PkRankBean;
|
||||
import com.yunbao.common.bean.PrankGiftBean;
|
||||
import com.yunbao.common.bean.PrankHttpTurntableBean;
|
||||
import com.yunbao.common.bean.PrankTurntableBean;
|
||||
import com.yunbao.common.bean.RandomPkUserBean;
|
||||
import com.yunbao.common.bean.RankPkInfoBean;
|
||||
import com.yunbao.common.bean.SetAttentsModel;
|
||||
@ -36,6 +39,7 @@ import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
|
||||
/**
|
||||
@ -742,6 +746,158 @@ public class LiveNetManager {
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取转盘整蛊列表
|
||||
*/
|
||||
public void getAnchorPrankTurntable(String mLiveUid, HttpCallback<PrankHttpTurntableBean> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.getAnchorPrankTurntable(mLiveUid)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe(responseModel -> {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(responseModel.getData().getInfo());
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(throwable.getMessage());
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交转盘整蛊
|
||||
*/
|
||||
public void setAnchorPrankTurntable(String mLiveUid, String coin,
|
||||
String turntable_one,
|
||||
String turntable_two,
|
||||
String turntable_three,
|
||||
String turntable_four,
|
||||
String turntable_five,
|
||||
String turntable_six,
|
||||
String status,
|
||||
HttpCallback<Object> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.setAnchorPrankTurntable(mLiveUid,
|
||||
coin,
|
||||
turntable_one,
|
||||
turntable_two,
|
||||
turntable_three,
|
||||
turntable_four,
|
||||
turntable_five,
|
||||
turntable_six,
|
||||
status)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe(new Consumer<ResponseModel<List<BaseModel>>>() {
|
||||
|
||||
@Override
|
||||
public void accept(ResponseModel<List<BaseModel>> listResponseModel) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess("");
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(throwable.getMessage());
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取转盘整蛊列表
|
||||
*/
|
||||
public void getPrankGiftList(String mLiveUid, HttpCallback<List<PrankGiftBean>> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.prankList(mLiveUid)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe(responseModel -> {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(responseModel.getData().getInfo());
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(throwable.getMessage());
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置礼物整蛊
|
||||
*/
|
||||
public void setPrankGift(String mLiveUid, String gift_id, String gift_num, String prank_content, HttpCallback<PrankHttpTurntableBean> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.setPrank(mLiveUid, gift_id, gift_num, prank_content)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe(responseModel -> {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(null);
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(throwable.getMessage());
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除礼物整蛊
|
||||
*/
|
||||
public void deletePrankGift(String mLiveUid, String prank_index, HttpCallback<PrankHttpTurntableBean> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.deletePrank(mLiveUid, prank_index)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe(responseModel -> {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(null);
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(throwable.getMessage());
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 整蛊结束
|
||||
*/
|
||||
public void endPrankTurntable(String mLiveUid,HttpCallback<BaseModel> callback){
|
||||
API.get().pdLiveApi(mContext)
|
||||
.endPrankTurntable(mLiveUid)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe(responseModel -> {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(null);
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(throwable.getMessage());
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 直播间取消网络请求
|
||||
*/
|
||||
|
@ -74,6 +74,7 @@ import com.yunbao.live.dialog.FreePkDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveLinkMicListDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveNewFunctionDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveNewWishListDialogFragment;
|
||||
import com.yunbao.live.dialog.LivePrankDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveWishListDialogFragment4Audience;
|
||||
import com.yunbao.live.dialog.RandomPkDialogFragment;
|
||||
import com.yunbao.live.event.LinkMicTxMixStreamEvent;
|
||||
@ -279,7 +280,10 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
||||
public void onClick(int functionID) {
|
||||
switch (functionID) {
|
||||
case Constants.LIVE_FUNC_ZG://zg
|
||||
ToastUtil.show("開發中,敬請期待");
|
||||
// ToastUtil.show("開發中,敬請期待");
|
||||
LivePrankDialogFragment fragment = new LivePrankDialogFragment();
|
||||
fragment.setmLiveUid(mLiveUid);
|
||||
fragment.show(getSupportFragmentManager(), "LivePrankDialogFragment");
|
||||
break;
|
||||
case Constants.LIVE_FUNC_MIC://語音
|
||||
//ToastUtil.show("開發中,敬請期待");
|
||||
@ -1295,7 +1299,9 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
||||
|
||||
@Override
|
||||
public void prankTurntable(String msgtype, int time, JSONObject jsonObject) {
|
||||
|
||||
if (mLiveRoomViewHolder != null) {
|
||||
mLiveRoomViewHolder.closeAndOpenTrickery(msgtype, time, jsonObject);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,209 @@
|
||||
package com.yunbao.live.adapter;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.yunbao.common.bean.PrankGiftBean;
|
||||
import com.yunbao.common.bean.PrankTurntableBean;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.live.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
public class LivePrankRecyclerAdapter extends RecyclerView.Adapter<LivePrankRecyclerAdapter.PrankRecyclerViewHolder> {
|
||||
public static final int TYPE_TURNTABLE = 0;
|
||||
public static final int TYPE_GIFT = 1;
|
||||
|
||||
private Context mContext;
|
||||
private List<?> list = new ArrayList<>();
|
||||
private OnItemClickListener<String> onItemClickListener;
|
||||
private int viewType = TYPE_TURNTABLE;
|
||||
|
||||
|
||||
public LivePrankRecyclerAdapter(Context mContext) {
|
||||
this.mContext = mContext;
|
||||
}
|
||||
|
||||
public void setList(List<?> list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
public void setOnItemClickListener(OnItemClickListener<String> onItemClickListener) {
|
||||
this.onItemClickListener = onItemClickListener;
|
||||
}
|
||||
|
||||
public void setViewType(int viewType) {
|
||||
this.viewType = viewType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
return this.viewType;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public PrankRecyclerViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
if (viewType == TYPE_TURNTABLE) {
|
||||
return new TurntableViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_live_prank_turntable_config, parent, false));
|
||||
} else {
|
||||
return new GiftViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_live_prank_gift, parent, false));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull PrankRecyclerViewHolder holder, int position) {
|
||||
if (viewType == TYPE_TURNTABLE) {
|
||||
((TurntableViewHolder) holder).setDate((PrankTurntableBean) list.get(position), position);
|
||||
} else {
|
||||
((GiftViewHolder) holder).setDate((PrankGiftBean) list.get(position), position);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return list.size();
|
||||
}
|
||||
|
||||
public void clearList() {
|
||||
list.clear();
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public <T> List<T> getList() {
|
||||
return (List<T>) list;
|
||||
}
|
||||
|
||||
public boolean getViewTypeOfList() {
|
||||
return viewType==TYPE_TURNTABLE;
|
||||
}
|
||||
|
||||
public static abstract class PrankRecyclerViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
|
||||
public PrankRecyclerViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class GiftViewHolder extends PrankRecyclerViewHolder {
|
||||
private ImageView mIcon;
|
||||
private TextView mTitle;
|
||||
private TextView mName;
|
||||
private TextView mNum;
|
||||
private ImageView mRemove;
|
||||
|
||||
public GiftViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
mIcon = itemView.findViewById(R.id.gift_icon);
|
||||
mTitle = itemView.findViewById(R.id.gift_title);
|
||||
mName = itemView.findViewById(R.id.gift_name);
|
||||
mNum = itemView.findViewById(R.id.gift_num);
|
||||
mRemove = itemView.findViewById(R.id.gift_close);
|
||||
mRemove.setOnClickListener(v -> {
|
||||
PrankGiftBean bean = (PrankGiftBean) v.getTag();
|
||||
onItemClickListener.onItemClick(bean.getGiftId(), (Integer) itemView.getTag());
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void setDate(PrankGiftBean bean, int position) {
|
||||
ImgLoader.display(mContext, bean.getIcon(), mIcon);
|
||||
itemView.setTag(position);
|
||||
mName.setText(bean.getName());
|
||||
mTitle.setText(bean.getTitle());
|
||||
mNum.setText(bean.getNum() + "");
|
||||
mRemove.setTag(bean);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class TurntableViewHolder extends PrankRecyclerViewHolder {
|
||||
private TextView title;
|
||||
private TextView probability;
|
||||
private TextView context;
|
||||
|
||||
public TurntableViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
title = itemView.findViewById(R.id.prank_turntable_title);
|
||||
probability = itemView.findViewById(R.id.prank_turntable_probability);
|
||||
context = itemView.findViewById(R.id.prank_turntable_val);
|
||||
context.setOnClickListener(v -> {
|
||||
DialogUitl.showSimpleInputDialog(mContext, "填寫整蠱內容", DialogUitl.INPUT_TYPE_TEXT, 10, new DialogUitl.SimpleCallback() {
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
if (content.length() >= 2 && content.length() <= 10) {
|
||||
context.setText(content);
|
||||
onItemClickListener.onItemClick(content, ((PrankTurntableBean)list.get((Integer) itemView.getTag())).getId());
|
||||
((PrankTurntableBean)list.get((Integer) itemView.getTag())).setContext(content);
|
||||
dialog.dismiss();
|
||||
} /*else if (content.length() == 0) {
|
||||
context.setText("");
|
||||
onItemClickListener.onItemClick(content, ((PrankTurntableBean)list.get((Integer) itemView.getTag())).getId());
|
||||
dialog.dismiss();
|
||||
} */else {
|
||||
ToastUtil.show("最少2個字,最多10個字");
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public void setDate(PrankTurntableBean bean, int position) {
|
||||
title.setText("轉盤" + getChineseNum(bean.getId()) + "號位");
|
||||
probability.setText(getProbability(bean.getId()));
|
||||
context.setText(bean.getContext());
|
||||
itemView.setTag(position);
|
||||
}
|
||||
|
||||
private String getChineseNum(int id) {
|
||||
switch (id) {
|
||||
case 1:
|
||||
return "一";
|
||||
case 2:
|
||||
return "二";
|
||||
case 3:
|
||||
return "三";
|
||||
case 4:
|
||||
return "四";
|
||||
case 5:
|
||||
return "五";
|
||||
case 6:
|
||||
return "六";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
private String getProbability(int id) {
|
||||
switch (id) {
|
||||
case 1:
|
||||
return "抽取幾率:40%";
|
||||
case 2:
|
||||
return "抽取幾率:30%";
|
||||
case 3:
|
||||
return "抽取幾率:15%";
|
||||
case 4:
|
||||
return "抽取幾率:10%";
|
||||
case 5:
|
||||
return "抽取幾率:4%";
|
||||
default:
|
||||
return "抽取幾率:1%";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
278
live/src/main/java/com/yunbao/live/dialog/GiftPopDialog.java
Normal file
278
live/src/main/java/com/yunbao/live/dialog/GiftPopDialog.java
Normal file
@ -0,0 +1,278 @@
|
||||
package com.yunbao.live.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewParent;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.PopupWindow;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.RadioGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.yunbao.common.bean.LiveGiftBean;
|
||||
import com.yunbao.common.bean.PrankGiftBean;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.adapter.GiftTopAdapter;
|
||||
import com.yunbao.live.adapter.LiveGiftPagerAdapter;
|
||||
import com.yunbao.live.adapter.LiveGiftPagerAdapter.ActionListener;
|
||||
import com.yunbao.live.bean.GiftTopBean;
|
||||
import com.yunbao.live.http.LiveHttpUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
public class GiftPopDialog extends PopupWindow implements ActionListener, View.OnClickListener {
|
||||
|
||||
private View mParent;
|
||||
private Context mContext;
|
||||
private View mContentView;
|
||||
private LiveGiftPagerAdapter mLiveGiftPagerAdapter;
|
||||
private GiftPopDialog.ActionListener mActionListener;
|
||||
private View mLoading;
|
||||
private RecyclerView items;
|
||||
private ViewPager mViewPager;
|
||||
private RadioGroup mRadioGroup;
|
||||
private TextView mBtnSend, mBtnContext;
|
||||
public int type = 0;
|
||||
private GiftTopAdapter giftTopAdapter;
|
||||
private String type_name;
|
||||
private View mBack;
|
||||
private View mBtn;
|
||||
private LiveGiftBean bean;
|
||||
private String prangContext;
|
||||
private int prangNum;
|
||||
private InputMethodManager imm;
|
||||
|
||||
private void initView(View mRootView) {
|
||||
mLoading = mRootView.findViewById(R.id.loading);
|
||||
items = (RecyclerView) mRootView.findViewById(R.id.items);
|
||||
mViewPager = (ViewPager) mRootView.findViewById(R.id.viewPager);
|
||||
mRadioGroup = (RadioGroup) mRootView.findViewById(R.id.radio_group);
|
||||
mBtnSend = mRootView.findViewById(R.id.btn_send);
|
||||
mBtnContext = mRootView.findViewById(R.id.btn_context);
|
||||
mBtn = mRootView.findViewById(R.id.gift_btn);
|
||||
mBack = mRootView.findViewById(R.id.gift_back);
|
||||
final LinearLayoutManager manager = new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false);
|
||||
items.setLayoutManager(manager);
|
||||
mViewPager.setOffscreenPageLimit(5);
|
||||
giftTopAdapter = new GiftTopAdapter(mContext);
|
||||
items.setAdapter(giftTopAdapter);
|
||||
items.setOnClickListener(this);
|
||||
mBtn.setOnClickListener(this);
|
||||
mBack.setOnClickListener(this);
|
||||
mBtnSend.setOnClickListener(this);
|
||||
mBtnContext.setOnClickListener(this);
|
||||
imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
|
||||
giftTopAdapter.setOnItemClickListener((bean, position) -> {
|
||||
manager.scrollToPositionWithOffset(position, 0);
|
||||
giftTopAdapter.notifyDataSetChanged();
|
||||
type = position;
|
||||
type_name = bean.getName();
|
||||
initDate();
|
||||
//点击礼物,展示礼物列表
|
||||
if (mViewPager != null) {
|
||||
mViewPager.setVisibility(View.VISIBLE);
|
||||
mRadioGroup.setVisibility(View.VISIBLE);
|
||||
}
|
||||
});
|
||||
mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
||||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
if (mRadioGroup != null) {
|
||||
((RadioButton) mRadioGroup.getChildAt(position)).setChecked(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int state) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public GiftPopDialog(Context mContext, View parent, GiftPopDialog.ActionListener actionListener) {
|
||||
this.mContext = mContext;
|
||||
mParent = parent;
|
||||
mActionListener = actionListener;
|
||||
mContentView = LayoutInflater.from(mContext).inflate(R.layout.dialog_live_select_gift_wrap, null);
|
||||
ViewParent viewParent = mContentView.getParent();
|
||||
if (viewParent != null) {
|
||||
((ViewGroup) viewParent).removeView(mContentView);
|
||||
}
|
||||
setContentView(mContentView);
|
||||
setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
setHeight(ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
setBackgroundDrawable(new ColorDrawable());
|
||||
setOutsideTouchable(true);
|
||||
setFocusable(true);
|
||||
setAnimationStyle(R.style.leftToRightAnim);
|
||||
setOnDismissListener(new OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss() {
|
||||
if (mActionListener != null) {
|
||||
if (bean == null || StringUtil.isEmpty(prangContext) || prangNum==0) {
|
||||
mActionListener.onDismiss();
|
||||
return;
|
||||
}
|
||||
PrankGiftBean giftBean = new PrankGiftBean();
|
||||
giftBean.setGiftId(bean.getId() + "");
|
||||
giftBean.setNum(prangNum);
|
||||
giftBean.setIcon(bean.getIcon());
|
||||
giftBean.setTitle(prangContext);
|
||||
giftBean.setName(bean.getName());
|
||||
mActionListener.onSelectGift(giftBean);
|
||||
System.out.println("gift.bean = " + bean);
|
||||
}
|
||||
ViewParent viewParent = mContentView.getParent();
|
||||
if (viewParent != null) {
|
||||
((ViewGroup) viewParent).removeView(mContentView);
|
||||
}
|
||||
mContentView = null;
|
||||
}
|
||||
});
|
||||
initView(mContentView);
|
||||
initDate();
|
||||
}
|
||||
|
||||
private void initDate() {
|
||||
LiveHttpUtil.getNewGiftList(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
JSONArray list = obj.getJSONArray("listarray");
|
||||
setDate(list);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
if (mLoading != null) {
|
||||
mLoading.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setDate(JSONArray list) {
|
||||
List<GiftTopBean> name = new ArrayList<>();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
JSONObject data = list.getJSONObject(i);
|
||||
GiftTopBean giftTopBean = new GiftTopBean();
|
||||
giftTopBean.setName(data.getString("name"));
|
||||
name.add(giftTopBean);
|
||||
}
|
||||
|
||||
giftTopAdapter.setList(name);
|
||||
|
||||
|
||||
JSONObject obj2 = list.getJSONObject(type);
|
||||
String giftJson = obj2.getString("giftlist");
|
||||
showGiftList(JSON.parseArray(giftJson, LiveGiftBean.class));
|
||||
}
|
||||
|
||||
private void showGiftList(List<LiveGiftBean> list) {
|
||||
|
||||
mLiveGiftPagerAdapter = new LiveGiftPagerAdapter(mContext, list);
|
||||
mLiveGiftPagerAdapter.setActionListener(this);
|
||||
|
||||
mViewPager.setAdapter(mLiveGiftPagerAdapter);
|
||||
LayoutInflater inflater = LayoutInflater.from(mContext);
|
||||
mRadioGroup.removeAllViews();
|
||||
for (int i = 0, size = mLiveGiftPagerAdapter.getCount(); i < size; i++) {
|
||||
RadioButton radioButton = (RadioButton) inflater.inflate(R.layout.view_gift_indicator, mRadioGroup, false);
|
||||
radioButton.setId(i + 10000);
|
||||
if (i == 0) {
|
||||
radioButton.setChecked(true);
|
||||
}
|
||||
mRadioGroup.addView(radioButton);
|
||||
}
|
||||
}
|
||||
|
||||
public void show() {
|
||||
showAtLocation(mParent, Gravity.CENTER, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onItemChecked(LiveGiftBean bean) {
|
||||
this.bean = bean;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
int id = view.getId();
|
||||
if (id == R.id.btn_send) {
|
||||
DialogUitl.showSimpleInputDialog(mContext, "輸入數量", DialogUitl.INPUT_TYPE_NUMBER, new DialogUitl.SimpleCallback() {
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
try {
|
||||
prangNum = Integer.parseInt(content);
|
||||
if (prangNum <= 0) {
|
||||
ToastUtil.show("數量錯誤");
|
||||
return;
|
||||
}
|
||||
mBtnSend.setText(content);
|
||||
if (imm != null) {
|
||||
imm.hideSoftInputFromWindow(dialog.getCurrentFocus().getWindowToken(), 0);
|
||||
}
|
||||
dialog.dismiss();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
ToastUtil.show("輸入錯誤");
|
||||
}
|
||||
}
|
||||
});
|
||||
} else if (id == R.id.btn_context) {
|
||||
DialogUitl.showSimpleInputDialog(mContext, "輸入整蠱內容...", new DialogUitl.SimpleCallback() {
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
prangContext = content;
|
||||
mBtnContext.setText(content);
|
||||
if (imm != null) {
|
||||
imm.hideSoftInputFromWindow(dialog.getCurrentFocus().getWindowToken(), 0);
|
||||
}
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
} else if (id == R.id.gift_btn) {
|
||||
if (bean == null || StringUtil.isEmpty(prangContext) || prangNum==0) {
|
||||
ToastUtil.show("整蠱內容或數量不能為空");
|
||||
return;
|
||||
}
|
||||
dismiss();
|
||||
} else if (id == R.id.gift_back) {
|
||||
dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public interface ActionListener {
|
||||
void onSelectGift(PrankGiftBean bean);
|
||||
|
||||
void onDismiss();
|
||||
}
|
||||
}
|
@ -0,0 +1,344 @@
|
||||
package com.yunbao.live.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
import com.yunbao.common.bean.LiveGiftBean;
|
||||
import com.yunbao.common.bean.PrankGiftBean;
|
||||
import com.yunbao.common.bean.PrankHttpTurntableBean;
|
||||
import com.yunbao.common.bean.PrankTurntableBean;
|
||||
import com.yunbao.common.dialog.AbsDialogFragment;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.adapter.LivePrankRecyclerAdapter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class LivePrankDialogFragment extends AbsDialogFragment implements View.OnClickListener {
|
||||
private TabLayout mTabLayout;
|
||||
private View mTurntableConfigLayout;
|
||||
private TextView mPrankBtn;
|
||||
private ImageView mTurntableConfigImageView;
|
||||
private TextView mCoinTextView;
|
||||
private TextView mGiftNotDate;
|
||||
private RecyclerView mPrankRecyclerView;
|
||||
private LivePrankRecyclerAdapter recyclerAdapter;
|
||||
private String mLiveUid;
|
||||
private PrankHttpTurntableBean bean = new PrankHttpTurntableBean();
|
||||
|
||||
public void setmLiveUid(String mLiveUid) {
|
||||
this.mLiveUid = mLiveUid;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.dialog_live_prank;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getDialogStyle() {
|
||||
return R.style.dialog2;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canCancel() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setWindowAttributes(Window window) {
|
||||
WindowManager.LayoutParams params = window.getAttributes();
|
||||
window.setWindowAnimations(R.style.bottomToTopAnim);
|
||||
params.width = WindowManager.LayoutParams.MATCH_PARENT;
|
||||
params.height = DpUtil.dp2px(400);
|
||||
params.gravity = Gravity.BOTTOM;
|
||||
window.setAttributes(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
initView();
|
||||
initTab();
|
||||
initTurntableData();
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
mTabLayout = (TabLayout) findViewById(R.id.prank_tabLayout);
|
||||
mTurntableConfigLayout = findViewById(R.id.turntable_layout);
|
||||
mTurntableConfigImageView = (ImageView) findViewById(R.id.switch1_btn);
|
||||
mCoinTextView = (TextView) findViewById(R.id.switch2_btn);
|
||||
mPrankRecyclerView = (RecyclerView) findViewById(R.id.prank_config);
|
||||
mPrankBtn = (TextView) findViewById(R.id.prank_btn);
|
||||
mGiftNotDate = (TextView) findViewById(R.id.gift_prank_not_date);
|
||||
mPrankRecyclerView.setLayoutManager(new LinearLayoutManager(mContext, RecyclerView.VERTICAL, false));
|
||||
recyclerAdapter = new LivePrankRecyclerAdapter(mContext);
|
||||
mPrankRecyclerView.setAdapter(recyclerAdapter);
|
||||
mCoinTextView.setOnClickListener(this);
|
||||
mTurntableConfigImageView.setOnClickListener(this);
|
||||
recyclerAdapter.setOnItemClickListener(new OnItemClickListener<String>() {
|
||||
@Override
|
||||
public void onItemClick(String bean, int position) {
|
||||
if (recyclerAdapter.getViewTypeOfList()) {
|
||||
switch (position) {
|
||||
case 1:
|
||||
LivePrankDialogFragment.this.bean.setTurntable1(bean);
|
||||
break;
|
||||
case 2:
|
||||
LivePrankDialogFragment.this.bean.setTurntable2(bean);
|
||||
break;
|
||||
case 3:
|
||||
LivePrankDialogFragment.this.bean.setTurntable3(bean);
|
||||
break;
|
||||
case 4:
|
||||
LivePrankDialogFragment.this.bean.setTurntable4(bean);
|
||||
break;
|
||||
case 5:
|
||||
LivePrankDialogFragment.this.bean.setTurntable5(bean);
|
||||
break;
|
||||
case 6:
|
||||
LivePrankDialogFragment.this.bean.setTurntable6(bean);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
LiveNetManager.get(mContext).deletePrankGift(mLiveUid, position + "", new HttpCallback<PrankHttpTurntableBean>() {
|
||||
@Override
|
||||
public void onSuccess(PrankHttpTurntableBean data) {
|
||||
initGiftData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
initGiftData();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
mPrankBtn.setOnClickListener(view -> {
|
||||
if ((int) view.getTag() == 1) {
|
||||
GiftPopDialog dialog = new GiftPopDialog(mContext, mRootView, new GiftPopDialog.ActionListener() {
|
||||
|
||||
@Override
|
||||
public void onSelectGift(PrankGiftBean bean) {
|
||||
if (bean != null) {
|
||||
setGiftBean(bean);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDismiss() {
|
||||
|
||||
}
|
||||
});
|
||||
dialog.show();
|
||||
} else {
|
||||
setPrankConfig();
|
||||
}
|
||||
});
|
||||
mPrankBtn.setTag(0);
|
||||
}
|
||||
|
||||
private void initTab() {
|
||||
TabLayout.Tab turntable = mTabLayout.newTab();
|
||||
TabLayout.Tab gift = mTabLayout.newTab();
|
||||
turntable.setText("轉盤整蠱");
|
||||
gift.setText("禮物整蠱");
|
||||
turntable.setTag(0);
|
||||
gift.setTag(1);
|
||||
mTabLayout.addTab(turntable);
|
||||
mTabLayout.addTab(gift);
|
||||
mTabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
|
||||
@Override
|
||||
public void onTabSelected(TabLayout.Tab tab) {
|
||||
if (tab.getTag() == null) {
|
||||
return;
|
||||
}
|
||||
if ((int) tab.getTag() == 0) {
|
||||
mTurntableConfigLayout.setVisibility(View.VISIBLE);
|
||||
mPrankRecyclerView.setVisibility(View.VISIBLE);
|
||||
mGiftNotDate.setVisibility(View.GONE);
|
||||
recyclerAdapter.setViewType(LivePrankRecyclerAdapter.TYPE_TURNTABLE);
|
||||
mPrankBtn.setBackgroundResource(R.drawable.bg_live_prank_turntable_save);
|
||||
mPrankBtn.setText("保存設置");
|
||||
mPrankBtn.setTag(0);
|
||||
recyclerAdapter.clearList();
|
||||
initTurntableData();
|
||||
} else {
|
||||
mTurntableConfigLayout.setVisibility(View.GONE);
|
||||
mPrankBtn.setBackgroundResource(R.drawable.bg_live_prank_gift_set);
|
||||
mPrankBtn.setText("添加禮物");
|
||||
mPrankBtn.setTag(1);
|
||||
recyclerAdapter.clearList();
|
||||
mGiftNotDate.setVisibility(View.VISIBLE);
|
||||
initGiftData();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabUnselected(TabLayout.Tab tab) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabReselected(TabLayout.Tab tab) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initTurntableData() {
|
||||
LiveNetManager.get(mContext).getAnchorPrankTurntable(mLiveUid, new HttpCallback<PrankHttpTurntableBean>() {
|
||||
@Override
|
||||
public void onSuccess(PrankHttpTurntableBean data) {
|
||||
setDate(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
setDate(bean);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setGiftBean(PrankGiftBean bean) {
|
||||
LiveNetManager.get(mContext).setPrankGift(mLiveUid, bean.getGiftId(), bean.getNum() + "", bean.getTitle(), new HttpCallback<PrankHttpTurntableBean>() {
|
||||
@Override
|
||||
public void onSuccess(PrankHttpTurntableBean data) {
|
||||
initGiftData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
initGiftData();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initGiftData() {
|
||||
LiveNetManager.get(mContext).getPrankGiftList(mLiveUid, new HttpCallback<List<PrankGiftBean>>() {
|
||||
@Override
|
||||
public void onSuccess(List<PrankGiftBean> data) {
|
||||
if (!data.isEmpty()) {
|
||||
mGiftNotDate.setVisibility(View.GONE);
|
||||
mPrankRecyclerView.setVisibility(View.VISIBLE);
|
||||
recyclerAdapter.setViewType(LivePrankRecyclerAdapter.TYPE_GIFT);
|
||||
recyclerAdapter.setList(data);
|
||||
recyclerAdapter.notifyDataSetChanged();
|
||||
}else{
|
||||
mPrankRecyclerView.setVisibility(View.GONE);
|
||||
mGiftNotDate.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setDate(PrankHttpTurntableBean bean) {
|
||||
this.bean = bean;
|
||||
List<PrankTurntableBean> list = new ArrayList<>();
|
||||
list.add(buildBean(1, bean.getTurntable1()));
|
||||
list.add(buildBean(2, bean.getTurntable2()));
|
||||
list.add(buildBean(3, bean.getTurntable3()));
|
||||
list.add(buildBean(4, bean.getTurntable4()));
|
||||
list.add(buildBean(5, bean.getTurntable5()));
|
||||
list.add(buildBean(6, bean.getTurntable6()));
|
||||
recyclerAdapter.setList(list);
|
||||
recyclerAdapter.notifyDataSetChanged();
|
||||
if (bean.getStatus() == 1) {
|
||||
mTurntableConfigImageView.setImageResource(R.mipmap.special_icon_on);
|
||||
} else {
|
||||
mTurntableConfigImageView.setImageResource(R.mipmap.special_icon_off);
|
||||
}
|
||||
}
|
||||
|
||||
private void setCoin(long coin) {
|
||||
mCoinTextView.setText((coin / 1000) + "," + String.format("%03d", (coin % 1000)));
|
||||
bean.setCoin(coin);
|
||||
}
|
||||
|
||||
private PrankTurntableBean buildBean(int id, String context) {
|
||||
PrankTurntableBean bean = new PrankTurntableBean();
|
||||
bean.setId(id);
|
||||
bean.setContext(context);
|
||||
return bean;
|
||||
}
|
||||
|
||||
private void setPrankConfig() {
|
||||
LiveNetManager.get(mContext).setAnchorPrankTurntable(
|
||||
mLiveUid,
|
||||
bean.getCoin() + "",
|
||||
bean.getTurntable1(),
|
||||
bean.getTurntable2(),
|
||||
bean.getTurntable3(),
|
||||
bean.getTurntable4(),
|
||||
bean.getTurntable5(),
|
||||
bean.getTurntable6(),
|
||||
bean.getStatus() + "",
|
||||
new HttpCallback<Object>() {
|
||||
@Override
|
||||
public void onSuccess(Object data) {
|
||||
ToastUtil.show("保存成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show("保存失败:" + error);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int id = v.getId();
|
||||
if (id == R.id.switch1_btn) {
|
||||
bean.setStatus(bean.getStatus() == 1 ? 0 : 1);
|
||||
if (bean.getStatus() == 1) {
|
||||
mTurntableConfigImageView.setImageResource(R.mipmap.special_icon_on);
|
||||
} else {
|
||||
mTurntableConfigImageView.setImageResource(R.mipmap.special_icon_off);
|
||||
}
|
||||
} else if (id == R.id.switch2_btn) {
|
||||
DialogUitl.showSimpleInputDialog(mContext, "請輸入數量", DialogUitl.INPUT_TYPE_NUMBER, new DialogUitl.SimpleCallback() {
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
try {
|
||||
int coin = Integer.parseInt(content);
|
||||
if (coin < 1000) {
|
||||
ToastUtil.show("最少1000鑽石");
|
||||
return;
|
||||
}
|
||||
setCoin(Long.parseLong(content));
|
||||
dialog.dismiss();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
ToastUtil.show("最少1000鑽石");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -60,6 +60,7 @@ import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.activity.AbsActivity;
|
||||
import com.yunbao.common.bean.AiAutomaticSpeechModel;
|
||||
import com.yunbao.common.bean.BannerBean;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.bean.GiftModel;
|
||||
import com.yunbao.common.bean.GuardUserModel;
|
||||
import com.yunbao.common.bean.HourRank;
|
||||
@ -3449,6 +3450,17 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
countDownTimerTrickery.cancel();
|
||||
countDownTimerTrickery = null;
|
||||
lt_trickery.setVisibility(View.GONE);
|
||||
LiveNetManager.get(mContext).endPrankTurntable(mLiveUid, new com.yunbao.common.http.base.HttpCallback<BaseModel>() {
|
||||
@Override
|
||||
public void onSuccess(BaseModel data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
9
live/src/main/res/drawable/bg_live_prank_gift_add.xml
Normal file
9
live/src/main/res/drawable/bg_live_prank_gift_add.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:width="68dp" android:height="23dp">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#ff81c16d" />
|
||||
<corners android:topLeftRadius="12dp" android:topRightRadius="12dp" android:bottomLeftRadius="12dp" android:bottomRightRadius="12dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
9
live/src/main/res/drawable/bg_live_prank_gift_set.xml
Normal file
9
live/src/main/res/drawable/bg_live_prank_gift_set.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:width="68dp" android:height="23dp">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#ffe96ba2" />
|
||||
<corners android:topLeftRadius="12dp" android:topRightRadius="12dp" android:bottomLeftRadius="12dp" android:bottomRightRadius="12dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:width="68dp" android:height="23dp">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#ff8873d8" />
|
||||
<corners android:topLeftRadius="12dp" android:topRightRadius="12dp" android:bottomLeftRadius="12dp" android:bottomRightRadius="12dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
9
live/src/main/res/drawable/bg_prank_coin.xml
Normal file
9
live/src/main/res/drawable/bg_prank_coin.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:width="96dp" android:height="27dp">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#ff181d29" />
|
||||
<corners android:topLeftRadius="8dp" android:topRightRadius="8dp" android:bottomLeftRadius="8dp" android:bottomRightRadius="8dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
9
live/src/main/res/drawable/bg_prank_gift_item.xml
Normal file
9
live/src/main/res/drawable/bg_prank_gift_item.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:width="229dp" android:height="53dp">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#ff181d29" />
|
||||
<corners android:topLeftRadius="8dp" android:topRightRadius="8dp" android:bottomLeftRadius="8dp" android:bottomRightRadius="8dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
47
live/src/main/res/layout/dialog_live_prank.xml
Normal file
47
live/src/main/res/layout/dialog_live_prank.xml
Normal file
@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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="330dp"
|
||||
android:background="#000002">
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/prank_tabLayout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:tabIndicatorColor="#F6F7FB"
|
||||
app:tabIndicatorFullWidth="false"
|
||||
app:tabMaxWidth="100dp"
|
||||
app:tabMode="scrollable"
|
||||
app:tabSelectedTextColor="#F6F7FB"
|
||||
app:tabTextColor="#9A9A9A">
|
||||
|
||||
|
||||
</com.google.android.material.tabs.TabLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/prank_btn"
|
||||
android:layout_width="67dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:background="@drawable/bg_live_prank_turntable_save"
|
||||
android:gravity="center"
|
||||
android:text="保存設置"
|
||||
android:textColor="#FFF"
|
||||
android:textSize="10sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<include
|
||||
layout="@layout/view_live_prank_turntable"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/prank_tabLayout" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
183
live/src/main/res/layout/dialog_live_select_gift_wrap.xml
Normal file
183
live/src/main/res/layout/dialog_live_select_gift_wrap.xml
Normal file
@ -0,0 +1,183 @@
|
||||
<?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="350dp"
|
||||
android:background="#000"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/gift_back"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginStart="16dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@mipmap/title_back" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/gift_btn"
|
||||
android:layout_width="67dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:background="@drawable/bg_live_prank_gift_add"
|
||||
android:gravity="center"
|
||||
android:text="确定添加"
|
||||
android:textColor="#FFF"
|
||||
android:textSize="10sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
|
||||
</TextView>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:gravity="center"
|
||||
android:text="選擇整蠱禮物"
|
||||
android:textColor="#808080"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/gift_back"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/gift_tab_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/items"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_weight="1" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/group"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="300dp"
|
||||
android:layout_below="@id/gift_tab_layout"
|
||||
android:gravity="bottom"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:id="@+id/viewPager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:id="@+id/vpWrapList"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="3dp"
|
||||
android:layout_weight="1"
|
||||
android:visibility="gone" />
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="66dp"
|
||||
android:layout_weight="0">
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/radio_group"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="6dp"
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginTop="3.5dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:gravity="end"
|
||||
android:orientation="horizontal" />
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/radio_group_wrap"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="6dp"
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginTop="3.5dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:gravity="end"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="visible" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/btn_send_group"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp">
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/btn_send"
|
||||
android:layout_width="71dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:background="@drawable/bg_prank_gift_item"
|
||||
android:gravity="center"
|
||||
android:text="输入数量"
|
||||
android:textColor="#8C8C8C"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/btn_context"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="35dp"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_toStartOf="@+id/btn_send"
|
||||
android:background="@drawable/bg_prank_gift_item"
|
||||
android:gravity="start|center"
|
||||
android:paddingStart="10dp"
|
||||
android:paddingEnd="10dp"
|
||||
android:text="輸入整蠱內容..."
|
||||
android:textColor="#8C8C8C"
|
||||
android:textSize="14sp" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/loading"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_marginTop="14dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:indeterminateBehavior="repeat"
|
||||
android:indeterminateDrawable="@drawable/anim_loading"
|
||||
android:indeterminateOnly="true" />
|
||||
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
93
live/src/main/res/layout/item_live_prank_gift.xml
Normal file
93
live/src/main/res/layout/item_live_prank_gift.xml
Normal file
@ -0,0 +1,93 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:background="@drawable/bg_prank_gift_item">
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/gift_icon"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginStart="11dp"
|
||||
android:layout_marginTop="11dp"
|
||||
android:layout_marginBottom="11dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:srcCompat="@tools:sample/avatars" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/gift_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="7dp"
|
||||
android:gravity="top"
|
||||
android:text="TextView"
|
||||
android:textColor="#FFF69F"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintStart_toEndOf="@+id/gift_icon"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/gift_close"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@mipmap/icon_live_prank_gift_item_close" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="禮物"
|
||||
android:textColor="#808080"
|
||||
android:textSize="10sp"
|
||||
app:layout_constraintStart_toEndOf="@+id/gift_icon"
|
||||
app:layout_constraintTop_toBottomOf="@+id/gift_title" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/gift_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="TextView"
|
||||
android:textColor="#FFF"
|
||||
android:textSize="10sp"
|
||||
app:layout_constraintStart_toEndOf="@+id/textView5"
|
||||
app:layout_constraintTop_toBottomOf="@+id/gift_title" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/gift_num"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="7dp"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:text="1"
|
||||
android:textColor="#FFF"
|
||||
android:textSize="10sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/gift_close" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView8"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="7dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:text="数量"
|
||||
android:textColor="#808080"
|
||||
android:textSize="10sp"
|
||||
app:layout_constraintEnd_toStartOf="@+id/gift_num"
|
||||
app:layout_constraintTop_toBottomOf="@+id/gift_close" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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_marginBottom="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/prank_turntable_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="轉盤一號位"
|
||||
android:textColor="#FFF69F"
|
||||
android:textSize="10sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/prank_turntable_probability"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:text="抽取幾率:40%"
|
||||
android:textColor="#80CEF2"
|
||||
android:textSize="10sp"
|
||||
app:layout_constraintStart_toEndOf="@+id/prank_turntable_title"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/prank_turntable_val"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="43dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:background="@drawable/bg_prank_coin"
|
||||
android:ems="10"
|
||||
android:hint="填寫整蠱內容,最少2個字,最多10個字"
|
||||
android:gravity="start|center"
|
||||
android:paddingStart="12dp"
|
||||
android:paddingEnd="12dp"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textColorHint="#8C8C8C"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/prank_turntable_title" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
111
live/src/main/res/layout/view_live_prank_turntable.xml
Normal file
111
live/src/main/res/layout/view_live_prank_turntable.xml
Normal file
@ -0,0 +1,111 @@
|
||||
<?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:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/turntable_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="visible"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/turntable_config_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/switch1_title_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="轉盤整蠱開關"
|
||||
android:textColor="#A992FF"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/switch1_desc_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="關閉後所有用戶將無法看到轉盤內容"
|
||||
android:textColor="#B3B3B3"
|
||||
android:textSize="10sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/switch1_title_text" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/switch1_btn"
|
||||
android:layout_width="47dp"
|
||||
android:layout_height="23dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@mipmap/special_icon_on" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/switch2_title_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="轉盤每次消耗鑽石"
|
||||
android:textColor="#A992FF"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/switch2_desc_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="最少1,000鑽石起步"
|
||||
android:textColor="#B3B3B3"
|
||||
android:textSize="10sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/switch2_title_text" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/switch2_btn"
|
||||
android:layout_width="96dp"
|
||||
android:layout_height="26dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:background="@drawable/bg_prank_coin"
|
||||
android:gravity="center"
|
||||
android:text="1,000"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/prank_config"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="10dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/gift_prank_not_date"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="250dp"
|
||||
android:gravity="center"
|
||||
android:visibility="gone"
|
||||
android:textColor="#BFBFBF"
|
||||
android:text="您目前還未設置整蠱內容" />
|
||||
</LinearLayout>
|
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
@ -244,7 +244,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
||||
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
|
||||
@Override
|
||||
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
|
||||
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
|
||||
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -425,7 +425,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
||||
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
|
||||
@Override
|
||||
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
|
||||
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
|
||||
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -907,7 +907,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
||||
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
|
||||
@Override
|
||||
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
|
||||
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
|
||||
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user