From 210e755fed8c734d270a67910acd09dba8cb333e Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Tue, 26 Sep 2023 14:56:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=B8=E6=88=8F=E5=88=97=E8=A1=A8=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC=E6=B8=B8=E6=88=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../adapter/LiveNewRoleFunGamesAdapter.java | 7 +- .../adapter/LiveNewRolerPopupAdapter.java | 7 +- .../adapter/NewRoleFunGamesAdapter.java | 2 +- .../common/adapter/SudGameListAdapter.java | 11 +- .../SudGameSearchHistoryListAdapter.java | 16 +- .../adapter/SudHomeGameListAdapter.java | 13 +- .../common/dialog/LiveNewRolePopup.java | 7 +- .../common/dialog/SudGameListPopup.java | 10 +- .../dialog/SudGameSearchDialogPopup.java | 32 ++-- .../LiveNewRoleRigtsInterestsViewHolder.java | 6 +- .../views/NewRoleFunGamesChildViewHolder.java | 16 +- .../common/views/SudGameListViewHolder.java | 1 - .../drawable/bg_item_home_search_history.xml | 9 ++ .../res/layout/dialog_search_sud_game.xml | 132 ++++++++++++++++ .../main/res/layout/dialog_sud_game_list.xml | 4 +- .../res/layout/item_home_search_history.xml | 25 +++ ...iew_live_new_role_fun_games_child_view.xml | 33 +++- .../live/views/LiveAudienceViewHolder.java | 2 +- .../main/views/MainHomeGameViewHolder.java | 143 +++++++++++------- .../layout/view_main_home_sud_game_list.xml | 21 +-- 20 files changed, 386 insertions(+), 111 deletions(-) create mode 100644 common/src/main/res/drawable/bg_item_home_search_history.xml create mode 100644 common/src/main/res/layout/dialog_search_sud_game.xml create mode 100644 common/src/main/res/layout/item_home_search_history.xml diff --git a/common/src/main/java/com/yunbao/common/adapter/LiveNewRoleFunGamesAdapter.java b/common/src/main/java/com/yunbao/common/adapter/LiveNewRoleFunGamesAdapter.java index 17cb37cf3..54c1f1c45 100644 --- a/common/src/main/java/com/yunbao/common/adapter/LiveNewRoleFunGamesAdapter.java +++ b/common/src/main/java/com/yunbao/common/adapter/LiveNewRoleFunGamesAdapter.java @@ -20,17 +20,18 @@ public class LiveNewRoleFunGamesAdapter extends RecyclerView.Adapter { private Context mContext; private boolean rigts; private List child = new ArrayList<>(); - - public LiveNewRoleFunGamesAdapter(Context mContext, boolean rigts) { + private boolean showRed = false; + public LiveNewRoleFunGamesAdapter(Context mContext, boolean rigts,boolean showRed) { this.mContext = mContext; this.rigts = rigts; + this.showRed = showRed; } @NonNull @Override public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View runGamesView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_live_new_role_fun_games_child_view, parent, false); - return new NewRoleFunGamesChildViewHolder(runGamesView); + return new NewRoleFunGamesChildViewHolder(runGamesView,showRed); } @Override diff --git a/common/src/main/java/com/yunbao/common/adapter/LiveNewRolerPopupAdapter.java b/common/src/main/java/com/yunbao/common/adapter/LiveNewRolerPopupAdapter.java index 67e49c60a..ef0105714 100644 --- a/common/src/main/java/com/yunbao/common/adapter/LiveNewRolerPopupAdapter.java +++ b/common/src/main/java/com/yunbao/common/adapter/LiveNewRolerPopupAdapter.java @@ -27,9 +27,10 @@ public class LiveNewRolerPopupAdapter extends RecyclerView.Adapter { private final int FUN_GAMES = 3; private final int RIGHTS_INTERESTS = 4; private List infoModels = new ArrayList<>(); - - public LiveNewRolerPopupAdapter(Context mContext) { + private boolean showRed = false; + public LiveNewRolerPopupAdapter(Context mContext,boolean showRed) { this.mContext = mContext; + this.showRed = showRed; } @NonNull @@ -41,7 +42,7 @@ public class LiveNewRolerPopupAdapter extends RecyclerView.Adapter { return new LiveNewRoleFunGamesViewHolder(runGamesView); case RIGHTS_INTERESTS: View rightsInterestsView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_live_new_roler_ights_interests, parent, false); - return new LiveNewRoleRigtsInterestsViewHolder(rightsInterestsView); + return new LiveNewRoleRigtsInterestsViewHolder(rightsInterestsView,showRed); default: View gamesView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_live_new_role_interaction_games_view, parent, false); return new LiveNewRoleInteractionGamesViewHolder(gamesView); diff --git a/common/src/main/java/com/yunbao/common/adapter/NewRoleFunGamesAdapter.java b/common/src/main/java/com/yunbao/common/adapter/NewRoleFunGamesAdapter.java index f9a020e6b..d473abe0b 100644 --- a/common/src/main/java/com/yunbao/common/adapter/NewRoleFunGamesAdapter.java +++ b/common/src/main/java/com/yunbao/common/adapter/NewRoleFunGamesAdapter.java @@ -30,7 +30,7 @@ public class NewRoleFunGamesAdapter extends RecyclerView.Adapter { @Override public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View runGamesView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_live_new_role_fun_games_child_view2, parent, false); - return new NewRoleFunGamesChildViewHolder(runGamesView); + return new NewRoleFunGamesChildViewHolder(runGamesView,false); } @Override diff --git a/common/src/main/java/com/yunbao/common/adapter/SudGameListAdapter.java b/common/src/main/java/com/yunbao/common/adapter/SudGameListAdapter.java index 958a274e8..8b43ab516 100644 --- a/common/src/main/java/com/yunbao/common/adapter/SudGameListAdapter.java +++ b/common/src/main/java/com/yunbao/common/adapter/SudGameListAdapter.java @@ -11,14 +11,21 @@ import com.yunbao.common.bean.SudRoomListModel; import com.yunbao.common.views.SudGameListViewHolder; public class SudGameListAdapter extends RefreshAdapter { - public SudGameListAdapter(Context context) { + private boolean isHome = false; + + public SudGameListAdapter(Context context, boolean isHome) { super(context); + this.isHome = isHome; } @NonNull @Override public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { - return new SudGameListViewHolder(mInflater.inflate(R.layout.item_sud_game_list, parent, false)); + if (isHome){ + return new SudGameListViewHolder(mInflater.inflate(R.layout.item_home_sud_game_list, parent, false)); + }else { + return new SudGameListViewHolder(mInflater.inflate(R.layout.item_sud_game_list, parent, false)); + } } @Override diff --git a/common/src/main/java/com/yunbao/common/adapter/SudGameSearchHistoryListAdapter.java b/common/src/main/java/com/yunbao/common/adapter/SudGameSearchHistoryListAdapter.java index dae3a224e..076778b2a 100644 --- a/common/src/main/java/com/yunbao/common/adapter/SudGameSearchHistoryListAdapter.java +++ b/common/src/main/java/com/yunbao/common/adapter/SudGameSearchHistoryListAdapter.java @@ -19,8 +19,10 @@ public class SudGameSearchHistoryListAdapter extends RecyclerView.Adapter mList; private Context mContext; private OnItemClickListener onItemClickListener; + private boolean isHome = false; - public SudGameSearchHistoryListAdapter(Context mContext) { + public SudGameSearchHistoryListAdapter(Context mContext, boolean isHome) { + this.isHome = isHome; this.mContext = mContext; mList = new ArrayList<>(); } @@ -37,7 +39,13 @@ public class SudGameSearchHistoryListAdapter extends RecyclerView.Adapter { - if(onItemClickListener!=null){ - onItemClickListener.onItemClick(name,0); + if (onItemClickListener != null) { + onItemClickListener.onItemClick(name, 0); } }); } diff --git a/common/src/main/java/com/yunbao/common/adapter/SudHomeGameListAdapter.java b/common/src/main/java/com/yunbao/common/adapter/SudHomeGameListAdapter.java index 5b5f927a4..18adc9cee 100644 --- a/common/src/main/java/com/yunbao/common/adapter/SudHomeGameListAdapter.java +++ b/common/src/main/java/com/yunbao/common/adapter/SudHomeGameListAdapter.java @@ -17,10 +17,12 @@ import java.util.List; public class SudHomeGameListAdapter extends RecyclerView.Adapter { private Context mContext; private List mList; + private boolean isHome = false; - public SudHomeGameListAdapter(Context mContext) { + public SudHomeGameListAdapter(Context mContext, boolean isHome) { this.mContext = mContext; - mList=new ArrayList<>(); + this.isHome = isHome; + mList = new ArrayList<>(); } public void setList(List mList) { @@ -31,7 +33,12 @@ public class SudHomeGameListAdapter extends RecyclerView.Adapter sudRoomListModels = sudGameListAdapter.getList(); - if (sudRoomListModels.size()>1){ + if (sudRoomListModels.size() > 1) { int random = RandomUtil.nextInt(sudRoomListModels.size() - 1); CreateSudRoomModel createSudRoomModel = new CreateSudRoomModel(); createSudRoomModel.setSudGameId(sudRoomListModels.get(random).getSudGameId()); @@ -173,6 +173,12 @@ public class SudGameListPopup extends BottomPopupView { } }); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.search), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + new SudGameSearchDialogPopup(getContext(), false).showDialog(); + } + }); ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.interactive_game_room_game), new ViewClicksAntiShake.ViewClicksCallBack() { @Override public void onViewClicks() { diff --git a/common/src/main/java/com/yunbao/common/dialog/SudGameSearchDialogPopup.java b/common/src/main/java/com/yunbao/common/dialog/SudGameSearchDialogPopup.java index c1ad7bd8e..cad8083f9 100644 --- a/common/src/main/java/com/yunbao/common/dialog/SudGameSearchDialogPopup.java +++ b/common/src/main/java/com/yunbao/common/dialog/SudGameSearchDialogPopup.java @@ -1,12 +1,9 @@ package com.yunbao.common.dialog; import android.content.Context; -import android.content.SharedPreferences; -import android.graphics.Color; import android.text.Editable; import android.text.TextWatcher; import android.view.View; -import android.view.inputmethod.InputMethodManager; import android.widget.EditText; import androidx.annotation.NonNull; @@ -16,10 +13,7 @@ import androidx.recyclerview.widget.RecyclerView; import com.alibaba.fastjson.JSONArray; import com.lxj.xpopup.XPopup; -import com.yunbao.common.CommonAppConfig; -import com.yunbao.common.CommonAppContext; import com.yunbao.common.R; -import com.yunbao.common.adapter.SudGameListAdapter; import com.yunbao.common.adapter.SudGameSearchHistoryListAdapter; import com.yunbao.common.adapter.SudHomeGameListAdapter; import com.yunbao.common.bean.CreateSudRoomModel; @@ -31,6 +25,7 @@ import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.utils.SpUtil; import com.yunbao.common.utils.StringUtil; import com.yunbao.common.views.LiveSudGamePopup; +import com.yunbao.common.views.weight.ViewClicksAntiShake; import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; @@ -46,19 +41,26 @@ public class SudGameSearchDialogPopup extends AbsDialogPopupWindow { private SudGameSearchHistoryListAdapter historyListAdapter; private SudHomeGameListAdapter sudGameListAdapter; + private boolean isHome = false; - public SudGameSearchDialogPopup(@NonNull Context context) { + public SudGameSearchDialogPopup(@NonNull Context context, boolean isHome) { super(context); + this.isHome = isHome; } @Override public void buildDialog(XPopup.Builder builder) { - builder.moveUpToKeyboard(false); + builder.moveUpToKeyboard(false); } @Override public int bindLayoutId() { - return R.layout.dialog_home_search_sud_game; + if (isHome) { + return R.layout.dialog_home_search_sud_game; + } else { + return R.layout.dialog_search_sud_game; + } + } @Override @@ -75,15 +77,15 @@ public class SudGameSearchDialogPopup extends AbsDialogPopupWindow { manager.setReverseLayout(true); } - historyListAdapter = new SudGameSearchHistoryListAdapter(mContext); - sudGameListAdapter = new SudHomeGameListAdapter(mContext); + historyListAdapter = new SudGameSearchHistoryListAdapter(mContext, isHome); + sudGameListAdapter = new SudHomeGameListAdapter(mContext, isHome); historyListAdapter.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(String bean, int position) { editSearch.setText(bean); } }); - listRoom.setLayoutManager(new LinearLayoutManager(mContext,LinearLayoutManager.VERTICAL,false)); + listRoom.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false)); listRoom.setAdapter(sudGameListAdapter); listHistory.setAdapter(historyListAdapter); initHistoryData(); @@ -110,6 +112,12 @@ public class SudGameSearchDialogPopup extends AbsDialogPopupWindow { } }); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.btn_back), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + dialog.dismiss(); + } + }); } private void initHistoryData() { diff --git a/common/src/main/java/com/yunbao/common/views/LiveNewRoleRigtsInterestsViewHolder.java b/common/src/main/java/com/yunbao/common/views/LiveNewRoleRigtsInterestsViewHolder.java index d5e7e22ab..43d54460a 100644 --- a/common/src/main/java/com/yunbao/common/views/LiveNewRoleRigtsInterestsViewHolder.java +++ b/common/src/main/java/com/yunbao/common/views/LiveNewRoleRigtsInterestsViewHolder.java @@ -20,14 +20,14 @@ public class LiveNewRoleRigtsInterestsViewHolder extends RecyclerView.ViewHolder private LiveNewRoleFunGamesAdapter funGamesAdapter; private TextView sendGoodGift; private RecyclerView childList; - - public LiveNewRoleRigtsInterestsViewHolder(@NonNull View itemView) { + private boolean showRed = false; + public LiveNewRoleRigtsInterestsViewHolder(@NonNull View itemView,boolean showRed) { super(itemView); sendGoodGift = itemView.findViewById(R.id.send_good_gift); childList = itemView.findViewById(R.id.child_list); sendGoodGift = itemView.findViewById(R.id.send_good_gift); childList = itemView.findViewById(R.id.child_list); - funGamesAdapter = new LiveNewRoleFunGamesAdapter(itemView.getContext(), false); + funGamesAdapter = new LiveNewRoleFunGamesAdapter(itemView.getContext(), false,showRed); childList.setLayoutManager(new GridLayoutManager(itemView.getContext(), 4)); childList.setAdapter(funGamesAdapter); } diff --git a/common/src/main/java/com/yunbao/common/views/NewRoleFunGamesChildViewHolder.java b/common/src/main/java/com/yunbao/common/views/NewRoleFunGamesChildViewHolder.java index 9a2a2d7a9..a3b1fc6fa 100644 --- a/common/src/main/java/com/yunbao/common/views/NewRoleFunGamesChildViewHolder.java +++ b/common/src/main/java/com/yunbao/common/views/NewRoleFunGamesChildViewHolder.java @@ -1,6 +1,7 @@ package com.yunbao.common.views; import android.text.TextUtils; +import android.util.Log; import android.view.View; import android.widget.ImageView; import android.widget.TextView; @@ -12,7 +13,6 @@ import com.yunbao.common.CommonAppConfig; import com.yunbao.common.R; import com.yunbao.common.bean.CustomSidebarChildModel; import com.yunbao.common.bean.IMLoginModel; -import com.yunbao.common.event.CustomDrawerPopupEvent; import com.yunbao.common.event.LiveNewRoleEvent; import com.yunbao.common.event.NewRoleCustomDrawerPopupEvent; import com.yunbao.common.glide.ImgLoader; @@ -23,11 +23,15 @@ import com.yunbao.common.views.weight.ViewClicksAntiShake; public class NewRoleFunGamesChildViewHolder extends RecyclerView.ViewHolder { private ImageView funGamePic; private TextView funGameName; + private View red_point; + private boolean showRed = false; - public NewRoleFunGamesChildViewHolder(@NonNull View itemView) { + public NewRoleFunGamesChildViewHolder(@NonNull View itemView, boolean showRed) { super(itemView); + this.showRed = showRed; funGamePic = itemView.findViewById(R.id.fun_game_pic); funGameName = itemView.findViewById(R.id.fun_game_name); + red_point = itemView.findViewById(R.id.red_point); } public void setData(CustomSidebarChildModel model, boolean rigts) { @@ -36,7 +40,12 @@ public class NewRoleFunGamesChildViewHolder extends RecyclerView.ViewHolder { } else { ImgLoader.display(itemView.getContext(), model.getResIcon(), funGamePic); } - + Log.e("GamesChildViewHolder", "model.getTitle::::::::::" + model.getTitle()); + Log.e("GamesChildViewHolder", "itemView.getContext().getString::::::::::" + model.getTitle()); + Log.e("GamesChildViewHolder", "showRed::::::::::" + showRed); + if (TextUtils.equals(model.getTitle(), itemView.getContext().getString(R.string.fan_club))) { + red_point.setVisibility(showRed ? View.VISIBLE : View.GONE); + } funGameName.setText(model.getTitle()); @@ -75,7 +84,6 @@ public class NewRoleFunGamesChildViewHolder extends RecyclerView.ViewHolder { .setScreen(TextUtils.equals(model.getShowType(), "2"))); - } } diff --git a/common/src/main/java/com/yunbao/common/views/SudGameListViewHolder.java b/common/src/main/java/com/yunbao/common/views/SudGameListViewHolder.java index e56c09f7b..ba7c4fbd4 100644 --- a/common/src/main/java/com/yunbao/common/views/SudGameListViewHolder.java +++ b/common/src/main/java/com/yunbao/common/views/SudGameListViewHolder.java @@ -15,7 +15,6 @@ import com.yunbao.common.bean.CreateSudRoomModel; import com.yunbao.common.bean.SudRoomListModel; import com.yunbao.common.bean.playerObject; import com.yunbao.common.event.SudGameListDissMissEvent; -import com.yunbao.common.event.SudRoomListModelEvent; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.utils.Bus; import com.yunbao.common.views.weight.ViewClicksAntiShake; diff --git a/common/src/main/res/drawable/bg_item_home_search_history.xml b/common/src/main/res/drawable/bg_item_home_search_history.xml new file mode 100644 index 000000000..acb8f9067 --- /dev/null +++ b/common/src/main/res/drawable/bg_item_home_search_history.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/dialog_search_sud_game.xml b/common/src/main/res/layout/dialog_search_sud_game.xml new file mode 100644 index 000000000..1c1470553 --- /dev/null +++ b/common/src/main/res/layout/dialog_search_sud_game.xml @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/dialog_sud_game_list.xml b/common/src/main/res/layout/dialog_sud_game_list.xml index 94c8b8918..903115206 100644 --- a/common/src/main/res/layout/dialog_sud_game_list.xml +++ b/common/src/main/res/layout/dialog_sud_game_list.xml @@ -33,6 +33,7 @@ android:layout_weight="1" /> + android:src="@mipmap/icon_interactive_game__ranking" + android:visibility="gone" /> + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/view_live_new_role_fun_games_child_view.xml b/common/src/main/res/layout/view_live_new_role_fun_games_child_view.xml index 7525c91c4..a32ea1d1c 100644 --- a/common/src/main/res/layout/view_live_new_role_fun_games_child_view.xml +++ b/common/src/main/res/layout/view_live_new_role_fun_games_child_view.xml @@ -1,5 +1,7 @@ - + + + + + + + diff --git a/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java index 3bb0d7df3..51c59e0b7 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java @@ -467,7 +467,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { // fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveRoleDialogFragment"); new XPopup.Builder(mContext) .enableDrag(false) - .asCustom(new LiveNewRolePopup(mContext)) + .asCustom(new LiveNewRolePopup(mContext, mRedPointPrivilege.getVisibility() == View.VISIBLE)) .show(); } diff --git a/main/src/main/java/com/yunbao/main/views/MainHomeGameViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainHomeGameViewHolder.java index 67f45b39c..5d93b94fd 100644 --- a/main/src/main/java/com/yunbao/main/views/MainHomeGameViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainHomeGameViewHolder.java @@ -1,57 +1,31 @@ package com.yunbao.main.views; import android.animation.ObjectAnimator; -import android.app.Activity; -import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; -import android.graphics.Outline; -import android.graphics.drawable.Drawable; import android.text.TextUtils; import android.util.Log; -import android.view.View; import android.view.ViewGroup; -import android.view.ViewOutlineProvider; import android.view.animation.LinearInterpolator; import android.widget.ImageView; import android.widget.TextView; -import androidx.annotation.Nullable; -import androidx.core.app.ActivityCompat; -import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.bumptech.glide.Glide; -import com.bumptech.glide.load.DataSource; -import com.bumptech.glide.load.engine.GlideException; -import com.bumptech.glide.request.RequestListener; -import com.bumptech.glide.request.target.DrawableImageViewTarget; -import com.bumptech.glide.request.target.Target; +import com.google.gson.Gson; import com.lxj.xpopup.XPopup; import com.lxj.xpopup.enums.PopupPosition; -import com.ms.banner.Banner; -import com.ms.banner.listener.OnBannerClickListener; -import com.umeng.analytics.MobclickAgent; -import com.yunbao.common.CommonAppConfig; -import com.yunbao.common.Constants; -import com.yunbao.common.activity.WebViewActivity; import com.yunbao.common.adapter.RefreshAdapter; -import com.yunbao.common.bean.AnchorRecommendModel; -import com.yunbao.common.bean.BannerBean; +import com.yunbao.common.adapter.SudGameListAdapter; +import com.yunbao.common.bean.CreateSudRoomModel; import com.yunbao.common.bean.CustomSidebarChildModel; import com.yunbao.common.bean.CustomSidebarInfoModel; import com.yunbao.common.bean.LiveBean; -import com.yunbao.common.bean.LiveClassBean; -import com.yunbao.common.bean.WeekListBean; +import com.yunbao.common.bean.SudRoomListModel; import com.yunbao.common.custom.CommonRefreshView; -import com.yunbao.common.custom.ItemDecoration; import com.yunbao.common.dialog.CreateSudGamePopup; import com.yunbao.common.dialog.SudGameListSelectPopup; import com.yunbao.common.dialog.SudGameSearchDialogPopup; -import com.yunbao.common.event.LiveRoomChangeEvent; import com.yunbao.common.event.RoomHolderTypeEvent; import com.yunbao.common.event.SudGameListEvent; import com.yunbao.common.event.SudGameListSillEvent; @@ -59,34 +33,17 @@ import com.yunbao.common.http.LiveHttpUtil; import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.interfaces.OnItemClickListener; -import com.yunbao.common.manager.LiveClassManager; import com.yunbao.common.utils.Bus; -import com.yunbao.common.utils.DialogUitl; -import com.yunbao.common.utils.LiveRoomCheckLivePresenter; -import com.yunbao.common.utils.MicStatusManager; -import com.yunbao.common.utils.RouteUtil; -import com.yunbao.common.utils.StringUtil; -import com.yunbao.common.utils.ToastUtil; -import com.yunbao.common.views.CustomViewHolder; +import com.yunbao.common.utils.RandomUtil; +import com.yunbao.common.views.LiveSudGamePopup; import com.yunbao.common.views.weight.ViewClicksAntiShake; -import com.yunbao.live.utils.LiveStorge; -import com.yunbao.live.views.LiveRoomViewHolder; import com.yunbao.main.R; -import com.yunbao.main.activity.MainActivity; -import com.yunbao.main.adapter.MainHomeLiveAdapter; -import com.yunbao.main.adapter.MainHomeLivesClassAdapter; -import com.yunbao.main.http.MainHttpConsts; -import com.yunbao.main.http.MainHttpUtil; -import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; import java.util.List; -import java.util.Map; /** * Created by cxf on 2018/9/22. @@ -103,6 +60,7 @@ public class MainHomeGameViewHolder extends AbsMainHomeChildViewHolder implement private String mSill = "0,0", mSillName, roomHolderType = "0", roomHolderTypeName; private long animDuration = 500; private String id = "0"; + private SudGameListAdapter sudGameListAdapter; public MainHomeGameViewHolder(Context context, ViewGroup parentView) { super(context, parentView); @@ -119,12 +77,91 @@ public class MainHomeGameViewHolder extends AbsMainHomeChildViewHolder implement public void init() { initData(); + mSill = "0,0"; + roomHolderType = "0"; + id = "0"; roomGameArrow = (ImageView) findViewById(R.id.room_game_arrow); roomSillArrow = (ImageView) findViewById(R.id.room_sill_arrow); houseOwnerArrow = (ImageView) findViewById(R.id.house_owner_arrow); gameTitle = (TextView) findViewById(R.id.game_title); sillTitle = (TextView) findViewById(R.id.room_sill_text); houseOwnerTitle = (TextView) findViewById(R.id.house_owner_text); + mRefreshView = (CommonRefreshView) findViewById(R.id.refreshView); + mRefreshView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false)); + sudGameListAdapter = new SudGameListAdapter(mContext, true); + mRefreshView.setLoadMoreEnable(true); + mRefreshView.setRecyclerViewAdapter(sudGameListAdapter); + mRefreshView.setDataHelper(new CommonRefreshView.DataHelper() { + @Override + public RefreshAdapter getAdapter() { + return null; + } + + @Override + public void loadData(int p, com.yunbao.common.http.HttpCallback callback) { + LiveHttpUtil.getRoomList(id, mSill, roomHolderType, "0", p, callback); + } + + @Override + public List processData(String[] info) { + if (info.length > 0) { + List sudRoomListModels = new ArrayList<>(); + for (String json : info) { + SudRoomListModel model = new Gson().fromJson(json, SudRoomListModel.class); + sudRoomListModels.add(model); + } + return sudRoomListModels; + } else { + return new ArrayList<>(); + } + + } + + @Override + public void onRefreshSuccess(List list, int listCount) { + Log.i("onRefreshSuccess", listCount + ""); + } + + @Override + public void onRefreshFailure() { + + } + + @Override + public void onLoadMoreSuccess(List loadItemList, int loadItemCount) { + sudGameListAdapter.insertList(loadItemList); + } + + @Override + public void onLoadMoreFailure() { + + } + }); + mRefreshView.initData(); + ViewClicksAntiShake.clicksAntiShake(findViewById(com.yunbao.common.R.id.random_start), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + + List sudRoomListModels = sudGameListAdapter.getList(); + if (sudRoomListModels.size() > 1) { + int random = RandomUtil.nextInt(sudRoomListModels.size() - 1); + CreateSudRoomModel createSudRoomModel = new CreateSudRoomModel(); + createSudRoomModel.setSudGameId(sudRoomListModels.get(random).getSudGameId()); + createSudRoomModel.setSudGameRoomId(sudRoomListModels.get(random).getSudGameRoomId()); + createSudRoomModel.setAvatar(sudRoomListModels.get(random).getAvatar()); + createSudRoomModel.setRoomName(sudRoomListModels.get(random).getRoomName()); + createSudRoomModel.setSudGameName(sudRoomListModels.get(random).getSudGameName()); + new XPopup.Builder(mContext) + .enableDrag(false) + .dismissOnTouchOutside(false) + .dismissOnBackPressed(false) + .asCustom(new LiveSudGamePopup(mContext, createSudRoomModel)) + .show(); + + } + + } + }); ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.interactive_game_room_game), new ViewClicksAntiShake.ViewClicksCallBack() { @Override public void onViewClicks() { @@ -204,7 +241,7 @@ public class MainHomeGameViewHolder extends AbsMainHomeChildViewHolder implement ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.search), new ViewClicksAntiShake.ViewClicksCallBack() { @Override public void onViewClicks() { - new SudGameSearchDialogPopup(mContext).showDialog(); + new SudGameSearchDialogPopup(mContext, true).showDialog(); } }); @@ -237,7 +274,7 @@ public class MainHomeGameViewHolder extends AbsMainHomeChildViewHolder implement interactionID = event.getInteractionID(); gameTitle.setText(event.getTitle().substring(0, 2)); id = event.getId(); - initData(); + mRefreshView.initData(); closeAnimSudGameListEvent(); } @@ -251,7 +288,7 @@ public class MainHomeGameViewHolder extends AbsMainHomeChildViewHolder implement sillTitle.setText(mSillName.substring(0, mSillName.length() - 2)); } closeAnimSudGameListSillEvent(); - initData(); + mRefreshView.initData(); } @Subscribe(threadMode = ThreadMode.MAIN) @@ -259,7 +296,7 @@ public class MainHomeGameViewHolder extends AbsMainHomeChildViewHolder implement roomHolderType = event.getRoomHolderType(); roomHolderTypeName = event.getRoomHolderTypeName(); houseOwnerTitle.setText(roomHolderTypeName); - initData(); + mRefreshView.initData(); closeAnimRoomHolderTypeEvent(); } diff --git a/main/src/main/res/layout/view_main_home_sud_game_list.xml b/main/src/main/res/layout/view_main_home_sud_game_list.xml index 87a6e9a7e..218973e2c 100644 --- a/main/src/main/res/layout/view_main_home_sud_game_list.xml +++ b/main/src/main/res/layout/view_main_home_sud_game_list.xml @@ -1,7 +1,6 @@ + android:textSize="16sp" + android:textStyle="bold" /> + android:src="@mipmap/icon_home_interactive_game_ranking" + android:visibility="gone" /> + android:textSize="14sp" + android:textStyle="bold" /> + android:textSize="14sp" + android:textStyle="bold" /> + android:textSize="14sp" + android:textStyle="bold" />