1、新版 广场界面 完成

2、新版 娱乐界面 完成
This commit is contained in:
老皮 2024-09-11 15:35:49 +08:00
parent d299e579d6
commit 1985eebfb1
33 changed files with 965 additions and 47 deletions

View File

@ -1,6 +1,8 @@
package com.yunbao.common.adapter;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
@ -8,29 +10,43 @@ import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.R;
import com.yunbao.common.bean.SudRoomListModel;
import com.yunbao.common.views.SudGameListViewHolder;
import com.yunbao.common.views.NewSudGameListViewHolder;
public class SudGameListAdapter extends RefreshAdapter<SudRoomListModel> {
private boolean isHome = false;
private final Drawable[] bgList = new Drawable[6];
@SuppressLint("UseCompatLoadingForDrawables")
public SudGameListAdapter(Context context, boolean isHome) {
super(context);
this.isHome = isHome;
bgList[0] = mContext.getDrawable(R.drawable.grid_item_bg_1);
bgList[1] = mContext.getDrawable(R.drawable.grid_item_bg_2);
bgList[2] = mContext.getDrawable(R.drawable.grid_item_bg_3);
bgList[3] = mContext.getDrawable(R.drawable.grid_item_bg_4);
bgList[4] = mContext.getDrawable(R.drawable.grid_item_bg_5);
bgList[5] = mContext.getDrawable(R.drawable.grid_item_bg_6);
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
if (isHome){
/*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));
}
}*/
return new NewSudGameListViewHolder(mInflater.inflate(R.layout.item_new_game_room, parent, false));
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
SudGameListViewHolder sudGameListViewHolder = (SudGameListViewHolder) holder;
NewSudGameListViewHolder sudGameListViewHolder = (NewSudGameListViewHolder) holder;
sudGameListViewHolder.itemView.setBackground(bgList[position % 6]);
sudGameListViewHolder.setData(mList.get(position),isHome);
}
}

View File

@ -36,6 +36,16 @@ public class CustomSidebarChildModel extends BaseModel {
private String isShow;
@SerializedName("sud_game_is_new")
private String sudGameIsNew;
@SerializedName("is_click")
private boolean isClick;
public boolean isClick() {
return isClick;
}
public void setClick(boolean click) {
isClick = click;
}
public String getSudGameIsNew() {
return sudGameIsNew;

View File

@ -412,6 +412,10 @@ public class CommonRefreshView extends FrameLayout implements View.OnClickListen
}
}
public void addItemDecoration(RecyclerView.ItemDecoration gridSpacingItemDecoration) {
mRecyclerView.addItemDecoration(gridSpacingItemDecoration);
}
public interface DataHelperNew {
void loadData(int p);

View File

@ -0,0 +1,239 @@
package com.yunbao.common.views;
import android.app.Dialog;
import android.os.Handler;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.fastjson.JSON;
import com.google.gson.Gson;
import com.lxj.xpopup.XPopup;
import com.makeramen.roundedimageview.RoundedImageView;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.R;
import com.yunbao.common.bean.CreateSudRoomModel;
import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.bean.SudGameScoreBean;
import com.yunbao.common.bean.SudRoomListModel;
import com.yunbao.common.event.LiveOpenSudRoomEvent;
import com.yunbao.common.event.LiveSudGamePopupShowOrHideEvent;
import com.yunbao.common.event.SudGameListDissMissEvent;
import com.yunbao.common.event.SudGameListRefreshEvent;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.LiveHttpUtil;
import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.manager.RandomSudGameManager;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.LiveRoomCheckLivePresenter;
import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import java.util.Locale;
public class NewSudGameListViewHolder extends RecyclerView.ViewHolder {
private RoundedImageView mAvatar;
private TextView roomName, playerWeAre, playerWeAre2, goldenBeanNumber;
private ImageView sex, gold_coin;
public NewSudGameListViewHolder(@NonNull View itemView) {
super(itemView);
mAvatar = itemView.findViewById(R.id.avatar);
roomName = itemView.findViewById(R.id.room_name);
playerWeAre = itemView.findViewById(R.id.player_we_are);
playerWeAre2 = itemView.findViewById(R.id.player_we_are_2);
goldenBeanNumber = itemView.findViewById(R.id.golden_bean_number);
gold_coin = itemView.findViewById(R.id.gold_coin);
sex = itemView.findViewById(R.id.sex);
}
public void setData(SudRoomListModel model, boolean isHome) {
ImgLoader.display(itemView.getContext(), model.getAvatar(), mAvatar);
roomName.setText(model.getRoomName());
playerWeAre.setText(String.format(itemView.getContext().getString(R.string.interactive_game_player_we_are_4), model.getPlayerTotal()));
playerWeAre2.setText(String.format(itemView.getContext().getString(R.string.interactive_game_player_we_are_3), model.getTotal()));
goldenBeanNumber.setText(model.getGoldenBeanNumber());
if (TextUtils.equals(model.getSex(), "1")) {
ImgLoader.display(itemView.getContext(), R.mipmap.man, sex);
} else if (TextUtils.equals(model.getSex(), "2")) {
ImgLoader.display(itemView.getContext(), R.mipmap.girl, sex);
}
if (TextUtils.equals(model.getCurrencyType(), "2")) {
ImgLoader.display(itemView.getContext(), R.mipmap.icon_collectibles, gold_coin);
} else {
ImgLoader.display(itemView.getContext(), R.mipmap.gold_coin, gold_coin);
}
ViewClicksAntiShake.clicksAntiShake(itemView, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
LiveNetManager.get(itemView.getContext()).checkRoomStatus(model.getId(), new com.yunbao.common.http.base.HttpCallback<CreateSudRoomModel>() {
@Override
public void onSuccess(CreateSudRoomModel data) {
if (TextUtils.equals(data.getRoomStatus(), "0")) {
if (IMLoginManager.get(itemView.getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
ToastUtil.show("房间不存在");
} else {
ToastUtil.show("The room does not exist");
}
Bus.get().post(new SudGameListRefreshEvent());
} else {
if (TextUtils.equals(model.getIsActivity(), "1")) {
LiveNetManager.get(mAvatar.getContext())
.getScore(model.getSudGameRoomId(), new com.yunbao.common.http.base.HttpCallback<SudGameScoreBean>() {
@Override
public void onSuccess(SudGameScoreBean data) {
if(data.getGolden_bean_remaining_balance()!=1){
RandomSudGameManager.getManager().showNotActivityTicketDialog(itemView.getContext(), true, new DialogUitl.SimpleCallback2() {
@Override
public void onCancelClick() {
}
@Override
public void onConfirmClick(Dialog dialog, String content) {
toGame(model, isHome, true);
}
});
return;
}
toGame(model, isHome, true);
}
@Override
public void onError(String error) {
}
});
} else {
toGame(model, isHome, false);
}
}
}
@Override
public void onError(String error) {
ToastUtil.show(error);
}
});
}
});
}
private void toGame(SudRoomListModel model, boolean isHome,boolean isActivity) {
CreateSudRoomModel createSudRoomModel = new CreateSudRoomModel();
createSudRoomModel.setSudGameId(model.getSudGameId());
createSudRoomModel.setSudGameRoomId(model.getSudGameRoomId());
createSudRoomModel.setAvatar(model.getAvatar());
createSudRoomModel.setRoomName(model.getRoomName());
createSudRoomModel.setSudGameName(model.getSudGameName());
if (isHome) {
if (TextUtils.equals(model.getLiveUid(), "0")) {
if (CommonAppConfig.getInstance().getConfig().isSw()) {
RouteUtil.forwardSwSudGameActivity(new Gson().toJson(createSudRoomModel), isActivity,false, isHome);
} else {
RouteUtil.forwardRySudGameActivity(new Gson().toJson(createSudRoomModel), true, isHome);
}
} else {
String yes = "";
if (IMLoginManager.get(itemView.getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
yes = "";
} else {
yes = "Yes";
}
new XPopup.Builder(itemView.getContext())
.asCustom(new HintCustomPopup(itemView.getContext(),
itemView.getContext().getString(R.string.interactive_game_search_room_currently_live),
itemView.getContext().getString(R.string.interactive_game_search_room_broadcast_room))
.setLiveOpenOk(yes)
.setLiveOpenCancel(itemView.getContext().getString(R.string.interactive_game_search_room_bhe_game))
.setCallBack(new HintCustomPopup.HintCustomCallBack() {
@Override
public void onSure() {
LiveHttpUtil.getLiveInfo(model.getLiveUid() + "", new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
new LiveRoomCheckLivePresenter(itemView.getContext(), liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk, boolean isSw) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal), isSw);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
LiveNetManager.get(mAvatar.getContext())
.getScore(model.getSudGameRoomId(), new com.yunbao.common.http.base.HttpCallback<SudGameScoreBean>() {
@Override
public void onSuccess(SudGameScoreBean data) {
if(data.getGolden_bean_remaining_balance()!=1){
RandomSudGameManager.getManager().showNotActivityTicketDialog(itemView.getContext(), true, new DialogUitl.SimpleCallback2() {
@Override
public void onCancelClick() {
}
@Override
public void onConfirmClick(Dialog dialog, String content) {
Bus.get().post(new LiveOpenSudRoomEvent().setActivity(isActivity).setCreateSudRoomModel(createSudRoomModel));
}
});
return;
}
Bus.get().post(new LiveOpenSudRoomEvent().setActivity(isActivity).setCreateSudRoomModel(createSudRoomModel));
}
@Override
public void onError(String error) {
}
});
}
}, 1500);
}
@Override
public void onCheckError(String contextError) {
}
});
} else {
RouteUtil.forwardUserHome(itemView.getContext(), model.getLiveUid(), 0);
}
}
});
}
@Override
public void onCancel() {
if (CommonAppConfig.getInstance().getConfig().isSw()) {
RouteUtil.forwardSwSudGameActivity(new Gson().toJson(createSudRoomModel), isActivity,false, isHome);
} else {
RouteUtil.forwardRySudGameActivity(new Gson().toJson(createSudRoomModel), true, isHome);
}
}
})).show();
}
} else {
Bus.get().post(new LiveSudGamePopupShowOrHideEvent().setType(0).setActivityGame(isActivity).setCreateSudRoomModel(createSudRoomModel));
Bus.get().post(new SudGameListDissMissEvent());
}
}
}

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<corners android:radius="10dp"/>
<gradient
android:angle="180"
android:endColor="#D1E6FF"
android:startColor="#D4F7FF" />
</shape>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<corners android:radius="10dp"/>
<gradient
android:angle="180"
android:endColor="#D2FFF8"
android:startColor="#E7FAFF" />
</shape>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<corners android:radius="10dp"/>
<gradient
android:angle="180"
android:endColor="#EDD9FF"
android:startColor="#FFECFF" />
</shape>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<corners android:radius="10dp"/>
<gradient
android:angle="180"
android:endColor="#FFF8CD"
android:startColor="#FFFCE0" />
</shape>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<corners android:radius="10dp"/>
<gradient
android:angle="180"
android:endColor="#FFD1D1"
android:startColor="#FFF4E8" />
</shape>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<corners android:radius="10dp"/>
<gradient
android:angle="180"
android:endColor="#ECFFE8"
android:startColor="#EFFFE9" />
</shape>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="19dp" />
<gradient
android:angle="0"
android:endColor="#FFFFFFFF"
android:startColor="#00FFFFFF" />
</shape>

View File

@ -0,0 +1,149 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="168dp"
xmlns:app="http://schemas.android.com/apk/res-auto"
app:cardCornerRadius="10dp"
app:cardElevation="0dp"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:id="@+id/layout"
android:layout_height="match_parent">
<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginTop="15dp"
android:layout_marginStart="15dp"
app:cardElevation="0dp"
app:cardCornerRadius="10dp"
app:cardBackgroundColor="@color/white"
android:id="@+id/top_view_1"
android:layout_height="25dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="wrap_content"
android:layout_height="match_parent">
<ImageView
android:layout_width="18dp"
android:layout_height="18dp"
android:src="@mipmap/image"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginStart="8dp"
app:layout_constraintBottom_toBottomOf="parent"
android:id="@+id/gold_coin"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1,000"
android:textColor="#ff333333"
android:textSize="12sp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/gold_coin"
android:layout_marginEnd="8dp"
android:layout_marginStart="4dp"
android:id="@+id/golden_bean_number"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
<TextView
android:layout_width="0dp"
android:layout_height="17dp"
android:textColor="#ff000000"
android:textSize="15sp"
android:layout_marginEnd="6dp"
android:id="@+id/room_name"
app:layout_constraintStart_toStartOf="@id/top_view_1"
app:layout_constraintEnd_toEndOf="parent"
android:maxLines="1"
android:ellipsize="end"
android:singleLine="true"
app:layout_constraintTop_toBottomOf="@id/top_view_1"
android:layout_marginTop="10dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ff777777"
android:textSize="10sp"
android:id="@+id/player_we_are_2"
android:text="@string/interactive_game_player_we_are_3"
app:layout_constraintStart_toStartOf="@id/top_view_1"
app:layout_constraintTop_toBottomOf="@id/room_name"
android:layout_marginTop="10dp"
/>
<TextView
android:layout_width="95dp"
android:layout_height="21dp"
android:background="@drawable/white_alpa_shape"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginBottom="15dp"
android:layout_marginStart="37dp"
android:id="@+id/tmp_view"
/>
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/avatar"
android:layout_width="47dp"
android:layout_height="47dp"
android:scaleType="centerCrop"
app:riv_oval="true"
app:layout_constraintBottom_toBottomOf="@id/tmp_view"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginStart="16dp"
/>
<ImageView
android:id="@+id/sex"
android:layout_width="16dp"
android:layout_height="16dp"
app:layout_constraintBottom_toBottomOf="@id/avatar"
app:layout_constraintEnd_toEndOf="@id/avatar"
android:src="@mipmap/girl"
/>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="#ff777777"
android:textSize="10sp"
android:id="@+id/player_we_are"
android:text="@string/interactive_game_player_we_are_4"
app:layout_constraintEnd_toEndOf="@id/tmp_view"
app:layout_constraintTop_toTopOf="@id/tmp_view"
app:layout_constraintBottom_toBottomOf="@id/tmp_view"
android:layout_marginEnd="6dp"
app:layout_constraintStart_toEndOf="@id/tmp_image"
/>
<ImageView
android:layout_width="8dp"
android:layout_height="8dp"
android:src="@mipmap/people"
app:layout_constraintTop_toTopOf="@id/tmp_view"
app:layout_constraintBottom_toBottomOf="@id/tmp_view"
app:layout_constraintStart_toEndOf="@id/sex"
android:layout_marginStart="5dp"
android:id="@+id/tmp_image"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 854 B

View File

@ -1319,6 +1319,7 @@
<string name="live_gift_dialog_select_add">確定添加</string>
<string name="interactive_game">互動遊戲</string>
<string name="interactive_game_room_list">房間列表</string>
<string name="interactive_game_room_list_new">娛樂遊戲</string>
<string name="interactive_game_room_game">游戲:</string>
<string name="interactive_game_room_game_all">所有</string>
<string name="interactive_game_room_sill">門檻:</string>
@ -1339,7 +1340,9 @@
<string name="interactive_game_create_5">5K以上金豆</string>
<string name="interactive_game_player">玩家</string>
<string name="interactive_game_player_we_are">%s人組隊中一起來玩吧</string>
<string name="interactive_game_player_we_are_4">%s 正在遊戲</string>
<string name="interactive_game_player_we_are_2">%s人在綫</string>
<string name="interactive_game_player_we_are_3">在線人數%s人快加入吧</string>
<string name="interactive_game_search_room">搜索房間</string>
<string name="interactive_game_search_history">搜索历史</string>
<string name="interactive_game_search_room_name_input">請輸入您要搜索的房主昵稱、房主ID或房間名</string>

View File

@ -1326,6 +1326,7 @@
<string name="live_gift_dialog_select_add">Add</string>
<string name="interactive_game">Interactive Games</string>
<string name="interactive_game_room_list">Room list</string>
<string name="interactive_game_room_list_new">Recreation Game</string>
<string name="interactive_game_room_game">Game:</string>
<string name="interactive_game_room_game_all">All</string>
<string name="interactive_game_room_sill">Threshold:</string>
@ -1346,7 +1347,9 @@
<string name="interactive_game_create_5">Above 5K beans</string>
<string name="interactive_game_player">User</string>
<string name="interactive_game_player_we_are">In a team of %s people, let\'s play together~</string>
<string name="interactive_game_player_we_are_4">%s Be playing</string>
<string name="interactive_game_player_we_are_2">%s people online</string>
<string name="interactive_game_player_we_are_3">There are %s people online. Join us</string>
<string name="interactive_game_search_room">Search for room</string>
<string name="interactive_game_search_history">Search History</string>
<string name="interactive_game_search_room_name_input">Search for room: Please enter the owner\'s name, owner ID, or room name you want to search for.</string>

View File

@ -0,0 +1,136 @@
package com.yunbao.main.adapter;
import android.annotation.SuppressLint;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import com.yunbao.common.bean.BattlePassPoints;
import com.yunbao.common.bean.CustomSidebarChildModel;
import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.main.R;
import java.util.ArrayList;
import java.util.List;
public class NewGameRoomTopAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private final Context mContext;
private List<CustomSidebarChildModel> customSidebarChildModels = new ArrayList<>();
OnItemClickListener<CustomSidebarChildModel> onItemClickListener;
public void setOnItemClickListener(OnItemClickListener<CustomSidebarChildModel> onItemClickListener) {
this.onItemClickListener = onItemClickListener;
}
public NewGameRoomTopAdapter(Context mContext) {
this.mContext = mContext;
}
@SuppressLint("NotifyDataSetChanged")
public void setList(List<CustomSidebarChildModel> mList) {
if (mList == null) {
return;
}
this.customSidebarChildModels.clear();
this.customSidebarChildModels.addAll(mList);
CustomSidebarChildModel allBean = new CustomSidebarChildModel();
allBean.setId("0");
allBean.setClick(true);
this.customSidebarChildModels.add(0,allBean);
notifyDataSetChanged();
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
if (viewType == 0) {
return new NewGameRoomTopNormalViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_game_room_type_1, parent, false));
} else {
return new NewGameRoomTopSelectedViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_game_room_type_2, parent, false));
}
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
CustomSidebarChildModel data = this.customSidebarChildModels.get(position);
if (holder instanceof NewGameRoomTopNormalViewHolder) {
if (position == 0) {
((NewGameRoomTopNormalViewHolder) holder).itemName.setText(mContext.getString(com.yunbao.common.R.string.interactive_game_room_all));
Glide.with(mContext).load(R.mipmap.game).into(((NewGameRoomTopNormalViewHolder) holder).itemImage);
} else {
((NewGameRoomTopNormalViewHolder) holder).itemName.setText(data.getTitle());
Glide.with(mContext).load(data.getIcon()).into(((NewGameRoomTopNormalViewHolder) holder).itemImage);
}
} else if (holder instanceof NewGameRoomTopSelectedViewHolder) {
if (position == 0) {
((NewGameRoomTopSelectedViewHolder) holder).itemName.setText(mContext.getString(com.yunbao.common.R.string.interactive_game_room_all));
Glide.with(mContext).load(R.mipmap.game).into(((NewGameRoomTopSelectedViewHolder) holder).itemImage);
} else {
((NewGameRoomTopSelectedViewHolder) holder).itemName.setText(data.getTitle());
Glide.with(mContext).load(data.getIcon()).into(((NewGameRoomTopSelectedViewHolder) holder).itemImage);
}
}
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int currentPosition = holder.getAdapterPosition();
for (int i = 0; i < customSidebarChildModels.size(); i++) {
customSidebarChildModels.get(i).setClick(i == currentPosition);
notifyDataSetChanged();
}
onItemClickListener.onItemClick(data,currentPosition);
}
});
}
@Override
public int getItemCount() {
return customSidebarChildModels.size();
}
@Override
public int getItemViewType(int position) {
if (this.customSidebarChildModels.get(position).isClick()) {
return 1;
}
return 0;
}
}
class NewGameRoomTopNormalViewHolder extends RecyclerView.ViewHolder {
ImageView itemImage;
TextView itemName;
public NewGameRoomTopNormalViewHolder(@NonNull View itemView) {
super(itemView);
itemImage = itemView.findViewById(R.id.item_image);
itemName = itemView.findViewById(R.id.item_name);
}
}
class NewGameRoomTopSelectedViewHolder extends RecyclerView.ViewHolder {
ImageView itemImage;
TextView itemName;
public NewGameRoomTopSelectedViewHolder(@NonNull View itemView) {
super(itemView);
itemImage = itemView.findViewById(R.id.item_image);
itemName = itemView.findViewById(R.id.item_name);
}
}

View File

@ -0,0 +1,42 @@
package com.yunbao.main.views;
import android.graphics.Rect;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
public class GridSpacingItemDecoration extends RecyclerView.ItemDecoration {
private final int spanCount;
private final int spacing;
private final boolean includeEdge;
public GridSpacingItemDecoration(int spanCount, int spacing, boolean includeEdge) {
this.spanCount = spanCount;
this.spacing = spacing;
this.includeEdge = includeEdge;
}
@Override
public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
int position = parent.getChildAdapterPosition(view); // item position
int column = position % spanCount; // item column
if (includeEdge) {
outRect.left = spacing - column * spacing / spanCount;
outRect.right = (column + 1) * spacing / spanCount;
if (position < spanCount) { // top edge
outRect.top = spacing;
}
outRect.bottom = spacing; // item bottom
} else {
outRect.left = column * spacing / spanCount;
outRect.right = spacing - (column + 1) * spacing / spanCount;
if (position >= spanCount) {
outRect.top = spacing; // item top
}
}
}
}

View File

@ -11,7 +11,9 @@ import android.view.animation.LinearInterpolator;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.gson.Gson;
import com.lxj.xpopup.XPopup;
@ -46,6 +48,9 @@ import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.LiveSudGameHistoryPopup;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.main.R;
import com.yunbao.main.adapter.NewGameRoomTopAdapter;
import net.lucode.hackware.magicindicator.buildins.UIUtil;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
@ -62,8 +67,8 @@ import java.util.Locale;
public class MainHomeGameViewHolder extends AbsMainHomeChildViewHolder implements OnItemClickListener<LiveBean> {
private CommonRefreshView mRefreshView;
private ImageView roomGameArrow, roomSillArrow, houseOwnerArrow;
private TextView gameTitle, sillTitle, houseOwnerTitle;
private ImageView roomSillArrow, houseOwnerArrow;
private TextView sillTitle, houseOwnerTitle;
private long interactionID = 0;
private List<CustomSidebarChildModel> customSidebarChildModels = new ArrayList<>();
private String mSill = "0,0,0", mSillName, roomHolderType = "0", roomHolderTypeName;
@ -71,6 +76,9 @@ public class MainHomeGameViewHolder extends AbsMainHomeChildViewHolder implement
private String id = "0";
private SudGameListAdapter sudGameListAdapter;
private AbsActivity context;
private RecyclerView topRecyclerView;
private NewGameRoomTopAdapter newGameRoomTopAdapter;
public MainHomeGameViewHolder(AbsActivity context, ViewGroup parentView) {
super(context, parentView);
@ -80,7 +88,7 @@ public class MainHomeGameViewHolder extends AbsMainHomeChildViewHolder implement
@Override
protected int getLayoutId() {
return R.layout.view_main_home_sud_game_list;
return R.layout.new_gram_room;
}
@ -91,14 +99,30 @@ public class MainHomeGameViewHolder extends AbsMainHomeChildViewHolder implement
mSill = "0,0,0";
roomHolderType = "0";
id = "0";
roomGameArrow = (ImageView) findViewById(R.id.room_game_arrow);
topRecyclerView = (RecyclerView) findViewById(R.id.game_type_recyclerview);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context);
linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
topRecyclerView.setLayoutManager(linearLayoutManager);
newGameRoomTopAdapter = new NewGameRoomTopAdapter(mContext);
topRecyclerView.setAdapter(newGameRoomTopAdapter);
newGameRoomTopAdapter.setOnItemClickListener(new OnItemClickListener<CustomSidebarChildModel>() {
@Override
public void onItemClick(CustomSidebarChildModel bean, int position) {
id = bean.getId();
mRefreshView.initData();
}
});
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));
mRefreshView.setLayoutManager(new GridLayoutManager(mContext, 2));
int dip2px = UIUtil.dip2px(mContext, 10);
mRefreshView.addItemDecoration(new GridSpacingItemDecoration(2, dip2px, false));
sudGameListAdapter = new SudGameListAdapter(mContext, true);
mRefreshView.setLoadMoreEnable(true);
mRefreshView.setRecyclerViewAdapter(sudGameListAdapter);
@ -150,7 +174,7 @@ public class MainHomeGameViewHolder extends AbsMainHomeChildViewHolder implement
});
mRefreshView.initData();
mRefreshView.setEmptyLayoutId(R.layout.sud_no_data);
ViewClicksAntiShake.clicksAntiShake(findViewById(com.yunbao.common.R.id.random_start), new ViewClicksAntiShake.ViewClicksCallBack() {
/* ViewClicksAntiShake.clicksAntiShake(findViewById(com.yunbao.common.R.id.random_start), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
LiveNetManager.get(mContext)
@ -198,8 +222,8 @@ public class MainHomeGameViewHolder extends AbsMainHomeChildViewHolder implement
}
});
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.interactive_game_room_game), new ViewClicksAntiShake.ViewClicksCallBack() {
});*/
/* ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.interactive_game_room_game), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
ObjectAnimator animator = ObjectAnimator.ofFloat(roomGameArrow, "rotation", 0f, 90f);
@ -223,7 +247,7 @@ public class MainHomeGameViewHolder extends AbsMainHomeChildViewHolder implement
}
});
});*/
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.room_sill), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
@ -298,6 +322,7 @@ public class MainHomeGameViewHolder extends AbsMainHomeChildViewHolder implement
for (CustomSidebarInfoModel datum : data) {
if (datum.getType().equals("6")) {
customSidebarChildModels = datum.getChild();
newGameRoomTopAdapter.setList(customSidebarChildModels);
return;
}
}
@ -308,7 +333,7 @@ public class MainHomeGameViewHolder extends AbsMainHomeChildViewHolder implement
}
});
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.sud_rule), new ViewClicksAntiShake.ViewClicksCallBack() {
/* ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.sud_rule), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
new XPopup.Builder(mContext)
@ -316,7 +341,7 @@ public class MainHomeGameViewHolder extends AbsMainHomeChildViewHolder implement
.maxWidth(DeviceUtils.getScreenHeight((Activity) mContext) - DpUtil.dp2px(34))
.asCustom(new SudGameRulePopup(mContext)).show();
}
});
});*/
}
private void initData() {
@ -324,28 +349,6 @@ public class MainHomeGameViewHolder extends AbsMainHomeChildViewHolder implement
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onSudGameListEvent(SudGameListEvent event) {
interactionID = event.getInteractionID();
if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
gameTitle.setText(event.getTitle());
} else {
if (event.getTitle().contains("All")) {
gameTitle.setText("All");
} else {
if ((event.getTitle().length() > 6)) {
gameTitle.setText(event.getTitle());
} else {
gameTitle.setText(event.getTitle());
}
}
}
id = event.getId();
mRefreshView.initData();
closeAnimSudGameListEvent();
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onSudGameListSillEvent(SudGameListSillEvent event) {
@ -369,12 +372,6 @@ public class MainHomeGameViewHolder extends AbsMainHomeChildViewHolder implement
closeAnimRoomHolderTypeEvent();
}
private void closeAnimSudGameListEvent() {
ObjectAnimator animator = ObjectAnimator.ofFloat(roomGameArrow, "rotation", 90f, 0f);
animator.setDuration(animDuration);
animator.setInterpolator(new LinearInterpolator());
animator.start();
}
private void closeAnimSudGameListSillEvent() {
ObjectAnimator backAnimator = ObjectAnimator.ofFloat(roomSillArrow, "rotation", 90f, 0f);

View File

@ -403,6 +403,15 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi
case 17:
RouteUtil.forwardActivity(RouteUtil.PATH_FEEDBACK_ACTIVITY);
break;
case 100:
// 精彩短劇
break;
case 101:
// 消息中心
break;
}
} else {
//21 在线客服

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="19dp" />
<gradient
android:angle="0"
android:endColor="#FFFFFFFF"
android:startColor="#00FFFFFF" />
</shape>

View File

@ -0,0 +1,53 @@
<?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="90dp"
android:layout_height="90dp">
<androidx.cardview.widget.CardView
android:layout_width="72dp"
android:layout_height="72dp"
app:cardBackgroundColor="@color/white"
app:cardCornerRadius="15dp"
app:cardElevation="0dp"
android:layout_marginStart="10dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="35dp"
android:layout_height="35dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="10dp"
android:id="@+id/item_image"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ff333333"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginBottom="8dp"
android:id="@+id/item_name"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="90dp"
android:layout_height="90dp"
xmlns:app="http://schemas.android.com/apk/res-auto"
app:cardBackgroundColor="@color/white"
app:cardCornerRadius="15dp"
app:cardElevation="0dp"
android:layout_marginStart="10dp"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="45dp"
android:layout_height="45dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="10dp"
android:id="@+id/item_image"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="所有游戏"
android:textColor="#111111"
android:textSize="13sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginBottom="14dp"
android:id="@+id/item_name"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>

View File

@ -0,0 +1,134 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="168dp"
xmlns:app="http://schemas.android.com/apk/res-auto"
app:cardCornerRadius="10dp"
app:cardElevation="0dp"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginTop="15dp"
android:layout_marginStart="15dp"
app:cardElevation="0dp"
app:cardCornerRadius="10dp"
app:cardBackgroundColor="@color/white"
android:id="@+id/top_view_1"
android:layout_height="25dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="wrap_content"
android:layout_height="match_parent">
<ImageView
android:layout_width="18dp"
android:layout_height="18dp"
android:src="@mipmap/image"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginStart="8dp"
app:layout_constraintBottom_toBottomOf="parent"
android:id="@+id/gold_coin"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1,000"
android:textColor="#ff333333"
android:textSize="12sp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/gold_coin"
android:layout_marginEnd="8dp"
android:layout_marginStart="4dp"
android:id="@+id/golden_bean_number"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ff000000"
android:textSize="15sp"
android:text="@string/interactive_game_create_room_name"
android:id="@+id/room_name"
app:layout_constraintStart_toStartOf="@id/top_view_1"
app:layout_constraintTop_toBottomOf="@id/top_view_1"
android:layout_marginTop="10dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ff777777"
android:textSize="10sp"
android:id="@+id/player_we_are_2"
android:text="@string/interactive_game_player_we_are_2"
app:layout_constraintStart_toStartOf="@id/top_view_1"
app:layout_constraintTop_toBottomOf="@id/room_name"
android:layout_marginTop="10dp"
/>
<TextView
android:layout_width="95dp"
android:layout_height="21dp"
android:background="@drawable/white_alpa_shape"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginBottom="15dp"
android:layout_marginStart="37dp"
android:id="@+id/tmp_view"
/>
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/avatar"
android:layout_width="47dp"
android:layout_height="47dp"
android:scaleType="centerCrop"
app:riv_oval="true"
app:layout_constraintBottom_toBottomOf="@id/tmp_view"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginStart="16dp"
/>
<ImageView
android:id="@+id/sex"
android:layout_width="16dp"
android:layout_height="16dp"
app:layout_constraintBottom_toBottomOf="@id/avatar"
app:layout_constraintEnd_toEndOf="@id/avatar"
android:src="@mipmap/girl"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ff777777"
android:textSize="10sp"
android:id="@+id/player_we_are"
android:text="@string/interactive_game_player_we_are"
app:layout_constraintEnd_toEndOf="@id/tmp_view"
app:layout_constraintTop_toTopOf="@id/tmp_view"
app:layout_constraintBottom_toBottomOf="@id/tmp_view"
android:layout_marginEnd="6dp"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>

View File

@ -10,7 +10,7 @@
android:layout_width="match_parent"
android:layout_height="240dp"
android:scaleType="fitXY"
android:src="@mipmap/bg1"
android:src="@mipmap/bg"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription" />
@ -21,7 +21,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="17dp"
android:layout_marginTop="52dp"
android:text="@string/interactive_game_room_list"
android:text="@string/interactive_game_room_list_new"
android:textColor="#000"
android:textSize="19sp"
app:layout_constraintStart_toStartOf="parent"
@ -168,9 +168,13 @@
android:layout_marginTop="15dp"
android:id="@+id/refreshView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
android:layout_height="0dp"
app:layout_constraintTop_toBottomOf="@id/select_game_type"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -4,6 +4,7 @@
android:layout_height="match_parent">
<LinearLayout
android:layout_marginTop="50dp"
android:id="@+id/rootView"
android:layout_width="match_parent"
android:layout_height="match_parent"

View File

@ -1,7 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/fragment_container"
android:layout_height="match_parent">
<ImageView
android:id="@+id/backgroup_iv"
android:layout_width="match_parent"
android:layout_height="240dp"
android:scaleType="fitXY"
android:src="@mipmap/bg"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription" />
</androidx.constraintlayout.widget.ConstraintLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 570 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB