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z7z7v$!GF=oAs_{kn|5T@Qs1OiyetFqWy`%hjo2152k#XwY!e zD~uu)^2+2J!p6pJ(t&<2f~XI&9tpNLTwtt3g8f3to?uD%UZ&uwuz9AdW4(HpSA9g4 z@>gHza^-J)7cXm>8FtLaA`arZ^le92{CYvA^f -t zC9+cb)1&RJK4Z7g;^L60mmWbg+aA0}E03f+YW3( Q%j@RWo+7GNZAu7R>TUq_7IJA!%#^!{|dFjbOt3N+4U3W0X8=bH=bT!#iuiyj2KM zv!0^!ynzg|MxJeA=7)2^#374>cCJ7XPEx0j7bYT52P&%zX}Q-!fDue~HWXovrDWu? zkMX1F$wGsMF|^{SJ4apR@9APLn96|#KAbsM^G(P>j%yRQ&-ZAdMkz0W)0;s>>$VvG Y0mJk8yL!3D-T(jq07*qoM6N<$f;It~*8l(j literal 0 HcmV?d00001 diff --git a/live/src/main/res/values/strings.xml b/live/src/main/res/values/strings.xml index de6947d08..f83fcb9fc 100644 --- a/live/src/main/res/values/strings.xml +++ b/live/src/main/res/values/strings.xml @@ -36,5 +36,6 @@ 开始匹配 匹配中 %s \n再次点击可取消匹配 正在退出匹配 %s \n退出过程中也有可能匹配到对手 +请输入您要pk的主播昵称或id diff --git a/main/src/main/java/com/yunbao/main/activity/MainActivity.java b/main/src/main/java/com/yunbao/main/activity/MainActivity.java index 0def9b415..6eeafe9bd 100644 --- a/main/src/main/java/com/yunbao/main/activity/MainActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MainActivity.java @@ -91,6 +91,7 @@ import com.yunbao.common.views.AbsMainViewHolder; import com.yunbao.common.views.floatingview.APPEasyFloat; import com.yunbao.common.views.weight.LiveFloatView; import com.yunbao.live.activity.LiveAudienceActivity; +import com.yunbao.live.dialog.RandomPkDialogFragment; import com.yunbao.live.http.LiveHttpConsts; import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; @@ -646,7 +647,9 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene //关注 FollowActivity.forward(mContext, CommonAppConfig.getInstance().getUid(), 0); } else if (i == R.id.img_trophy) { - MainListActivity.forward(mContext, 0); + // MainListActivity.forward(mContext, 0); + RandomPkDialogFragment fragment = new RandomPkDialogFragment(); + fragment.show(this.getSupportFragmentManager(), "RandomPkDialogFragment"); } From e0b69be2d43e9809e3fbc9ee3f2a7bdc23357960 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Thu, 24 Nov 2022 15:34:51 +0800 Subject: [PATCH 04/13] =?UTF-8?q?update=20=E9=9A=8F=E6=9C=BAPk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../live/adapter/RandomPkRecyclerAdapter.java | 89 +++++++++++-- .../live/dialog/RandomPkDialogFragment.java | 118 +++++++++++++++++- .../res/drawable/bg_item_random_pk_type_2.xml | 9 ++ .../layout/dialog_live_random_pk_function.xml | 27 ++-- .../main/res/layout/item_random_pk_info.xml | 25 ++-- .../src/main/res/layout/item_random_pk_rv.xml | 6 +- .../res/layout/item_random_pk_rv_head.xml | 4 +- .../res/layout/item_random_pk_rv_search.xml | 24 ++-- 8 files changed, 253 insertions(+), 49 deletions(-) create mode 100644 live/src/main/res/drawable/bg_item_random_pk_type_2.xml diff --git a/live/src/main/java/com/yunbao/live/adapter/RandomPkRecyclerAdapter.java b/live/src/main/java/com/yunbao/live/adapter/RandomPkRecyclerAdapter.java index 6206619c9..47cede1f8 100644 --- a/live/src/main/java/com/yunbao/live/adapter/RandomPkRecyclerAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/RandomPkRecyclerAdapter.java @@ -1,56 +1,121 @@ package com.yunbao.live.adapter; import android.content.Context; +import android.view.KeyEvent; +import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.EditText; +import android.widget.ImageView; +import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; +import com.makeramen.roundedimageview.RoundedImageView; import com.yunbao.common.adapter.RefreshAdapter; +import com.yunbao.common.glide.ImgLoader; +import com.yunbao.live.R; import com.yunbao.live.bean.RandomPkBean; import java.util.ArrayList; import java.util.List; public class RandomPkRecyclerAdapter extends RefreshAdapter{ - private List list=new ArrayList<>(); + private static final int HEAD = 0; + private static final int ITEM = 2; public RandomPkRecyclerAdapter(Context context) { super(context); } - @Override - public void setList(List list) { - this.list = list; - } @NonNull @Override - public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { - return null; + public HeadViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + if (viewType == HEAD) { + return new HeadViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_random_pk_rv_head, parent, false)); + } + return new ItemViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_random_pk_rv, parent, false)); } @Override public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { - + if (getItemViewType(position) == ITEM) { + ((HeadViewHolder) holder).setData(mList.get(position-1)); + } } @Override public int getItemCount() { - return 0; + return mList.size(); } @Override public int getItemViewType(int position) { - return super.getItemViewType(position); + if (position == 0) { + return HEAD; + } + return ITEM; } - public class ViewHolder extends RecyclerView.ViewHolder{ + private class HeadViewHolder extends RecyclerView.ViewHolder { - public ViewHolder(@NonNull View itemView) { + public HeadViewHolder(@NonNull View itemView) { super(itemView); } + + public void setData(RandomPkBean bean) { + + } + } + + + public class ItemViewHolder extends HeadViewHolder { + private TextView mNum; + private TextView mName; + private TextView mId; + private TextView mStatus; + private RoundedImageView mAvatar; + private ImageView mPkStatus; + private ImageView mFollow; + + public ItemViewHolder(@NonNull View itemView) { + super(itemView); + mNum = itemView.findViewById(R.id.item_id); + mName = itemView.findViewById(R.id.item_name); + mId = itemView.findViewById(R.id.item_uid); + mStatus = itemView.findViewById(R.id.item_status); + mAvatar = itemView.findViewById(R.id.item_avatar); + mPkStatus = itemView.findViewById(R.id.item_pk); + mFollow = itemView.findViewById(R.id.item_follow); + } + + @Override + public void setData(RandomPkBean bean) { + super.setData(bean); + int position = getAbsoluteAdapterPosition(); + mNum.setText((position) + ""); + if (position % 2 == 0) { + itemView.setBackgroundResource(R.drawable.bg_item_random_pk_type_1); + } else { + itemView.setBackgroundResource(R.drawable.bg_item_random_pk_type_2); + } + ImgLoader.display(mContext, bean.getAvatar(), mAvatar); + mName.setText(bean.getUserNiceName()); + mId.setText(bean.getId()); + mStatus.setText(bean.getStatus()); + if (bean.isPkIng()) { + ImgLoader.display(mContext, R.mipmap.ic_random_pk_pk, mPkStatus); + } else { + ImgLoader.display(mContext, R.mipmap.ic_random_pk_pk_unselect, mPkStatus); + } + if (bean.isFollow()) { + ImgLoader.display(mContext, R.mipmap.ic_random_pk_like, mFollow); + } else { + ImgLoader.display(mContext, R.mipmap.ic_random_pk_like_unselect, mFollow); + } + } } } diff --git a/live/src/main/java/com/yunbao/live/dialog/RandomPkDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/RandomPkDialogFragment.java index 373da2a29..87ca3a9c1 100644 --- a/live/src/main/java/com/yunbao/live/dialog/RandomPkDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/RandomPkDialogFragment.java @@ -1,33 +1,54 @@ package com.yunbao.live.dialog; import android.os.Bundle; +import android.util.Log; import android.view.Gravity; +import android.view.KeyEvent; import android.view.View; 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.appcompat.widget.SwitchCompat; +import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.google.android.material.tabs.TabLayout; +import com.lzf.easyfloat.interfaces.OnPermissionResult; +import com.lzf.easyfloat.permission.PermissionUtils; +import com.yunbao.common.adapter.RefreshAdapter; import com.yunbao.common.custom.CommonRefreshView; import com.yunbao.common.dialog.AbsDialogFragment; +import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.http.HttpCallback; +import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.live.R; +import com.yunbao.live.adapter.RandomPkRecyclerAdapter; +import com.yunbao.live.bean.RandomPkBean; + +import java.util.ArrayList; +import java.util.List; /** * 随机PK */ public class RandomPkDialogFragment extends AbsDialogFragment { + private static final String TAG = "随机PK"; private TabLayout tabLayout; private View reset; private CommonRefreshView mRecyclerView; private View mPkInfoLayout; + private View mSearchLayout; private View mPkBtn; private TextView mPkBtnTitle; private TextView mPkBtnDesc; - private SwitchCompat mRandomPkSwitch; + private ImageView mRandomPkSwitch; + private EditText mSearch; + private ImageView mClear; + private RandomPkRecyclerAdapter adapter; @Override protected int getLayoutId() { @@ -67,10 +88,92 @@ public class RandomPkDialogFragment extends AbsDialogFragment { reset = findViewById(R.id.menu_reset); mRecyclerView = (CommonRefreshView) findViewById(R.id.random_container_view); mPkInfoLayout = findViewById(R.id.layout_random_pk_info); + mSearchLayout = findViewById(R.id.random_pk_search_layout); mPkBtn = findViewById(R.id.random_pk_info_btn); mPkBtnTitle = (TextView) findViewById(R.id.random_pk_btn_title); mPkBtnDesc = (TextView) findViewById(R.id.random_pk_btn_desc); - mRandomPkSwitch = (SwitchCompat) findViewById(R.id.live_random_pk_switch); + mRandomPkSwitch = (ImageView) findViewById(R.id.live_random_pk_switch); + mSearch = (EditText) findViewById(R.id.search_edit); + mClear = (ImageView) findViewById(R.id.search_clear); + mClear.setOnClickListener(v -> { + mSearch.setText(""); + }); + mRandomPkSwitch.setTag(true); + mRandomPkSwitch.setOnClickListener(v -> { + if (mRandomPkSwitch.getTag() != null && (boolean) mRandomPkSwitch.getTag()) { + ImgLoader.display(mContext, com.yunbao.common.R.mipmap.special_icon_off, mRandomPkSwitch); + mRandomPkSwitch.setTag(false); + } else { + ImgLoader.display(mContext, com.yunbao.common.R.mipmap.special_icon_on, mRandomPkSwitch); + mRandomPkSwitch.setTag(true); + } + }); + mSearch.setOnEditorActionListener(new TextView.OnEditorActionListener() { + @Override + public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { + return false; + } + }); + + initRecycler(); + } + + private void initRecycler() { + adapter = new RandomPkRecyclerAdapter(mContext); + mRecyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false)); + mRecyclerView.setDataHelper(new CommonRefreshView.DataHelper () { + @Override + public RefreshAdapter getAdapter() { + return adapter; + } + + @Override + public void loadData(int p, HttpCallback callback) { + callback.onSuccess(0, "", new String[0]); + } + + @Override + public List processData(String[] info) { + Log.i(TAG, "processData: 获取数据成功"); + return createTmpData(); + } + + @Override + public void onRefreshSuccess(List list, int listCount) { + + } + + @Override + public void onRefreshFailure() { + + } + + @Override + public void onLoadMoreSuccess(List loadItemList, int loadItemCount) { + + } + + @Override + public void onLoadMoreFailure() { + + } + }); + mRecyclerView.initData(); + } + + private List createTmpData() { + List list = new ArrayList<>(); + for (int i = 1; i < 10; i++) { + RandomPkBean bean = new RandomPkBean(); + bean.setId(i + ""); + bean.setAvatar("https://ceshi.yaoulive.com/default.jpg"); + bean.setUserNiceName("测试样本" + i); + bean.setStatus(i % 3 == 0 ? "PK中" : "空闲"); + bean.setPkIng(i % 3 == 0); + bean.setFollow(i % 2 == 0); + list.add(bean); + } + return list; } private void initData() { @@ -94,12 +197,21 @@ public class RandomPkDialogFragment extends AbsDialogFragment { @Override public void onTabSelected(TabLayout.Tab tab) { if (tab.getTag() != null) { + mPkInfoLayout.setVisibility(View.GONE); + mRecyclerView.setVisibility(View.GONE); + mSearchLayout.setVisibility(View.INVISIBLE); switch ((int) tab.getTag()) { case 1: mPkInfoLayout.setVisibility(View.VISIBLE); - mRecyclerView.setVisibility(View.GONE); break; case 2: + mSearchLayout.setVisibility(View.VISIBLE); + mRecyclerView.setVisibility(View.VISIBLE); + mRecyclerView.initData(); + break; + case 3: + mRecyclerView.setVisibility(View.VISIBLE); + mRecyclerView.initData(); break; } } diff --git a/live/src/main/res/drawable/bg_item_random_pk_type_2.xml b/live/src/main/res/drawable/bg_item_random_pk_type_2.xml new file mode 100644 index 000000000..61fcb5aa2 --- /dev/null +++ b/live/src/main/res/drawable/bg_item_random_pk_type_2.xml @@ -0,0 +1,9 @@ + + + \ No newline at end of file diff --git a/live/src/main/res/layout/dialog_live_random_pk_function.xml b/live/src/main/res/layout/dialog_live_random_pk_function.xml index 3035cbbca..d7ce86bc8 100644 --- a/live/src/main/res/layout/dialog_live_random_pk_function.xml +++ b/live/src/main/res/layout/dialog_live_random_pk_function.xml @@ -2,13 +2,13 @@- +
++ ++ + + android:layout_height="wrap_content" + android:background="@drawable/bg_live_tota"> diff --git a/live/src/main/res/layout/item_random_pk_info.xml b/live/src/main/res/layout/item_random_pk_info.xml index 31aa12d9c..b1fa08829 100644 --- a/live/src/main/res/layout/item_random_pk_info.xml +++ b/live/src/main/res/layout/item_random_pk_info.xml @@ -1,15 +1,17 @@ + android:layout_height="wrap_content" + android:visibility="visible" /> + + + + android:layout_weight="1" + android:visibility="gone"> + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:visibility="visible"> + android:textSize="10sp" + android:visibility="gone" />
- * 1: inviterAutoMix为true时: - * - * 1.1:如果被邀请方在加入邀请方房间之前发布了资源,当被邀请方加入邀请者房间成功后,服务器会把被邀请方流资源合并到邀请方视图 ·(默认仅悬浮布局合流)上。 - * - * 1.2:如果被邀请方在加入邀请方房间之前没有发布过资源,将会在被邀请方发布资源成功后,服务器会把被邀请方流资源合并到邀请方视图(默认仅悬浮布局合流)上。 - * - * 2:无论为true或false,双方都可以使用{@link RCRTCLiveInfo#setMixConfig(RCRTCMixConfig, IRCRTCResultCallback)} 方法主动设置合流布局。一旦主动设置过合流布局,后续音视频直播过程中设置的自动合流参数将失效。 - *
- */ - rtcRoom.getLocalUser().requestJoinOtherRoom(user.getString("id"), user.getString("id"), false, "LiveDRPK1", new IRCRTCResultCallback() { - @Override - public void onSuccess() { - } + for (int i = 0; i < users.size(); i++) { + JSONObject user = users.getJSONObject(i); + Log.e("ry", mApplyUid + "VS" + user.getString("id") + "列表"); + if (!user.getString("id").equals(CommonAppConfig.getInstance().getUid())) { + if (!user.getString("id").equals(CommonAppConfig.getInstance().getUid()) && !user.getString("id").equals(u.getId())) { + /** + * 向指定用户发送跨房间连麦请求 + *+ * 1: inviterAutoMix为true时: + * + * 1.1:如果被邀请方在加入邀请方房间之前发布了资源,当被邀请方加入邀请者房间成功后,服务器会把被邀请方流资源合并到邀请方视图 ·(默认仅悬浮布局合流)上。 + * + * 1.2:如果被邀请方在加入邀请方房间之前没有发布过资源,将会在被邀请方发布资源成功后,服务器会把被邀请方流资源合并到邀请方视图(默认仅悬浮布局合流)上。 + * + * 2:无论为true或false,双方都可以使用{@link RCRTCLiveInfo#setMixConfig(RCRTCMixConfig, IRCRTCResultCallback)} 方法主动设置合流布局。一旦主动设置过合流布局,后续音视频直播过程中设置的自动合流参数将失效。 + *
+ */ + IMRTCManager.getInstance().requestJoinOtherRoom(user.getString("id"), false, "LiveDRPK1", new IRCRTCResultCallback() { + @Override + public void onSuccess() { + } - @Override - public void onFailed(RTCErrorCode errorCode) { + @Override + public void onFailed(RTCErrorCode errorCode) { - } - }); + } + }); + } } } } - } - }); + }); } } @@ -1308,7 +1309,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { } else { if (mPkWaitCount < 0) { - rtcRoom.getLocalUser().responseJoinOtherRoom(u.getId(), u.getId(), false, false, "extra", new IRCRTCResultCallback() { + IMRTCManager.getInstance().responseJoinOtherRoom(u.getId(), false, "extra", new IRCRTCResultCallback() { @Override public void onFailed(RTCErrorCode errorCode) { @@ -1350,7 +1351,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { }); } else { - rtcRoom.getLocalUser().responseJoinOtherRoom(u.getId(), u.getId(), false, false, "extra", new IRCRTCResultCallback() { + IMRTCManager.getInstance().responseJoinOtherRoom(u.getId(),false, "extra", new IRCRTCResultCallback() { @Override public void onFailed(RTCErrorCode errorCode) { diff --git a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java index f1b4f4e0c..fc9d7ff9d 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java @@ -267,6 +267,7 @@ public class SocketRyClient { // case Constants.SOCKET_SEND_GIFT://送礼物 // ////////pk // break; + case Constants.SOCKET_LIVE_DRPK_RANDOM: case Constants.SOCKET_LIVE_DRPK://多人PK int action3 = map.getIntValue("action"); //收到多人PK邀请 @@ -288,7 +289,7 @@ public class SocketRyClient { } LiveRoomViewHolder.UpPkBar(map.getJSONArray("userlist"), mLiveUid, map.getIntValue("drpk_time")); if (livePushRyViewHolder == null) { - // LiveAudienceActivity.getmLivePlayViewHolder().setPkview(); + // LiveAudienceActivity.getmLivePlayViewHolder().setPkview(); Bus.get().post(new LiveAudienceEvent() .setType(LiveAudienceEvent.LiveAudienceType.SOCKET_LIVE_DRPK_SET_PK_VIEW) ); @@ -322,7 +323,7 @@ public class SocketRyClient { isDRPK = 1; } else if (action3 == 10) { if (!map.getString("uid").equals(CommonAppConfig.getInstance().getUid())) { - // LiveAudienceActivity.getmLivePlayViewHolder().setPkview(); + // LiveAudienceActivity.getmLivePlayViewHolder().setPkview(); Bus.get().post(new LiveAudienceEvent() .setType(LiveAudienceEvent.LiveAudienceType.SOCKET_LIVE_DRPK_SET_PK_VIEW) ); diff --git a/live/src/main/java/com/yunbao/live/utils/RandomPkManager.java b/live/src/main/java/com/yunbao/live/utils/RandomPkManager.java new file mode 100644 index 000000000..59dbc4249 --- /dev/null +++ b/live/src/main/java/com/yunbao/live/utils/RandomPkManager.java @@ -0,0 +1,103 @@ +package com.yunbao.live.utils; + +import android.content.Context; +import android.os.Handler; +import android.os.Looper; + +import com.yunbao.common.CommonAppContext; +import com.yunbao.common.http.base.HttpCallback; +import com.yunbao.common.http.live.LiveNetManager; + +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; +import java.util.Timer; +import java.util.TimerTask; + +public class RandomPkManager { + private static RandomPkManager manager; + private int min = -1; + private int sec = -1; + private Timer timer; + private TimerTask task; + private List