update 整蛊
This commit is contained in:
parent
308d5acc21
commit
07da7acacd
@ -338,4 +338,34 @@ public interface PDLiveApi {
|
||||
@Query("GroupId") String GroupId,
|
||||
@Query("stream") String stream
|
||||
);
|
||||
|
||||
/**
|
||||
* 获取转盘整蛊列表
|
||||
*/
|
||||
@GET("/api/public/?service=Prank.getAnchorPrankTurntable")
|
||||
Observable<ResponseModel<List<BaseModel>>> 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
|
||||
);
|
||||
}
|
||||
|
@ -33,6 +33,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;
|
||||
|
||||
|
||||
/**
|
||||
@ -501,6 +502,54 @@ public class LiveNetManager {
|
||||
});
|
||||
}
|
||||
|
||||
public void getAnchorPrankTurntable(String mLiveUid, HttpCallback<Object> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.getAnchorPrankTurntable(mLiveUid)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe(new Consumer<ResponseModel<List<BaseModel>>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<List<BaseModel>> listResponseModel) throws Exception {
|
||||
|
||||
}
|
||||
}, 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)
|
||||
.getAnchorPrankTurntable(mLiveUid)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe(new Consumer<ResponseModel<List<BaseModel>>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<List<BaseModel>> listResponseModel) throws Exception {
|
||||
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(throwable.getMessage());
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 直播间取消网络请求
|
||||
*/
|
||||
|
@ -0,0 +1,99 @@
|
||||
package com.yunbao.live.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
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> {
|
||||
private Context mContext;
|
||||
private List<PrankTurntableBean> list;
|
||||
|
||||
public LivePrankRecyclerAdapter(Context mContext) {
|
||||
this.mContext = mContext;
|
||||
}
|
||||
|
||||
public void setList(List<PrankTurntableBean> list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public PrankRecyclerViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new PrankRecyclerViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_live_prank_turntable_config, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull PrankRecyclerViewHolder holder, int position) {
|
||||
holder.setDate(list.get(position));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return list.size();
|
||||
}
|
||||
|
||||
public static class PrankRecyclerViewHolder extends RecyclerView.ViewHolder {
|
||||
private TextView title;
|
||||
private TextView probability;
|
||||
private EditText context;
|
||||
|
||||
public PrankRecyclerViewHolder(@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);
|
||||
}
|
||||
|
||||
public void setDate(PrankTurntableBean bean) {
|
||||
title.setText(getChineseNum(bean.getId()));
|
||||
probability.setText(getProbability(bean.getId()));
|
||||
context.setText(bean.getContext());
|
||||
}
|
||||
|
||||
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%";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
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;
|
||||
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.yunbao.live.bean;
|
||||
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
|
||||
public class PrankTurntableBean extends BaseModel {
|
||||
private int id;
|
||||
private String context;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
@ -15,13 +15,15 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
import com.yunbao.common.dialog.AbsDialogFragment;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.adapter.LivePrankRecyclerAdapter;
|
||||
|
||||
public class LivePrankDialogFragment extends AbsDialogFragment {
|
||||
public class LivePrankDialogFragment extends AbsDialogFragment implements View.OnClickListener {
|
||||
private TabLayout mTabLayout;
|
||||
private View mTurntableConfigLayout;
|
||||
private ImageView mTurntableConfigImageView;
|
||||
private TextView mCoinTextView;
|
||||
private RecyclerView mPrankRecyclerView;
|
||||
private LivePrankRecyclerAdapter recyclerAdapter;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
@ -61,5 +63,15 @@ public class LivePrankDialogFragment extends AbsDialogFragment {
|
||||
mCoinTextView = (TextView) findViewById(R.id.switch2_btn);
|
||||
mPrankRecyclerView = (RecyclerView) findViewById(R.id.prank_config);
|
||||
mPrankRecyclerView.setLayoutManager(new LinearLayoutManager(mContext, RecyclerView.VERTICAL, false));
|
||||
recyclerAdapter = new LivePrankRecyclerAdapter(mContext);
|
||||
mPrankRecyclerView.setAdapter(recyclerAdapter);
|
||||
}
|
||||
private void initData(){
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -39,6 +39,7 @@
|
||||
android:textColor="#FFFFFF"
|
||||
android:textColorHint="#8C8C8C"
|
||||
android:textSize="10sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/prank_turntable_title" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
Loading…
Reference in New Issue
Block a user