diff --git a/OneToOne/src/main/AndroidManifest.xml b/OneToOne/src/main/AndroidManifest.xml index 94632b42a..84e2ac6ad 100644 --- a/OneToOne/src/main/AndroidManifest.xml +++ b/OneToOne/src/main/AndroidManifest.xml @@ -86,11 +86,11 @@ + @@ -165,10 +168,10 @@ android:windowSoftInputMode="stateHidden|adjustResize" /> + android:windowSoftInputMode="stateHidden|adjustResize" /> + android:windowSoftInputMode="stateHidden|adjustResize" /> () { + @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() { + @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() { + @Override + public void onSuccess(ResponseData data) { + + if (data.getCode() == 200) { + ret = true; + } + + } + + @Override + public void onError(String error) { + + } + }); + + return true; + } +} diff --git a/OneToOne/src/main/java/com/shayu/onetoone/activity/setting/SettingActivity.java b/OneToOne/src/main/java/com/shayu/onetoone/activity/setting/SettingActivity.java index 4907df181..7b85cbc02 100644 --- a/OneToOne/src/main/java/com/shayu/onetoone/activity/setting/SettingActivity.java +++ b/OneToOne/src/main/java/com/shayu/onetoone/activity/setting/SettingActivity.java @@ -60,7 +60,7 @@ public class SettingActivity extends AbsActivity { ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.blacklist), new ViewClicksAntiShake.ViewClicksCallBack() { @Override 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(); } }); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.layout_alerts), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + startActivity(new Intent(SettingActivity.this, OneMsgSettActivity.class)); + } + }); } /** diff --git a/OneToOne/src/main/res/layout/activity_setting.xml b/OneToOne/src/main/res/layout/activity_setting.xml index c55b6af52..5a567606d 100644 --- a/OneToOne/src/main/res/layout/activity_setting.xml +++ b/OneToOne/src/main/res/layout/activity_setting.xml @@ -101,7 +101,7 @@ android:id="@+id/blacklist" android:layout_width="match_parent" android:layout_height="wrap_content" - android:gravity="center_vertical" + android:gravity="center_vertical" android:paddingTop="15.33dp" android:paddingBottom="15dp"> @@ -127,17 +127,19 @@ diff --git a/main/src/main/java/com/yunbao/main/adapter/MsgFollowAdapter.java b/common/src/main/java/com/yunbao/common/adapter/MsgFollowAdapter.java similarity index 95% rename from main/src/main/java/com/yunbao/main/adapter/MsgFollowAdapter.java rename to common/src/main/java/com/yunbao/common/adapter/MsgFollowAdapter.java index 74bbb5719..335f8a6f5 100644 --- a/main/src/main/java/com/yunbao/main/adapter/MsgFollowAdapter.java +++ b/common/src/main/java/com/yunbao/common/adapter/MsgFollowAdapter.java @@ -1,8 +1,6 @@ -package com.yunbao.main.adapter; +package com.yunbao.common.adapter; import android.app.Activity; -import android.content.Context; -import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -13,9 +11,8 @@ import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; 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.UserItemBean; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.ResponseData; 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.utils.ToastUtil; import com.yunbao.common.views.weight.ViewClicksAntiShake; -import com.yunbao.main.R; import java.util.List; diff --git a/main/src/main/res/layout/activity_msg_sett.xml b/common/src/main/res/layout/activity_msg_sett.xml similarity index 100% rename from main/src/main/res/layout/activity_msg_sett.xml rename to common/src/main/res/layout/activity_msg_sett.xml diff --git a/main/src/main/res/layout/item_msg_follow.xml b/common/src/main/res/layout/item_msg_follow.xml similarity index 100% rename from main/src/main/res/layout/item_msg_follow.xml rename to common/src/main/res/layout/item_msg_follow.xml diff --git a/main/src/main/java/com/yunbao/main/activity/MsgSettActivity.java b/main/src/main/java/com/yunbao/main/activity/MsgSettActivity.java index 805905987..14e919eb2 100644 --- a/main/src/main/java/com/yunbao/main/activity/MsgSettActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MsgSettActivity.java @@ -15,7 +15,7 @@ import com.yunbao.common.http.main.MainNetManager; import com.yunbao.common.utils.SpUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.main.R; -import com.yunbao.main.adapter.MsgFollowAdapter; +import com.yunbao.common.adapter.MsgFollowAdapter; public class MsgSettActivity extends AbsActivity {