多语言切换

This commit is contained in:
18401019693 2023-04-18 13:45:21 +08:00
parent 098ef7aa36
commit d0e2278df7
7 changed files with 154 additions and 90 deletions

View File

@ -1125,5 +1125,16 @@ Limited ride And limited avatar frame</string>
<string name="unfollow"> Where is the host doing badly~\nBrother, are you sure you want to unfollow?</string>
<string name="unfollow_confrim">follow</string>
<string name="heat_add">Heat Add</string>
<string name="chat_prompt">Private chat prompt</string>
<string name="broadcast_oom">A private buoy on the side of the broadcast room</string>
<string name="chat_prompt2">Dynamic message</string>
<string name="chat_prompt3">The anchor posts a new dynamic notification</string>
<string name="chat_prompt4">Interactive notification</string>
<string name="chat_prompt5">Like, comment, and encourage gifts</string>
<string name="chat_prompt6">Chat notification</string>
<string name="chat_prompt7">User chat message</string>
<string name="chat_prompt8">System notification</string>
<string name="chat_prompt9">New activity, system message</string>
<string name="chat_prompt10">Broadcast notice</string>
<string name="chat_prompt11">Get live notification after opening</string>
</resources>

View File

@ -1119,4 +1119,17 @@
<string name="add_gift2">添加禮物、貴族、守護心願</string>
<string name="heat_add">热度加成</string>
<string name="must_hint">最多只能设置10条</string>
<string name="chat_prompt">私聊提示</string>
<string name="broadcast_oom">直播間內的側邊私聊浮標</string>
<string name="chat_prompt2">動態消息</string>
<string name="chat_prompt3">主播發佈新動態通知</string>
<string name="chat_prompt4">互動通知</string>
<string name="chat_prompt5">點讚、評論、鼓勵送禮</string>
<string name="chat_prompt6">聊天通知</string>
<string name="chat_prompt7">用戶聊天訊息</string>
<string name="chat_prompt8">系統通知</string>
<string name="chat_prompt9">新活動、系統消息</string>
<string name="chat_prompt10">開播通知</string>
<string name="chat_prompt11">開啟後獲得直播通知</string>
</resources>

View File

@ -1119,4 +1119,17 @@
<string name="add_gift2">添加禮物、貴族、守護心願</string>
<string name="heat_add">热度加成</string>
<string name="must_hint">最多只能设置10条</string>
<string name="chat_prompt">私聊提示</string>
<string name="broadcast_oom">直播間內的側邊私聊浮標</string>
<string name="chat_prompt2">動態消息</string>
<string name="chat_prompt3">主播發佈新動態通知</string>
<string name="chat_prompt4">互動通知</string>
<string name="chat_prompt5">點讚、評論、鼓勵送禮</string>
<string name="chat_prompt6">聊天通知</string>
<string name="chat_prompt7">用戶聊天訊息</string>
<string name="chat_prompt8">系統通知</string>
<string name="chat_prompt9">新活動、系統消息</string>
<string name="chat_prompt10">開播通知</string>
<string name="chat_prompt11">開啟後獲得直播通知</string>
</resources>

View File

@ -1119,4 +1119,17 @@
<string name="add_gift2">添加禮物、貴族、守護心願</string>
<string name="heat_add">热度加成</string>
<string name="must_hint">最多只能设置10条</string>
<string name="chat_prompt">私聊提示</string>
<string name="broadcast_oom">直播間內的側邊私聊浮標</string>
<string name="chat_prompt2">動態消息</string>
<string name="chat_prompt3">主播發佈新動態通知</string>
<string name="chat_prompt4">互動通知</string>
<string name="chat_prompt5">點讚、評論、鼓勵送禮</string>
<string name="chat_prompt6">聊天通知</string>
<string name="chat_prompt7">用戶聊天訊息</string>
<string name="chat_prompt8">系統通知</string>
<string name="chat_prompt9">新活動、系統消息</string>
<string name="chat_prompt10">開播通知</string>
<string name="chat_prompt11">開啟後獲得直播通知</string>
</resources>

View File

@ -1125,5 +1125,16 @@ Limited ride And limited avatar frame</string>
<string name="unfollow"> Where is the host doing badly~\nBrother, are you sure you want to unfollow?</string>
<string name="unfollow_confrim">follow</string>
<string name="heat_add">Heat Add</string>
<string name="chat_prompt">Private chat prompt</string>
<string name="broadcast_oom">A private buoy on the side of the broadcast room</string>
<string name="chat_prompt2">Dynamic message</string>
<string name="chat_prompt3">The anchor posts a new dynamic notification</string>
<string name="chat_prompt4">Interactive notification</string>
<string name="chat_prompt5">Like, comment, and encourage gifts</string>
<string name="chat_prompt6">Chat notification</string>
<string name="chat_prompt7">User chat message</string>
<string name="chat_prompt8">System notification</string>
<string name="chat_prompt9">New activity, system message</string>
<string name="chat_prompt10">Broadcast notice</string>
<string name="chat_prompt11">Get live notification after opening</string>
</resources>

View File

@ -1,36 +1,29 @@
package com.yunbao.main.activity;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.activity.AbsActivity;
import com.yunbao.common.bean.BaseModel;
import com.yunbao.common.bean.MsgSwitchDetailModel;
import com.yunbao.common.bean.SlideInfoModel;
import com.yunbao.common.http.ResponseData;
import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.main.MainNetManager;
import com.yunbao.common.utils.SpUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.live.views.LoadingView;
import com.yunbao.main.R;
import com.yunbao.main.adapter.MainHomeLivesClassAdapter;
import com.yunbao.main.adapter.MsgFollowAdapter;
import java.util.List;
public class MsgSettActivity extends AbsActivity {
ImageView dt_switch,hdd_switch,lt_switch,xt_switch,kb_switch,privateChatMessageSwitch;
public static final String SWITCH_PRIVATE_CHAT_MSG="private_chat_message_switch";
ImageView dt_switch, hdd_switch, lt_switch, xt_switch, kb_switch, privateChatMessageSwitch;
public static final String SWITCH_PRIVATE_CHAT_MSG = "private_chat_message_switch";
RecyclerView follow_list;
@Override
protected int getLayoutId() {
return R.layout.activity_msg_sett;
@ -39,27 +32,29 @@ public class MsgSettActivity extends AbsActivity {
@Override
protected void main() {
super.main();
setTitle("消息通知");
setTitle(getString(R.string.alerts));
follow_list = (RecyclerView) findViewById(R.id.follow_list);
dt_switch = (ImageView) findViewById(R.id.dt_switch);
hdd_switch= (ImageView) findViewById(R.id.hdd_switch);
hdd_switch = (ImageView) findViewById(R.id.hdd_switch);
lt_switch = (ImageView) findViewById(R.id.lt_switch);
xt_switch= (ImageView) findViewById(R.id.xt_switch);
kb_switch= (ImageView) findViewById(R.id.kb_switch);
privateChatMessageSwitch=findViewById(R.id.private_chat_switch);
xt_switch = (ImageView) findViewById(R.id.xt_switch);
kb_switch = (ImageView) findViewById(R.id.kb_switch);
privateChatMessageSwitch = findViewById(R.id.private_chat_switch);
getData();
dt_switch.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//打开的
if (dt_switch.getDrawable().getCurrent().getConstantState().equals(getResources().getDrawable(R.mipmap.special_icon_on).getConstantState())){
if(setMsgMasterSwitch("2","1")){
if (dt_switch.getDrawable().getCurrent().getConstantState().equals(getResources().getDrawable(R.mipmap.special_icon_on).getConstantState())) {
if (setMsgMasterSwitch("2", "1")) {
dt_switch.setImageResource(R.mipmap.special_icon_off);
};
}else{
if(setMsgMasterSwitch("1","1")){
}
;
} else {
if (setMsgMasterSwitch("1", "1")) {
dt_switch.setImageResource(R.mipmap.special_icon_on);
};
}
;
}
}
});
@ -68,14 +63,16 @@ public class MsgSettActivity extends AbsActivity {
@Override
public void onClick(View v) {
//打开的
if (hdd_switch.getDrawable().getCurrent().getConstantState().equals(getResources().getDrawable(R.mipmap.special_icon_on).getConstantState())){
if(setMsgMasterSwitch("2","2")){
if (hdd_switch.getDrawable().getCurrent().getConstantState().equals(getResources().getDrawable(R.mipmap.special_icon_on).getConstantState())) {
if (setMsgMasterSwitch("2", "2")) {
hdd_switch.setImageResource(R.mipmap.special_icon_off);
};
}else{
if(setMsgMasterSwitch("1","2")){
}
;
} else {
if (setMsgMasterSwitch("1", "2")) {
hdd_switch.setImageResource(R.mipmap.special_icon_on);
};
}
;
}
}
});
@ -84,14 +81,16 @@ public class MsgSettActivity extends AbsActivity {
@Override
public void onClick(View v) {
//打开的
if (lt_switch.getDrawable().getCurrent().getConstantState().equals(getResources().getDrawable(R.mipmap.special_icon_on).getConstantState())){
if(setMsgMasterSwitch("2","3")){
if (lt_switch.getDrawable().getCurrent().getConstantState().equals(getResources().getDrawable(R.mipmap.special_icon_on).getConstantState())) {
if (setMsgMasterSwitch("2", "3")) {
lt_switch.setImageResource(R.mipmap.special_icon_off);
};
}else{
if(setMsgMasterSwitch("1","3")){
}
;
} else {
if (setMsgMasterSwitch("1", "3")) {
lt_switch.setImageResource(R.mipmap.special_icon_on);
};
}
;
}
}
});
@ -100,14 +99,16 @@ public class MsgSettActivity extends AbsActivity {
@Override
public void onClick(View v) {
//打开的
if (xt_switch.getDrawable().getCurrent().getConstantState().equals(getResources().getDrawable(R.mipmap.special_icon_on).getConstantState())){
if(setMsgMasterSwitch("2","4")){
if (xt_switch.getDrawable().getCurrent().getConstantState().equals(getResources().getDrawable(R.mipmap.special_icon_on).getConstantState())) {
if (setMsgMasterSwitch("2", "4")) {
xt_switch.setImageResource(R.mipmap.special_icon_off);
};
}else{
if(setMsgMasterSwitch("1","4")){
}
;
} else {
if (setMsgMasterSwitch("1", "4")) {
xt_switch.setImageResource(R.mipmap.special_icon_on);
};
}
;
}
}
});
@ -116,24 +117,24 @@ public class MsgSettActivity extends AbsActivity {
kb_switch.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int is =1;
int is = 1;
//打开的
if (kb_switch.getDrawable().getCurrent().getConstantState().equals(getResources().getDrawable(R.mipmap.special_icon_on).getConstantState())){
if (kb_switch.getDrawable().getCurrent().getConstantState().equals(getResources().getDrawable(R.mipmap.special_icon_on).getConstantState())) {
is = 2;
}else{
} else {
is = 1;
}
MainNetManager.get(mContext).setBeginShowMsgSwitch(is+"", "1","", new HttpCallback<ResponseData>() {
MainNetManager.get(mContext).setBeginShowMsgSwitch(is + "", "1", "", new HttpCallback<ResponseData>() {
@Override
public void onSuccess(ResponseData data) {
Log.e("ds",data.getCode()+"");
if(data.getCode() == 200 ){
Log.e("ds",kb_switch.getDrawable().getCurrent().getConstantState()+"");
if (kb_switch.getDrawable().getCurrent().getConstantState().equals(getResources().getDrawable(R.mipmap.special_icon_on).getConstantState())){
Log.e("ds", data.getCode() + "");
if (data.getCode() == 200) {
Log.e("ds", kb_switch.getDrawable().getCurrent().getConstantState() + "");
if (kb_switch.getDrawable().getCurrent().getConstantState().equals(getResources().getDrawable(R.mipmap.special_icon_on).getConstantState())) {
kb_switch.setImageResource(R.mipmap.special_icon_off);
follow_list.setVisibility(View.GONE);
}else{
} else {
getData();
}
}
@ -142,7 +143,7 @@ public class MsgSettActivity extends AbsActivity {
@Override
public void onError(String error) {
Log.e("ds",kb_switch.getDrawable().getCurrent().getConstantState()+"11"+error);
Log.e("ds", kb_switch.getDrawable().getCurrent().getConstantState() + "11" + error);
}
});
@ -160,12 +161,12 @@ public class MsgSettActivity extends AbsActivity {
}
});*/
privateChatMessageSwitch.setOnClickListener(view -> {
if (privateChatMessageSwitch.getDrawable().getCurrent().getConstantState().equals(getResources().getDrawable(R.mipmap.special_icon_on).getConstantState())){
if (privateChatMessageSwitch.getDrawable().getCurrent().getConstantState().equals(getResources().getDrawable(R.mipmap.special_icon_on).getConstantState())) {
privateChatMessageSwitch.setImageResource(R.mipmap.special_icon_off);
SpUtil.getInstance().setBooleanValue(SWITCH_PRIVATE_CHAT_MSG,false);
}else{
SpUtil.getInstance().setBooleanValue(SWITCH_PRIVATE_CHAT_MSG, false);
} else {
privateChatMessageSwitch.setImageResource(R.mipmap.special_icon_on);
SpUtil.getInstance().setBooleanValue(SWITCH_PRIVATE_CHAT_MSG,true);
SpUtil.getInstance().setBooleanValue(SWITCH_PRIVATE_CHAT_MSG, true);
}
});
@ -175,59 +176,59 @@ public class MsgSettActivity extends AbsActivity {
}
public void getData(){
public void getData() {
MainNetManager.get(mContext)
.getMsgSwitchDetail(new HttpCallback<MsgSwitchDetailModel>() {
@Override
public void onSuccess(MsgSwitchDetailModel data) {
if(data.getDynamic_msg_switch().equals("2")){
if (data.getDynamic_msg_switch().equals("2")) {
dt_switch.setImageResource(R.mipmap.special_icon_off);
}else{
} else {
dt_switch.setImageResource(R.mipmap.special_icon_on);
}
if(data.getInteraction_show_msg_switch().equals("2")){
if (data.getInteraction_show_msg_switch().equals("2")) {
hdd_switch.setImageResource(R.mipmap.special_icon_off);
}else{
} else {
hdd_switch.setImageResource(R.mipmap.special_icon_on);
}
if(data.getChat_msg_switch().equals("2")){
if (data.getChat_msg_switch().equals("2")) {
lt_switch.setImageResource(R.mipmap.special_icon_off);
}else{
} else {
lt_switch.setImageResource(R.mipmap.special_icon_on);
}
if(data.getChat_msg_switch().equals("2")){
if (data.getChat_msg_switch().equals("2")) {
lt_switch.setImageResource(R.mipmap.special_icon_off);
}else{
} else {
lt_switch.setImageResource(R.mipmap.special_icon_on);
}
if(data.getSystem_msg_switch().equals("2")){
if (data.getSystem_msg_switch().equals("2")) {
xt_switch.setImageResource(R.mipmap.special_icon_off);
}else{
} else {
xt_switch.setImageResource(R.mipmap.special_icon_on);
}
if(data.getSystem_msg_switch().equals("2")){
if (data.getSystem_msg_switch().equals("2")) {
xt_switch.setImageResource(R.mipmap.special_icon_off);
}else{
} else {
xt_switch.setImageResource(R.mipmap.special_icon_on);
}
for(int i = 0; i < data.getFollowList().size();i++) {
if(!data.getFollowList().get(i).getStatus().equals("2")){
for (int i = 0; i < data.getFollowList().size(); i++) {
if (!data.getFollowList().get(i).getStatus().equals("2")) {
kb_switch.setImageResource(R.mipmap.special_icon_on);
follow_list.setVisibility(View.VISIBLE);
break;
}
}
if(SpUtil.getInstance().getBooleanValue(SWITCH_PRIVATE_CHAT_MSG)){
if (SpUtil.getInstance().getBooleanValue(SWITCH_PRIVATE_CHAT_MSG)) {
privateChatMessageSwitch.setImageResource(R.mipmap.special_icon_on);
}else{
} else {
privateChatMessageSwitch.setImageResource(R.mipmap.special_icon_off);
}
@ -243,14 +244,16 @@ public class MsgSettActivity extends AbsActivity {
}
});
}
boolean ret = false;
public boolean setMsgMasterSwitch(String status,String type){
ret =false;
public boolean setMsgMasterSwitch(String status, String type) {
ret = false;
MainNetManager.get(mContext).setMsgMasterSwitch(status, type, new HttpCallback<ResponseData>() {
@Override
public void onSuccess(ResponseData data) {
if(data.getCode() == 200 ){
if (data.getCode() == 200) {
ret = true;
}

View File

@ -33,7 +33,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="私聊提示"
android:text="@string/chat_prompt"
android:textColor="#ff1e1f20"
android:textSize="16sp" />
@ -41,7 +41,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="直播間內的側邊私聊浮標"
android:text="@string/broadcast_oom"
android:textColor="#ffc7c8c9"
android:textSize="12sp" />
</LinearLayout>
@ -73,7 +73,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="動態消息"
android:text="@string/chat_prompt2"
android:textColor="#ff1e1f20"
android:textSize="16sp" />
@ -81,7 +81,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="主播發佈新動態通知"
android:text="@string/chat_prompt3"
android:textColor="#ffc7c8c9"
android:textSize="12sp" />
</LinearLayout>
@ -113,7 +113,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="互動通知"
android:text="@string/chat_prompt4"
android:textColor="#ff1e1f20"
android:textSize="16sp" />
@ -121,7 +121,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="點讚、評論、鼓勵送禮"
android:text="@string/chat_prompt5"
android:textColor="#ffc7c8c9"
android:textSize="12sp" />
</LinearLayout>
@ -152,7 +152,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="聊天通知"
android:text="@string/chat_prompt6"
android:textColor="#ff1e1f20"
android:textSize="16sp" />
@ -160,7 +160,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="用戶聊天訊息"
android:text="@string/chat_prompt7"
android:textColor="#ffc7c8c9"
android:textSize="12sp" />
</LinearLayout>
@ -192,7 +192,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="系統通知"
android:text="@string/chat_prompt8"
android:textColor="#ff1e1f20"
android:textSize="16sp" />
@ -200,7 +200,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="新活動、系統消息"
android:text="@string/chat_prompt9"
android:textColor="#ffc7c8c9"
android:textSize="12sp" />
</LinearLayout>
@ -234,7 +234,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="開播通知"
android:text="@string/chat_prompt10"
android:textColor="#ff1e1f20"
android:textSize="16sp" />
@ -242,7 +242,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="開啟後獲得直播通知"
android:text="@string/chat_prompt11"
android:textColor="#ffc7c8c9"
android:textSize="12sp" />
</LinearLayout>