add:新增悬浮窗开关设置

This commit is contained in:
2022-09-05 17:46:43 +08:00
parent 5bcbe7cd9a
commit 02af777192
6 changed files with 94 additions and 2 deletions

View File

@@ -16,6 +16,7 @@ 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;
@@ -26,7 +27,8 @@ import java.util.List;
public class MsgSettActivity extends AbsActivity {
ImageView dt_switch,hdd_switch,lt_switch,xt_switch,kb_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
@@ -44,6 +46,7 @@ public class MsgSettActivity extends AbsActivity {
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
@@ -145,6 +148,26 @@ public class MsgSettActivity extends AbsActivity {
});
}
});
/* 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);
@@ -202,6 +225,12 @@ public class MsgSettActivity extends AbsActivity {
}
}
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(MsgSettActivity.this, data.getFollowList());
follow_list.setAdapter(topAdapter);
follow_list.setVisibility(View.VISIBLE);

View File

@@ -23,6 +23,46 @@
android:layout_marginTop="12dp"
android:background="@color/color_white">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="26dp"
android:gravity="center|left"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="私聊提示"
android:textColor="#ff1e1f20"
android:textSize="16sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="直播間內的側邊私聊浮標"
android:textColor="#ffc7c8c9"
android:textSize="12sp" />
</LinearLayout>
<ImageView
android:id="@+id/private_chat_switch"
android:layout_width="40.8dp"
android:layout_height="24.8dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_gravity="end|center_vertical"
android:layout_marginRight="25dp"
android:src="@mipmap/special_icon_off" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="73dp"
android:background="@color/color_white">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"