设置页面消息通知
This commit is contained in:
@@ -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 {
|
||||
|
||||
|
||||
@@ -1,125 +0,0 @@
|
||||
package com.yunbao.main.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;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.makeramen.roundedimageview.RoundedImageView;
|
||||
import com.yunbao.common.bean.MsgSwitchDetailModel;
|
||||
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;
|
||||
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;
|
||||
|
||||
public class MsgFollowAdapter extends RecyclerView.Adapter<MsgFollowAdapter.Vh> {
|
||||
|
||||
private Activity mContext;
|
||||
private List<MsgSwitchFollowlModel> mList;
|
||||
private LayoutInflater mInflater;
|
||||
private OnItemClickListener<MsgSwitchFollowlModel> mOnItemClickListener;
|
||||
public MsgFollowAdapter(Activity context, List<MsgSwitchFollowlModel> list) {
|
||||
mContext = context;
|
||||
mList = list;
|
||||
mInflater = LayoutInflater.from(context);
|
||||
}
|
||||
|
||||
public void setOnItemClickListener(OnItemClickListener<MsgSwitchFollowlModel> onItemClickListener) {
|
||||
mOnItemClickListener = onItemClickListener;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Vh onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
|
||||
return new Vh(mInflater.inflate( R.layout.item_msg_follow, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull Vh holder, int position) {
|
||||
holder.setData(mList.get(position),position);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mList.size();
|
||||
}
|
||||
|
||||
class Vh extends RecyclerView.ViewHolder {
|
||||
|
||||
RoundedImageView avatar;
|
||||
TextView anchor_name;
|
||||
ImageView sb_switch;
|
||||
|
||||
public Vh(View itemView) {
|
||||
super(itemView);
|
||||
avatar = (RoundedImageView) itemView.findViewById(R.id.avatar);
|
||||
anchor_name = (TextView) itemView.findViewById(R.id.anchor_name);
|
||||
sb_switch = (ImageView) itemView.findViewById(R.id.sb_switch);
|
||||
ViewClicksAntiShake.clicksAntiShake(itemView, () -> {
|
||||
Object tag = itemView.getTag();
|
||||
if (tag != null) {
|
||||
MsgSwitchFollowlModel bean = (MsgSwitchFollowlModel) tag;
|
||||
if (mOnItemClickListener != null) {
|
||||
mOnItemClickListener.onItemClick(bean, 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
String is = "1";
|
||||
void setData(MsgSwitchFollowlModel bean,int position) {
|
||||
itemView.setTag(bean);
|
||||
ImgLoader.display(mContext, bean.getAvatar(), avatar);
|
||||
anchor_name.setText(bean.getUser_nicename());
|
||||
if(bean.getStatus().equals("2")) {
|
||||
is = "1";
|
||||
sb_switch.setImageResource(R.mipmap.special_icon_off);
|
||||
}else{
|
||||
is = "2";
|
||||
sb_switch.setImageResource(R.mipmap.special_icon_on);
|
||||
}
|
||||
sb_switch.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
MainNetManager.get(mContext).setBeginShowMsgSwitch(is + "", "", bean.getLiveuid(), new HttpCallback<ResponseData>() {
|
||||
@Override
|
||||
public void onSuccess(ResponseData data) {
|
||||
if(data.getCode() == 200){
|
||||
mList.get(position).setStatus(is);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show( R.string.net_error);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,268 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#F4F6F8"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<include layout="@layout/view_title" />
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="73dp"
|
||||
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="@string/chat_prompt"
|
||||
android:textColor="#ff1e1f20"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/broadcast_oom"
|
||||
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"
|
||||
android:layout_marginLeft="26dp"
|
||||
android:gravity="center|left"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/chat_prompt2"
|
||||
android:textColor="#ff1e1f20"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/chat_prompt3"
|
||||
android:textColor="#ffc7c8c9"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/dt_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"
|
||||
android:layout_marginLeft="26dp"
|
||||
android:gravity="center|left"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/chat_prompt4"
|
||||
android:textColor="#ff1e1f20"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/chat_prompt5"
|
||||
android:textColor="#ffc7c8c9"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView android:id="@+id/hdd_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"
|
||||
android:layout_marginLeft="26dp"
|
||||
android:gravity="center|left"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/chat_prompt6"
|
||||
android:textColor="#ff1e1f20"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/chat_prompt7"
|
||||
android:textColor="#ffc7c8c9"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/lt_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"
|
||||
android:layout_marginLeft="26dp"
|
||||
android:gravity="center|left"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/chat_prompt8"
|
||||
android:textColor="#ff1e1f20"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/chat_prompt9"
|
||||
android:textColor="#ffc7c8c9"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/xt_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: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="@string/chat_prompt10"
|
||||
android:textColor="#ff1e1f20"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/chat_prompt11"
|
||||
android:textColor="#ffc7c8c9"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/kb_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>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/follow_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
</LinearLayout>
|
||||
@@ -1,40 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="80dp"
|
||||
android:background="@color/color_white"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<com.makeramen.roundedimageview.RoundedImageView
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="26dp"
|
||||
android:scaleType="centerCrop"
|
||||
app:riv_border_color="#FFFFFF"
|
||||
app:riv_border_width="2dp"
|
||||
app:riv_oval="true" />
|
||||
|
||||
<TextView android:id="@+id/anchor_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/avatar"
|
||||
android:text="主播名稱名稱"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:textColor="#ff1e1f20"
|
||||
android:textSize="16sp"
|
||||
/>
|
||||
|
||||
|
||||
<ImageView android:id="@+id/sb_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>
|
||||
Reference in New Issue
Block a user