add:新增悬浮窗开关设置

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

View File

@ -32,9 +32,11 @@ import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.manager.imrongcloud.MessageIMManager;
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
import com.yunbao.common.utils.L;
import com.yunbao.common.utils.SpUtil;
import com.yunbao.live.socket.SocketRyClient;
import com.yunbao.live.utils.LiveImDeletUtil;
import com.yunbao.live.views.PortraitLiveManager;
import com.yunbao.main.activity.MsgSettActivity;
import java.io.File;
import java.io.IOException;
@ -226,7 +228,16 @@ public class AppContext extends CommonAppContext {
}
}
});
configSPApp();
}
/**
* 配置SharedPreferences默认值
*/
private void configSPApp(){
if(!SpUtil.getInstance().isExists(MsgSettActivity.SWITCH_PRIVATE_CHAT_MSG)){
SpUtil.getInstance().setBooleanValue(MsgSettActivity.SWITCH_PRIVATE_CHAT_MSG,true);
}
}

View File

@ -70,6 +70,13 @@ public class SpUtil {
return mSharedPreferences.getString(key, "");
}
/**
* 判断一个值是否存在
*/
public boolean isExists(String key){
return mSharedPreferences.contains(key);
}
/**
* 保存多个字符串
*/

View File

@ -130,7 +130,7 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl
super.onWindowFocusChanged(hasFocus);
if(hasFocus&&isDialogWindow){
ViewGroup.LayoutParams params = mRootLayout.getLayoutParams();
params.height= DpUtil.dp2px(400);
params.height= DpUtil.dp2px(500);
mRootLayout.setLayoutParams(params);
}
}

View File

@ -69,6 +69,7 @@ import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.ScreenDimenUtil;
import com.yunbao.common.utils.SpUtil;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.utils.formatBigNum;
@ -655,6 +656,10 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
ViewClicksAntiShake.clicksAntiShake(msg, this::openChatWindow);
ViewClicksAntiShake.clicksAntiShake(msg2, this::openChatWindow);
if(!SpUtil.getInstance().getBooleanValue("private_chat_message_switch")){
msgLayout.setVisibility(View.GONE);
}
mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {

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"