From 9b17c1225a1f85d8501ea83a53dcb820e0d4a31c Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Thu, 24 Nov 2022 13:34:09 +0800 Subject: [PATCH] =?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 --- config.gradle | 8 +- .../live/adapter/RandomPkRecyclerAdapter.java | 56 +++++++++++ .../com/yunbao/live/bean/RandomPkBean.java | 33 ++++++ .../live/dialog/RandomPkDialogFragment.java | 79 ++++++++++++++- .../res/drawable/bg_item_random_pk_type_1.xml | 9 ++ .../res/drawable/bg_random_pk_rv_search.xml | 9 ++ .../random_pk_shape_tab_indicator.xml | 13 +++ .../layout/dialog_live_random_pk_function.xml | 15 ++- .../main/res/layout/item_random_pk_info.xml | 16 +-- .../src/main/res/layout/item_random_pk_rv.xml | 94 ++++++++++++++++++ .../res/layout/item_random_pk_rv_head.xml | 64 ++++++++++++ .../res/layout/item_random_pk_rv_search.xml | 41 ++++++++ .../res/mipmap-xhdpi/ic_random_pk_clear.png | Bin 0 -> 1111 bytes .../res/mipmap-xhdpi/ic_random_pk_like.png | Bin 0 -> 1902 bytes .../ic_random_pk_like_unselect.png | Bin 0 -> 2232 bytes .../main/res/mipmap-xhdpi/ic_random_pk_pk.png | Bin 0 -> 4039 bytes .../mipmap-xhdpi/ic_random_pk_pk_unselect.png | Bin 0 -> 2674 bytes .../res/mipmap-xhdpi/ic_random_pk_search.png | Bin 0 -> 1366 bytes live/src/main/res/values/strings.xml | 1 + .../yunbao/main/activity/MainActivity.java | 5 +- 20 files changed, 419 insertions(+), 24 deletions(-) create mode 100644 live/src/main/java/com/yunbao/live/adapter/RandomPkRecyclerAdapter.java create mode 100644 live/src/main/java/com/yunbao/live/bean/RandomPkBean.java create mode 100644 live/src/main/res/drawable/bg_item_random_pk_type_1.xml create mode 100644 live/src/main/res/drawable/bg_random_pk_rv_search.xml create mode 100644 live/src/main/res/drawable/random_pk_shape_tab_indicator.xml create mode 100644 live/src/main/res/layout/item_random_pk_rv.xml create mode 100644 live/src/main/res/layout/item_random_pk_rv_head.xml create mode 100644 live/src/main/res/layout/item_random_pk_rv_search.xml create mode 100644 live/src/main/res/mipmap-xhdpi/ic_random_pk_clear.png create mode 100644 live/src/main/res/mipmap-xhdpi/ic_random_pk_like.png create mode 100644 live/src/main/res/mipmap-xhdpi/ic_random_pk_like_unselect.png create mode 100644 live/src/main/res/mipmap-xhdpi/ic_random_pk_pk.png create mode 100644 live/src/main/res/mipmap-xhdpi/ic_random_pk_pk_unselect.png create mode 100644 live/src/main/res/mipmap-xhdpi/ic_random_pk_search.png diff --git a/config.gradle b/config.gradle index 9b9ac5933..e8971d031 100644 --- a/config.gradle +++ b/config.gradle @@ -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 ] } \ No newline at end of file diff --git a/live/src/main/java/com/yunbao/live/adapter/RandomPkRecyclerAdapter.java b/live/src/main/java/com/yunbao/live/adapter/RandomPkRecyclerAdapter.java new file mode 100644 index 000000000..6206619c9 --- /dev/null +++ b/live/src/main/java/com/yunbao/live/adapter/RandomPkRecyclerAdapter.java @@ -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 { + private List list=new ArrayList<>(); + + 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; + } + + @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); + } + } +} diff --git a/live/src/main/java/com/yunbao/live/bean/RandomPkBean.java b/live/src/main/java/com/yunbao/live/bean/RandomPkBean.java new file mode 100644 index 000000000..c68b735cd --- /dev/null +++ b/live/src/main/java/com/yunbao/live/bean/RandomPkBean.java @@ -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; + } +} 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 ed9d1f8ad..373da2a29 100644 --- a/live/src/main/java/com/yunbao/live/dialog/RandomPkDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/RandomPkDialogFragment.java @@ -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) { - initView(); + 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) { + + } + }); + } } diff --git a/live/src/main/res/drawable/bg_item_random_pk_type_1.xml b/live/src/main/res/drawable/bg_item_random_pk_type_1.xml new file mode 100644 index 000000000..ce9ea1e40 --- /dev/null +++ b/live/src/main/res/drawable/bg_item_random_pk_type_1.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_random_pk_rv_search.xml b/live/src/main/res/drawable/bg_random_pk_rv_search.xml new file mode 100644 index 000000000..aae6625dd --- /dev/null +++ b/live/src/main/res/drawable/bg_random_pk_rv_search.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/random_pk_shape_tab_indicator.xml b/live/src/main/res/drawable/random_pk_shape_tab_indicator.xml new file mode 100644 index 000000000..53176bb53 --- /dev/null +++ b/live/src/main/res/drawable/random_pk_shape_tab_indicator.xml @@ -0,0 +1,13 @@ + + + + + + + + + + \ 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 9ee2ab156..3035cbbca 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,6 +2,7 @@ @@ -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 @@ + 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 3a1474a02..31aa12d9c 100644 --- a/live/src/main/res/layout/item_random_pk_info.xml +++ b/live/src/main/res/layout/item_random_pk_info.xml @@ -2,6 +2,8 @@ -