From 7ca1ee2aad980b43c0a9f1c7b643e3da5c526b99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=81=E7=9A=AE?= <14840170+lao-pi123@user.noreply.gitee.com> Date: Thu, 10 Oct 2024 09:42:54 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E5=A2=9E=E5=8A=A0=E7=9B=B4=E6=92=AD?= =?UTF-8?q?=E9=97=B4=E6=9C=BA=E5=99=A8=E4=BA=BA=E8=AF=AD=E8=A8=80=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE--=E5=90=8C=E6=AD=A5=E6=BD=98=E5=A4=9A=E6=8B=89=202?= =?UTF-8?q?=E3=80=81=E5=AE=98=E6=96=B9=E9=80=9A=E7=9F=A5=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E5=9B=BE=E6=A0=87=E5=90=8C=E6=AD=A5iOS=203=E3=80=81=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E6=B6=88=E6=81=AF=E6=9F=A5=E7=9C=8B=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E6=98=BE=E7=A4=BA=EF=BC=88=E4=B8=BE=E6=8A=A5?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E7=9A=84=E6=83=85=E5=86=B5=E4=B8=8B=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yunbao/common/bean/LiveAiRobotBean.java | 15 ++++ .../com/yunbao/common/utils/DialogUitl.java | 9 ++ .../views/LiveRobotSettingCustomPopup.java | 85 ++++++++++++++++++- .../res/layout/dialog_live_robot_setting.xml | 64 +++++++++++++- common/src/main/res/values-zh/strings.xml | 4 +- common/src/main/res/values/strings.xml | 4 + .../src/main/res/values/strings.xml | 3 + .../live/adapter/SystemMessageNewAdapter.java | 4 +- live/src/main/res/layout/item_sys_msg.xml | 6 +- live/src/main/res/values-zh/strings.xml | 2 +- live/src/main/res/values/strings.xml | 2 +- 11 files changed, 187 insertions(+), 11 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/bean/LiveAiRobotBean.java b/common/src/main/java/com/yunbao/common/bean/LiveAiRobotBean.java index 44e8b9f95..1c6d81445 100644 --- a/common/src/main/java/com/yunbao/common/bean/LiveAiRobotBean.java +++ b/common/src/main/java/com/yunbao/common/bean/LiveAiRobotBean.java @@ -19,6 +19,21 @@ public class LiveAiRobotBean extends BaseModel { @SerializedName("ai_gz") private int autoRequestFollowNumber;//自动求关注已配置数量 + @SerializedName("ai_langue")//0中文1英文 + private int aiLangue; + + public int getAiLangue() { + return aiLangue; + } + + public Boolean isLangueCn(){ + return aiLangue==0; + } + + public void setAiLangue(int aiLangue) { + this.aiLangue = aiLangue; + } + public LiveAiRobotBean() { } diff --git a/common/src/main/java/com/yunbao/common/utils/DialogUitl.java b/common/src/main/java/com/yunbao/common/utils/DialogUitl.java index 72a88646a..62318f184 100644 --- a/common/src/main/java/com/yunbao/common/utils/DialogUitl.java +++ b/common/src/main/java/com/yunbao/common/utils/DialogUitl.java @@ -168,6 +168,15 @@ public class DialogUitl { showSimpleDialog(context, content, false, callback); } + public static void showSimpleDialogString(Context context, String content,String confirmString, SimpleCallback callback) { + if (context instanceof Activity) { + if (((Activity) context).isDestroyed() || ((Activity) context).isFinishing()) { + return; + } + } + new Builder(context).setTitle(null).setContent(content).setCancelable(false).setClickCallback(callback).setConfirmString(confirmString).build().show(); + } + public static void showSimpleDialog(Context context, String content, boolean cancelable, SimpleCallback callback) { showSimpleDialog(context, null, content, cancelable, callback); } diff --git a/common/src/main/java/com/yunbao/common/views/LiveRobotSettingCustomPopup.java b/common/src/main/java/com/yunbao/common/views/LiveRobotSettingCustomPopup.java index d777f6ca0..ce7fde261 100644 --- a/common/src/main/java/com/yunbao/common/views/LiveRobotSettingCustomPopup.java +++ b/common/src/main/java/com/yunbao/common/views/LiveRobotSettingCustomPopup.java @@ -1,5 +1,6 @@ package com.yunbao.common.views; +import android.app.Dialog; import android.content.Context; import android.view.KeyEvent; import android.view.View; @@ -7,6 +8,8 @@ import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethodManager; import android.widget.EditText; import android.widget.ImageView; +import android.widget.RadioButton; +import android.widget.RadioGroup; import android.widget.TextView; import androidx.annotation.NonNull; @@ -23,6 +26,11 @@ import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; +import com.yunbao.common.utils.MicStatusManager; +import com.yunbao.common.manager.MicUserManager; +import com.yunbao.common.manager.MicedUserManager; +import com.yunbao.common.manager.RandomPkManager; +import com.yunbao.common.utils.DialogUitl; public class LiveRobotSettingCustomPopup extends BottomPopupView implements View.OnClickListener { private static String TAG = "AI机器人"; @@ -32,6 +40,11 @@ public class LiveRobotSettingCustomPopup extends BottomPopupView implements View private String time = ""; private ImageView robotState; + private ImageView languageZhImgView; + private AppCompatTextView languageZhTv; + private ImageView languageEnImgView; + private AppCompatTextView languageEnTv; + private int lastLanguage = 1; private int robotStateInt = 1; public int getRobotStateInt() { @@ -60,6 +73,10 @@ public class LiveRobotSettingCustomPopup extends BottomPopupView implements View robotNameSetting = findViewById(R.id.robot_name_setting); robotNameText = findViewById(R.id.robot_name_text); robotState = findViewById(R.id.robot_state); + languageZhImgView = findViewById(R.id.languageZhImgView); + languageZhTv = findViewById(R.id.languageZhTv); + languageEnImgView = findViewById(R.id.languageEnImgView); + languageEnTv = findViewById(R.id.languageEnTv); automaticGreetingNumber = findViewById(R.id.automatic_greeting_number); automaticMessageNumber = findViewById(R.id.automatic_message_number); findViewById(R.id.automatic_message_sending).setOnClickListener(this); @@ -91,8 +108,65 @@ public class LiveRobotSettingCustomPopup extends BottomPopupView implements View return false; } }); + + languageZhImgView.setOnClickListener(v -> { + if (lastLanguage == 0) { + return; + } + ShowChangeLanguagePopup(0); + }); + languageZhTv.setOnClickListener(v -> { + if (lastLanguage == 0) { + return; + } + ShowChangeLanguagePopup(0); + }); + + languageEnImgView.setOnClickListener(v -> { + if (lastLanguage == 1) { + return; + } + ShowChangeLanguagePopup(1); + }); + languageEnTv.setOnClickListener(v -> { + if (lastLanguage == 1) { + return; + } + ShowChangeLanguagePopup(1); + }); } + + private void ShowChangeLanguagePopup(int i) { + DialogUitl.showSimpleDialogString(getContext(), getContext().getString(R.string.chang_langue_tips), getContext().getString(R.string.aristocrat_determine) ,new DialogUitl.SimpleCallback() { + @Override + public void onConfirmClick(Dialog dialog, String content) { + LiveNetManager.get(getContext()) + .setAiRobotDate("ai_langue", i+"", new HttpCallback() { + @Override + public void onSuccess(HttpCallbackModel data) { + if (i==0) { + languageZhImgView.setSelected(true); + languageEnImgView.setSelected(false); + lastLanguage = 0; + } else { + languageZhImgView.setSelected(false); + languageEnImgView.setSelected(true); + lastLanguage = 1; + } + } + + @Override + public void onError(String error) { + ToastUtil.show(error); + } + }); + } + }); + } + + + @Override public void onClick(View v) { int viewID = v.getId(); @@ -243,6 +317,15 @@ public class LiveRobotSettingCustomPopup extends BottomPopupView implements View robotNameText.setText(data.getName()); automaticGreetingNumber.setText(String.valueOf(data.getAutoSeyHiNumber())); automaticMessageNumber.setText(String.valueOf(data.getAutoRequestFollowNumber())); + if (data.isLangueCn()) { + languageZhImgView.setSelected(true); + languageEnImgView.setSelected(false); + lastLanguage = 0; + } else { + languageZhImgView.setSelected(false); + languageEnImgView.setSelected(true); + lastLanguage = 1; + } time = String.valueOf(data.getTime()); robotStateInt = data.getStatus(); if (data.getStatus() == 1) { @@ -252,7 +335,7 @@ public class LiveRobotSettingCustomPopup extends BottomPopupView implements View @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"); } }); diff --git a/common/src/main/res/layout/dialog_live_robot_setting.xml b/common/src/main/res/layout/dialog_live_robot_setting.xml index 0cedd53b9..4cdfe8c34 100644 --- a/common/src/main/res/layout/dialog_live_robot_setting.xml +++ b/common/src/main/res/layout/dialog_live_robot_setting.xml @@ -45,11 +45,73 @@ app:srcCompat="@mipmap/special_icon_off" /> + + + + + + + + + + + diff --git a/common/src/main/res/values-zh/strings.xml b/common/src/main/res/values-zh/strings.xml index 8e78b1831..d3f8413f9 100644 --- a/common/src/main/res/values-zh/strings.xml +++ b/common/src/main/res/values-zh/strings.xml @@ -1,5 +1,7 @@ - + 机器人语言设置 + 开通贵族 + 此設定後,所有機器人語言將會被翻譯覆蓋,請確認是否完成此操作 下拉可以重繪 正在重繪 正在加載 diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index 13dbede0f..1e4f4f1da 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -323,6 +323,10 @@ Sending gifts sent UnlockVIP + openVip + Language Settings + After this setting, all robot languages will be covered by translation, please confirm whether this operation is completed! + Pieces I sent one. diff --git a/lib_country_code/src/main/res/values/strings.xml b/lib_country_code/src/main/res/values/strings.xml index 497c062c2..572807954 100644 --- a/lib_country_code/src/main/res/values/strings.xml +++ b/lib_country_code/src/main/res/values/strings.xml @@ -1,4 +1,7 @@ Library Search + Language Settings + openVip + After this setting, all robot languages will be covered by translation, please confirm whether this operation is completed! diff --git a/live/src/main/java/com/yunbao/live/adapter/SystemMessageNewAdapter.java b/live/src/main/java/com/yunbao/live/adapter/SystemMessageNewAdapter.java index 99c147efd..2ea440117 100644 --- a/live/src/main/java/com/yunbao/live/adapter/SystemMessageNewAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/SystemMessageNewAdapter.java @@ -119,9 +119,7 @@ public class SystemMessageNewAdapter extends RefreshAdapter { } if (bean.getIs_report() == 1) { - if (bean.getIs_replenishment() != 1) { - layoutMore.setVisibility(View.VISIBLE); - } + layoutMore.setVisibility(View.VISIBLE); } itemLayout.setOnClickListener(new View.OnClickListener() { diff --git a/live/src/main/res/layout/item_sys_msg.xml b/live/src/main/res/layout/item_sys_msg.xml index 48a6f9b11..ee1f783ad 100644 --- a/live/src/main/res/layout/item_sys_msg.xml +++ b/live/src/main/res/layout/item_sys_msg.xml @@ -107,10 +107,10 @@ android:textSize="12sp" /> + android:src="@mipmap/icon_more" /> diff --git a/live/src/main/res/values-zh/strings.xml b/live/src/main/res/values-zh/strings.xml index 54b691bbc..6b75dcb02 100644 --- a/live/src/main/res/values-zh/strings.xml +++ b/live/src/main/res/values-zh/strings.xml @@ -161,6 +161,6 @@ 完成新人任務,可領多重專屬豪禮! 詳情 喜歡主播就關注ta吧~ - 點擊查看~ + 點擊查看 diff --git a/live/src/main/res/values/strings.xml b/live/src/main/res/values/strings.xml index 7fe87f626..d31cda1ff 100644 --- a/live/src/main/res/values/strings.xml +++ b/live/src/main/res/values/strings.xml @@ -164,5 +164,5 @@ Complete the newcomer tasks and receive multiple gifts Details If you like this anchor, please subscribe to him. - Click to view~ + Click to view \ No newline at end of file