update 自由PK
This commit is contained in:
parent
28b4a36800
commit
f62a093092
@ -68,6 +68,7 @@ import com.yunbao.live.bean.LiveKsyConfigBean;
|
|||||||
import com.yunbao.live.bean.LiveReceiveGiftBean;
|
import com.yunbao.live.bean.LiveReceiveGiftBean;
|
||||||
import com.yunbao.common.bean.LiveUserGiftBean;
|
import com.yunbao.common.bean.LiveUserGiftBean;
|
||||||
import com.yunbao.common.bean.MicUserBean;
|
import com.yunbao.common.bean.MicUserBean;
|
||||||
|
import com.yunbao.live.dialog.FreePkDialogFragment;
|
||||||
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;
|
||||||
@ -161,11 +162,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
|||||||
@Override
|
@Override
|
||||||
public void onStartPK(String pkUid) {
|
public void onStartPK(String pkUid) {
|
||||||
ToastUtil.show("发起随机PK:" + pkUid);
|
ToastUtil.show("发起随机PK:" + pkUid);
|
||||||
JSONObject msg1 = new JSONObject();
|
JSONObject msg1 = buildLinkMicJSON();
|
||||||
msg1.put("uid", CommonAppConfig.getInstance().getUid());
|
|
||||||
msg1.put("pkuid", CommonAppConfig.getInstance().getUid());
|
|
||||||
msg1.put("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName());
|
|
||||||
msg1.put("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatar());
|
|
||||||
msg1.put("randomPk", true);
|
msg1.put("randomPk", true);
|
||||||
linkMicAnchorApply(pkUid, pkUid, msg1.toString());
|
linkMicAnchorApply(pkUid, pkUid, msg1.toString());
|
||||||
}
|
}
|
||||||
@ -402,7 +399,8 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
|||||||
break;
|
break;
|
||||||
case Constants.LIVE_FUNC_LINK_MIC://连麦
|
case Constants.LIVE_FUNC_LINK_MIC://连麦
|
||||||
if (isDRPK != 1) {
|
if (isDRPK != 1) {
|
||||||
openLinkMicAnchorWindow(false);
|
//openLinkMicAnchorWindow(false);
|
||||||
|
openFreePkWindow();
|
||||||
} else {
|
} else {
|
||||||
ToastUtil.show("您已在PK中");
|
ToastUtil.show("您已在PK中");
|
||||||
}
|
}
|
||||||
@ -603,6 +601,12 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
|||||||
fragment.setArguments(bundle);
|
fragment.setArguments(bundle);
|
||||||
fragment.show(getSupportFragmentManager(), "LiveLinkMicListDialogFragment");
|
fragment.show(getSupportFragmentManager(), "LiveLinkMicListDialogFragment");
|
||||||
}
|
}
|
||||||
|
public void openFreePkWindow(){
|
||||||
|
FreePkDialogFragment fragment = new FreePkDialogFragment();
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
fragment.setArguments(bundle);
|
||||||
|
fragment.show(getSupportFragmentManager(), "FreePkDialogFragment");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 随机PK
|
* 随机PK
|
||||||
@ -1065,12 +1069,16 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
|||||||
* @param stream 对方主播的stream
|
* @param stream 对方主播的stream
|
||||||
*/
|
*/
|
||||||
public void linkMicAnchorApply(String pkUid, String stream) {
|
public void linkMicAnchorApply(String pkUid, String stream) {
|
||||||
|
JSONObject msg1 = buildLinkMicJSON();
|
||||||
|
linkMicAnchorApply(pkUid, stream, msg1.toString());
|
||||||
|
}
|
||||||
|
public JSONObject buildLinkMicJSON(){
|
||||||
JSONObject msg1 = new JSONObject();
|
JSONObject msg1 = new JSONObject();
|
||||||
msg1.put("uid", CommonAppConfig.getInstance().getUid());
|
msg1.put("uid", CommonAppConfig.getInstance().getUid());
|
||||||
msg1.put("pkuid", CommonAppConfig.getInstance().getUid());
|
msg1.put("pkuid", CommonAppConfig.getInstance().getUid());
|
||||||
msg1.put("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName());
|
msg1.put("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName());
|
||||||
msg1.put("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatar());
|
msg1.put("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatar());
|
||||||
linkMicAnchorApply(pkUid, stream, msg1.toString());
|
return msg1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void linkMicAnchorApply(final String pkUid, String stream, String extra) {
|
public void linkMicAnchorApply(final String pkUid, String stream, String extra) {
|
||||||
|
@ -14,7 +14,13 @@ import com.makeramen.roundedimageview.RoundedImageView;
|
|||||||
import com.yunbao.common.adapter.RefreshAdapter;
|
import com.yunbao.common.adapter.RefreshAdapter;
|
||||||
import com.yunbao.common.bean.RandomPkUserBean;
|
import com.yunbao.common.bean.RandomPkUserBean;
|
||||||
import com.yunbao.common.glide.ImgLoader;
|
import com.yunbao.common.glide.ImgLoader;
|
||||||
|
import com.yunbao.common.manager.IMRTCManager;
|
||||||
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
import com.yunbao.live.R;
|
import com.yunbao.live.R;
|
||||||
|
import com.yunbao.live.activity.LiveRyAnchorActivity;
|
||||||
|
|
||||||
|
import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback;
|
||||||
|
import cn.rongcloud.rtc.base.RTCErrorCode;
|
||||||
|
|
||||||
public class RandomPkRecyclerAdapter extends RefreshAdapter<RandomPkUserBean> {
|
public class RandomPkRecyclerAdapter extends RefreshAdapter<RandomPkUserBean> {
|
||||||
private static final int HEAD = 0;
|
private static final int HEAD = 0;
|
||||||
@ -85,6 +91,16 @@ public class RandomPkRecyclerAdapter extends RefreshAdapter<RandomPkUserBean> {
|
|||||||
mAvatar = itemView.findViewById(R.id.item_avatar);
|
mAvatar = itemView.findViewById(R.id.item_avatar);
|
||||||
mPkStatus = itemView.findViewById(R.id.item_pk);
|
mPkStatus = itemView.findViewById(R.id.item_pk);
|
||||||
mFollow = itemView.findViewById(R.id.item_follow);
|
mFollow = itemView.findViewById(R.id.item_follow);
|
||||||
|
mPkStatus.setOnClickListener(v -> {
|
||||||
|
RandomPkUserBean bean = (RandomPkUserBean) itemView.getTag();
|
||||||
|
if (bean.isPk()) {
|
||||||
|
ToastUtil.show(R.string.free_pk_user_pking);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
((LiveRyAnchorActivity) mContext).linkMicAnchorApply(bean.getId(), bean.getId(),
|
||||||
|
((LiveRyAnchorActivity) mContext).buildLinkMicJSON().toString()
|
||||||
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -94,7 +110,7 @@ public class RandomPkRecyclerAdapter extends RefreshAdapter<RandomPkUserBean> {
|
|||||||
if (bean == null) {
|
if (bean == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
System.out.println("bean = " + bean);
|
itemView.setTag(bean);
|
||||||
mNum.setText((position) + "");
|
mNum.setText((position) + "");
|
||||||
if (position % 2 == 0) {
|
if (position % 2 == 0) {
|
||||||
itemView.setBackgroundResource(R.drawable.bg_item_random_pk_type_1);
|
itemView.setBackgroundResource(R.drawable.bg_item_random_pk_type_1);
|
||||||
|
@ -30,6 +30,7 @@ import com.yunbao.common.http.HttpCallback;
|
|||||||
import com.yunbao.common.http.live.LiveNetManager;
|
import com.yunbao.common.http.live.LiveNetManager;
|
||||||
import com.yunbao.common.manager.RandomPkManager;
|
import com.yunbao.common.manager.RandomPkManager;
|
||||||
import com.yunbao.common.utils.DialogUitl;
|
import com.yunbao.common.utils.DialogUitl;
|
||||||
|
import com.yunbao.common.utils.DpUtil;
|
||||||
import com.yunbao.common.utils.ToastUtil;
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
import com.yunbao.common.utils.WordUtil;
|
import com.yunbao.common.utils.WordUtil;
|
||||||
import com.yunbao.common.utils.WordsTypeUtil;
|
import com.yunbao.common.utils.WordsTypeUtil;
|
||||||
@ -48,18 +49,20 @@ import java.util.TimerTask;
|
|||||||
* 自由PK
|
* 自由PK
|
||||||
*/
|
*/
|
||||||
public class FreePkDialogFragment extends AbsDialogFragment implements View.OnClickListener {
|
public class FreePkDialogFragment extends AbsDialogFragment implements View.OnClickListener {
|
||||||
|
private static final int TAB_STATUS_SEARCH = 1;
|
||||||
|
private static final int TAB_STATUS_FOLLOW = 2;
|
||||||
|
|
||||||
private static final String TAG = "自由PK";
|
private static final String TAG = "自由PK";
|
||||||
private int mLiveUid;
|
private int mLiveUid;
|
||||||
private TabLayout tabLayout;
|
private TabLayout tabLayout;
|
||||||
private View reset;
|
private View reset;
|
||||||
private CommonRefreshView mRecyclerView;
|
private CommonRefreshView mRecyclerView;
|
||||||
private View mPkInfoLayout;
|
|
||||||
private View mSearchLayout;
|
private View mSearchLayout;
|
||||||
private EditText mSearch;
|
private EditText mSearch;
|
||||||
private ImageView mClear;
|
private ImageView mClear;
|
||||||
private RandomPkRecyclerAdapter adapter;
|
private RandomPkRecyclerAdapter adapter;
|
||||||
private DataHelper helper;
|
private DataHelper helper;
|
||||||
|
private int tabStatus;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -82,7 +85,7 @@ public class FreePkDialogFragment extends AbsDialogFragment implements View.OnCl
|
|||||||
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(330);
|
||||||
params.gravity = Gravity.BOTTOM;
|
params.gravity = Gravity.BOTTOM;
|
||||||
window.setAttributes(params);
|
window.setAttributes(params);
|
||||||
}
|
}
|
||||||
@ -108,7 +111,6 @@ public class FreePkDialogFragment extends AbsDialogFragment implements View.OnCl
|
|||||||
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);
|
||||||
mRecyclerView = (CommonRefreshView) findViewById(R.id.random_container_view);
|
mRecyclerView = (CommonRefreshView) findViewById(R.id.random_container_view);
|
||||||
mPkInfoLayout = findViewById(R.id.layout_random_pk_info);
|
|
||||||
mSearchLayout = findViewById(R.id.random_pk_search_layout);
|
mSearchLayout = findViewById(R.id.random_pk_search_layout);
|
||||||
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);
|
||||||
@ -148,26 +150,27 @@ public class FreePkDialogFragment extends AbsDialogFragment implements View.OnCl
|
|||||||
private void initTab() {
|
private void initTab() {
|
||||||
TabLayout.Tab searchTag = tabLayout.newTab();
|
TabLayout.Tab searchTag = tabLayout.newTab();
|
||||||
TabLayout.Tab listTag = tabLayout.newTab();
|
TabLayout.Tab listTag = tabLayout.newTab();
|
||||||
searchTag.setTag(1);
|
searchTag.setTag(TAB_STATUS_SEARCH);
|
||||||
searchTag.setText("主播搜索");
|
searchTag.setText("主播搜索");
|
||||||
listTag.setTag(2);
|
listTag.setTag(TAB_STATUS_FOLLOW);
|
||||||
listTag.setText("關注列表");
|
listTag.setText("關注列表");
|
||||||
tabLayout.addTab(searchTag);
|
tabLayout.addTab(searchTag);
|
||||||
tabLayout.addTab(listTag);
|
tabLayout.addTab(listTag);
|
||||||
|
tabStatus = TAB_STATUS_SEARCH;
|
||||||
tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
|
tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onTabSelected(TabLayout.Tab tab) {
|
public void onTabSelected(TabLayout.Tab tab) {
|
||||||
if (tab.getTag() != null) {
|
if (tab.getTag() != null) {
|
||||||
mPkInfoLayout.setVisibility(View.GONE);
|
tabStatus = (int) tab.getTag();
|
||||||
mRecyclerView.setVisibility(View.GONE);
|
mRecyclerView.setVisibility(View.GONE);
|
||||||
mSearchLayout.setVisibility(View.INVISIBLE);
|
mSearchLayout.setVisibility(View.GONE);
|
||||||
switch ((int) tab.getTag()) {
|
switch (tabStatus) {
|
||||||
case 1:
|
case TAB_STATUS_SEARCH:
|
||||||
mSearchLayout.setVisibility(View.VISIBLE);
|
mSearchLayout.setVisibility(View.VISIBLE);
|
||||||
mRecyclerView.setVisibility(View.VISIBLE);
|
mRecyclerView.setVisibility(View.VISIBLE);
|
||||||
mRecyclerView.initData();
|
mRecyclerView.initData();
|
||||||
break;
|
break;
|
||||||
case 2:
|
case TAB_STATUS_FOLLOW:
|
||||||
mRecyclerView.setVisibility(View.VISIBLE);
|
mRecyclerView.setVisibility(View.VISIBLE);
|
||||||
mRecyclerView.initData();
|
mRecyclerView.initData();
|
||||||
break;
|
break;
|
||||||
@ -188,8 +191,6 @@ public class FreePkDialogFragment extends AbsDialogFragment implements View.OnCl
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
int id = v.getId();
|
int id = v.getId();
|
||||||
|
@ -99,7 +99,7 @@
|
|||||||
<com.yunbao.common.custom.CommonRefreshView
|
<com.yunbao.common.custom.CommonRefreshView
|
||||||
android:id="@+id/random_container_view"
|
android:id="@+id/random_container_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="238dp"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:visibility="visible">
|
android:visibility="visible">
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
app:riv_oval="true" />
|
app:riv_oval="true" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:layout_marginStart="5dp"
|
||||||
android:id="@+id/item_name"
|
android:id="@+id/item_name"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
<string name="random_pk_info_btn_end" translatable="false">正在退出匹配 %s</string>
|
<string name="random_pk_info_btn_end" translatable="false">正在退出匹配 %s</string>
|
||||||
<string name="random_pk_info_btn_end_desc" translatable="false">退出過程中也有可能匹配到對手</string>
|
<string name="random_pk_info_btn_end_desc" translatable="false">退出過程中也有可能匹配到對手</string>
|
||||||
<string name="random_pk_search_hint" translatable="false">請輸入您要pk的主播昵稱或id</string>
|
<string name="random_pk_search_hint" translatable="false">請輸入您要pk的主播昵稱或id</string>
|
||||||
|
<string name="free_pk_user_pking" translatable="false">對方正在PK中</string>
|
||||||
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user