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>