update 随机Pk

This commit is contained in:
zlzw 2022-11-24 13:34:09 +08:00
parent 8a03b194b2
commit 9b17c1225a
20 changed files with 419 additions and 24 deletions

View File

@ -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",
@ -25,8 +25,8 @@ ext {
baiduAppSecretKey: "nEVSgmuGpU0pjPr6VleEGGAl0hzGW52S",
// true表示谷歌支付 false
isGooglePlay : true,
isGooglePlay : false,
//
isUploadLog : true
isUploadLog : false
]
}

View File

@ -0,0 +1,56 @@
package com.yunbao.live.adapter;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.adapter.RefreshAdapter;
import com.yunbao.live.bean.RandomPkBean;
import java.util.ArrayList;
import java.util.List;
public class RandomPkRecyclerAdapter extends RefreshAdapter<RandomPkBean> {
private List<RandomPkBean> list=new ArrayList<>();
public RandomPkRecyclerAdapter(Context context) {
super(context);
}
@Override
public void setList(List<RandomPkBean> list) {
this.list = list;
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return null;
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
}
@Override
public int getItemCount() {
return 0;
}
@Override
public int getItemViewType(int position) {
return super.getItemViewType(position);
}
public class ViewHolder extends RecyclerView.ViewHolder{
public ViewHolder(@NonNull View itemView) {
super(itemView);
}
}
}

View File

@ -0,0 +1,33 @@
package com.yunbao.live.bean;
import com.yunbao.common.bean.UserBean;
public class RandomPkBean extends UserBean {
private String status;
private boolean pkIng;
private boolean follow;
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public boolean isPkIng() {
return pkIng;
}
public void setPkIng(boolean pkIng) {
this.pkIng = pkIng;
}
public boolean isFollow() {
return follow;
}
public void setFollow(boolean follow) {
this.follow = follow;
}
}

View File

@ -1,11 +1,18 @@
package com.yunbao.live.dialog;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.SwitchCompat;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.tabs.TabLayout;
import com.yunbao.common.custom.CommonRefreshView;
import com.yunbao.common.dialog.AbsDialogFragment;
import com.yunbao.live.R;
@ -15,7 +22,12 @@ import com.yunbao.live.R;
public class RandomPkDialogFragment extends AbsDialogFragment {
private TabLayout tabLayout;
private View reset;
private RecyclerView mRecyclerView;
private CommonRefreshView mRecyclerView;
private View mPkInfoLayout;
private View mPkBtn;
private TextView mPkBtnTitle;
private TextView mPkBtnDesc;
private SwitchCompat mRandomPkSwitch;
@Override
protected int getLayoutId() {
@ -34,13 +46,74 @@ public class RandomPkDialogFragment extends AbsDialogFragment {
@Override
protected void setWindowAttributes(Window window) {
WindowManager.LayoutParams params = window.getAttributes();
window.setWindowAnimations(R.style.bottomToTopAnim);
params.width = WindowManager.LayoutParams.MATCH_PARENT;
params.height = WindowManager.LayoutParams.WRAP_CONTENT;
params.gravity = Gravity.BOTTOM;
window.setAttributes(params);
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
initView();
initTab();
initData();
}
private void initView() {
tabLayout = (TabLayout) findViewById(R.id.menu_tab);
reset = findViewById(R.id.menu_reset);
mRecyclerView = (RecyclerView) findViewById(R.id.random_container_view);
mRecyclerView = (CommonRefreshView) findViewById(R.id.random_container_view);
mPkInfoLayout = findViewById(R.id.layout_random_pk_info);
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);
}
private void initData() {
}
private void initTab() {
TabLayout.Tab randPkTag = tabLayout.newTab();
TabLayout.Tab searchTag = tabLayout.newTab();
TabLayout.Tab listTag = tabLayout.newTab();
randPkTag.setTag(1);
randPkTag.setText("隨機PK");
searchTag.setTag(2);
searchTag.setText("主播搜索");
listTag.setTag(3);
listTag.setText("關注列表");
tabLayout.addTab(randPkTag);
tabLayout.addTab(searchTag);
tabLayout.addTab(listTag);
tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
@Override
public void onTabSelected(TabLayout.Tab tab) {
if (tab.getTag() != null) {
switch ((int) tab.getTag()) {
case 1:
mPkInfoLayout.setVisibility(View.VISIBLE);
mRecyclerView.setVisibility(View.GONE);
break;
case 2:
break;
}
}
}
@Override
public void onTabUnselected(TabLayout.Tab tab) {
}
@Override
public void onTabReselected(TabLayout.Tab tab) {
}
});
}
}

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="355dp" android:height="36dp">
<shape android:shape="rectangle">
<solid android:color="#337792d0" />
<corners android:radius="8dp" />
</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="355dp" android:height="32dp">
<shape android:shape="rectangle">
<solid android:color="#33ffffff" />
<corners android:radius="16dp" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:width="14dp"
android:height="3dp"
android:gravity="center">
<shape>
<corners android:radius="1.5dp" />
<!--color无效源码用tabIndicatorColor-->
<solid android:color="#FFF" />
</shape>
</item>
</layer-list>

View File

@ -2,6 +2,7 @@
<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:background="@drawable/bg_live_tota2"
android:layout_height="wrap_content">
<LinearLayout
@ -17,8 +18,9 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="35dp"
android:layout_height="45dp"
android:gravity="center"
android:layout_marginBottom="5dp"
android:orientation="horizontal">
<ImageView
@ -37,9 +39,9 @@
app:srcCompat="@drawable/rc_picture_icon_back" />
<HorizontalScrollView
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginStart="10dp"
android:layout_marginStart="20dp"
android:layout_marginEnd="10dp"
android:layout_weight="1">
@ -49,6 +51,7 @@
android:layout_height="match_parent"
app:tabIndicatorColor="#F6F7FB"
app:tabIndicatorFullWidth="false"
app:tabIndicator="@drawable/random_pk_shape_tab_indicator"
app:tabMaxWidth="100dp"
app:tabMode="scrollable"
app:tabSelectedTextColor="#F6F7FB"
@ -85,9 +88,15 @@
</LinearLayout>
</LinearLayout>
<include
android:visibility="visible"
layout="@layout/item_random_pk_info"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<com.yunbao.common.custom.CommonRefreshView
android:id="@+id/random_container_view"
android:layout_width="match_parent"
android:visibility="gone"
android:layout_height="216dp"
android:layout_marginTop="10dp"
android:layout_weight="1" >

View File

@ -2,6 +2,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:visibility="visible"
android:id="@+id/layout_random_pk_info"
android:layout_height="wrap_content">
<LinearLayout
@ -77,21 +79,9 @@
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"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:id="@+id/random_pk_info_btn"
android:layout_width="188dp"
android:layout_height="42dp"
android:layout_marginStart="10dp"

View File

@ -0,0 +1,94 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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="36dp"
android:background="@drawable/bg_item_random_pk_type_1"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:id="@+id/item_id"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:text="序号"
android:textColor="#FFFFFF"
android:textSize="14sp" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.5"
android:orientation="horizontal">
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/item_avatar"
android:layout_width="28dp"
android:layout_height="28dp"
android:layout_centerInParent="true"
android:layout_centerHorizontal="true"
android:gravity="center"
android:scaleType="centerCrop"
android:src="@mipmap/beauty_jingbai"
app:riv_oval="true" />
<TextView
android:id="@+id/item_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="头像&amp;昵称"
android:textColor="#FFFFFF"
android:textSize="14sp" />
</LinearLayout>
<TextView
android:id="@+id/item_uid"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="ID"
android:textColor="#FFFFFF"
android:textSize="14sp" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="5dp"
android:layout_weight="2"
android:orientation="horizontal">
<TextView
android:id="@+id/item_status"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center"
android:text="状态"
android:textColor="#FFFFFF"
android:textSize="14sp" />
<ImageView
android:id="@+id/item_pk"
android:layout_width="0dp"
android:layout_height="27dp"
android:layout_weight="1"
android:layout_gravity="center"
android:src="@mipmap/ic_random_pk_pk"
/>
<ImageView
android:id="@+id/item_follow"
android:layout_width="0dp"
android:layout_height="23dp"
android:layout_weight="1"
android:layout_gravity="center"
android:src="@mipmap/ic_random_pk_like"
/>
</LinearLayout>
</LinearLayout>

View File

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="36dp"
android:background="@drawable/bg_item_random_pk_type_1"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:text="序号"
android:textColor="#B3FFFFFF" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="头像&amp;昵称"
android:textColor="#B3FFFFFF" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="ID"
android:textColor="#B3FFFFFF" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="5dp"
android:layout_weight="2"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="状态"
android:textColor="#B3FFFFFF" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="操作"
android:textColor="#B3FFFFFF" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="关注"
android:textColor="#B3FFFFFF" />
</LinearLayout>
</LinearLayout>

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:visibility="visible"
android:background="@drawable/bg_random_pk_rv_search"
android:layout_height="32dp">
<ImageView
android:id="@+id/search_icon"
android:layout_width="0dp"
android:layout_weight="0.1"
android:layout_height="18dp"
android:layout_marginStart="10dp"
android:layout_gravity="center"
app:srcCompat="@mipmap/ic_random_pk_search" />
<EditText
android:id="@+id/search_edit"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_marginStart="5dp"
android:layout_gravity="center"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textPersonName"
android:hint="@string/random_pk_search_hint"
android:textColor="#FFFFFF"
android:background="@null" />
<ImageView
android:id="@+id/search_clear"
android:layout_width="0dp"
android:layout_height="16dp"
android:layout_gravity="center"
android:layout_marginEnd="16dp"
android:layout_weight="0.1"
app:srcCompat="@mipmap/ic_random_pk_clear" />
</LinearLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -36,5 +36,6 @@
<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>
<string name="random_pk_search_hint" translatable="false">请输入您要pk的主播昵称或id</string>
</resources>

View File

@ -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");
}