update 整蛊
This commit is contained in:
parent
07da7acacd
commit
d39ee17cc4
@ -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;
|
||||||
|
}
|
||||||
|
}
|
@ -1,11 +1,13 @@
|
|||||||
package com.yunbao.live.bean;
|
package com.yunbao.common.bean;
|
||||||
|
|
||||||
import com.yunbao.common.bean.BaseModel;
|
|
||||||
|
|
||||||
public class PrankTurntableBean extends BaseModel {
|
public class PrankTurntableBean extends BaseModel {
|
||||||
private int id;
|
private int id;
|
||||||
private String context;
|
private String context;
|
||||||
|
|
||||||
|
public PrankTurntableBean() {
|
||||||
|
}
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
@ -18,6 +18,8 @@ import com.yunbao.common.bean.NewPeopleInfo;
|
|||||||
import com.yunbao.common.bean.NobleRankHideUserListModel;
|
import com.yunbao.common.bean.NobleRankHideUserListModel;
|
||||||
import com.yunbao.common.bean.NobleTrumpetModel;
|
import com.yunbao.common.bean.NobleTrumpetModel;
|
||||||
import com.yunbao.common.bean.PkRankBean;
|
import com.yunbao.common.bean.PkRankBean;
|
||||||
|
import com.yunbao.common.bean.PrankGiftBean;
|
||||||
|
import com.yunbao.common.bean.PrankHttpTurntableBean;
|
||||||
import com.yunbao.common.bean.SearchModel;
|
import com.yunbao.common.bean.SearchModel;
|
||||||
import com.yunbao.common.bean.SetAttentsModel;
|
import com.yunbao.common.bean.SetAttentsModel;
|
||||||
import com.yunbao.common.bean.SlideInBannerModel;
|
import com.yunbao.common.bean.SlideInBannerModel;
|
||||||
@ -343,7 +345,7 @@ public interface PDLiveApi {
|
|||||||
* 获取转盘整蛊列表
|
* 获取转盘整蛊列表
|
||||||
*/
|
*/
|
||||||
@GET("/api/public/?service=Prank.getAnchorPrankTurntable")
|
@GET("/api/public/?service=Prank.getAnchorPrankTurntable")
|
||||||
Observable<ResponseModel<List<BaseModel>>> getAnchorPrankTurntable(
|
Observable<ResponseModel<PrankHttpTurntableBean>> getAnchorPrankTurntable(
|
||||||
@Query("anchor_id") String anchor_id
|
@Query("anchor_id") String anchor_id
|
||||||
);
|
);
|
||||||
/**
|
/**
|
||||||
@ -368,4 +370,31 @@ public interface PDLiveApi {
|
|||||||
Observable<ResponseModel<List<BaseModel>>> endPrankTurntable(
|
Observable<ResponseModel<List<BaseModel>>> endPrankTurntable(
|
||||||
@Query("anchor_id") String anchor_id
|
@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
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,9 @@ import com.yunbao.common.bean.LiveRoomActivityBanner;
|
|||||||
import com.yunbao.common.bean.NobleRankHideUserListModel;
|
import com.yunbao.common.bean.NobleRankHideUserListModel;
|
||||||
import com.yunbao.common.bean.NobleTrumpetModel;
|
import com.yunbao.common.bean.NobleTrumpetModel;
|
||||||
import com.yunbao.common.bean.PkRankBean;
|
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.SetAttentsModel;
|
import com.yunbao.common.bean.SetAttentsModel;
|
||||||
import com.yunbao.common.bean.StarChallengeStatusModel;
|
import com.yunbao.common.bean.StarChallengeStatusModel;
|
||||||
import com.yunbao.common.bean.VipModel;
|
import com.yunbao.common.bean.VipModel;
|
||||||
@ -502,15 +505,17 @@ public class LiveNetManager {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getAnchorPrankTurntable(String mLiveUid, HttpCallback<Object> callback) {
|
/**
|
||||||
|
* 获取转盘整蛊列表
|
||||||
|
*/
|
||||||
|
public void getAnchorPrankTurntable(String mLiveUid, HttpCallback<PrankHttpTurntableBean> callback) {
|
||||||
API.get().pdLiveApi(mContext)
|
API.get().pdLiveApi(mContext)
|
||||||
.getAnchorPrankTurntable(mLiveUid)
|
.getAnchorPrankTurntable(mLiveUid)
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.subscribe(new Consumer<ResponseModel<List<BaseModel>>>() {
|
.subscribe(responseModel -> {
|
||||||
@Override
|
if (callback != null) {
|
||||||
public void accept(ResponseModel<List<BaseModel>> listResponseModel) throws Exception {
|
callback.onSuccess(responseModel.getData().getInfo());
|
||||||
|
|
||||||
}
|
}
|
||||||
}, new Consumer<Throwable>() {
|
}, new Consumer<Throwable>() {
|
||||||
@Override
|
@Override
|
||||||
@ -522,6 +527,9 @@ public class LiveNetManager {
|
|||||||
}).isDisposed();
|
}).isDisposed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提交转盘整蛊
|
||||||
|
*/
|
||||||
public void setAnchorPrankTurntable(String mLiveUid, String coin,
|
public void setAnchorPrankTurntable(String mLiveUid, String coin,
|
||||||
String turntable_one,
|
String turntable_one,
|
||||||
String turntable_two,
|
String turntable_two,
|
||||||
@ -532,13 +540,90 @@ public class LiveNetManager {
|
|||||||
String status,
|
String status,
|
||||||
HttpCallback<Object> callback) {
|
HttpCallback<Object> callback) {
|
||||||
API.get().pdLiveApi(mContext)
|
API.get().pdLiveApi(mContext)
|
||||||
.getAnchorPrankTurntable(mLiveUid)
|
.setAnchorPrankTurntable(mLiveUid,
|
||||||
|
coin,
|
||||||
|
turntable_one,
|
||||||
|
turntable_two,
|
||||||
|
turntable_three,
|
||||||
|
turntable_four,
|
||||||
|
turntable_five,
|
||||||
|
turntable_six,
|
||||||
|
status)
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.subscribe(new Consumer<ResponseModel<List<BaseModel>>>() {
|
.subscribe(new Consumer<ResponseModel<List<BaseModel>>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void accept(ResponseModel<List<BaseModel>> listResponseModel) throws Exception {
|
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>() {
|
}, new Consumer<Throwable>() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -66,6 +66,7 @@ import com.yunbao.live.bean.LiveReceiveGiftBean;
|
|||||||
import com.yunbao.live.dialog.LiveLinkMicListDialogFragment;
|
import com.yunbao.live.dialog.LiveLinkMicListDialogFragment;
|
||||||
import com.yunbao.live.dialog.LiveNewFunctionDialogFragment;
|
import com.yunbao.live.dialog.LiveNewFunctionDialogFragment;
|
||||||
import com.yunbao.live.dialog.LiveNewWishListDialogFragment;
|
import com.yunbao.live.dialog.LiveNewWishListDialogFragment;
|
||||||
|
import com.yunbao.live.dialog.LivePrankDialogFragment;
|
||||||
import com.yunbao.live.dialog.LiveWishListDialogFragment4Audience;
|
import com.yunbao.live.dialog.LiveWishListDialogFragment4Audience;
|
||||||
import com.yunbao.live.event.LinkMicTxMixStreamEvent;
|
import com.yunbao.live.event.LinkMicTxMixStreamEvent;
|
||||||
import com.yunbao.live.event.LiveAudienceEvent;
|
import com.yunbao.live.event.LiveAudienceEvent;
|
||||||
@ -236,7 +237,10 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
|||||||
public void onClick(int functionID) {
|
public void onClick(int functionID) {
|
||||||
switch (functionID) {
|
switch (functionID) {
|
||||||
case Constants.LIVE_FUNC_ZG://zg
|
case Constants.LIVE_FUNC_ZG://zg
|
||||||
ToastUtil.show("開發中,敬請期待");
|
// ToastUtil.show("開發中,敬請期待");
|
||||||
|
LivePrankDialogFragment fragment = new LivePrankDialogFragment();
|
||||||
|
fragment.setmLiveUid(mLiveUid);
|
||||||
|
fragment.show(getSupportFragmentManager(), "LivePrankDialogFragment");
|
||||||
break;
|
break;
|
||||||
case Constants.LIVE_FUNC_MIC://語音
|
case Constants.LIVE_FUNC_MIC://語音
|
||||||
//ToastUtil.show("開發中,敬請期待");
|
//ToastUtil.show("開發中,敬請期待");
|
||||||
|
@ -1,41 +1,75 @@
|
|||||||
package com.yunbao.live.adapter;
|
package com.yunbao.live.adapter;
|
||||||
|
|
||||||
|
import android.app.Dialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.EditText;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
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.annotation.NonNull;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.yunbao.live.R;
|
|
||||||
import com.yunbao.live.bean.PrankTurntableBean;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class LivePrankRecyclerAdapter extends RecyclerView.Adapter<LivePrankRecyclerAdapter.PrankRecyclerViewHolder> {
|
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 Context mContext;
|
||||||
private List<PrankTurntableBean> list;
|
private List<?> list = new ArrayList<>();
|
||||||
|
private OnItemClickListener<String> onItemClickListener;
|
||||||
|
private int viewType = TYPE_TURNTABLE;
|
||||||
|
|
||||||
|
|
||||||
public LivePrankRecyclerAdapter(Context mContext) {
|
public LivePrankRecyclerAdapter(Context mContext) {
|
||||||
this.mContext = mContext;
|
this.mContext = mContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setList(List<PrankTurntableBean> list) {
|
public void setList(List<?> list) {
|
||||||
this.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
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public PrankRecyclerViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
public PrankRecyclerViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
return new PrankRecyclerViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_live_prank_turntable_config, parent, false));
|
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
|
@Override
|
||||||
public void onBindViewHolder(@NonNull PrankRecyclerViewHolder holder, int position) {
|
public void onBindViewHolder(@NonNull PrankRecyclerViewHolder holder, int position) {
|
||||||
holder.setDate(list.get(position));
|
if (viewType == TYPE_TURNTABLE) {
|
||||||
|
((TurntableViewHolder) holder).setDate((PrankTurntableBean) list.get(position), position);
|
||||||
|
} else {
|
||||||
|
((GiftViewHolder) holder).setDate((PrankGiftBean) list.get(position), position);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -43,22 +77,98 @@ public class LivePrankRecyclerAdapter extends RecyclerView.Adapter<LivePrankRecy
|
|||||||
return list.size();
|
return list.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class PrankRecyclerViewHolder extends RecyclerView.ViewHolder {
|
public void clearList() {
|
||||||
private TextView title;
|
list.clear();
|
||||||
private TextView probability;
|
notifyDataSetChanged();
|
||||||
private EditText context;
|
}
|
||||||
|
|
||||||
|
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) {
|
public PrankRecyclerViewHolder(@NonNull View itemView) {
|
||||||
super(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);
|
title = itemView.findViewById(R.id.prank_turntable_title);
|
||||||
probability = itemView.findViewById(R.id.prank_turntable_probability);
|
probability = itemView.findViewById(R.id.prank_turntable_probability);
|
||||||
context = itemView.findViewById(R.id.prank_turntable_val);
|
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) {
|
public void setDate(PrankTurntableBean bean, int position) {
|
||||||
title.setText(getChineseNum(bean.getId()));
|
title.setText("轉盤" + getChineseNum(bean.getId()) + "號位");
|
||||||
probability.setText(getProbability(bean.getId()));
|
probability.setText(getProbability(bean.getId()));
|
||||||
context.setText(bean.getContext());
|
context.setText(bean.getContext());
|
||||||
|
itemView.setTag(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getChineseNum(int id) {
|
private String getChineseNum(int id) {
|
||||||
@ -96,4 +206,4 @@ public class LivePrankRecyclerAdapter extends RecyclerView.Adapter<LivePrankRecy
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,30 +0,0 @@
|
|||||||
package com.yunbao.live.bean;
|
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
|
||||||
import com.yunbao.common.bean.BaseModel;
|
|
||||||
|
|
||||||
public class PrankHttpTurntableBean extends BaseModel {
|
|
||||||
@SerializedName("id")
|
|
||||||
private int id;
|
|
||||||
@SerializedName("anchor_id")
|
|
||||||
private String anchor_id;
|
|
||||||
@SerializedName("coin")
|
|
||||||
private long coin;
|
|
||||||
@SerializedName("hope_coin")
|
|
||||||
private long hopeCoin;
|
|
||||||
@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;
|
|
||||||
|
|
||||||
}
|
|
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();
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,7 @@
|
|||||||
package com.yunbao.live.dialog;
|
package com.yunbao.live.dialog;
|
||||||
|
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.graphics.Color;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -13,17 +15,38 @@ import androidx.recyclerview.widget.LinearLayoutManager;
|
|||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.google.android.material.tabs.TabLayout;
|
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.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.R;
|
||||||
import com.yunbao.live.adapter.LivePrankRecyclerAdapter;
|
import com.yunbao.live.adapter.LivePrankRecyclerAdapter;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class LivePrankDialogFragment extends AbsDialogFragment implements View.OnClickListener {
|
public class LivePrankDialogFragment extends AbsDialogFragment implements View.OnClickListener {
|
||||||
private TabLayout mTabLayout;
|
private TabLayout mTabLayout;
|
||||||
private View mTurntableConfigLayout;
|
private View mTurntableConfigLayout;
|
||||||
|
private TextView mPrankBtn;
|
||||||
private ImageView mTurntableConfigImageView;
|
private ImageView mTurntableConfigImageView;
|
||||||
private TextView mCoinTextView;
|
private TextView mCoinTextView;
|
||||||
|
private TextView mGiftNotDate;
|
||||||
private RecyclerView mPrankRecyclerView;
|
private RecyclerView mPrankRecyclerView;
|
||||||
private LivePrankRecyclerAdapter recyclerAdapter;
|
private LivePrankRecyclerAdapter recyclerAdapter;
|
||||||
|
private String mLiveUid;
|
||||||
|
private PrankHttpTurntableBean bean = new PrankHttpTurntableBean();
|
||||||
|
|
||||||
|
public void setmLiveUid(String mLiveUid) {
|
||||||
|
this.mLiveUid = mLiveUid;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getLayoutId() {
|
protected int getLayoutId() {
|
||||||
@ -45,7 +68,7 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O
|
|||||||
WindowManager.LayoutParams params = window.getAttributes();
|
WindowManager.LayoutParams params = window.getAttributes();
|
||||||
window.setWindowAnimations(R.style.bottomToTopAnim);
|
window.setWindowAnimations(R.style.bottomToTopAnim);
|
||||||
params.width = WindowManager.LayoutParams.MATCH_PARENT;
|
params.width = WindowManager.LayoutParams.MATCH_PARENT;
|
||||||
params.height = WindowManager.LayoutParams.WRAP_CONTENT;
|
params.height = DpUtil.dp2px(400);
|
||||||
params.gravity = Gravity.BOTTOM;
|
params.gravity = Gravity.BOTTOM;
|
||||||
window.setAttributes(params);
|
window.setAttributes(params);
|
||||||
}
|
}
|
||||||
@ -54,6 +77,8 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O
|
|||||||
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
||||||
super.onActivityCreated(savedInstanceState);
|
super.onActivityCreated(savedInstanceState);
|
||||||
initView();
|
initView();
|
||||||
|
initTab();
|
||||||
|
initTurntableData();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initView() {
|
private void initView() {
|
||||||
@ -62,16 +87,258 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O
|
|||||||
mTurntableConfigImageView = (ImageView) findViewById(R.id.switch1_btn);
|
mTurntableConfigImageView = (ImageView) findViewById(R.id.switch1_btn);
|
||||||
mCoinTextView = (TextView) findViewById(R.id.switch2_btn);
|
mCoinTextView = (TextView) findViewById(R.id.switch2_btn);
|
||||||
mPrankRecyclerView = (RecyclerView) findViewById(R.id.prank_config);
|
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));
|
mPrankRecyclerView.setLayoutManager(new LinearLayoutManager(mContext, RecyclerView.VERTICAL, false));
|
||||||
recyclerAdapter = new LivePrankRecyclerAdapter(mContext);
|
recyclerAdapter = new LivePrankRecyclerAdapter(mContext);
|
||||||
mPrankRecyclerView.setAdapter(recyclerAdapter);
|
mPrankRecyclerView.setAdapter(recyclerAdapter);
|
||||||
}
|
mCoinTextView.setOnClickListener(this);
|
||||||
private void initData(){
|
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
|
@Override
|
||||||
public void onClick(View v) {
|
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鑽石");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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_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>
|
@ -11,27 +11,35 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="16dp"
|
android:layout_marginStart="16dp"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="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>
|
</com.google.android.material.tabs.TabLayout>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textView4"
|
android:id="@+id/prank_btn"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="67dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="24dp"
|
||||||
android:textColor="#FFF"
|
|
||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="16dp"
|
||||||
android:layout_marginEnd="16dp"
|
android:layout_marginEnd="16dp"
|
||||||
android:text="TextView"
|
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_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<include
|
<include
|
||||||
layout="@layout/view_live_prank_turntable"
|
layout="@layout/view_live_prank_turntable"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="0dp"
|
||||||
android:layout_marginTop="20dp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
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>
|
@ -2,7 +2,8 @@
|
|||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="10dp">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/prank_turntable_title"
|
android:id="@+id/prank_turntable_title"
|
||||||
@ -25,20 +26,20 @@
|
|||||||
app:layout_constraintStart_toEndOf="@+id/prank_turntable_title"
|
app:layout_constraintStart_toEndOf="@+id/prank_turntable_title"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<EditText
|
<TextView
|
||||||
android:id="@+id/prank_turntable_val"
|
android:id="@+id/prank_turntable_val"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="33dp"
|
android:layout_height="43dp"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:background="@drawable/bg_prank_coin"
|
android:background="@drawable/bg_prank_coin"
|
||||||
android:ems="10"
|
android:ems="10"
|
||||||
android:hint="填寫整蠱內容,最少2個字,最多10個字"
|
android:hint="填寫整蠱內容,最少2個字,最多10個字"
|
||||||
android:inputType="text"
|
android:gravity="start|center"
|
||||||
android:paddingStart="12dp"
|
android:paddingStart="12dp"
|
||||||
android:paddingEnd="12dp"
|
android:paddingEnd="12dp"
|
||||||
android:textColor="#FFFFFF"
|
android:textColor="#FFFFFF"
|
||||||
android:textColorHint="#8C8C8C"
|
android:textColorHint="#8C8C8C"
|
||||||
android:textSize="10sp"
|
android:textSize="14sp"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/prank_turntable_title" />
|
app:layout_constraintTop_toBottomOf="@+id/prank_turntable_title" />
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
android:id="@+id/turntable_layout"
|
android:id="@+id/turntable_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="visible"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
@ -23,7 +24,6 @@
|
|||||||
android:layout_marginStart="10dp"
|
android:layout_marginStart="10dp"
|
||||||
android:text="轉盤整蠱開關"
|
android:text="轉盤整蠱開關"
|
||||||
android:textColor="#A992FF"
|
android:textColor="#A992FF"
|
||||||
android:textSize="10sp"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
@ -34,7 +34,7 @@
|
|||||||
android:layout_marginStart="10dp"
|
android:layout_marginStart="10dp"
|
||||||
android:text="關閉後所有用戶將無法看到轉盤內容"
|
android:text="關閉後所有用戶將無法看到轉盤內容"
|
||||||
android:textColor="#B3B3B3"
|
android:textColor="#B3B3B3"
|
||||||
android:textSize="8sp"
|
android:textSize="10sp"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/switch1_title_text" />
|
app:layout_constraintTop_toBottomOf="@+id/switch1_title_text" />
|
||||||
|
|
||||||
@ -61,7 +61,6 @@
|
|||||||
android:layout_marginStart="10dp"
|
android:layout_marginStart="10dp"
|
||||||
android:text="轉盤每次消耗鑽石"
|
android:text="轉盤每次消耗鑽石"
|
||||||
android:textColor="#A992FF"
|
android:textColor="#A992FF"
|
||||||
android:textSize="10sp"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
@ -72,7 +71,7 @@
|
|||||||
android:layout_marginStart="10dp"
|
android:layout_marginStart="10dp"
|
||||||
android:text="最少1,000鑽石起步"
|
android:text="最少1,000鑽石起步"
|
||||||
android:textColor="#B3B3B3"
|
android:textColor="#B3B3B3"
|
||||||
android:textSize="8sp"
|
android:textSize="10sp"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/switch2_title_text" />
|
app:layout_constraintTop_toBottomOf="@+id/switch2_title_text" />
|
||||||
|
|
||||||
@ -100,4 +99,13 @@
|
|||||||
android:layout_marginStart="10dp"
|
android:layout_marginStart="10dp"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:layout_marginEnd="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>
|
</LinearLayout>
|
||||||
|
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
@ -240,7 +240,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
|||||||
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
|
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
|
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
|
@Override
|
||||||
@ -421,7 +421,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
|||||||
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
|
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
|
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
|
@Override
|
||||||
@ -901,7 +901,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
|||||||
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
|
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
|
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
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user