update 自由PK
This commit is contained in:
parent
8e45e17768
commit
415ed2fc9b
@ -9,7 +9,6 @@ import com.yunbao.common.bean.CustomSidebarInfoModel;
|
||||
import com.yunbao.common.bean.EnterRoomNewModel;
|
||||
import com.yunbao.common.bean.FaceBookUpModel;
|
||||
import com.yunbao.common.bean.HourRank;
|
||||
import com.yunbao.common.bean.HttpCallbackModel;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.bean.LinkMicUserBeanV2;
|
||||
import com.yunbao.common.bean.LiveInfoModel;
|
||||
@ -358,10 +357,10 @@ public interface PDLiveApi {
|
||||
@GET("/api/public/?service=Livepk.setRandomPKType")
|
||||
Observable<ResponseModel<List<BaseModel>>> changeRandomPkSwitch(@Query("random_pk") int pk);
|
||||
/**
|
||||
* 获取随机PK次数
|
||||
* 获取自由PK次数
|
||||
*/
|
||||
@GET("/api/public/?service=Livepk.getRandomPKType")
|
||||
Observable<ResponseModel<Integer>> getRandomPkNumber();
|
||||
@GET("/api/public/?service=Livepk.getActivePkNum")
|
||||
Observable<ResponseModel<Integer>> getFreePkNumber();
|
||||
/**
|
||||
* 发起随机PK
|
||||
*/
|
||||
@ -376,7 +375,7 @@ public interface PDLiveApi {
|
||||
* 自由PK开始后调用接口扣掉次数
|
||||
*/
|
||||
@GET("/api/public/?service=Livepk.setActivePkNum")
|
||||
Observable<ResponseModel<BaseModel>> setRandomPkNum();
|
||||
Observable<ResponseModel<BaseModel>> setFreePkNum();
|
||||
/**
|
||||
* 随机PK搜索用户
|
||||
* @param cs 简体关键字/uid
|
||||
|
@ -4,7 +4,6 @@ import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.ActiveModel;
|
||||
@ -564,11 +563,11 @@ public class LiveNetManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取随机PK次数
|
||||
* 获取自由PK次数
|
||||
*/
|
||||
public void getRandomPkNumber(HttpCallback<Integer> callback) {
|
||||
public void getFreePkNumber(HttpCallback<Integer> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.getRandomPkNumber()
|
||||
.getFreePkNumber()
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe(new Consumer<ResponseModel<Integer>>() {
|
||||
@ -616,9 +615,9 @@ public class LiveNetManager {
|
||||
/**
|
||||
* 自由PK开始后调用接口扣掉次数
|
||||
*/
|
||||
public void setRandomPkNum(HttpCallback<HttpCallbackModel> callback) {
|
||||
public void setFreePkNum(HttpCallback<HttpCallbackModel> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.setRandomPkNum()
|
||||
.setFreePkNum()
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe(new Consumer<ResponseModel<BaseModel>>() {
|
||||
|
@ -10,9 +10,9 @@ ext {
|
||||
manifestPlaceholders = [
|
||||
//正式
|
||||
|
||||
serverHost : "https://napi.yaoulive.com",
|
||||
// serverHost : "https://napi.yaoulive.com",
|
||||
//測試
|
||||
// serverHost : "https://ceshi.yaoulive.com",
|
||||
serverHost : "https://ceshi.yaoulive.com",
|
||||
|
||||
//腾讯地图
|
||||
txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB",
|
||||
|
@ -17,13 +17,12 @@ import com.yunbao.common.bean.SetAttentsModel;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.manager.IMRTCManager;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.activity.LiveRyAnchorActivity;
|
||||
import com.yunbao.live.http.LiveHttpUtil;
|
||||
|
||||
import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback;
|
||||
import cn.rongcloud.rtc.base.RTCErrorCode;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class RandomPkRecyclerAdapter extends RefreshAdapter<RandomPkUserBean> {
|
||||
private static final int HEAD = 0;
|
||||
@ -46,7 +45,7 @@ public class RandomPkRecyclerAdapter extends RefreshAdapter<RandomPkUserBean> {
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
if (getItemViewType(position) == ITEM) {
|
||||
((ItemViewHolder) holder).setData(mList.get(position ), position );
|
||||
((ItemViewHolder) holder).setData(mList.get(position), position);
|
||||
} else {
|
||||
((HeadViewHolder) holder).setData(mList.get(position), position);
|
||||
}
|
||||
@ -102,9 +101,23 @@ public class RandomPkRecyclerAdapter extends RefreshAdapter<RandomPkUserBean> {
|
||||
ToastUtil.show(R.string.free_pk_user_pking);
|
||||
return;
|
||||
}
|
||||
((LiveRyAnchorActivity) mContext).linkMicAnchorApply(bean.getId(), bean.getId(),
|
||||
((LiveRyAnchorActivity) mContext).buildLinkMicJSON().toString()
|
||||
);
|
||||
LiveHttpUtil.getMicList(LiveRyAnchorActivity.mLiveUid, 0, new com.yunbao.common.http.HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
System.out.println("code = " + code + ", msg = " + msg + ", info = " + Arrays.deepToString(info));
|
||||
//非0认为未开通连麦权限
|
||||
if (code != 0) {
|
||||
ToastUtil.show("邀请 " + bean.getUserNiceName() + " 发送成功");
|
||||
mOnItemClickListener.onItemClick(bean, -1);
|
||||
((LiveRyAnchorActivity) mContext).linkMicAnchorApply(bean.getId(), bean.getId(),
|
||||
((LiveRyAnchorActivity) mContext).buildLinkMicJSON().toString()
|
||||
);
|
||||
} else {
|
||||
ToastUtil.show("請先關閉語言連麥");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
mFollow.setOnClickListener(v -> {
|
||||
RandomPkUserBean bean = (RandomPkUserBean) itemView.getTag();
|
||||
|
@ -10,6 +10,7 @@ import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
@ -25,6 +26,7 @@ import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordsTypeUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.adapter.RandomPkRecyclerAdapter;
|
||||
@ -49,6 +51,7 @@ public class FreePkDialogFragment extends AbsDialogFragment implements View.OnCl
|
||||
private CommonRefreshView mRecyclerView;
|
||||
private View mSearchLayout;
|
||||
private EditText mSearch;
|
||||
private TextView freePkNum;
|
||||
private ImageView mClear;
|
||||
private RandomPkRecyclerAdapter adapter;
|
||||
private DataHelper helper;
|
||||
@ -75,7 +78,7 @@ public class FreePkDialogFragment extends AbsDialogFragment implements View.OnCl
|
||||
WindowManager.LayoutParams params = window.getAttributes();
|
||||
window.setWindowAnimations(R.style.bottomToTopAnim);
|
||||
params.width = WindowManager.LayoutParams.MATCH_PARENT;
|
||||
params.height = DpUtil.dp2px(330);
|
||||
params.height = DpUtil.dp2px(400);
|
||||
params.gravity = Gravity.BOTTOM;
|
||||
window.setAttributes(params);
|
||||
}
|
||||
@ -104,7 +107,9 @@ public class FreePkDialogFragment extends AbsDialogFragment implements View.OnCl
|
||||
mSearchLayout = findViewById(R.id.random_pk_search_layout);
|
||||
mSearch = (EditText) findViewById(R.id.search_edit);
|
||||
mClear = (ImageView) findViewById(R.id.search_clear);
|
||||
freePkNum = (TextView) findViewById(R.id.free_pk_num);
|
||||
mClear.setOnClickListener(this);
|
||||
reset.setOnClickListener(this);
|
||||
mSearch.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
@ -132,10 +137,15 @@ public class FreePkDialogFragment extends AbsDialogFragment implements View.OnCl
|
||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
|
||||
mRecyclerView.setDataHelper(helper);
|
||||
mRecyclerView.initData();
|
||||
mRecyclerView.setRefreshEnable(false);
|
||||
mRecyclerView.setEmptyLayoutId(R.layout.view_live_search_list_empty);
|
||||
adapter.setOnItemClickListener(new OnItemClickListener<RandomPkUserBean>() {
|
||||
@Override
|
||||
public void onItemClick(RandomPkUserBean bean, int position) {
|
||||
if (position == -1) {
|
||||
dismiss();
|
||||
return;
|
||||
}
|
||||
mRecyclerView.initData();
|
||||
}
|
||||
});
|
||||
@ -143,6 +153,17 @@ public class FreePkDialogFragment extends AbsDialogFragment implements View.OnCl
|
||||
|
||||
|
||||
private void initData() {
|
||||
LiveNetManager.get(mContext).getFreePkNumber(new com.yunbao.common.http.base.HttpCallback<Integer>() {
|
||||
@Override
|
||||
public void onSuccess(Integer data) {
|
||||
freePkNum.setText("" + data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initTab() {
|
||||
@ -198,8 +219,14 @@ public class FreePkDialogFragment extends AbsDialogFragment implements View.OnCl
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int id = v.getId();
|
||||
if (id == R.id.live_random_pk_switch) {
|
||||
|
||||
if (id == R.id.menu_reset) {
|
||||
if (helper.status == DataHelper.LIST_MODEL_LIST) {
|
||||
mSearch.setText("");
|
||||
mRecyclerView.initData();
|
||||
mRecyclerView.showEmpty();
|
||||
} else {
|
||||
mRecyclerView.initData();
|
||||
}
|
||||
} else if (id == R.id.search_clear) {
|
||||
mSearch.setText("");
|
||||
}
|
||||
@ -266,8 +293,11 @@ public class FreePkDialogFragment extends AbsDialogFragment implements View.OnCl
|
||||
@Override
|
||||
public List<RandomPkUserBean> processData(String[] info) {
|
||||
Log.i(TAG, "processData: 获取数据成功");
|
||||
List<LivePkBean> beans = JSON.parseArray(Arrays.toString(info), LivePkBean.class);
|
||||
List<RandomPkUserBean> list = new ArrayList<>();
|
||||
if (info == null || info.length == 0) {
|
||||
return list;
|
||||
}
|
||||
List<LivePkBean> beans = JSON.parseArray(Arrays.toString(info), LivePkBean.class);
|
||||
list.add(null);
|
||||
for (LivePkBean bean : beans) {
|
||||
RandomPkUserBean userBean = new RandomPkUserBean();
|
||||
@ -283,7 +313,6 @@ public class FreePkDialogFragment extends AbsDialogFragment implements View.OnCl
|
||||
|
||||
@Override
|
||||
public void onRefreshSuccess(List<RandomPkUserBean> list, int listCount) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -298,7 +327,6 @@ public class FreePkDialogFragment extends AbsDialogFragment implements View.OnCl
|
||||
|
||||
@Override
|
||||
public void onLoadMoreFailure() {
|
||||
mRecyclerView.showEmpty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,9 +31,11 @@ import com.tencent.rtmp.TXLiveConstants;
|
||||
import com.tencent.trtc.TRTCCloudDef;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.bean.HttpCallbackModel;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.HttpClient;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.manager.IMRTCManager;
|
||||
import com.yunbao.common.manager.RandomPkManager;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
@ -312,6 +314,18 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
|
||||
}
|
||||
mLiveRyLinkMicPkPresenter.onLinkMicToPk(userBean1);
|
||||
mLiveRyLinkMicPkPresenter.onLinkMicPkStart(inviteeRoomId, 3);
|
||||
//单人PK,减掉次数
|
||||
LiveNetManager.get(mContext).setFreePkNum(new com.yunbao.common.http.base.HttpCallback<HttpCallbackModel>() {
|
||||
@Override
|
||||
public void onSuccess(HttpCallbackModel data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -1,17 +1,18 @@
|
||||
<?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="330dp"
|
||||
android:layout_height="430dp"
|
||||
android:background="@drawable/bg_live_tota">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/random_menu_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:orientation="vertical"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@+id/constraintLayout"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
@ -105,4 +106,61 @@
|
||||
|
||||
</com.yunbao.common.custom.CommonRefreshView>
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/constraintLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:background="@drawable/background_7792d0"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tmp_text1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="自由PK剩余次數"
|
||||
android:textColor="#9A9A9A"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/free_pk_num"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:text="-2"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/tmp_text1"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tmp_text2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:text="每日凌晨6点更新"
|
||||
android:textColor="#9A9A9A"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView6"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="4dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/tmp_text2"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@mipmap/icon_free_pk_waring" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
BIN
live/src/main/res/mipmap-xhdpi/icon_free_pk_waring.png
Normal file
BIN
live/src/main/res/mipmap-xhdpi/icon_free_pk_waring.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 717 B |
Loading…
Reference in New Issue
Block a user