111
This commit is contained in:
parent
b3500b94c0
commit
036f27a415
92
app/agconnect-services.json
Normal file
92
app/agconnect-services.json
Normal file
@ -0,0 +1,92 @@
|
||||
{
|
||||
"agcgw":{
|
||||
"backurl":"connect-drcn.hispace.hicloud.com",
|
||||
"url":"connect-drcn.dbankcloud.cn",
|
||||
"websocketbackurl":"connect-ws-drcn.hispace.dbankcloud.com",
|
||||
"websocketurl":"connect-ws-drcn.hispace.dbankcloud.cn"
|
||||
},
|
||||
"agcgw_all":{
|
||||
"CN":"connect-drcn.dbankcloud.cn",
|
||||
"CN_back":"connect-drcn.hispace.hicloud.com",
|
||||
"DE":"connect-dre.dbankcloud.cn",
|
||||
"DE_back":"connect-dre.hispace.hicloud.com",
|
||||
"RU":"connect-drru.hispace.dbankcloud.ru",
|
||||
"RU_back":"connect-drru.hispace.dbankcloud.cn",
|
||||
"SG":"connect-dra.dbankcloud.cn",
|
||||
"SG_back":"connect-dra.hispace.hicloud.com"
|
||||
},
|
||||
"websocketgw_all":{
|
||||
"CN":"connect-ws-drcn.hispace.dbankcloud.cn",
|
||||
"CN_back":"connect-ws-drcn.hispace.dbankcloud.com",
|
||||
"DE":"connect-ws-dre.hispace.dbankcloud.cn",
|
||||
"DE_back":"connect-ws-dre.hispace.dbankcloud.com",
|
||||
"RU":"connect-ws-drru.hispace.dbankcloud.ru",
|
||||
"RU_back":"connect-ws-drru.hispace.dbankcloud.cn",
|
||||
"SG":"connect-ws-dra.hispace.dbankcloud.cn",
|
||||
"SG_back":"connect-ws-dra.hispace.dbankcloud.com"
|
||||
},
|
||||
"client":{
|
||||
"cp_id":"30086000612391734",
|
||||
"product_id":"99536292102564216",
|
||||
"client_id":"964994320723627840",
|
||||
"client_secret":"6D5FE29D85B967D3A66BDCD473641E4C7B5524F7F4935CA0EF4A842730C3402D",
|
||||
"project_id":"99536292102564216",
|
||||
"app_id":"106936673",
|
||||
"api_key":"DAEDADYGta/0O4ZSdrnug52NgC67/w/RIyTq9A8LyAY0+mp6g6XeJDbxugpluFPLAhaqjaMs5c0PLnRx14UzWbPPADgi1EqihbWLoA==",
|
||||
"package_name":"com.pdlive.shayu"
|
||||
},
|
||||
"oauth_client":{
|
||||
"client_id":"106936673",
|
||||
"client_type":1
|
||||
},
|
||||
"app_info":{
|
||||
"app_id":"106936673",
|
||||
"package_name":"com.pdlive.shayu"
|
||||
},
|
||||
"service":{
|
||||
"analytics":{
|
||||
"collector_url":"datacollector-drcn.dt.hicloud.com,datacollector-drcn.dt.dbankcloud.cn",
|
||||
"collector_url_ru":"datacollector-drru.dt.dbankcloud.ru,datacollector-drru.dt.hicloud.com",
|
||||
"collector_url_sg":"datacollector-dra.dt.hicloud.com,datacollector-dra.dt.dbankcloud.cn",
|
||||
"collector_url_de":"datacollector-dre.dt.hicloud.com,datacollector-dre.dt.dbankcloud.cn",
|
||||
"collector_url_cn":"datacollector-drcn.dt.hicloud.com,datacollector-drcn.dt.dbankcloud.cn",
|
||||
"resource_id":"p1",
|
||||
"channel_id":""
|
||||
},
|
||||
"search":{
|
||||
"url":"https://search-drcn.cloud.huawei.com"
|
||||
},
|
||||
"cloudstorage":{
|
||||
"storage_url_sg_back":"https://agc-storage-dra.cloud.huawei.asia",
|
||||
"storage_url_ru_back":"https://agc-storage-drru.cloud.huawei.ru",
|
||||
"storage_url_ru":"https://agc-storage-drru.cloud.huawei.ru",
|
||||
"storage_url_de_back":"https://agc-storage-dre.cloud.huawei.eu",
|
||||
"storage_url_de":"https://ops-dre.agcstorage.link",
|
||||
"storage_url":"https://agc-storage-drcn.platform.dbankcloud.cn",
|
||||
"storage_url_sg":"https://ops-dra.agcstorage.link",
|
||||
"storage_url_cn_back":"https://agc-storage-drcn.cloud.huawei.com.cn",
|
||||
"storage_url_cn":"https://agc-storage-drcn.platform.dbankcloud.cn"
|
||||
},
|
||||
"ml":{
|
||||
"mlservice_url":"ml-api-drcn.ai.dbankcloud.com,ml-api-drcn.ai.dbankcloud.cn"
|
||||
}
|
||||
},
|
||||
"region":"CN",
|
||||
"configuration_version":"3.0",
|
||||
"appInfos":[
|
||||
{
|
||||
"package_name":"com.pdlive.shayu",
|
||||
"client":{
|
||||
"app_id":"106936673"
|
||||
},
|
||||
"app_info":{
|
||||
"package_name":"com.pdlive.shayu",
|
||||
"app_id":"106936673"
|
||||
},
|
||||
"oauth_client":{
|
||||
"client_type":1,
|
||||
"client_id":"106936673"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -110,4 +110,6 @@ dependencies {
|
||||
//短视频
|
||||
api project(':video')
|
||||
annotationProcessor rootProject.ext.dependencies["arouter-compiler"]
|
||||
|
||||
|
||||
}
|
||||
|
@ -91,20 +91,20 @@
|
||||
android:theme="@style/AppTheme"
|
||||
android:usesCleartextTraffic="true"
|
||||
tools:replace="theme,label,icon,allowBackup">
|
||||
<service
|
||||
android:name="com.shayu.phonelive.utils.MyNotificationService">
|
||||
<intent-filter>
|
||||
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
<!-- <service-->
|
||||
<!-- android:name="io.rong.push.platform.google.RongFirebaseMessagingService"-->
|
||||
<!-- android:stopWithTask="false"-->
|
||||
<!-- android:exported="false">-->
|
||||
<!-- android:name="com.shayu.phonelive.utils.MyNotificationService">-->
|
||||
<!-- <intent-filter>-->
|
||||
<!-- <action android:name="com.google.firebase.MESSAGING_EVENT"/>-->
|
||||
<!-- <action android:name="com.google.firebase.MESSAGING_EVENT" />-->
|
||||
<!-- </intent-filter>-->
|
||||
<!-- </service>-->
|
||||
<service
|
||||
android:name="io.rong.push.platform.google.RongFirebaseMessagingService"
|
||||
android:stopWithTask="false"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
|
||||
</intent-filter>
|
||||
</service>
|
||||
<activity
|
||||
android:name="com.shayu.phonelive.activity.LauncherActivity"
|
||||
android:screenOrientation="portrait"
|
||||
@ -164,7 +164,29 @@
|
||||
<meta-data
|
||||
android:name="firebase_analytics_collection_enabled"
|
||||
android:value="false" />
|
||||
<receiver
|
||||
android:name="com.shayu.phonelive.utils.CustomMessageReceiver"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="io.rong.push.intent.MESSAGE_ARRIVED" />
|
||||
<action android:name="io.rong.push.intent.MESSAGE_CLICKED" />
|
||||
<action android:name="io.rong.push.intent.THIRD_PARTY_PUSH_STATE" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<service
|
||||
android:name="io.rong.push.platform.hms.HMSPushService"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="com.huawei.push.action.MESSAGING_EVENT" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
<meta-data
|
||||
android:name="com.huawei.hms.client.appid"
|
||||
android:value="106936673"/>
|
||||
<meta-data
|
||||
android:name="com.huawei.hms.client.cpid"
|
||||
android:value="30086000612391734"/>
|
||||
</application>
|
||||
|
||||
</manifest>
|
@ -120,11 +120,6 @@ public class AppContext extends CommonAppContext {
|
||||
}
|
||||
ARouter.init(this);
|
||||
|
||||
//谷歌推送
|
||||
PushConfig gconfig = new PushConfig.Builder()
|
||||
.enableFCM(true)
|
||||
.build();
|
||||
RongPushClient.setPushConfig(gconfig);
|
||||
|
||||
//初始化 邀请码库
|
||||
if (isMainProcess()) {
|
||||
@ -194,6 +189,7 @@ public class AppContext extends CommonAppContext {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//监听im消息
|
||||
V2TIMManager.getInstance().addSimpleMsgListener(new V2TIMSimpleMsgListener() {
|
||||
@Override
|
||||
|
@ -31,6 +31,8 @@ import com.tencent.rtmp.TXLivePlayer;
|
||||
import com.tencent.rtmp.ui.TXCloudVideoView;
|
||||
import com.tencent.ugc.TXUGCBase;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.activity.WebViewActivity;
|
||||
import com.yunbao.common.bean.AdBean;
|
||||
import com.yunbao.common.bean.ConfigBean;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
@ -40,6 +42,7 @@ import com.yunbao.common.event.DataUserInfoEvent;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.CommonHttpConsts;
|
||||
import com.yunbao.common.http.CommonHttpUtil;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.interfaces.CommonCallback;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
|
||||
@ -50,11 +53,17 @@ import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.common.utils.SpUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.live.activity.LiveAudienceActivity;
|
||||
import com.yunbao.live.bean.LiveBean;
|
||||
import com.yunbao.live.http.LiveHttpUtil;
|
||||
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
|
||||
import com.yunbao.live.views.LauncherAdViewHolder;
|
||||
import com.yunbao.main.activity.EntryActivity;
|
||||
import com.yunbao.main.activity.MainActivity;
|
||||
import com.yunbao.main.activity.PDLiveConversationListActivity;
|
||||
import com.yunbao.main.http.MainHttpConsts;
|
||||
import com.yunbao.main.http.MainHttpUtil;
|
||||
import com.yunbao.main.manager.imrongcloud.ConversationIMListManager;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
@ -78,8 +87,8 @@ public class LauncherActivity extends AppCompatActivity implements View.OnClickL
|
||||
private static final String TAG = "LauncherActivity";
|
||||
private static final int WHAT_GET_CONFIG = 0;
|
||||
private static final int WHAT_COUNT_DOWN = 1;
|
||||
private Handler mHandler;
|
||||
protected Context mContext;
|
||||
private Handler mHandler;
|
||||
private ViewGroup mRoot;
|
||||
private ImageView mCover;
|
||||
private ViewGroup mContainer;
|
||||
@ -261,10 +270,24 @@ public class LauncherActivity extends AppCompatActivity implements View.OnClickL
|
||||
*/
|
||||
private void forwardMainActivity() {
|
||||
releaseVideo();
|
||||
MainActivity.forward(mContext);
|
||||
finish();
|
||||
Intent intent = new Intent(
|
||||
LauncherActivity.this, MainActivity.class);
|
||||
intent.putExtra(Constants.SHOW_INVITE, false);
|
||||
|
||||
if (getIntent().getStringExtra("liveid") != null) {
|
||||
intent.putExtra("liveid", getIntent().getStringExtra("liveid"));
|
||||
}
|
||||
if (getIntent().getStringExtra("type") != null) {
|
||||
intent.putExtra("type", getIntent().getStringExtra("type"));
|
||||
}
|
||||
|
||||
if (getIntent().getStringExtra("activityUrl") != null) {
|
||||
intent.putExtra("activityUrl", getIntent().getStringExtra("activityUrl"));
|
||||
}
|
||||
|
||||
LauncherActivity.this.startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
|
@ -0,0 +1,282 @@
|
||||
package com.shayu.phonelive.utils;
|
||||
|
||||
import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationChannel;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.PorterDuffXfermode;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.net.Uri;
|
||||
import android.util.Log;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RemoteViews;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.app.NotificationCompat;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.target.SimpleTarget;
|
||||
import com.bumptech.glide.request.target.Target;
|
||||
import com.bumptech.glide.request.transition.Transition;
|
||||
import com.makeramen.roundedimageview.RoundedImageView;
|
||||
import com.shayu.phonelive.activity.LauncherActivity;
|
||||
import com.yunbao.common.bean.NotificationMsgBean;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.main.activity.MainActivity;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import io.rong.imlib.ConnectChangeReceiver;
|
||||
import io.rong.push.PushType;
|
||||
import io.rong.push.notification.PushMessageReceiver;
|
||||
import io.rong.push.notification.PushNotificationMessage;
|
||||
import myname.pdlive.shayu.R;
|
||||
|
||||
public class CustomMessageReceiver extends PushMessageReceiver {
|
||||
|
||||
|
||||
private String createNotificationChannel(Context context, String channelID, String channelNAME, int level) {
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
|
||||
NotificationManager manager = (NotificationManager) context.getSystemService(context.NOTIFICATION_SERVICE);
|
||||
NotificationChannel channel = new NotificationChannel(channelID, channelNAME, level);
|
||||
channel.setSound(Uri.parse("android.resource://" + context.getPackageName() + "/raw/pdlive_sound"),null);
|
||||
manager.createNotificationChannel(channel);
|
||||
return channelID;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onNotificationMessageClicked(
|
||||
Context context, PushType pushType, PushNotificationMessage message) {
|
||||
if (pushType.equals(PushType.GOOGLE_FCM)) {
|
||||
|
||||
Log.i("gmc", "gmc");
|
||||
|
||||
// TODO
|
||||
} else {
|
||||
Log.i("gmc", "gmc1111");
|
||||
}
|
||||
// 返回 true 表示拦截,false 为不拦截
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
NotificationMsgBean msg = new NotificationMsgBean();
|
||||
|
||||
@Override
|
||||
public boolean onNotificationMessageArrived(Context context, PushType pushType, PushNotificationMessage notificationMessage) {
|
||||
Log.i("gmc", notificationMessage.getPushContent() + "VVV" + notificationMessage.getPushTitle() + "gmc11112222" + notificationMessage.getExtra());
|
||||
if (notificationMessage.getExtra() == null) {
|
||||
msg.setImg("" + notificationMessage.getSenderPortrait());
|
||||
msg.setTitle(notificationMessage.getPushTitle());
|
||||
msg.setContent(notificationMessage.getPushContent());
|
||||
msg.setType("-1");
|
||||
sendNotification(context, msg);
|
||||
} else {
|
||||
try {
|
||||
JSONObject obj = new JSONObject(notificationMessage.getExtra());
|
||||
Log.i("gmc", "1111222");
|
||||
//开播
|
||||
if (obj.getString("type").equals("1") || obj.getString("type").equals("9")) {
|
||||
Log.i("gmc", "1111");
|
||||
msg.setImg("" + obj.getString("avatar"));
|
||||
msg.setTitle(notificationMessage.getPushTitle());
|
||||
msg.setContent(notificationMessage.getPushContent());
|
||||
msg.setLiveuid(obj.getString("liveuid"));
|
||||
msg.setType("1");
|
||||
liveNotification(context, msg);
|
||||
//发布动态 2
|
||||
//点赞 3
|
||||
//评论 4
|
||||
//鼓励 5
|
||||
} else if (obj.getString("type").equals("2") || obj.getString("type").equals("3") || obj.getString("type").equals("4") || obj.getString("type").equals("5")) {
|
||||
msg.setImg("" + obj.getString("avatar"));
|
||||
msg.setTitle(notificationMessage.getPushTitle());
|
||||
msg.setContent(notificationMessage.getPushContent());
|
||||
msg.setType("2");
|
||||
dynamicNotification(context, msg);
|
||||
} else if (obj.getString("type").equals("8") || obj.getString("type").equals("7")) {
|
||||
msg.setImg("" + obj.getString("avatar"));
|
||||
msg.setTitle(notificationMessage.getPushTitle());
|
||||
msg.setContent(notificationMessage.getPushContent());
|
||||
msg.setType(obj.getString("type"));
|
||||
msg.setActivityurl(obj.getString("activityUrl"));
|
||||
serviceNotification(context, msg);
|
||||
}
|
||||
|
||||
} catch (JSONException e) {
|
||||
Log.i("gmc", "1111" + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static Bitmap makeRoundCorner(Bitmap bitmap, float roundPx) {
|
||||
try {
|
||||
Bitmap output = Bitmap.createBitmap(bitmap.getWidth(),
|
||||
bitmap.getHeight(), Bitmap.Config.ARGB_8888);
|
||||
Canvas canvas = new Canvas(output);
|
||||
final int color = 0xff424242;// 颜色值(0xff---alpha)
|
||||
final Paint paint = new Paint();
|
||||
final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
|
||||
final RectF rectF = new RectF(rect);// Rect是使用int类型作为数值,RectF是使用float类型作为数值
|
||||
// --------抗锯齿-------//
|
||||
paint.setAntiAlias(true);
|
||||
canvas.drawARGB(0, 0, 0, 0);
|
||||
paint.setColor(color);
|
||||
canvas.drawRoundRect(rectF, roundPx, roundPx, paint);
|
||||
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
|
||||
final Rect src = new Rect(0, 0, bitmap.getWidth(),
|
||||
bitmap.getHeight());
|
||||
canvas.drawBitmap(bitmap, null, rect, paint);
|
||||
return output;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
//私聊
|
||||
private void sendNotification(Context context, NotificationMsgBean message) {
|
||||
// 设置通知的点击行为:这里启动一个 Activity
|
||||
Intent intent = new Intent(context, MainActivity.class);
|
||||
intent.setFlags(FLAG_ACTIVITY_CLEAR_TOP);
|
||||
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
|
||||
String channelId = createNotificationChannel(context, "my_channel_ID", "my_channel_NAME", NotificationManager.IMPORTANCE_HIGH);
|
||||
// 构建 remoteView
|
||||
RemoteViews remoteView = new RemoteViews(context.getPackageName(), R.layout.notification_message);
|
||||
remoteView.setTextViewText(R.id.title, message.getTitle());
|
||||
remoteView.setTextViewText(R.id.content, message.getContent());
|
||||
Glide.with(context).asBitmap().load(message.getImg()).into(new SimpleTarget<Bitmap>() {
|
||||
@Override
|
||||
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
|
||||
remoteView.setImageViewBitmap(R.id.img, makeRoundCorner(resource, 50));
|
||||
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(context, channelId);
|
||||
// 设置自定义 RemoteViews
|
||||
builder.setContent(remoteView).setSmallIcon(R.drawable.small_icons);
|
||||
// 设置通知的优先级(悬浮通知)
|
||||
builder.setPriority(NotificationCompat.PRIORITY_MAX);
|
||||
builder.setContentIntent(pendingIntent);
|
||||
builder.setAutoCancel(true);
|
||||
Notification notification = builder.build();
|
||||
NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
manager.notify(0, notification);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
int id = 1;
|
||||
|
||||
//动态
|
||||
private void dynamicNotification(Context context, NotificationMsgBean message) {
|
||||
// 设置通知的点击行为:这里启动一个 Activity
|
||||
Intent intent = new Intent(context, MainActivity.class);
|
||||
intent.putExtra("type", "2");
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
String channelId = createNotificationChannel(context, "my_channel_ID", "my_channel_NAME", NotificationManager.IMPORTANCE_HIGH);
|
||||
// 构建 remoteView
|
||||
RemoteViews remoteView = new RemoteViews(context.getPackageName(), R.layout.notification_message);
|
||||
remoteView.setTextViewText(R.id.title, message.getTitle());
|
||||
remoteView.setTextViewText(R.id.content, message.getContent());
|
||||
remoteView.setImageViewResource(R.id.img, R.mipmap.ic_launcher);
|
||||
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(context, channelId);
|
||||
// 设置自定义 RemoteViews
|
||||
builder.setContent(remoteView).setSmallIcon(R.drawable.small_icons);
|
||||
// 设置通知的优先级(悬浮通知)
|
||||
builder.setPriority(NotificationCompat.PRIORITY_MAX);
|
||||
builder.setContentIntent(pendingIntent);
|
||||
builder.setAutoCancel(true);
|
||||
Notification notification = builder.build();
|
||||
NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
id = (int) (id + System.currentTimeMillis());
|
||||
manager.notify(id, notification);
|
||||
|
||||
}
|
||||
|
||||
//开播
|
||||
private void liveNotification(Context context, NotificationMsgBean message) {
|
||||
// 设置通知的点击行为:这里启动一个 Activity
|
||||
Intent intent = new Intent(context, LauncherActivity.class);
|
||||
intent.setFlags(FLAG_ACTIVITY_CLEAR_TOP);
|
||||
intent.putExtra("liveid", message.getLiveuid());
|
||||
Log.e("gmc", message.getLiveuid() + "21121");
|
||||
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
String channelId = createNotificationChannel(context, "my_channel_ID", "my_channel_NAME", NotificationManager.IMPORTANCE_HIGH);
|
||||
// 构建 remoteView
|
||||
RemoteViews remoteView = new RemoteViews(context.getPackageName(), R.layout.notification_message);
|
||||
remoteView.setTextViewText(R.id.title, message.getTitle());
|
||||
remoteView.setTextViewText(R.id.content, message.getContent());
|
||||
Glide.with(context).asBitmap().load(message.getImg()).into(new SimpleTarget<Bitmap>() {
|
||||
@Override
|
||||
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
|
||||
remoteView.setImageViewBitmap(R.id.img, makeRoundCorner(resource, 50));
|
||||
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(context, channelId);
|
||||
// 设置自定义 RemoteViews
|
||||
builder.setContent(remoteView).setSmallIcon(R.drawable.small_icons);
|
||||
// 设置通知的优先级(悬浮通知)
|
||||
builder.setPriority(NotificationCompat.PRIORITY_MAX);
|
||||
builder.setContentIntent(pendingIntent);
|
||||
builder.setAutoCancel(true);
|
||||
Notification notification = builder.build();
|
||||
NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
id = (int) (id + System.currentTimeMillis());
|
||||
manager.notify(id, notification);
|
||||
}
|
||||
});
|
||||
|
||||
Log.i("gmc", "11123231");
|
||||
|
||||
}
|
||||
|
||||
//后台
|
||||
private void serviceNotification(Context context, NotificationMsgBean message) {
|
||||
// 设置通知的点击行为:这里启动一个 Activity
|
||||
Intent intent = new Intent(context, MainActivity.class);
|
||||
intent.putExtra("type", message.getType());
|
||||
if (message.getType().equals("8")) {
|
||||
intent.putExtra("activityUrl", message.getActivityurl());
|
||||
}
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
String channelId = createNotificationChannel(context, "my_channel_ID", "my_channel_NAME", NotificationManager.IMPORTANCE_HIGH);
|
||||
// 构建 remoteView
|
||||
RemoteViews remoteView = new RemoteViews(context.getPackageName(), R.layout.notification_message);
|
||||
remoteView.setTextViewText(R.id.title, message.getTitle());
|
||||
remoteView.setTextViewText(R.id.content, message.getContent());
|
||||
remoteView.setImageViewResource(R.id.img, R.mipmap.ic_launcher);
|
||||
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(context, channelId);
|
||||
// 设置自定义 RemoteViews
|
||||
builder.setContent(remoteView).setSmallIcon(R.drawable.small_icons);
|
||||
// 设置通知的优先级(悬浮通知)
|
||||
builder.setPriority(NotificationCompat.PRIORITY_MAX);
|
||||
builder.setContentIntent(pendingIntent);
|
||||
builder.setAutoCancel(true);
|
||||
Notification notification = builder.build();
|
||||
NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
id = (int) (id + System.currentTimeMillis());
|
||||
manager.notify(id, notification);
|
||||
|
||||
}
|
||||
}
|
@ -22,9 +22,15 @@ import com.google.firebase.messaging.RemoteMessage;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.main.activity.MainActivity;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import myname.pdlive.shayu.R;
|
||||
|
||||
public class MyNotificationService extends FirebaseMessagingService {
|
||||
|
||||
private String createNotificationChannel(String channelID, String channelNAME, int level) {
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
|
||||
NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
|
||||
@ -35,36 +41,70 @@ public class MyNotificationService extends FirebaseMessagingService {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public void onMessageReceived(RemoteMessage remoteMessage) {
|
||||
Log.e("gmc","remoteMessage");
|
||||
|
||||
public void onMessageReceived(RemoteMessage message) {
|
||||
// do nothing
|
||||
sendNotification("remoteMessage");
|
||||
Map<String, String> params = message.getData();
|
||||
JSONObject object = new JSONObject(params);
|
||||
Log.e("JSON_OBJECT", object.toString());
|
||||
JSONObject remoteMessage = null;
|
||||
try {
|
||||
remoteMessage = new JSONObject(object.getString("message"));
|
||||
Log.e("gmc","remoteMessage1"+remoteMessage.toString());
|
||||
Log.e("gmc","remoteMessage"+remoteMessage.getString("fromUserName"));
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// if(remoteMessage!=null && remoteMessage.isNull("fcm_token")) {
|
||||
// String title = remoteMessage.getData().get("title");
|
||||
// String message = remoteMessage.getData().get("text");
|
||||
// String username = remoteMessage.getData().get("username");
|
||||
// String uid = remoteMessage.getData().get("uid");
|
||||
// String fcmToken = remoteMessage.getData().get("fcm_token");
|
||||
// Log.e("gmc","remoteMessage"+remoteMessage.getData().get("username"));
|
||||
//
|
||||
// //Muestro la notifiación
|
||||
//// sendNotification(title, message, username, uid, fcmToken);
|
||||
// }else {
|
||||
// /// Si es de tipo inserción la muestro sino no.
|
||||
// //Es una nueva notificación de que alguien ha creado algo
|
||||
// if(remoteMessage.getData().get("accion")!=null &&
|
||||
// remoteMessage.getData().get("accion").compareTo("insert")==0)
|
||||
//// displayNotification(remoteMessage.getNotification(), remoteMessage.getData());
|
||||
//// //Envío los datos al RecyclerView correspondiente para que se actualice
|
||||
//// addNotificacion(remoteMessage);
|
||||
// Log.e("gmc","remoteMessage"+remoteMessage.getData().get("username"));
|
||||
//
|
||||
// }
|
||||
|
||||
// sendNotification("remoteMessage");
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void sendNotification(String messageBody) {
|
||||
|
||||
// 设置通知的点击行为:这里启动一个 Activity
|
||||
Intent intent = new Intent(this, MainActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, 0);
|
||||
String channelId = createNotificationChannel("my_channel_ID", "my_channel_NAME", NotificationManager.IMPORTANCE_HIGH);
|
||||
// 构建 remoteView
|
||||
RemoteViews remoteView = new RemoteViews(getPackageName(), R.layout.notification_message);
|
||||
// remoteView.setTextViewText(R.id.tvMsg, "RemoteViews");
|
||||
// remoteView.setImageViewResource(R.id.ivIcon, R.mipmap.ic_launcher_round);
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(this,channelId);
|
||||
// 设置自定义 RemoteViews
|
||||
builder.setContent(remoteView).setSmallIcon(R.mipmap.ic_launcher);
|
||||
// 设置通知的优先级(悬浮通知)
|
||||
builder.setPriority(NotificationCompat.PRIORITY_MAX);
|
||||
builder.setContentIntent(pendingIntent);
|
||||
builder.setAutoCancel(true);
|
||||
Notification notification = builder.build();
|
||||
NotificationManager manager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
manager.notify(0, notification);
|
||||
|
||||
}
|
||||
// private void sendNotification(String messageBody) {
|
||||
//
|
||||
// // 设置通知的点击行为:这里启动一个 Activity
|
||||
// Intent intent = new Intent(this, MainActivity.class);
|
||||
// intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
// PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, 0);
|
||||
// String channelId = createNotificationChannel("my_channel_ID", "my_channel_NAME", NotificationManager.IMPORTANCE_HIGH);
|
||||
// // 构建 remoteView
|
||||
//// RemoteViews remoteView = new RemoteViews(getPackageName(), R.layout.notification_message);
|
||||
//
|
||||
//// remoteView.setTextViewText(R.id.tvMsg, "RemoteViews");
|
||||
//// remoteView.setImageViewResource(R.id.ivIcon, R.mipmap.ic_launcher_round);
|
||||
// NotificationCompat.Builder builder = new NotificationCompat.Builder(this,channelId);
|
||||
// // 设置自定义 RemoteViews
|
||||
// builder.setContent(remoteView).setSmallIcon(R.mipmap.ic_launcher);
|
||||
// // 设置通知的优先级(悬浮通知)
|
||||
// builder.setPriority(NotificationCompat.PRIORITY_MAX);
|
||||
// builder.setContentIntent(pendingIntent);
|
||||
// builder.setAutoCancel(true);
|
||||
// Notification notification = builder.build();
|
||||
// NotificationManager manager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
// manager.notify(0, notification);
|
||||
//
|
||||
// }
|
||||
|
||||
}
|
||||
|
BIN
app/src/main/res/drawable/small_icons.png
Normal file
BIN
app/src/main/res/drawable/small_icons.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
BIN
app/src/main/res/raw/pdlive_sound.mp3
Normal file
BIN
app/src/main/res/raw/pdlive_sound.mp3
Normal file
Binary file not shown.
@ -178,5 +178,5 @@ dependencies {
|
||||
api 'com.wang.avi:library:2.1.3'
|
||||
api 'com.google.firebase:firebase-messaging:23.0.6'
|
||||
api 'com.google.firebase:firebase-analytics:21.1.0'
|
||||
|
||||
// api 'com.huawei.hms:push:4.0.2.300'
|
||||
}
|
||||
|
@ -6,16 +6,21 @@ import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import androidx.multidex.MultiDex;
|
||||
import androidx.multidex.MultiDexApplication;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.facebook.FacebookSdk;
|
||||
import com.facebook.appevents.AppEventsLogger;
|
||||
import com.google.android.gms.common.api.ApiException;
|
||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||
import com.yunbao.common.http.CommonHttpUtil;
|
||||
import com.yunbao.common.utils.L;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import io.rong.push.RongPushClient;
|
||||
import io.rong.push.pushconfig.PushConfig;
|
||||
import me.leolin.shortcutbadger.ShortcutBadger;
|
||||
|
||||
import static com.facebook.FacebookSdk.setAdvertiserIDCollectionEnabled;
|
||||
@ -46,6 +51,16 @@ public class CommonAppContext extends MultiDexApplication {
|
||||
sInstance = this;
|
||||
//初始化Http
|
||||
CommonHttpUtil.init();
|
||||
// //华为推送
|
||||
// PushConfig config = new PushConfig.Builder()
|
||||
// .enableHWPush(true)
|
||||
// .build();
|
||||
// RongPushClient.setPushConfig(config); //将推送相关配置设置到 SDK
|
||||
//谷歌推送
|
||||
PushConfig gconfig = new PushConfig.Builder()
|
||||
.enableFCM(true)
|
||||
.build();
|
||||
RongPushClient.setPushConfig(gconfig);
|
||||
//初始化友盟统计
|
||||
// UMConfigure.init(this, UMConfigure.DEVICE_TYPE_PHONE, null);
|
||||
FacebookSdk.sdkInitialize(getApplicationContext());
|
||||
@ -54,6 +69,7 @@ public class CommonAppContext extends MultiDexApplication {
|
||||
mFirebaseAnalytics.setUserProperty("ALLOW_AD_PERSONALIZATION_SIGNALS", "true" );
|
||||
|
||||
|
||||
|
||||
logger = AppEventsLogger.newLogger(this);
|
||||
setAutoLogAppEventsEnabled(true);
|
||||
FacebookSdk.fullyInitialize();
|
||||
@ -75,6 +91,7 @@ public class CommonAppContext extends MultiDexApplication {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void attachBaseContext(Context base) {
|
||||
MultiDex.install(this);
|
||||
|
@ -0,0 +1,60 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MsgSwitchDetailModel extends BaseModel {
|
||||
@SerializedName("dynamic_msg_switch")
|
||||
String dynamic_msg_switch;
|
||||
@SerializedName("interaction_show_msg_switch")
|
||||
String interaction_show_msg_switch;
|
||||
@SerializedName("chat_msg_switch")
|
||||
String chat_msg_switch;
|
||||
@SerializedName("system_msg_switch")
|
||||
String system_msg_switch;
|
||||
|
||||
@SerializedName("followList")
|
||||
private List<MsgSwitchFollowlModel> followList = new ArrayList<>();
|
||||
|
||||
public String getDynamic_msg_switch() {
|
||||
return dynamic_msg_switch;
|
||||
}
|
||||
|
||||
public void setDynamic_msg_switch(String dynamic_msg_switch) {
|
||||
this.dynamic_msg_switch = dynamic_msg_switch;
|
||||
}
|
||||
|
||||
public String getInteraction_show_msg_switch() {
|
||||
return interaction_show_msg_switch;
|
||||
}
|
||||
|
||||
public void setInteraction_show_msg_switch(String interaction_show_msg_switch) {
|
||||
this.interaction_show_msg_switch = interaction_show_msg_switch;
|
||||
}
|
||||
|
||||
public String getChat_msg_switch() {
|
||||
return chat_msg_switch;
|
||||
}
|
||||
|
||||
public void setChat_msg_switch(String chat_msg_switch) {
|
||||
this.chat_msg_switch = chat_msg_switch;
|
||||
}
|
||||
|
||||
public String getSystem_msg_switch() {
|
||||
return system_msg_switch;
|
||||
}
|
||||
|
||||
public void setSystem_msg_switch(String system_msg_switch) {
|
||||
this.system_msg_switch = system_msg_switch;
|
||||
}
|
||||
|
||||
public List<MsgSwitchFollowlModel> getFollowList() {
|
||||
return followList;
|
||||
}
|
||||
|
||||
public void setFollowList(List<MsgSwitchFollowlModel> followList) {
|
||||
this.followList = followList;
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class MsgSwitchFollowlModel extends BaseModel{
|
||||
@SerializedName("status")
|
||||
String status;
|
||||
@SerializedName("user_nicename")
|
||||
String user_nicename;
|
||||
@SerializedName("avatar")
|
||||
String avatar;
|
||||
@SerializedName("liveuid")
|
||||
String liveuid;
|
||||
|
||||
public String getLiveuid() {
|
||||
return liveuid;
|
||||
}
|
||||
|
||||
public void setLiveuid(String liveuid) {
|
||||
this.liveuid = liveuid;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getUser_nicename() {
|
||||
return user_nicename;
|
||||
}
|
||||
|
||||
public void setUser_nicename(String user_nicename) {
|
||||
this.user_nicename = user_nicename;
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public void setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
public class NotificationMsgBean {
|
||||
String img;
|
||||
String title;
|
||||
String content;
|
||||
String type;
|
||||
String liveuid;
|
||||
String activityurl;
|
||||
|
||||
public String getActivityurl() {
|
||||
return activityurl;
|
||||
}
|
||||
|
||||
public void setActivityurl(String activityurl) {
|
||||
this.activityurl = activityurl;
|
||||
}
|
||||
|
||||
public String getLiveuid() {
|
||||
return liveuid;
|
||||
}
|
||||
|
||||
public void setLiveuid(String liveuid) {
|
||||
this.liveuid = liveuid;
|
||||
}
|
||||
|
||||
public String getImg() {
|
||||
return img;
|
||||
}
|
||||
|
||||
public void setImg(String img) {
|
||||
this.img = img;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
@ -7,6 +7,7 @@ import com.yunbao.common.bean.ContributeModel;
|
||||
import com.yunbao.common.bean.FaceBookUpModel;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.bean.LiveInfoModel;
|
||||
import com.yunbao.common.bean.MsgSwitchDetailModel;
|
||||
import com.yunbao.common.bean.NewPeopleInfo;
|
||||
import com.yunbao.common.bean.NobleTrumpetModel;
|
||||
import com.yunbao.common.bean.SearchModel;
|
||||
@ -184,4 +185,24 @@ public interface PDLiveApi {
|
||||
*/
|
||||
@GET("/api/public/?service=Live.newUserPreferential")
|
||||
Observable<ResponseModel<NewPeopleInfo>> getNewPeopleInfo();
|
||||
|
||||
/**
|
||||
* 获取推送关注的开关和关注列表
|
||||
*
|
||||
*/
|
||||
@GET("/api/public/?service=Tx.offlineMsgSwitchDetail")
|
||||
Observable<ResponseModel<MsgSwitchDetailModel>> getMsgSwitchDetail();
|
||||
|
||||
/**
|
||||
* 推送关注的开关设置
|
||||
*/
|
||||
@GET("/api/public/?service=Tx.setMsgMasterSwitch")
|
||||
Observable<ResponseModel<BaseModel>> setMsgMasterSwitch(@Query("status") String status,@Query("type") String type);
|
||||
|
||||
/**
|
||||
*开播推送设置开关
|
||||
*/
|
||||
@GET("/api/public/?service=Tx.setBeginShowMsgSwitch")
|
||||
Observable<ResponseModel<List<BaseModel>>> setBeginShowMsgSwitch(@Query("status") String status,@Query("isAll") String isAll,@Query("liveuid") String liveuid);
|
||||
|
||||
}
|
||||
|
@ -3,11 +3,14 @@ package com.yunbao.common.http.main;
|
||||
import android.app.Activity;
|
||||
|
||||
import com.yunbao.common.bean.AnchorRecommendModel;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.bean.FaceBookUpModel;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.bean.MsgSwitchDetailModel;
|
||||
import com.yunbao.common.bean.SearchModel;
|
||||
import com.yunbao.common.bean.SlideInfoModel;
|
||||
import com.yunbao.common.http.API;
|
||||
import com.yunbao.common.http.ResponseData;
|
||||
import com.yunbao.common.http.ResponseModel;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
|
||||
@ -201,4 +204,64 @@ public class MainNetManager {
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取推送关注的设置和关注列表
|
||||
* @param callback
|
||||
*/
|
||||
public void getMsgSwitchDetail(HttpCallback<MsgSwitchDetailModel> callback) {
|
||||
API.get().pdLiveApi(mContext).getMsgSwitchDetail()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(msgSwitchDetailModelResponseModel -> {
|
||||
if (!mContext.isFinishing() && callback != null) {
|
||||
MsgSwitchDetailModel msgSwitchDetailModel = msgSwitchDetailModelResponseModel.getData().getInfo();
|
||||
callback.onSuccess(msgSwitchDetailModel);
|
||||
}
|
||||
}, throwable -> {
|
||||
if (!mContext.isFinishing() && callback != null) {
|
||||
callback.onError(throwable.getMessage());
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送开关设置
|
||||
* @param callback
|
||||
*/
|
||||
public void setMsgMasterSwitch(String status,String type,HttpCallback<ResponseData> callback) {
|
||||
API.get().pdLiveApi(mContext).setMsgMasterSwitch(status,type)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(BaseModel -> {
|
||||
if (!mContext.isFinishing() && callback != null) {
|
||||
ResponseData responseData = BaseModel.getData();
|
||||
callback.onSuccess(responseData);
|
||||
}
|
||||
}, throwable -> {
|
||||
if (!mContext.isFinishing() && callback != null) {
|
||||
callback.onError(throwable.getMessage());
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 主播开播推送开关设置
|
||||
* @param callback
|
||||
*/
|
||||
public void setBeginShowMsgSwitch(String status,String isAll,String liveuid,HttpCallback<ResponseData> callback) {
|
||||
API.get().pdLiveApi(mContext).setBeginShowMsgSwitch(status,isAll,liveuid)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(BaseModel -> {
|
||||
if (!mContext.isFinishing() && callback != null) {
|
||||
ResponseData responseData = BaseModel.getData();
|
||||
callback.onSuccess(responseData);
|
||||
}
|
||||
}, throwable -> {
|
||||
if (!mContext.isFinishing() && callback != null) {
|
||||
callback.onError(throwable.getMessage());
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -53,6 +53,7 @@ public class RongcloudIMManager {
|
||||
private static RongIMClient.OnReceiveMessageWrapperListener mListener;
|
||||
|
||||
/**
|
||||
*
|
||||
* 设置消息接受监听器
|
||||
*/
|
||||
public static void addRongcloudIMOnReceiveMessageListener(RongIMClient.OnReceiveMessageWrapperListener listener) {
|
||||
|
@ -2,6 +2,7 @@
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="80dp"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:gravity="center">
|
||||
|
||||
<LinearLayout
|
||||
@ -11,27 +12,31 @@
|
||||
android:layout_marginRight="60dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img"
|
||||
app:riv_oval="true"
|
||||
android:src="@mipmap/ic_launcher"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="25dp"
|
||||
android:gravity="center|left"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
|
||||
<TextView
|
||||
<TextView android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="15sp"
|
||||
android:textColor="@color/yellow4"
|
||||
android:text="我开播了!"/>
|
||||
|
||||
<TextView
|
||||
<TextView android:id="@+id/content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="15sp"
|
||||
@ -43,6 +48,7 @@
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@ -50,4 +56,5 @@
|
||||
android:textColor="@color/gray3"
|
||||
android:layout_alignParentRight="true"
|
||||
android:text="PD LIVE"/>
|
||||
|
||||
</RelativeLayout>
|
@ -144,7 +144,6 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
||||
EventBus.getDefault().register(this);
|
||||
mImageUtil = new ProcessImageUtil(this);
|
||||
mDialogFragmentSet = new HashSet<>();
|
||||
|
||||
//解压 美颜模型
|
||||
try {
|
||||
CommonAppConfig.VIDEO_TIE_MODEl_PATH = getFilesDir().getAbsolutePath() + "/model";//app安装路径
|
||||
|
@ -238,7 +238,6 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
|
||||
// 满足此种条件,表明需要加载直播视频,以及聊天室了
|
||||
if (viewGroup.getId() == mCurrentItem && (position == 0) && mCurrentItem != mLastPosition) {
|
||||
|
||||
loadData(viewGroup, mCurrentItem);
|
||||
}
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ public class SocketChatUtil {
|
||||
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
Log.i("tx", code + "发送失败" + desc);
|
||||
Log.i("tx", code + "发送失败1" + desc);
|
||||
|
||||
}
|
||||
});
|
||||
@ -114,7 +114,7 @@ public class SocketChatUtil {
|
||||
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
Log.i("tx", code + "发送失败" + desc);
|
||||
Log.i("tx", code + "发送失败2" + desc);
|
||||
|
||||
}
|
||||
});
|
||||
@ -170,7 +170,7 @@ public class SocketChatUtil {
|
||||
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
Log.i("tx", code + "发送失败" + desc);
|
||||
Log.i("tx", code + "发送失败3" + desc);
|
||||
|
||||
}
|
||||
});
|
||||
@ -210,7 +210,7 @@ public class SocketChatUtil {
|
||||
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
Log.i("tx", code + "发送失败" + desc);
|
||||
Log.i("tx", code + "发送失败4" + desc);
|
||||
|
||||
}
|
||||
});
|
||||
@ -339,7 +339,7 @@ public class SocketChatUtil {
|
||||
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
Log.i("tx", code + "发送失败" + desc);
|
||||
Log.i("tx", code + "发送失败5" + desc);
|
||||
|
||||
}
|
||||
});
|
||||
@ -381,7 +381,7 @@ public class SocketChatUtil {
|
||||
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
Log.i("tx", code + "发送失败" + desc);
|
||||
Log.i("tx", code + "发送失败6" + desc);
|
||||
|
||||
}
|
||||
});
|
||||
@ -423,7 +423,7 @@ public class SocketChatUtil {
|
||||
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
Log.i("tx", code + "发送失败" + desc);
|
||||
Log.i("tx", code + "发送失败7" + desc);
|
||||
|
||||
}
|
||||
});
|
||||
@ -456,7 +456,7 @@ public class SocketChatUtil {
|
||||
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
Log.i("tx", code + "发送失败" + desc);
|
||||
Log.i("tx", code + "发送失败7" + desc);
|
||||
|
||||
}
|
||||
});
|
||||
@ -493,7 +493,7 @@ public class SocketChatUtil {
|
||||
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
Log.i("tx", code + "发送失败" + desc);
|
||||
Log.i("tx", code + "发送失败9" + desc);
|
||||
|
||||
}
|
||||
});
|
||||
@ -528,7 +528,7 @@ public class SocketChatUtil {
|
||||
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
Log.i("tx", code + "发送失败" + desc);
|
||||
Log.i("tx", code + "发送失败10" + desc);
|
||||
|
||||
}
|
||||
});
|
||||
|
@ -118,7 +118,7 @@ public class SocketRyChatUtil {
|
||||
|
||||
@Override
|
||||
public void onSuccess(Message message) {
|
||||
Log.i("tx", "发送成功" + mLiveUid);
|
||||
Log.i("tx", "ssss"+"发送成功" + mLiveUid);
|
||||
//首发言成功
|
||||
AdjustEvent adjustEvent1 = new AdjustEvent("j7isvr");
|
||||
Adjust.trackEvent(adjustEvent1);
|
||||
@ -141,7 +141,7 @@ public class SocketRyChatUtil {
|
||||
|
||||
@Override
|
||||
public void onError(Message message, RongIMClient.ErrorCode errorCode) {
|
||||
|
||||
Log.e("tx","aaa"+errorCode.toString());
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -415,6 +415,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onUpdata(String str) {
|
||||
ToastUtil.show("121212");
|
||||
if ("UsertoRY".equals(str)) {
|
||||
DialogUitl.showSimpleDialog(mContext, WordUtil.getString(R.string.mic_tag), new DialogUitl.SimpleCallback() {
|
||||
@Override
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
124
main/src/main/java/com/yunbao/main/adapter/MsgFollowAdapter.java
Normal file
124
main/src/main/java/com/yunbao/main/adapter/MsgFollowAdapter.java
Normal 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) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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>
|
40
main/src/main/res/layout/item_msg_follow.xml
Normal file
40
main/src/main/res/layout/item_msg_follow.xml
Normal 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>
|
Loading…
Reference in New Issue
Block a user