设置页面消息通知
This commit is contained in:
parent
617086cf40
commit
64fb7de187
@ -86,11 +86,11 @@
|
|||||||
<application
|
<application
|
||||||
android:name=".AppContext"
|
android:name=".AppContext"
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
|
android:enableOnBackInvokedCallback="true"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:largeHeap="true"
|
android:largeHeap="true"
|
||||||
android:preserveLegacyExternalStorage="true"
|
android:preserveLegacyExternalStorage="true"
|
||||||
android:enableOnBackInvokedCallback="true"
|
|
||||||
android:requestLegacyExternalStorage="true"
|
android:requestLegacyExternalStorage="true"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/AppTheme"
|
android:theme="@style/AppTheme"
|
||||||
@ -148,6 +148,9 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name=".activity.DiamondExchangeActivity"
|
android:name=".activity.DiamondExchangeActivity"
|
||||||
android:windowSoftInputMode="stateHidden|adjustResize" />
|
android:windowSoftInputMode="stateHidden|adjustResize" />
|
||||||
|
<activity
|
||||||
|
android:name=".activity.setting.OneMsgSettActivity"
|
||||||
|
android:windowSoftInputMode="stateHidden|adjustResize" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.ExchangeRecordActivity"
|
android:name=".activity.ExchangeRecordActivity"
|
||||||
android:windowSoftInputMode="stateHidden|adjustResize" />
|
android:windowSoftInputMode="stateHidden|adjustResize" />
|
||||||
@ -165,10 +168,10 @@
|
|||||||
android:windowSoftInputMode="stateHidden|adjustResize" />
|
android:windowSoftInputMode="stateHidden|adjustResize" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.MatchingActivity"
|
android:name=".activity.MatchingActivity"
|
||||||
android:windowSoftInputMode="stateHidden|adjustResize"/>
|
android:windowSoftInputMode="stateHidden|adjustResize" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.EndCallActivity"
|
android:name=".activity.EndCallActivity"
|
||||||
android:windowSoftInputMode="stateHidden|adjustResize"/>
|
android:windowSoftInputMode="stateHidden|adjustResize" />
|
||||||
|
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
|
@ -0,0 +1,268 @@
|
|||||||
|
package com.shayu.onetoone.activity.setting;
|
||||||
|
|
||||||
|
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.shayu.onetoone.R;
|
||||||
|
import com.shayu.onetoone.activity.AbsOTOActivity;
|
||||||
|
import com.yunbao.common.adapter.MsgFollowAdapter;
|
||||||
|
import com.yunbao.common.bean.MsgSwitchDetailModel;
|
||||||
|
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;
|
||||||
|
|
||||||
|
public class OneMsgSettActivity extends AbsOTOActivity {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void main(Bundle savedInstanceState) {
|
||||||
|
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);
|
||||||
|
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);
|
||||||
|
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")) {
|
||||||
|
dt_switch.setImageResource(R.mipmap.special_icon_off);
|
||||||
|
}
|
||||||
|
;
|
||||||
|
} else {
|
||||||
|
if (setMsgMasterSwitch("1", "1")) {
|
||||||
|
dt_switch.setImageResource(R.mipmap.special_icon_on);
|
||||||
|
}
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
hdd_switch.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@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")) {
|
||||||
|
hdd_switch.setImageResource(R.mipmap.special_icon_off);
|
||||||
|
}
|
||||||
|
;
|
||||||
|
} else {
|
||||||
|
if (setMsgMasterSwitch("1", "2")) {
|
||||||
|
hdd_switch.setImageResource(R.mipmap.special_icon_on);
|
||||||
|
}
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
lt_switch.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@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")) {
|
||||||
|
lt_switch.setImageResource(R.mipmap.special_icon_off);
|
||||||
|
}
|
||||||
|
;
|
||||||
|
} else {
|
||||||
|
if (setMsgMasterSwitch("1", "3")) {
|
||||||
|
lt_switch.setImageResource(R.mipmap.special_icon_on);
|
||||||
|
}
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
xt_switch.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@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")) {
|
||||||
|
xt_switch.setImageResource(R.mipmap.special_icon_off);
|
||||||
|
}
|
||||||
|
;
|
||||||
|
} else {
|
||||||
|
if (setMsgMasterSwitch("1", "4")) {
|
||||||
|
xt_switch.setImageResource(R.mipmap.special_icon_on);
|
||||||
|
}
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
follow_list.setVisibility(View.GONE);
|
||||||
|
kb_switch.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
int is = 1;
|
||||||
|
//打开的
|
||||||
|
if (kb_switch.getDrawable().getCurrent().getConstantState().equals(getResources().getDrawable(R.mipmap.special_icon_on).getConstantState())) {
|
||||||
|
is = 2;
|
||||||
|
} else {
|
||||||
|
is = 1;
|
||||||
|
}
|
||||||
|
MainNetManager.get(OneMsgSettActivity.this).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())) {
|
||||||
|
kb_switch.setImageResource(R.mipmap.special_icon_off);
|
||||||
|
follow_list.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
getData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(String error) {
|
||||||
|
Log.e("ds", kb_switch.getDrawable().getCurrent().getConstantState() + "11" + error);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
/* privateChatMessageSwitch.setOnClickListener(view -> {
|
||||||
|
if (privateChatMessageSwitch.getDrawable().getCurrent().getConstantState().equals(getResources().getDrawable(R.mipmap.special_icon_on).getConstantState())){
|
||||||
|
if(setMsgMasterSwitch("2","5")){
|
||||||
|
privateChatMessageSwitch.setImageResource(R.mipmap.special_icon_off);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if(setMsgMasterSwitch("1","5")){
|
||||||
|
privateChatMessageSwitch.setImageResource(R.mipmap.special_icon_on);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});*/
|
||||||
|
privateChatMessageSwitch.setOnClickListener(view -> {
|
||||||
|
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 {
|
||||||
|
privateChatMessageSwitch.setImageResource(R.mipmap.special_icon_on);
|
||||||
|
SpUtil.getInstance().setBooleanValue(SWITCH_PRIVATE_CHAT_MSG, true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
follow_list.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
|
||||||
|
follow_list.setHasFixedSize(true);
|
||||||
|
follow_list.setNestedScrollingEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getData() {
|
||||||
|
MainNetManager.get(this)
|
||||||
|
.getMsgSwitchDetail(new HttpCallback<MsgSwitchDetailModel>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(MsgSwitchDetailModel data) {
|
||||||
|
|
||||||
|
if (data.getDynamic_msg_switch().equals("2")) {
|
||||||
|
dt_switch.setImageResource(R.mipmap.special_icon_off);
|
||||||
|
} else {
|
||||||
|
dt_switch.setImageResource(R.mipmap.special_icon_on);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.getInteraction_show_msg_switch().equals("2")) {
|
||||||
|
hdd_switch.setImageResource(R.mipmap.special_icon_off);
|
||||||
|
} else {
|
||||||
|
hdd_switch.setImageResource(R.mipmap.special_icon_on);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.getChat_msg_switch().equals("2")) {
|
||||||
|
lt_switch.setImageResource(R.mipmap.special_icon_off);
|
||||||
|
} else {
|
||||||
|
lt_switch.setImageResource(R.mipmap.special_icon_on);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.getChat_msg_switch().equals("2")) {
|
||||||
|
lt_switch.setImageResource(R.mipmap.special_icon_off);
|
||||||
|
} else {
|
||||||
|
lt_switch.setImageResource(R.mipmap.special_icon_on);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.getSystem_msg_switch().equals("2")) {
|
||||||
|
xt_switch.setImageResource(R.mipmap.special_icon_off);
|
||||||
|
} else {
|
||||||
|
xt_switch.setImageResource(R.mipmap.special_icon_on);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.getSystem_msg_switch().equals("2")) {
|
||||||
|
xt_switch.setImageResource(R.mipmap.special_icon_off);
|
||||||
|
} 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")) {
|
||||||
|
kb_switch.setImageResource(R.mipmap.special_icon_on);
|
||||||
|
follow_list.setVisibility(View.VISIBLE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if (SpUtil.getInstance().getBooleanValue(SWITCH_PRIVATE_CHAT_MSG)) {
|
||||||
|
privateChatMessageSwitch.setImageResource(R.mipmap.special_icon_on);
|
||||||
|
} else {
|
||||||
|
privateChatMessageSwitch.setImageResource(R.mipmap.special_icon_off);
|
||||||
|
}
|
||||||
|
|
||||||
|
MsgFollowAdapter topAdapter = new MsgFollowAdapter(OneMsgSettActivity.this, data.getFollowList());
|
||||||
|
follow_list.setAdapter(topAdapter);
|
||||||
|
follow_list.setVisibility(View.VISIBLE);
|
||||||
|
kb_switch.setImageResource(R.mipmap.special_icon_on);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(String error) {
|
||||||
|
ToastUtil.show(R.string.net_error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean ret = false;
|
||||||
|
|
||||||
|
public boolean setMsgMasterSwitch(String status, String type) {
|
||||||
|
ret = false;
|
||||||
|
MainNetManager.get(this).setMsgMasterSwitch(status, type, new HttpCallback<ResponseData>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(ResponseData data) {
|
||||||
|
|
||||||
|
if (data.getCode() == 200) {
|
||||||
|
ret = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(String error) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
@ -60,7 +60,7 @@ public class SettingActivity extends AbsActivity {
|
|||||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.blacklist), new ViewClicksAntiShake.ViewClicksCallBack() {
|
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.blacklist), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||||
@Override
|
@Override
|
||||||
public void onViewClicks() {
|
public void onViewClicks() {
|
||||||
FollowActivity.forward(mContext,CommonAppConfig.getInstance().getUserBean().getId(),1);
|
FollowActivity.forward(mContext, CommonAppConfig.getInstance().getUserBean().getId(), 1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// 达人认证
|
// 达人认证
|
||||||
@ -77,6 +77,12 @@ public class SettingActivity extends AbsActivity {
|
|||||||
logout();
|
logout();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.layout_alerts), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||||
|
@Override
|
||||||
|
public void onViewClicks() {
|
||||||
|
startActivity(new Intent(SettingActivity.this, OneMsgSettActivity.class));
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -101,7 +101,7 @@
|
|||||||
android:id="@+id/blacklist"
|
android:id="@+id/blacklist"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:paddingTop="15.33dp"
|
android:paddingTop="15.33dp"
|
||||||
android:paddingBottom="15dp">
|
android:paddingBottom="15dp">
|
||||||
|
|
||||||
@ -127,17 +127,19 @@
|
|||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
android:id="@+id/layout_alerts"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:paddingTop="15.33dp"
|
android:paddingTop="15.33dp"
|
||||||
|
android:visibility="gone"
|
||||||
android:paddingBottom="15dp">
|
android:paddingBottom="15dp">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="25dp"
|
android:layout_marginStart="25dp"
|
||||||
android:text="消息通知"
|
android:text="@string/alerts"
|
||||||
android:textColor="#1E1F20"
|
android:textColor="#1E1F20"
|
||||||
android:textSize="16sp" />
|
android:textSize="16sp" />
|
||||||
|
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
package com.yunbao.main.adapter;
|
package com.yunbao.common.adapter;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@ -13,9 +11,8 @@ import androidx.annotation.NonNull;
|
|||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.makeramen.roundedimageview.RoundedImageView;
|
import com.makeramen.roundedimageview.RoundedImageView;
|
||||||
import com.yunbao.common.bean.MsgSwitchDetailModel;
|
import com.yunbao.common.R;
|
||||||
import com.yunbao.common.bean.MsgSwitchFollowlModel;
|
import com.yunbao.common.bean.MsgSwitchFollowlModel;
|
||||||
import com.yunbao.common.bean.UserItemBean;
|
|
||||||
import com.yunbao.common.glide.ImgLoader;
|
import com.yunbao.common.glide.ImgLoader;
|
||||||
import com.yunbao.common.http.ResponseData;
|
import com.yunbao.common.http.ResponseData;
|
||||||
import com.yunbao.common.http.base.HttpCallback;
|
import com.yunbao.common.http.base.HttpCallback;
|
||||||
@ -23,7 +20,6 @@ import com.yunbao.common.http.main.MainNetManager;
|
|||||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||||
import com.yunbao.common.utils.ToastUtil;
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||||
import com.yunbao.main.R;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -15,7 +15,7 @@ import com.yunbao.common.http.main.MainNetManager;
|
|||||||
import com.yunbao.common.utils.SpUtil;
|
import com.yunbao.common.utils.SpUtil;
|
||||||
import com.yunbao.common.utils.ToastUtil;
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
import com.yunbao.main.R;
|
import com.yunbao.main.R;
|
||||||
import com.yunbao.main.adapter.MsgFollowAdapter;
|
import com.yunbao.common.adapter.MsgFollowAdapter;
|
||||||
|
|
||||||
public class MsgSettActivity extends AbsActivity {
|
public class MsgSettActivity extends AbsActivity {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user