创建随机PK分支

This commit is contained in:
zlzw 2022-11-21 15:39:12 +08:00
parent 4cd1c22d01
commit 4a637d0a69
15 changed files with 391 additions and 0 deletions

View File

@ -130,6 +130,7 @@ public class Constants {
public static final int LIVE_FUNC_MIC = 2013;//語音
public static final int LIVE_FUNC_WKS = 2014;//語音
public static final int LIVE_FUNC_ZSLK = 2015;//語音
public static final int LIVE_FUNC_RANDOM_PK = 2016;//随机PK
//socket
public static final String SOCKET_CONN = "conn";

View File

@ -256,6 +256,27 @@
android:textColor="#FF9A9A9A"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/live_tool_random_pk"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="23dp"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:src="@mipmap/icon_live_random_pk" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:text="@string/live_random"
android:textColor="#FF9A9A9A"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/live_tool_mic"

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -721,6 +721,7 @@
<string name="live_wishlist">心願單</string>
<string name="live_zg">娛樂整蠱</string>
<string name="live_dr">多人PK</string>
<string name="live_random" translatable="false">随机PK</string>
<string name="live_mic">語音連麥</string>
<string name="live_wks">周星榜</string>
<string name="live_zslk">暫時離開</string>

View File

@ -67,6 +67,7 @@ import com.yunbao.live.dialog.LiveLinkMicListDialogFragment;
import com.yunbao.live.dialog.LiveNewFunctionDialogFragment;
import com.yunbao.live.dialog.LiveNewWishListDialogFragment;
import com.yunbao.live.dialog.LiveWishListDialogFragment4Audience;
import com.yunbao.live.dialog.RandomPkDialogFragment;
import com.yunbao.live.event.LinkMicTxMixStreamEvent;
import com.yunbao.live.event.LiveAudienceEvent;
import com.yunbao.live.http.LiveHttpConsts;
@ -377,6 +378,9 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
t.mirrorType = TRTC_VIDEO_MIRROR_TYPE_DISABLE;
}
break;
case Constants.LIVE_FUNC_RANDOM_PK:
openRandomPkWindow();
break;
default:
break;
}
@ -556,6 +560,15 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
fragment.show(getSupportFragmentManager(), "LiveLinkMicListDialogFragment");
}
/**
* 随机PK
*/
public void openRandomPkWindow(){
RandomPkDialogFragment fragment=new RandomPkDialogFragment();
Bundle bundle=new Bundle();
fragment.setArguments(bundle);
fragment.show(getSupportFragmentManager(), "RandomPkDialogFragment");
}
/**
* 打开选择游戏窗口

View File

@ -25,6 +25,7 @@ import com.yunbao.live.interfaces.LiveFunctionClickListener;
public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements View.OnClickListener {
private View mWishView, mPrankView, mWksView, mBeautyView, mCameraView, mLeaveView, mOnePkView, mMultiPkView, mMicView;
private View mRandomPk;
private LiveFunctionClickListener mFunctionClickListener;
private int leave = 0;
private boolean isPk;
@ -79,6 +80,7 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements
mOnePkView = findViewById(R.id.live_tool_one_pk);
mMultiPkView = findViewById(R.id.live_tool_multi_pk);
mMicView = findViewById(R.id.live_tool_mic);
mRandomPk = findViewById(R.id.live_tool_random_pk);
mWishView.setOnClickListener(this);
mPrankView.setOnClickListener(this);
@ -89,6 +91,7 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements
mOnePkView.setOnClickListener(this);
mMultiPkView.setOnClickListener(this);
mMicView.setOnClickListener(this);
mRandomPk.setOnClickListener(this);
if (leave == 0) {
((ImageView) mLeaveView.findViewById(R.id.live_tool_leave_img)).setImageResource(R.mipmap.icon_leave);
@ -140,6 +143,8 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements
mFunctionClickListener.onClick(LIVE_FUNC_DR);
} else if (id == R.id.live_tool_mic) {
mFunctionClickListener.onClick(LIVE_FUNC_MIC);
} else if (id == R.id.live_tool_random_pk) {
mFunctionClickListener.onClick(LIVE_FUNC_RANDOM_PK);
}
}
}

View File

@ -0,0 +1,46 @@
package com.yunbao.live.dialog;
import android.view.View;
import android.view.Window;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.tabs.TabLayout;
import com.yunbao.common.dialog.AbsDialogFragment;
import com.yunbao.live.R;
/**
* 随机PK
*/
public class RandomPkDialogFragment extends AbsDialogFragment {
private TabLayout tabLayout;
private View reset;
private RecyclerView mRecyclerView;
@Override
protected int getLayoutId() {
return R.layout.dialog_live_random_pk_function;
}
@Override
protected int getDialogStyle() {
return R.style.dialog2;
}
@Override
protected boolean canCancel() {
return true;
}
@Override
protected void setWindowAttributes(Window window) {
initView();
}
private void initView() {
tabLayout = (TabLayout) findViewById(R.id.menu_tab);
reset = findViewById(R.id.menu_reset);
mRecyclerView = (RecyclerView) findViewById(R.id.random_container_view);
}
}

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<corners android:radius="20dp" />
<solid android:color="#337792D0" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="188dp" android:height="42dp">
<shape android:shape="rectangle">
<solid android:color="#ffffbe41" />
<corners android:radius="21dp" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!--开关按钮关闭时的导轨样式-->
<item android:state_checked="false">
<shape>
<size android:height="25dp" android:width="40dp"/>
<corners android:radius="20dp"/>
<solid android:color="#33000000"/>
</shape>
</item>
<!--开关按钮打开时的导轨样式-->
<item android:state_checked="true">
<shape>
<size android:height="25dp" android:width="40dp"/>
<corners android:radius="20dp"/>
<solid android:color="#F7B500"/>
</shape>
</item>
</selector>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!--开关按钮关闭时的导轨样式-->
<item android:state_checked="false">
<shape>
<size android:height="25dp" android:width="25dp"/>
<corners android:radius="20dp"/>
<solid android:color="#FFFFFF"/>
</shape>
</item>
<item android:state_checked="true">
<shape>
<size android:height="25dp" android:width="25dp"/>
<corners android:radius="20dp"/>
<solid android:color="#FFFFFF"/>
<padding
android:bottom="2dp"
android:left="2dp"
android:right="2dp"
android:top="2dp" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="false">
<shape>
<solid android:color="#00000000" />
<corners android:radius="30dp" />
</shape>
</item>
<item android:state_checked="true">
<shape>
<solid android:color="#00000000" />
<corners android:radius="32dp" />
</shape>
</item>
</layer-list>

View File

@ -0,0 +1,95 @@
<?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"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/random_menu_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="35dp"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:id="@+id/menu_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_weight="0"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0"
app:srcCompat="@drawable/rc_picture_icon_back" />
<HorizontalScrollView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_weight="1">
<com.google.android.material.tabs.TabLayout
android:id="@+id/menu_tab"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:tabIndicatorColor="#F6F7FB"
app:tabIndicatorFullWidth="false"
app:tabMaxWidth="100dp"
app:tabMode="scrollable"
app:tabSelectedTextColor="#F6F7FB"
app:tabTextColor="#9A9A9A" />
</HorizontalScrollView>
<LinearLayout
android:id="@+id/menu_reset"
android:layout_width="15dp"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:layout_weight="0.1"
android:gravity="center"
android:visibility="visible">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
app:srcCompat="@mipmap/icon_reset" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="1dp"
android:layout_weight="1"
android:gravity="center"
android:text="@string/dialog_reset"
android:textColor="#9A9A9A"
android:textSize="12sp"
android:visibility="gone" />
</LinearLayout>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/random_container_view"
android:layout_width="match_parent"
android:layout_height="216dp"
android:layout_marginTop="10dp"
android:layout_weight="1" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,116 @@
<?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"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/background_7792d0"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="15dp"
android:text="@string/random_pk_info_title"
android:textColor="#F6F7FB"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:text="@string/random_pk_info_desc_1"
android:textColor="#F6F7FB"
android:textSize="14sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="2dp"
android:layout_marginEnd="10dp"
android:text="@string/random_pk_info_desc_2"
android:textColor="#F6F7FB"
android:textSize="14sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="2dp"
android:layout_marginEnd="10dp"
android:text="@string/random_pk_info_desc_3"
android:textColor="#F6F7FB"
android:textSize="14sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="2dp"
android:layout_marginEnd="10dp"
android:layout_marginBottom="15dp"
android:text="@string/random_pk_info_desc_4"
android:textColor="#F6F7FB"
android:textSize="14sp" />
</LinearLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout">
<Button
android:id="@+id/random_pk_info_btn"
android:layout_width="188dp"
android:layout_height="42dp"
android:layout_marginStart="10dp"
android:background="@drawable/bg_live_random_pk_info_btn"
android:text="@string/random_pk_info_btn_start"
android:textColor="#FFFFFF"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:text="@string/random_pk_info_switch"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/live_random_pk_switch"
app:layout_constraintTop_toTopOf="parent" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/live_random_pk_switch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bg_live_random_pk_info_switch"
android:checked="true"
android:thumb="@drawable/bg_live_random_pk_info_switch_thumb"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:track="@drawable/bg_live_random_pk_info_switch_track" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -27,4 +27,14 @@
<string name="more_than" translatable="false">已超过10秒未识别到录音</string>
<string name="live_role_title" translatable="false">身份特權</string>
<string name="noble_seat" translatable="false">貴族坐席</string>
<string name="random_pk_info_title" translatable="false">PK主要规则说明</string>
<string name="random_pk_info_desc_1" translatable="false">1、开始匹配后系统将会自动给您挑选对手进行PK</string>
<string name="random_pk_info_desc_2" translatable="false">2、每场PK总时长10分钟惩罚时间为1分钟</string>
<string name="random_pk_info_desc_3" translatable="false">3、PK过程中若出现黑屏、卡顿延迟等技术问题请检查个人设备及网络后尝试重新登陆开播软件并开播</string>
<string name="random_pk_info_desc_4" translatable="false">4、安全部门将会24小时巡查请文明PK严格遵守主播守则</string>
<string name="random_pk_info_switch" translatable="false">随机PK开关</string>
<string name="random_pk_info_btn_start" translatable="false">开始匹配</string>
<string name="random_pk_info_btn_ing" translatable="false">匹配中 %s \n再次点击可取消匹配</string>
<string name="random_pk_info_btn_end" translatable="false">正在退出匹配 %s \n退出过程中也有可能匹配到对手</string>
</resources>