From 0425b561066205cb237610a837c6906d310e22b9 Mon Sep 17 00:00:00 2001
From: Martin <13046765170@163.com>
Date: Tue, 11 Jun 2024 16:55:07 +0800
Subject: [PATCH] =?UTF-8?q?add[=E6=95=B4=E8=9B=8A=E7=BF=BB=E8=AF=91]?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
common/src/main/res/values-en-rUS/string.xml | 10 +-
common/src/main/res/values/strings.xml | 10 +-
common/src/main/res/values/style.xml | 6 +
.../adapter/LivePrankRecyclerAdapter.java | 55 ++++++---
.../live/dialog/LivePrankAddGiftDialog.java | 25 +++-
.../live/dialog/LivePrankDialogFragment.java | 108 +++++++++++-------
.../live/dialog/LivePrankExplainDialog.java | 89 +++++++++++----
.../src/main/res/layout/dialog_live_prank.xml | 1 +
.../res/layout/dialog_live_prank_add_gift.xml | 16 +--
.../res/layout/dialog_live_prank_explain.xml | 75 ++++++------
.../res/layout/view_live_prank_turntable.xml | 19 +--
live/src/main/res/layout/view_live_room.xml | 1 +
live/src/main/res/values-en/strings.xml | 14 ++-
13 files changed, 281 insertions(+), 148 deletions(-)
diff --git a/common/src/main/res/values-en-rUS/string.xml b/common/src/main/res/values-en-rUS/string.xml
index cf8ac1696..f7b69bd82 100644
--- a/common/src/main/res/values-en-rUS/string.xml
+++ b/common/src/main/res/values-en-rUS/string.xml
@@ -1353,11 +1353,11 @@ Limited ride And limited avatar frame
Whether to enter the live broadcast room
No,only enter the game
There are currently no rooms to join
- Turntable prank switch
- After closing, all users will not be able to see the contents of the turntable
- The turntable consumes diamonds every time
- Minimum requirement of 1000 diamonds
- Fill in the content of the prank,Fill in a minimum of 2 words and a maximum of 10 words
+ Turntable Trick Switch
+ After turning it on, all users will not be able to see the content of the carousel.
+ Each turn of the wheel consumes diamonds
+ Starting with at least 1000 diamonds
+ Choose a gift
You have not set up the prank content yet
Choose a prank gift
Enter the prank content...
diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml
index c937e7e14..f3f4d18bd 100644
--- a/common/src/main/res/values/strings.xml
+++ b/common/src/main/res/values/strings.xml
@@ -1356,11 +1356,11 @@ Limited ride And limited avatar frame
Whether to enter the live broadcast room
No,only enter the game
There are currently no rooms to join
- Turntable prank switch
- After closing, all users will not be able to see the contents of the turntable
- The turntable consumes diamonds every time
- Minimum requirement of 1000 diamonds
- Fill in the content of the prank,Fill in a minimum of 2 words and a maximum of 10 words
+ Turntable Trick Switch
+ After turning it on, all users will not be able to see the content of the carousel.
+ Each turn of the wheel consumes diamonds
+ Starting with at least 1000 diamonds
+ Choose a gift
You have not set up the prank content yet
Choose a prank gift
Enter the prank content...
diff --git a/common/src/main/res/values/style.xml b/common/src/main/res/values/style.xml
index c444de78d..190d8d7e2 100644
--- a/common/src/main/res/values/style.xml
+++ b/common/src/main/res/values/style.xml
@@ -131,4 +131,10 @@
- @anim/out_to_right_abit
- @anim/out_to_right
+
+
+
\ No newline at end of file
diff --git a/live/src/main/java/com/yunbao/live/adapter/LivePrankRecyclerAdapter.java b/live/src/main/java/com/yunbao/live/adapter/LivePrankRecyclerAdapter.java
index d88f1c850..25cf9ef60 100644
--- a/live/src/main/java/com/yunbao/live/adapter/LivePrankRecyclerAdapter.java
+++ b/live/src/main/java/com/yunbao/live/adapter/LivePrankRecyclerAdapter.java
@@ -235,19 +235,36 @@ public class LivePrankRecyclerAdapter extends RecyclerView.Adapter onItemClickListener;
@@ -42,7 +45,8 @@ public class LivePrankAddGiftDialog extends AbsDialogPopupWindow {
}
- public LivePrankAddGiftDialog setGiftBeans(List giftBeans) {
+ public LivePrankAddGiftDialog setGiftBeans(List giftBeans,boolean isShow) {
+ this.isShowGiftNumber = isShow;
this.giftBeans = giftBeans;
return this;
}
@@ -68,6 +72,10 @@ public class LivePrankAddGiftDialog extends AbsDialogPopupWindow {
giftText = findViewById(R.id.gift_text);
numberText = findViewById(R.id.number_text);
contentText = findViewById(R.id.content_text);
+ giftNumberLayout= findViewById(R.id.giftNumberLayout);
+ if(isShowGiftNumber){
+ giftNumberLayout.setVisibility(VISIBLE);
+ }
ViewClicksAntiShake.clicksAntiShake(backBtn, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
@@ -131,11 +139,18 @@ public class LivePrankAddGiftDialog extends AbsDialogPopupWindow {
ToastUtil.show(WordUtil.isNewZh() ? "整蠱禮物不能為空" : "A trick gift can't be empty");
return;
}
- if (numberText.getTag()==null||StringUtil.isEmpty(prankContent)){
- ToastUtil.show(WordUtil.isNewZh() ? "整蠱內容或數量不能為空" : "The content or number of pranks cannot be empty");
- return;
+ if(isShowGiftNumber){
+ if (numberText.getTag()==null||StringUtil.isEmpty(prankContent)){
+ ToastUtil.show(WordUtil.isNewZh() ? "整蠱內容或數量不能為空" : "The content or number of pranks cannot be empty");
+ return;
+ }
+ bean.setNum(Integer.parseInt(numberText.getText().toString()));
+ }else{
+ if (StringUtil.isEmpty(prankContent)){
+ ToastUtil.show(WordUtil.isNewZh() ? "整蠱內容或數量不能為空" : "The content or number of pranks cannot be empty");
+ return;
+ }
}
- bean.setNum(Integer.parseInt(numberText.getText().toString()));
bean.setTitle(prankContent);
onItemClickListener.onItemClick(bean,0);
dismiss();
diff --git a/live/src/main/java/com/yunbao/live/dialog/LivePrankDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LivePrankDialogFragment.java
index 45c28a730..6d9e7f6aa 100644
--- a/live/src/main/java/com/yunbao/live/dialog/LivePrankDialogFragment.java
+++ b/live/src/main/java/com/yunbao/live/dialog/LivePrankDialogFragment.java
@@ -69,6 +69,7 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O
private TextView giftTypeTodoText;
private TextView giftTypeNowSwitchText;
private Button mBtnAddGift;
+ private ImageView help;
public void setmLiveUid(String mLiveUid) {
this.mLiveUid = mLiveUid;
@@ -109,6 +110,7 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O
}
private void initView() {
+ help = (ImageView) findViewById(R.id.help);
mTabLayout = (TabLayout) findViewById(R.id.prank_tabLayout);
mTurntableConfigLayout = findViewById(R.id.turntable_layout);
mGiftConfigLayout = findViewById(R.id.gift_layout);
@@ -122,6 +124,7 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O
mPrankRecyclerView.setAdapter(recyclerAdapter);
mCoinTextView.setOnClickListener(this);
mTurntableConfigImageView.setOnClickListener(this);
+ help.setOnClickListener(this);
if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
mPrankBtn.setText("發送圖標");
} else {
@@ -159,6 +162,15 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O
giftBeans.remove(position);
recyclerAdapter.setList(giftBeans);
recyclerAdapter.notifyDataSetChanged();
+ if (giftBeans.size() < 6) {
+ mBtnAddGift.setVisibility(View.VISIBLE);
+ mGiftNotDate.setVisibility(View.VISIBLE);
+ mPrankBtn.setVisibility(View.VISIBLE);
+ } else {
+ mBtnAddGift.setVisibility(View.GONE);
+ mGiftNotDate.setVisibility(View.GONE);
+ mPrankBtn.setVisibility(View.GONE);
+ }
}
}
});
@@ -202,7 +214,7 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O
if (mPrankBtn.getTag() != null && Integer.parseInt(mPrankBtn.getTag().toString()) == 0) {
SocketRyChatUtil.sendPrankIcon();
} else {
-
+ showGiftDialog();
}
}
});
@@ -223,9 +235,14 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O
if ((int) mPrankBtn.getTag() == 0) {
clearPrankConfig();
} else {
+ giftSwitch1Btn.setTag("false");
+ giftSwitch1Btn.setImageResource(R.mipmap.special_icon_off);
giftBeans = new ArrayList<>();
recyclerAdapter.setList(giftBeans);
recyclerAdapter.notifyDataSetChanged();
+ mPrankBtn.setVisibility(View.VISIBLE);
+ mBtnAddGift.setVisibility(View.VISIBLE);
+ mGiftNotDate.setVisibility(View.VISIBLE);
}
}
});
@@ -239,10 +256,9 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O
turntable.setText("轉盤整蠱");
gift.setText("禮物整蠱");
} else {
- turntable.setText("Turntable prank");
- gift.setText("Gift prank");
+ turntable.setText("Turntable");
+ gift.setText("Gift");
}
-
turntable.setTag(0);
gift.setTag(1);
mTabLayout.addTab(turntable);
@@ -261,6 +277,7 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O
mBtnAddGift.setVisibility(View.GONE);
mGiftNotDate.setVisibility(View.GONE);
recyclerAdapter.setViewType(LivePrankRecyclerAdapter.TYPE_TURNTABLE);
+ mPrankBtn.setVisibility(View.VISIBLE);
mPrankBtn.setBackgroundResource(R.drawable.bg_live_prank_turntable_save);
if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
mPrankBtn.setText("發送圖標");
@@ -303,7 +320,7 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O
}
private void showGiftDialog() {
- LivePrankAddGiftDialog livePrankAddGiftDialog = new LivePrankAddGiftDialog(mContext).setGiftBeans(giftBeans);
+ LivePrankAddGiftDialog livePrankAddGiftDialog = new LivePrankAddGiftDialog(mContext).setGiftBeans(giftBeans, giftTypeNowText.getTag().equals("1"));
livePrankAddGiftDialog.setOnItemClickListener(new OnItemClickListener() {
@SuppressLint("NotifyDataSetChanged")
@Override
@@ -314,9 +331,11 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O
if (giftBeans.size() < 6) {
mBtnAddGift.setVisibility(View.VISIBLE);
mGiftNotDate.setVisibility(View.VISIBLE);
+ mPrankBtn.setVisibility(View.VISIBLE);
} else {
mBtnAddGift.setVisibility(View.GONE);
- mGiftNotDate.setVisibility(View.VISIBLE);
+ mGiftNotDate.setVisibility(View.GONE);
+ mPrankBtn.setVisibility(View.GONE);
}
}
});
@@ -330,8 +349,10 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O
giftTypeNowText = (TextView) findViewById(R.id.gift_type_now_text);
giftTypeTodoText = (TextView) findViewById(R.id.gift_type_todo);
giftTypeNowSwitchText = (TextView) findViewById(R.id.gift_type_now_switch);
+ giftTypeNowText.setTag("2");
mBtnAddGift = (Button) findViewById(R.id.gift_add_btn);
mBtnAddGift.setVisibility(View.GONE);
+ mGiftNotDate.setVisibility(View.GONE);
ViewClicksAntiShake.clicksAntiShake(giftSwitch1Btn, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
@@ -351,6 +372,12 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O
CharSequence tmp = giftTypeNowText.getText();
giftTypeNowText.setText(giftTypeNowSwitchText.getText());
giftTypeNowSwitchText.setText(tmp);
+ if (giftTypeNowText.getTag().equals("1")) {
+ giftTypeNowText.setTag("2");
+ } else {
+ giftTypeNowText.setTag("1");
+ }
+ initGiftData();
}
});
ViewClicksAntiShake.clicksAntiShake(mBtnAddGift, new ViewClicksAntiShake.ViewClicksCallBack() {
@@ -378,7 +405,7 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O
private void setGiftBean(List prankGiftBeans) {
JSONArray prankJson = getJsonObjects(prankGiftBeans);
- LiveNetManager.get(mContext).setPrankGift(mLiveUid, giftSwitch1Btn.getTag().equals("true")?"1":"0", new Gson().toJson(prankJson), "1", new HttpCallback() {
+ LiveNetManager.get(mContext).setPrankGift(mLiveUid, giftSwitch1Btn.getTag().equals("true") ? "1" : "0", new Gson().toJson(prankJson), giftTypeNowText.getTag().toString(), new HttpCallback() {
@Override
public void onSuccess(PrankHttpTurntableBean data) {
initGiftData();
@@ -410,23 +437,31 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O
}
private void initGiftData() {
- LiveNetManager.get(mContext).getPrankGiftList(mLiveUid, mPrankBtn.getTag().equals("0")?"2":"1",new HttpCallback() {
+ LiveNetManager.get(mContext).getPrankGiftList(mLiveUid, giftTypeNowText.getTag().toString(), new HttpCallback() {
@Override
public void onSuccess(PrankGiftResultBean data) {
- if(mPrankBtn.getTag().toString().equals("1")){
- if(data.getPrank_list()!=null){
+ if (mPrankBtn.getTag().toString().equals("1")) {
+ if (data.getPrank_list() != null) {
if (data.getPrank_list().size() < 6) {
mBtnAddGift.setVisibility(View.VISIBLE);
mGiftNotDate.setVisibility(View.VISIBLE);
} else {
mBtnAddGift.setVisibility(View.GONE);
- mGiftNotDate.setVisibility(View.VISIBLE);
+ mGiftNotDate.setVisibility(View.GONE);
+ mPrankBtn.setVisibility(View.GONE);
}
mPrankRecyclerView.setVisibility(View.VISIBLE);
recyclerAdapter.setViewType(LivePrankRecyclerAdapter.TYPE_GIFT);
giftBeans = data.getPrank_list();
recyclerAdapter.setList(giftBeans);
recyclerAdapter.notifyDataSetChanged();
+ if (data.getStatus().equals("1")) {
+ giftSwitch1Btn.setTag("true");
+ giftSwitch1Btn.setImageResource(R.mipmap.special_icon_on);
+ } else {
+ giftSwitch1Btn.setTag("false");
+ giftSwitch1Btn.setImageResource(R.mipmap.special_icon_off);
+ }
}
}
@@ -491,37 +526,26 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O
}
return;
}
- LiveNetManager.get(mContext).setAnchorPrankTurntable(
- mLiveUid,
- bean.getCoin() + "",
- bean.getTurntable1(),
- bean.getTurntable2(),
- bean.getTurntable3(),
- bean.getTurntable4(),
- bean.getTurntable5(),
- bean.getTurntable6(),
- bean.getStatus() + "",
- new HttpCallback