調整主播端設置整蠱UI

This commit is contained in:
zlzw 2024-05-31 15:06:35 +08:00
parent b7c0f5d3ec
commit 186b9d61ee
13 changed files with 370 additions and 122 deletions

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -17,6 +17,7 @@ import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R;
@ -148,11 +149,11 @@ public class LivePrankRecyclerAdapter extends RecyclerView.Adapter<LivePrankRecy
context = itemView.findViewById(R.id.prank_turntable_val);
context.setOnClickListener(v -> {
if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
DialogUitl.showSimpleInputDialog(mContext, "填寫整蠱內容", DialogUitl.INPUT_TYPE_TEXT, 10, new DialogUitl.SimpleCallback() {
DialogUitl.showSimpleInputDialog(mContext, WordUtil.isNewZh() ? "填寫整蠱內容" : "prank content", DialogUitl.INPUT_TYPE_TEXT, 10, new DialogUitl.SimpleCallback() {
@Override
public void onConfirmClick(Dialog dialog, String content) {
if (WordUtil.isSpecialChar(content)) {
ToastUtil.show("整蠱內容不能包含特殊字符");
ToastUtil.show(WordUtil.isNewZh() ? "整蠱內容不能包含特殊字符" : "The prank content must not contain special characters");
return;
}
if (content.length() >= 2 && content.length() <= 10) {
@ -205,6 +206,33 @@ public class LivePrankRecyclerAdapter extends RecyclerView.Adapter<LivePrankRecy
probability.setText(getProbability(bean.getId(), mContext));
context.setText(bean.getContext());
if (StringUtil.isEmpty(context.getText().toString().trim())) {
String str = null;
switch (position) {
case 0:
str = WordUtil.isNewZh() ? "請輸入整蠱内容,例如:深情表白三分钟" : "For example: Confess affectionately for three minutes";
break;
case 1:
str = WordUtil.isNewZh() ? "請輸入整蠱内容,例如:唱一首拿手歌曲" : "For example: sing a favorite song";
break;
case 2:
str = WordUtil.isNewZh() ? "請輸入整蠱内容,例如:跳一支熱門舞蹈" : "For example: dance a popular dance";
break;
case 3:
str = WordUtil.isNewZh() ? "請輸入整蠱内容,例如:回答一次真心話" : "For example: answer the truth once";
break;
case 4:
str = WordUtil.isNewZh() ? "請輸入整蠱内容,例如:進行一次大冒險" : "For example: Go on a big adventure";
break;
case 5:
str = WordUtil.isNewZh() ? "請輸入整蠱内容,例如:其他擅長的才藝" : "For example: other talents that you are good at";
break;
default:
str = WordUtil.getNewString(R.string.diamonds_every_time_requirement_of_hint);
}
context.setText(null);
context.setHint(str);
}
itemView.setTag(position);
}

View File

@ -1,6 +1,7 @@
package com.yunbao.live.dialog;
import android.app.Dialog;
import android.graphics.Color;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
@ -27,8 +28,10 @@ import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.live.R;
import com.yunbao.live.adapter.LivePrankRecyclerAdapter;
import com.yunbao.live.socket.SocketRyChatUtil;
import java.util.ArrayList;
import java.util.List;
@ -98,9 +101,9 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O
mCoinTextView.setOnClickListener(this);
mTurntableConfigImageView.setOnClickListener(this);
if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
mPrankBtn.setText("保存設置");
mPrankBtn.setText("發送圖標");
} else {
mPrankBtn.setText("Save Settings");
mPrankBtn.setText("send icon");
}
recyclerAdapter.setOnItemClickListener(new OnItemClickListener<String>() {
@Override
@ -141,7 +144,7 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O
}
}
});
mPrankBtn.setOnClickListener(view -> {
/* mPrankBtn.setOnClickListener(view -> {
if ((int) view.getTag() == 1) {
if (giftBeans != null && giftBeans.size() >= 20) {
@ -173,17 +176,52 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O
} else {
setPrankConfig();
}
});*/
ViewClicksAntiShake.clicksAntiShake(mPrankBtn, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
if (mPrankBtn.getTag() != null && Integer.parseInt(mPrankBtn.getTag().toString()) == 0) {
SocketRyChatUtil.sendPrankIcon();
} else {
}
}
});
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.btn_save), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
if ((int) mPrankBtn.getTag() == 0) {
setPrankConfig();
} else {
}
}
});
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.btn_clear), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
if ((int) mPrankBtn.getTag() == 0) {
clearPrankConfig();
} else {
giftBeans = new ArrayList<>();
recyclerAdapter.setList(giftBeans);
recyclerAdapter.notifyDataSetChanged();
}
}
});
mPrankBtn.setTag(0);
}
private void initTab() {
TabLayout.Tab turntable = mTabLayout.newTab();
TabLayout.Tab gift = mTabLayout.newTab();
if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
turntable.setText("轉盤整蠱");
gift.setText("禮物整蠱");
}else {
} else {
turntable.setText("Turntable prank");
gift.setText("Gift prank");
}
@ -205,9 +243,9 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O
recyclerAdapter.setViewType(LivePrankRecyclerAdapter.TYPE_TURNTABLE);
mPrankBtn.setBackgroundResource(R.drawable.bg_live_prank_turntable_save);
if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
mPrankBtn.setText("保存設置");
mPrankBtn.setText("發送圖標");
} else {
mPrankBtn.setText("Save Settings");
mPrankBtn.setText("send icon");
}
mPrankBtn.setTag(0);
@ -289,7 +327,7 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O
@Override
public void onError(String error) {
ToastUtil.show(WordUtil.isNewZh()?"抱歉!出錯了!":"i \\'m sorry! An error occurred");
ToastUtil.show(WordUtil.isNewZh() ? "抱歉!出錯了!" : "i \\'m sorry! An error occurred");
}
});
}
@ -324,6 +362,12 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O
return bean;
}
private void clearPrankConfig() {
bean = new PrankHttpTurntableBean();
setCoin(1000);
setDate(bean);
}
private void setPrankConfig() {
if (StringUtil.isEmpty(bean.getTurntable1(), bean.getTurntable2(), bean.getTurntable3(), bean.getTurntable4(), bean.getTurntable5(), bean.getTurntable6())) {

View File

@ -14,6 +14,7 @@ import com.yunbao.common.http.LiveHttpUtil;
import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
import com.yunbao.common.utils.AppManager;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R;
@ -798,4 +799,64 @@ public class SocketRyChatUtil {
});
}
public static void sendPrankIcon() {
IMLoginModel userInfo = IMLoginManager.get(AppManager.getInstance().getMainActivity()).getUserInfo();
final SocketSendBean msg = new SocketSendBean()
.param("_method_", Constants.SOCKET_SEND_MSG)
.param("action", 0)
.param("msgtype", 2)
.param("uid", String.valueOf(userInfo.getId()))
.param("uname", userInfo.getUserNicename())
.param("ugood", String.valueOf(userInfo.getId()))
.param("uname", userInfo.getLevel())
.param("tougood", "")
.param("touid", "")
.param("touname", "")
.param("liangname", "")
.param("vip_type", userInfo.getVip().getType())
.param("usertype", Constants.SOCKET_USER_TYPE_ANCHOR)
.param("prankIcon", "https://downs.yaoulive.com/Tricky/prankIcon.png")
.param("ct", "主播发送了转盘整蛊提示更新到最新版APP后即可查看。"
);
msg.create();
String targetId = "g" + userInfo.getId();
Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM;
TextMessage messageContent = TextMessage.obtain(msg.mResult.toString());
Message message = Message.obtain(targetId, conversationType, messageContent);
RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
@Override
public void onAttached(Message message) {
}
@Override
public void onSuccess(Message message) {
Log.i("tx", "发送成功");
if (SocketRyClient.mSocketHandler != null) {
SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
}
LiveNetManager.get(CommonAppContext.sInstance)
.addChatCount(LiveActivity.mStream, new com.yunbao.common.http.base.HttpCallback<HttpCallbackModel>() {
@Override
public void onSuccess(HttpCallbackModel data) {
}
@Override
public void onError(String error) {
}
});
}
@Override
public void onError(Message message, RongIMClient.ErrorCode errorCode) {
}
});
}
}

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="68dp" android:height="23dp">
<shape android:shape="rectangle">
<solid android:color="#D1D1D1" />
<corners android:radius="23dp" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="68dp" android:height="23dp">
<shape android:shape="rectangle">
<solid android:color="#F4B700" />
<corners android:radius="23dp" />
</shape>
</item>
</selector>

View File

@ -2,7 +2,7 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="68dp" android:height="23dp">
<shape android:shape="rectangle">
<solid android:color="#ff8873d8" />
<solid android:color="#F4B700" />
<corners android:topLeftRadius="12dp" android:topRightRadius="12dp" android:bottomLeftRadius="12dp" android:bottomRightRadius="12dp" />
</shape>
</item>

View File

@ -1,6 +1,7 @@
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="330dp"
android:background="#000002">
@ -12,8 +13,8 @@
android:layout_marginStart="16dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:tabIndicatorColor="#F6F7FB"
app:tabIndicator="@drawable/random_pk_shape_tab_indicator"
app:tabIndicatorColor="#F6F7FB"
app:tabIndicatorFullWidth="false"
app:tabMaxWidth="100dp"
app:tabMode="scrollable"
@ -28,20 +29,67 @@
android:layout_width="67dp"
android:layout_height="24dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:layout_marginEnd="15dp"
android:background="@drawable/bg_live_prank_turntable_save"
android:gravity="center"
android:textColor="#FFF"
android:textSize="10sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintEnd_toStartOf="@+id/help"
app:layout_constraintTop_toTopOf="parent" />
<include
layout="@layout/view_live_prank_turntable"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintBottom_toTopOf="@+id/button_layout"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/prank_tabLayout" />
<ImageView
android:id="@+id/help"
android:layout_width="18dp"
android:layout_height="18dp"
android:layout_marginTop="18dp"
android:layout_marginEnd="17dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@mipmap/ic_zl_rule" />
<LinearLayout
android:id="@+id/button_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<Button
android:id="@+id/btn_clear"
android:layout_width="106dp"
android:layout_height="38dp"
android:layout_marginEnd="26dp"
android:background="@drawable/bg_live_prank_btn_cancel"
android:textColor="#FFFFFF"
android:text="@string/live_prank_dialog_clear"
android:textAllCaps="false"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<Button
android:id="@+id/btn_save"
android:layout_width="106dp"
android:layout_height="38dp"
android:background="@drawable/bg_live_prank_btn_save"
android:text="@string/live_prank_dialog_save"
android:textColor="#FFFFFF"
android:textAllCaps="false"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -10,7 +10,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="轉盤一號位"
android:textColor="#FFF69F"
android:textColor="#FFFFFF"
android:textSize="10sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
@ -21,7 +21,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:text="抽取幾率40%"
android:textColor="#80CEF2"
android:textColor="#747474"
android:textSize="10sp"
app:layout_constraintStart_toEndOf="@+id/prank_turntable_title"
app:layout_constraintTop_toTopOf="parent" />

View File

@ -5,6 +5,15 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="@+id/turntable_layout"
android:layout_width="match_parent"
@ -24,7 +33,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:text="@string/prank_switch"
android:textColor="#A992FF"
android:textColor="#FFFFFF"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
@ -65,7 +74,7 @@
android:ellipsize="end"
android:singleLine="true"
android:text="@string/diamonds_every_time"
android:textColor="#A992FF"
android:textColor="#FFFFFF"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
@ -95,6 +104,29 @@
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp">
<TextView
android:id="@+id/gift_type_now_text"
android:layout_width="wrap_content"
android:text="@string/live_prank_dialog_gift_type_number"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:textColor="#FFFFFF"
android:textSize="14sp" />
<TextView
android:id="@+id/gift_type_now_switch"
android:layout_width="wrap_content"
android:text="@string/live_prank_dialog_gift_type_number"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:textColor="#FFFFFF"
android:textSize="14sp" />
</LinearLayout>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
@ -113,4 +145,8 @@
android:text="@string/prank_content_yet_hint"
android:textColor="#BFBFBF"
android:visibility="gone" />
</LinearLayout>
</ScrollView>
</LinearLayout>

View File

@ -117,4 +117,8 @@
<string name="live_fans_group_send_gift_tips">Fan group level Of Lv%s Can send this gift</string>
<string name="live_rad_pack_join_fans_group_tip">Join the fan group can be opened [Join]</string>
<string name="live_rad_pack_join_fans_group_click_tip">Join the fan group to open</string>
<string name="live_prank_dialog_save">Clear</string>
<string name="live_prank_dialog_clear">Save</string>
<string name="live_prank_dialog_gift_type_number">Highest combo</string>
<string name="live_prank_dialog_gift_type_achieved">Quantity achieved</string>
</resources>

View File

@ -115,4 +115,8 @@
<string name="live_fans_group_send_gift_tips">粉絲團等級達到 Lv%s 可送出該禮物</string>
<string name="live_rad_pack_join_fans_group_tip">加入粉絲團可開啟【加入】</string>
<string name="live_rad_pack_join_fans_group_click_tip">加入粉絲團可開啟</string>
<string name="live_prank_dialog_save">保存設置</string>
<string name="live_prank_dialog_clear">清除設置</string>
<string name="live_prank_dialog_gift_type_number">禮物數達成</string>
<string name="live_prank_dialog_gift_type_achieved">連擊數最高</string>
</resources>

View File

@ -1,5 +1,6 @@
package com.yunbao.main.views;
import android.app.Activity;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
@ -8,7 +9,10 @@ import android.widget.HorizontalScrollView;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import com.lxj.xpopup.XPopup;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.MobclickAgent;
import com.yunbao.common.activity.AbsActivity;
import com.yunbao.common.dialog.SkitCheckInWasSuccessfulPopup;
@ -17,6 +21,7 @@ import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.utils.RouteUtil;
import com.yunbao.live.dialog.LiveBuyGuardDialog;
import com.yunbao.live.dialog.LiveGuardDialog;
import com.yunbao.live.dialog.LivePrankDialogFragment;
import com.yunbao.main.R;
import org.greenrobot.eventbus.EventBus;
@ -57,15 +62,15 @@ public class MainHomeViewHolder extends AbsMainHomeParentViewHolder {
ImgLoader.display(mContext, "https://downs.yaoulive.com/gif_trophy.gif", img_trophy);
// img_trophy.setOnLongClickListener(new View.OnLongClickListener() {
// @Override
// public boolean onLongClick(View view) {
// new XPopup.Builder(mContext)
// .asCustom(new SkitCheckInWasSuccessfulPopup(mContext))
// .show();
// return true;
// }
// });
img_trophy.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
LivePrankDialogFragment fragment = new LivePrankDialogFragment();
fragment.setmLiveUid(String.valueOf(IMLoginManager.get(mContext).getUserInfo().getId()));
fragment.show(((AppCompatActivity) mContext).getSupportFragmentManager(), "LivePrankDialogFragment");
return true;
}
});
findViewById(R.id.tvPlay).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {