This commit is contained in:
18142669586
2022-08-26 13:00:45 +08:00
parent b3500b94c0
commit 036f27a415
29 changed files with 1262 additions and 80 deletions

View File

@@ -62,7 +62,7 @@ public class GoogleFragment extends Fragment {
private View view;
private static String mOrderid,mProductId,MoneyUsds;
private String mOrderid,mProductId,MoneyUsds;
private WebView rlWebview;
private String url;
@@ -84,9 +84,6 @@ public class GoogleFragment extends Fragment {
new Thread(new Runnable() {
public void run() {
try {
try {
adid = AdvertisingIdClient.getAdvertisingIdInfo(getActivity()).getId();
Log.e("vssss",adid);

View File

@@ -46,8 +46,10 @@ import com.tencent.imsdk.v2.V2TIMSDKConfig;
import com.tencent.imsdk.v2.V2TIMSDKListener;
import com.tencent.imsdk.v2.V2TIMUserFullInfo;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.CommonAppContext;
import com.yunbao.common.Constants;
import com.yunbao.common.activity.AbsActivity;
import com.yunbao.common.activity.WebViewActivity;
import com.yunbao.common.adapter.ViewPagerAdapter;
import com.yunbao.common.bean.AnchorRecommendModel;
import com.yunbao.common.bean.ChatRemarksBean;
@@ -133,6 +135,7 @@ import io.rong.imlib.RongIMClient;
import kotlin.Unit;
import static com.yunbao.common.CommonAppContext.isReady;
import static com.yunbao.live.activity.SystemMessageActivity.type;
import io.rong.imlib.model.Message;
import io.rong.push.PushManager;
@@ -267,6 +270,37 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
};
// private void getToken() {
// // 创建一个新线程
// new Thread() {
// @Override
// public void run() {
// try {
// // 从agconnect-service.json文件中读取appId
// String appId = "106936673";
//
// // 输入token标识"HCM"
// String tokenScope = "HCM";
// String token = HmsInstanceId.getInstance(MainActivity.this).getToken(appId, tokenScope);
// Log.i("hw", "get token: " + token);
//
// // 判断token是否为空
// if(!TextUtils.isEmpty(token)) {
// sendRegTokenToServer(token);
// }
// } catch (Exception e) {
// Log.e("hw","get token failed, " + e);
// }
// }
// }.start();
// }
// private void sendRegTokenToServer(String token) {
// PushManager.getInstance()
// .onReceiveToken(MainActivity.this, PushType.HUAWEI, token);
// Log.i("hw", "sending token to server. token:" + token);
// }
@Override
protected void main() {
ConversationIMListManager.get(this);
@@ -287,6 +321,40 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
// RTCLib 初始化
RCRTCConfig.Builder config = RCRTCConfig.Builder.create();
RCRTCEngine.getInstance().init(MainActivity.this, config.build());
//推送跳直播间
if(getIntent().getStringExtra("liveid")!=null){
LiveHttpUtil.getLiveInfo(getIntent().getStringExtra("liveid") + "", new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
LiveRoomCheckLivePresenter mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() {
@Override
public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) {
if (liveBean == null) {
return;
}
LiveAudienceActivity.forward(mContext, liveBean, liveType, liveTypeVal, "", 0, liveSdk);
}
});
mCheckLivePresenter.checkLive(liveBean);
} else {
ToastUtil.show("直播已结束");
}
}
});
}else if(getIntent().getStringExtra("type")!=null&&getIntent().getStringExtra("type").equals("2")){
//跳转消息列表
Bundle bundle = new Bundle();
bundle.putInt(PDLiveConversationListActivity.MESSAGENUMBER, messageNumber);
bundle.putInt(PDLiveConversationListActivity.NUMBERME, numberMe);
ConversationIMListManager.get(this).jumpConversationList(bundle);
}else if(getIntent().getStringExtra("type")!=null&&getIntent().getStringExtra("type").equals("8")){
WebViewActivity.forward(mContext, getIntent().getStringExtra("activityUrl"), true);
}
FirebaseMessaging.getInstance().getToken()
.addOnCompleteListener(new OnCompleteListener<String>() {
@Override
@@ -306,6 +374,10 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
// Toast.makeText(MainActivity.this, token, Toast.LENGTH_SHORT).show();
}
});
//华为推送
// getToken();
boolean showInvite = getIntent().getBooleanExtra(Constants.SHOW_INVITE, false);
mRootView = (ViewGroup) findViewById(R.id.rootView);
floatBanner = findViewById(R.id.float_banner_home);

View File

@@ -1,15 +1,33 @@
package com.yunbao.main.activity;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import com.yunbao.common.activity.AbsActivity;
import com.yunbao.common.bean.BaseModel;
import com.yunbao.common.bean.MsgSwitchDetailModel;
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.ToastUtil;
import com.yunbao.main.R;
import com.yunbao.main.adapter.MainHomeLivesClassAdapter;
import com.yunbao.main.adapter.MsgFollowAdapter;
import java.util.List;
public class MsgSettActivity extends AbsActivity {
ImageView dt_switch,hdd_switch,lt_switch,xt_switch,kb_switch;
RecyclerView follow_list;
@Override
protected int getLayoutId() {
return R.layout.activity_msg_sett;
@@ -19,5 +37,200 @@ public class MsgSettActivity extends AbsActivity {
protected void main() {
super.main();
setTitle("消息通知");
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);
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(mContext).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);
}
});
}
});
follow_list.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
follow_list.setHasFixedSize(true);
follow_list.setNestedScrollingEnabled(true);
getData();
}
public void getData(){
MainNetManager.get(mContext)
.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;
}
}
MsgFollowAdapter topAdapter = new MsgFollowAdapter(MsgSettActivity.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) {
}
});
}
boolean ret = false;
public boolean setMsgMasterSwitch(String status,String type){
ret =false;
MainNetManager.get(mContext).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;
}
}

View File

@@ -0,0 +1,124 @@
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.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) {
}
});
}
});
}
}
}

View File

@@ -8,7 +8,7 @@
<include layout="@layout/view_title" />
<ScrollView
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
@@ -47,7 +47,7 @@
</LinearLayout>
<ImageView
android:id="@+id/special_switch"
android:id="@+id/dt_switch"
android:layout_width="40.8dp"
android:layout_height="24.8dp"
android:layout_alignParentRight="true"
@@ -73,7 +73,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="動態消息"
android:text="互動通知"
android:textColor="#ff1e1f20"
android:textSize="16sp" />
@@ -81,12 +81,12 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="主播發佈新動態通知"
android:text="點讚、評論、鼓勵送禮"
android:textColor="#ffc7c8c9"
android:textSize="12sp" />
</LinearLayout>
<ImageView
<ImageView android:id="@+id/hdd_switch"
android:layout_width="40.8dp"
android:layout_height="24.8dp"
android:layout_alignParentRight="true"
@@ -112,7 +112,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="動態消息"
android:text="聊天通知"
android:textColor="#ff1e1f20"
android:textSize="16sp" />
@@ -120,12 +120,13 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="主播發佈新動態通知"
android:text="用戶聊天訊息"
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"
@@ -151,7 +152,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="動態消息"
android:text="系統通知"
android:textColor="#ff1e1f20"
android:textSize="16sp" />
@@ -159,12 +160,13 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="主播發佈新動態通知"
android:text="新活動、系統消息"
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"
@@ -192,7 +194,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="動態消息"
android:text="開播通知"
android:textColor="#ff1e1f20"
android:textSize="16sp" />
@@ -200,12 +202,13 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="主播發佈新動態通知"
android:text="開啟後獲得直播通知"
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"
@@ -216,6 +219,10 @@
</RelativeLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/follow_list"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
</ScrollView>
</androidx.core.widget.NestedScrollView>
</LinearLayout>

View File

@@ -0,0 +1,40 @@
<?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>