update 多人PK也用新UI
This commit is contained in:
parent
f024283e80
commit
5356d91fef
@ -146,7 +146,7 @@ public class Constants {
|
|||||||
public static final String SOCKET_ALL_SERVER_NOTIFY = "AllServerNotify";//全服通知
|
public static final String SOCKET_ALL_SERVER_NOTIFY = "AllServerNotify";//全服通知
|
||||||
public static final String SOCKET_SEND_BARRAGE = "SendBarrage";//发弹幕
|
public static final String SOCKET_SEND_BARRAGE = "SendBarrage";//发弹幕
|
||||||
public static final String SOCKET_LIVE_DRPK = "LiveDRPK";//多人PK
|
public static final String SOCKET_LIVE_DRPK = "LiveDRPK";//多人PK
|
||||||
public static final String SOCKET_LIVE_DRPK_RANDOM = "LiveRandomPK";//多人PK
|
public static final String SOCKET_LIVE_DRPK_RANDOM = "LiveRandomPK";//随机PK
|
||||||
public static final String SOCKET_LEAVE_ROOM = "disconnect";//用户离开房间
|
public static final String SOCKET_LEAVE_ROOM = "disconnect";//用户离开房间
|
||||||
public static final String SOCKET_LIVE_END = "StartEndLive";//主播关闭直播
|
public static final String SOCKET_LIVE_END = "StartEndLive";//主播关闭直播
|
||||||
public static final String SOCKET_SYSTEM = "SystemNot";//系统消息
|
public static final String SOCKET_SYSTEM = "SystemNot";//系统消息
|
||||||
|
@ -5,6 +5,8 @@ import android.content.res.Resources;
|
|||||||
import com.yunbao.common.CommonAppContext;
|
import com.yunbao.common.CommonAppContext;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by cxf on 2017/10/10.
|
* Created by cxf on 2017/10/10.
|
||||||
@ -28,4 +30,14 @@ public class WordUtil {
|
|||||||
String language = locale.getLanguage();
|
String language = locale.getLanguage();
|
||||||
return language.endsWith("zh");
|
return language.endsWith("zh");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否包含特殊字符
|
||||||
|
*/
|
||||||
|
public static boolean isSpecialChar(String str) {
|
||||||
|
String regEx = "[ _`~!@#$%^&*()+=|{}':;',\\[\\].<>/?~!@#¥%……&*()——+|{}【】‘;:”“’。,、?]|\n|\r|\t";
|
||||||
|
Pattern p = Pattern.compile(regEx);
|
||||||
|
Matcher m = p.matcher(str);
|
||||||
|
return m.find();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -603,11 +603,15 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
|||||||
if (mLiveLinkMicAnchorPresenter != null && !mLiveLinkMicAnchorPresenter.canOpenLinkMicAnchor()) {
|
if (mLiveLinkMicAnchorPresenter != null && !mLiveLinkMicAnchorPresenter.canOpenLinkMicAnchor()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
LiveLinkMicListDialogFragment fragment = new LiveLinkMicListDialogFragment();
|
/* LiveLinkMicListDialogFragment fragment = new LiveLinkMicListDialogFragment();
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putBoolean("isDRPK", isDRPK);
|
bundle.putBoolean("isDRPK", isDRPK);
|
||||||
fragment.setArguments(bundle);
|
fragment.setArguments(bundle);
|
||||||
fragment.show(getSupportFragmentManager(), "LiveLinkMicListDialogFragment");
|
fragment.show(getSupportFragmentManager(), "LiveLinkMicListDialogFragment");*/
|
||||||
|
FreePkDialogFragment fragment=new FreePkDialogFragment();
|
||||||
|
fragment.setDrPkNum(pk_nub);
|
||||||
|
fragment.show(getSupportFragmentManager(),"LiveLinkMicListDialogFragment");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void openFreePkWindow() {
|
public void openFreePkWindow() {
|
||||||
|
@ -28,6 +28,7 @@ public class FreePkRecyclerAdapter extends RefreshAdapter<RandomPkUserBean> {
|
|||||||
private static final int HEAD = 0;
|
private static final int HEAD = 0;
|
||||||
private static final int ITEM = 2;
|
private static final int ITEM = 2;
|
||||||
private int freePkNum;//PK次数
|
private int freePkNum;//PK次数
|
||||||
|
private int mDrPkNum = -1;
|
||||||
|
|
||||||
public void setFreePkNum(int freePkNum) {
|
public void setFreePkNum(int freePkNum) {
|
||||||
this.freePkNum = freePkNum;
|
this.freePkNum = freePkNum;
|
||||||
@ -37,6 +38,9 @@ public class FreePkRecyclerAdapter extends RefreshAdapter<RandomPkUserBean> {
|
|||||||
super(context);
|
super(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setDrPkNum(int mDrPkNum) {
|
||||||
|
this.mDrPkNum = mDrPkNum;
|
||||||
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
@ -106,21 +110,31 @@ public class FreePkRecyclerAdapter extends RefreshAdapter<RandomPkUserBean> {
|
|||||||
ToastUtil.show(R.string.free_pk_user_pking);
|
ToastUtil.show(R.string.free_pk_user_pking);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (freePkNum == 0) {
|
if (freePkNum == 0 && mDrPkNum == -1) {
|
||||||
ToastUtil.show(R.string.free_pk_num_null);
|
ToastUtil.show(R.string.free_pk_num_null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LiveHttpUtil.getMicList(LiveRyAnchorActivity.mLiveUid, 0, new com.yunbao.common.http.HttpCallback() {
|
LiveHttpUtil.getMicList(LiveRyAnchorActivity.mLiveUid, 0, new com.yunbao.common.http.HttpCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(int code, String msg, String[] info) {
|
public void onSuccess(int code, String msg, String[] info) {
|
||||||
System.out.println("code = " + code + ", msg = " + msg + ", info = " + Arrays.deepToString(info));
|
System.out.println("code = " + code + ", msg = " + msg + ", info = " + Arrays.deepToString(info));
|
||||||
//非0认为未开通连麦权限
|
//非0认为未开通连麦权限
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
ToastUtil.show("邀请 " + bean.getUserNiceName() + " 发送成功");
|
if (mDrPkNum == -1) {
|
||||||
mOnItemClickListener.onItemClick(bean, -1);
|
ToastUtil.show("邀请 " + bean.getUserNiceName() + " 发送成功");
|
||||||
((LiveRyAnchorActivity) mContext).linkMicAnchorApply(bean.getId(), bean.getId(),
|
mOnItemClickListener.onItemClick(bean, -1);
|
||||||
((LiveRyAnchorActivity) mContext).buildLinkMicJSON().toString()
|
((LiveRyAnchorActivity) mContext).linkMicAnchorApply(bean.getId(), bean.getId(),
|
||||||
);
|
((LiveRyAnchorActivity) mContext).buildLinkMicJSON().toString()
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (mDrPkNum <= 0) {
|
||||||
|
ToastUtil.show("多人次數已用完");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
((LiveRyAnchorActivity) mContext).linkDrMicAnchorApply(bean.getId(), bean.getId());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
ToastUtil.show("請先關閉語言連麥");
|
ToastUtil.show("請先關閉語言連麥");
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ import com.yunbao.common.glide.ImgLoader;
|
|||||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||||
import com.yunbao.common.utils.DialogUitl;
|
import com.yunbao.common.utils.DialogUitl;
|
||||||
import com.yunbao.common.utils.ToastUtil;
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
|
import com.yunbao.common.utils.WordUtil;
|
||||||
import com.yunbao.live.R;
|
import com.yunbao.live.R;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -147,6 +148,10 @@ public class LivePrankRecyclerAdapter extends RecyclerView.Adapter<LivePrankRecy
|
|||||||
DialogUitl.showSimpleInputDialog(mContext, "填寫整蠱內容", DialogUitl.INPUT_TYPE_TEXT, 10, new DialogUitl.SimpleCallback() {
|
DialogUitl.showSimpleInputDialog(mContext, "填寫整蠱內容", DialogUitl.INPUT_TYPE_TEXT, 10, new DialogUitl.SimpleCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onConfirmClick(Dialog dialog, String content) {
|
public void onConfirmClick(Dialog dialog, String content) {
|
||||||
|
if(WordUtil.isSpecialChar(content)){
|
||||||
|
ToastUtil.show("整蠱內容不能包含特殊字符");
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (content.length() >= 2 && content.length() <= 10) {
|
if (content.length() >= 2 && content.length() <= 10) {
|
||||||
context.setText(content);
|
context.setText(content);
|
||||||
onItemClickListener.onItemClick(content, ((PrankTurntableBean)list.get((Integer) itemView.getTag())).getId());
|
onItemClickListener.onItemClick(content, ((PrankTurntableBean)list.get((Integer) itemView.getTag())).getId());
|
||||||
|
@ -50,10 +50,12 @@ public class FreePkDialogFragment extends AbsDialogFragment implements View.OnCl
|
|||||||
private View mSearchLayout;
|
private View mSearchLayout;
|
||||||
private EditText mSearch;
|
private EditText mSearch;
|
||||||
private TextView freePkNum;
|
private TextView freePkNum;
|
||||||
|
private TextView mPkNumText;
|
||||||
private ImageView mClear;
|
private ImageView mClear;
|
||||||
private FreePkRecyclerAdapter adapter;
|
private FreePkRecyclerAdapter adapter;
|
||||||
private DataHelper helper;
|
private DataHelper helper;
|
||||||
private int tabStatus;
|
private int tabStatus;
|
||||||
|
private int mDrPkNum = -1;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -94,6 +96,10 @@ public class FreePkDialogFragment extends AbsDialogFragment implements View.OnCl
|
|||||||
initData();
|
initData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setDrPkNum(int mDrPkNum) {
|
||||||
|
this.mDrPkNum = mDrPkNum;
|
||||||
|
}
|
||||||
|
|
||||||
private void initView() {
|
private void initView() {
|
||||||
tabLayout = (TabLayout) findViewById(R.id.menu_tab);
|
tabLayout = (TabLayout) findViewById(R.id.menu_tab);
|
||||||
reset = findViewById(R.id.menu_reset);
|
reset = findViewById(R.id.menu_reset);
|
||||||
@ -102,6 +108,7 @@ public class FreePkDialogFragment extends AbsDialogFragment implements View.OnCl
|
|||||||
mSearch = (EditText) findViewById(R.id.search_edit);
|
mSearch = (EditText) findViewById(R.id.search_edit);
|
||||||
mClear = (ImageView) findViewById(R.id.search_clear);
|
mClear = (ImageView) findViewById(R.id.search_clear);
|
||||||
freePkNum = (TextView) findViewById(R.id.free_pk_num);
|
freePkNum = (TextView) findViewById(R.id.free_pk_num);
|
||||||
|
mPkNumText = (TextView) findViewById(R.id.tmp_text1);
|
||||||
mClear.setOnClickListener(this);
|
mClear.setOnClickListener(this);
|
||||||
reset.setOnClickListener(this);
|
reset.setOnClickListener(this);
|
||||||
mSearch.addTextChangedListener(new TextWatcher() {
|
mSearch.addTextChangedListener(new TextWatcher() {
|
||||||
@ -120,7 +127,9 @@ public class FreePkDialogFragment extends AbsDialogFragment implements View.OnCl
|
|||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
if (mDrPkNum != -1) {
|
||||||
|
mPkNumText.setText("多人PK剩余次數");
|
||||||
|
}
|
||||||
initRecycler();
|
initRecycler();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,6 +142,7 @@ public class FreePkDialogFragment extends AbsDialogFragment implements View.OnCl
|
|||||||
mRecyclerView.initData();
|
mRecyclerView.initData();
|
||||||
mRecyclerView.setRefreshEnable(false);
|
mRecyclerView.setRefreshEnable(false);
|
||||||
mRecyclerView.setEmptyLayoutId(R.layout.view_live_search_list_empty);
|
mRecyclerView.setEmptyLayoutId(R.layout.view_live_search_list_empty);
|
||||||
|
adapter.setDrPkNum(mDrPkNum);
|
||||||
adapter.setOnItemClickListener(new OnItemClickListener<RandomPkUserBean>() {
|
adapter.setOnItemClickListener(new OnItemClickListener<RandomPkUserBean>() {
|
||||||
@Override
|
@Override
|
||||||
public void onItemClick(RandomPkUserBean bean, int position) {
|
public void onItemClick(RandomPkUserBean bean, int position) {
|
||||||
@ -147,6 +157,10 @@ public class FreePkDialogFragment extends AbsDialogFragment implements View.OnCl
|
|||||||
|
|
||||||
|
|
||||||
private void initData() {
|
private void initData() {
|
||||||
|
if (mDrPkNum != -1) {
|
||||||
|
freePkNum.setText("" + mDrPkNum);
|
||||||
|
return;
|
||||||
|
}
|
||||||
LiveNetManager.get(mContext).getFreePkNumber(new com.yunbao.common.http.base.HttpCallback<Integer>() {
|
LiveNetManager.get(mContext).getFreePkNumber(new com.yunbao.common.http.base.HttpCallback<Integer>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Integer data) {
|
public void onSuccess(Integer data) {
|
||||||
|
@ -23,6 +23,7 @@ import com.yunbao.common.http.HttpCallback;
|
|||||||
import com.yunbao.common.utils.DialogUitl;
|
import com.yunbao.common.utils.DialogUitl;
|
||||||
import com.yunbao.common.utils.StringUtil;
|
import com.yunbao.common.utils.StringUtil;
|
||||||
import com.yunbao.common.utils.ToastUtil;
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
|
import com.yunbao.common.utils.WordUtil;
|
||||||
import com.yunbao.live.R;
|
import com.yunbao.live.R;
|
||||||
import com.yunbao.live.adapter.GiftTopAdapter;
|
import com.yunbao.live.adapter.GiftTopAdapter;
|
||||||
import com.yunbao.live.adapter.LiveGiftPagerAdapter;
|
import com.yunbao.live.adapter.LiveGiftPagerAdapter;
|
||||||
@ -58,6 +59,7 @@ public class GiftPopDialog extends PopupWindow implements ActionListener, View.O
|
|||||||
private String prangContext;
|
private String prangContext;
|
||||||
private int prangNum;
|
private int prangNum;
|
||||||
private InputMethodManager imm;
|
private InputMethodManager imm;
|
||||||
|
private List<PrankGiftBean> giftBeans;
|
||||||
|
|
||||||
private void initView(View mRootView) {
|
private void initView(View mRootView) {
|
||||||
mLoading = mRootView.findViewById(R.id.loading);
|
mLoading = mRootView.findViewById(R.id.loading);
|
||||||
@ -132,7 +134,7 @@ public class GiftPopDialog extends PopupWindow implements ActionListener, View.O
|
|||||||
@Override
|
@Override
|
||||||
public void onDismiss() {
|
public void onDismiss() {
|
||||||
if (mActionListener != null) {
|
if (mActionListener != null) {
|
||||||
if (bean == null || StringUtil.isEmpty(prangContext) || prangNum==0) {
|
if (bean == null || StringUtil.isEmpty(prangContext) || prangNum == 0) {
|
||||||
mActionListener.onDismiss();
|
mActionListener.onDismiss();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -259,16 +261,36 @@ public class GiftPopDialog extends PopupWindow implements ActionListener, View.O
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (id == R.id.gift_btn) {
|
} else if (id == R.id.gift_btn) {
|
||||||
if (bean == null || StringUtil.isEmpty(prangContext) || prangNum==0) {
|
if (bean == null || StringUtil.isEmpty(prangContext) || prangNum == 0) {
|
||||||
ToastUtil.show("整蠱內容或數量不能為空");
|
ToastUtil.show("整蠱內容或數量不能為空");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(WordUtil.isSpecialChar(prangContext)){
|
||||||
|
ToastUtil.show("整蠱內容不能包含特殊字符");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(prangContext.length()>6){
|
||||||
|
ToastUtil.show("整蠱內容過長");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(giftBeans!=null){
|
||||||
|
for (PrankGiftBean giftBean : giftBeans) {
|
||||||
|
if(giftBean.getGiftId().equals(bean.getId()+"")){
|
||||||
|
ToastUtil.show("整蠱禮物已存在");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
dismiss();
|
dismiss();
|
||||||
} else if (id == R.id.gift_back) {
|
} else if (id == R.id.gift_back) {
|
||||||
dismiss();
|
dismiss();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setList(List<PrankGiftBean> giftBeans) {
|
||||||
|
this.giftBeans = giftBeans;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public interface ActionListener {
|
public interface ActionListener {
|
||||||
void onSelectGift(PrankGiftBean bean);
|
void onSelectGift(PrankGiftBean bean);
|
||||||
|
@ -43,6 +43,7 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O
|
|||||||
private LivePrankRecyclerAdapter recyclerAdapter;
|
private LivePrankRecyclerAdapter recyclerAdapter;
|
||||||
private String mLiveUid;
|
private String mLiveUid;
|
||||||
private PrankHttpTurntableBean bean = new PrankHttpTurntableBean();
|
private PrankHttpTurntableBean bean = new PrankHttpTurntableBean();
|
||||||
|
private List<PrankGiftBean> giftBeans;
|
||||||
|
|
||||||
public void setmLiveUid(String mLiveUid) {
|
public void setmLiveUid(String mLiveUid) {
|
||||||
this.mLiveUid = mLiveUid;
|
this.mLiveUid = mLiveUid;
|
||||||
@ -135,6 +136,10 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O
|
|||||||
});
|
});
|
||||||
mPrankBtn.setOnClickListener(view -> {
|
mPrankBtn.setOnClickListener(view -> {
|
||||||
if ((int) view.getTag() == 1) {
|
if ((int) view.getTag() == 1) {
|
||||||
|
if(giftBeans!=null&&giftBeans.size()>=20){
|
||||||
|
ToastUtil.show("可添加禮物數量達到上限");
|
||||||
|
return;
|
||||||
|
}
|
||||||
GiftPopDialog dialog = new GiftPopDialog(mContext, mRootView, new GiftPopDialog.ActionListener() {
|
GiftPopDialog dialog = new GiftPopDialog(mContext, mRootView, new GiftPopDialog.ActionListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -149,6 +154,7 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O
|
|||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
dialog.setList(giftBeans);
|
||||||
dialog.show();
|
dialog.show();
|
||||||
} else {
|
} else {
|
||||||
setPrankConfig();
|
setPrankConfig();
|
||||||
@ -241,9 +247,10 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O
|
|||||||
mGiftNotDate.setVisibility(View.GONE);
|
mGiftNotDate.setVisibility(View.GONE);
|
||||||
mPrankRecyclerView.setVisibility(View.VISIBLE);
|
mPrankRecyclerView.setVisibility(View.VISIBLE);
|
||||||
recyclerAdapter.setViewType(LivePrankRecyclerAdapter.TYPE_GIFT);
|
recyclerAdapter.setViewType(LivePrankRecyclerAdapter.TYPE_GIFT);
|
||||||
|
giftBeans = data;
|
||||||
recyclerAdapter.setList(data);
|
recyclerAdapter.setList(data);
|
||||||
recyclerAdapter.notifyDataSetChanged();
|
recyclerAdapter.notifyDataSetChanged();
|
||||||
}else{
|
} else {
|
||||||
mPrankRecyclerView.setVisibility(View.GONE);
|
mPrankRecyclerView.setVisibility(View.GONE);
|
||||||
mGiftNotDate.setVisibility(View.VISIBLE);
|
mGiftNotDate.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user