This commit is contained in:
18142669586 2022-08-20 14:48:09 +08:00
parent 8bd6a6b071
commit 3ae14ed506
16 changed files with 422 additions and 42 deletions

View File

@ -92,13 +92,19 @@
android:usesCleartextTraffic="true"
tools:replace="theme,label,icon,allowBackup">
<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"
@ -158,6 +164,7 @@
<meta-data
android:name="firebase_analytics_collection_enabled"
android:value="false" />
</application>
</manifest>

View File

@ -0,0 +1,70 @@
package com.shayu.phonelive.utils;
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.BitmapFactory;
import android.media.RingtoneManager;
import android.net.Uri;
import android.util.Log;
import android.widget.RemoteViews;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
import com.google.android.gms.common.internal.zzm;
import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.RemoteMessage;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.main.activity.MainActivity;
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);
NotificationChannel channel = new NotificationChannel(channelID, channelNAME, level);
manager.createNotificationChannel(channel);
return channelID;
} else {
return null;
}
}
public void onMessageReceived(RemoteMessage remoteMessage) {
Log.e("gmc","remoteMessage");
// do nothing
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);
}
}

View File

@ -45,11 +45,7 @@ public abstract class HttpCallback extends AbsCallback<JsonBean> {
//token过期重新登录
RouteUtil.forwardLoginInvalid(data.getMsg());
} else {
if(data.getInfo().length==0){
onSuccess(data.getCode(), data.getMsg(), new String[]{data.getData()});
}else {
onSuccess(data.getCode(), data.getMsg(), data.getInfo());
}
onSuccess(data.getCode(), data.getMsg(), data.getInfo());
}
} else {
L.e("服务器返回值异常--->ret: " + bean.getRet() + " msg: " + bean.getMsg());

View File

@ -0,0 +1,53 @@
<?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:gravity="center">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="60dp"
android:orientation="horizontal">
<ImageView
android:src="@mipmap/ic_launcher"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="25dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:textColor="@color/yellow4"
android:text="我开播了!"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:layout_marginTop="5dp"
android:textColor="@color/gray3"
android:text="说好的,你今天来看我直播!"/>
</LinearLayout>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="15dp"
android:textColor="@color/gray3"
android:layout_alignParentRight="true"
android:text="PD LIVE"/>
</RelativeLayout>

View File

@ -9,9 +9,10 @@ ext {
]
manifestPlaceholders = [
//
// serverHost : "https://napi.yaoulive.com",
serverHost : "https://napi.yaoulive.com",
//
serverHost : "https://ceshi.yaoulive.com",
// serverHost : "https://ceshi.yaoulive.com",
//
txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB",

View File

@ -290,7 +290,7 @@ public class ImListAdapter extends RecyclerView.Adapter
}
if ("1".equals(bean.getIs_admin())) {
ImgLoader.display(mContext, "https://qny.shayucm.com/Instructors.png", img_new);
ImgLoader.display(mContext, "https://downs.yaoulive.com/Instructors.png", img_new);
img_new.setVisibility(View.VISIBLE);
} else {
img_new.setVisibility(View.GONE);

View File

@ -326,7 +326,7 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
});
//周星
BannerBean bannerBean = new BannerBean();
bannerBean.setImageUrl("https://qny.shayucm.com/img/BTN_WEEKSTAR%20%281%29.png");
bannerBean.setImageUrl("https://downs.yaoulive.com/img/BTN_WEEKSTAR%20%281%29.png");
bannerBean.setLink("zxb");
mBannerList1.add(bannerBean);
@ -358,18 +358,18 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
}
}
BannerBean banner3Bean = new BannerBean();
banner3Bean.setImageUrl("https://qny.shayucm.com/live_Mission_box.png");
banner3Bean.setImageUrl("https://downs.yaoulive.com/live_Mission_box.png");
banner3Bean.setLink(obj.getString("sendgift"));
mBannerList3.add(banner3Bean);
BannerBean banner3Bean1 = new BannerBean();
banner3Bean1.setImageUrl("https://qny.shayucm.com/live_Mission_box.png");
banner3Bean1.setImageUrl("https://downs.yaoulive.com/live_Mission_box.png");
banner3Bean1.setLink(obj.getString("attent"));
mBannerList3.add(banner3Bean1);
BannerBean banner3Bean2 = new BannerBean();
banner3Bean2.setImageUrl("https://qny.shayucm.com/live_Mission_box.png");
banner3Bean2.setImageUrl("https://downs.yaoulive.com/live_Mission_box.png");
banner3Bean2.setLink(obj.getString("illumine"));
mBannerList3.add(banner3Bean2);

View File

@ -1773,7 +1773,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
* 获取是否有热度卡加成
*/
public static void getIsHot() {
ImgLoader.display(Contexts, "https://qny.shayucm.com/img_hot_gif.gif", img_hot_gif);
ImgLoader.display(Contexts, "https://downs.yaoulive.com/img_hot_gif.gif", img_hot_gif);
LiveHttpUtil.isHotCard(mLiveUid, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {

View File

@ -70,6 +70,8 @@ dependencies {
//
api project(':video')
api project(':common')
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.4.0'
annotationProcessor rootProject.ext.dependencies["arouter-compiler"]
api files('libs/OpenInstall_v2.3.0.jar')
implementation project(path: ':lib_country_code')

View File

@ -5,7 +5,10 @@
<application
android:allowBackup="true"
android:theme="@style/AppTheme">
<activity android:name=".activity.OneLoginActivity"></activity>
<activity
android:name=".MsgSettActivity"
android:exported="false" />
<activity android:name=".activity.OneLoginActivity" />
<activity
android:name=".activity.WeekWebViewActivity"
android:screenOrientation="portrait" />
@ -56,7 +59,7 @@
<activity
android:name=".activity.SearchActivity"
android:screenOrientation="portrait"
android:theme="@style/CAppTheme"/>
android:theme="@style/CAppTheme" />
<activity
android:name=".activity.FollowActivity"
android:screenOrientation="portrait" />
@ -122,8 +125,7 @@
android:screenOrientation="portrait" />
<activity
android:name=".activity.MyWebViewActivity2"
android:screenOrientation="portrait" />
<!--融云消息列表界面-->
android:screenOrientation="portrait" /> <!-- 融云消息列表界面 -->
<activity
android:name=".activity.PDLiveConversationListActivity"
android:hardwareAccelerated="true"
@ -131,7 +133,9 @@
android:screenOrientation="portrait"
android:theme="@style/noAnimationStyle"
android:windowSoftInputMode="stateHidden|adjustResize" />
<activity
android:name=".activity.MsgSettActivity"
android:screenOrientation="portrait" />
</application>
</manifest>

View File

@ -277,23 +277,23 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
// RTCLib 初始化
RCRTCConfig.Builder config = RCRTCConfig.Builder.create();
RCRTCEngine.getInstance().init(MainActivity.this, config.build());
// FirebaseMessaging.getInstance().getToken()
// .addOnCompleteListener(new OnCompleteListener<String>() {
// @Override
// public void onComplete(@NonNull Task<String> task) {
// if (!task.isSuccessful()) {
// Log.w(TAG, "Fetching FCM registration token failed", task.getException());
// return;
// }
//
// // Get new FCM registration token
// String token = task.getResult();
//
// // Log and toast
// Log.d(TAG, token);
// Toast.makeText(MainActivity.this, token, Toast.LENGTH_SHORT).show();
// }
// });
FirebaseMessaging.getInstance().getToken()
.addOnCompleteListener(new OnCompleteListener<String>() {
@Override
public void onComplete(@NonNull Task<String> task) {
if (!task.isSuccessful()) {
Log.w(TAG, "Fetching FCM registration token failed", task.getException());
return;
}
// Get new FCM registration token
String token = task.getResult();
// Log and toast
Log.d(TAG, token);
Toast.makeText(MainActivity.this, token, Toast.LENGTH_SHORT).show();
}
});
boolean showInvite = getIntent().getBooleanExtra(Constants.SHOW_INVITE, false);
mRootView = (ViewGroup) findViewById(R.id.rootView);
floatBanner = findViewById(R.id.float_banner_home);
@ -379,6 +379,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
if (showInvite) {
showInvitationCode();
}
checkVersion();
loginIM();
CommonAppConfig.getInstance().setLaunched(true);

View File

@ -0,0 +1,23 @@
package com.yunbao.main.activity;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import com.yunbao.common.activity.AbsActivity;
import com.yunbao.main.R;
public class MsgSettActivity extends AbsActivity {
@Override
protected int getLayoutId() {
return R.layout.activity_msg_sett;
}
@Override
protected void main() {
super.main();
setTitle("消息通知");
}
}

View File

@ -96,7 +96,9 @@ public class SettingActivity extends AbsActivity implements OnItemClickListener<
FollowActivity.forward(mContext, CommonAppConfig.getInstance().getUid(),1);
} else if (bean.getId() == SETTING_CLEAR_CACHE) {//清除缓存
clearCache(position);
}
}else if (bean.getId() == 21) {//清除缓存
startActivity(new Intent(SettingActivity.this,MsgSettActivity.class));
}
} else {
if (bean.getId() == 17) {//意见反馈要在url上加版本号和设备号
href += "&version=" + android.os.Build.VERSION.RELEASE + "&model=" + android.os.Build.MODEL;

View File

@ -60,7 +60,7 @@ public class PDLiveCustomConversationProvider extends BaseConversationProvider {
if (userInfo != null && !TextUtils.isEmpty(userInfo.getExtra())) {
IMLoginModel model = new Gson().fromJson(userInfo.getExtra(), IMLoginModel.class);
if (model != null && TextUtils.equals(model.getIsAdmin(), "1"))
Glide.with(holder.getContext()).asDrawable().load("https://qny.shayucm.com/Instructors.png").into(imgNew);
Glide.with(holder.getContext()).asDrawable().load("https://downs.yaoulive.com/Instructors.png").into(imgNew);
}
}

View File

@ -35,7 +35,7 @@ public class MainHomeViewHolder extends AbsMainHomeParentViewHolder {
super.init();
img_trophy = (ImageView) findViewById(R.id.img_trophy);
ImgLoader.display(mContext, "https://qny.shayucm.com/gif_trophy.gif", img_trophy);
ImgLoader.display(mContext, "https://downs.yaoulive.com/gif_trophy.gif", img_trophy);
}
@Override

View File

@ -0,0 +1,221 @@
<?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" />
<ScrollView
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="動態消息"
android:textColor="#ff1e1f20"
android:textSize="16sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="主播發佈新動態通知"
android:textColor="#ffc7c8c9"
android:textSize="12sp" />
</LinearLayout>
<ImageView
android:id="@+id/special_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="動態消息"
android:textColor="#ff1e1f20"
android:textSize="16sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="主播發佈新動態通知"
android:textColor="#ffc7c8c9"
android:textSize="12sp" />
</LinearLayout>
<ImageView
android: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="動態消息"
android:textColor="#ff1e1f20"
android:textSize="16sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="主播發佈新動態通知"
android:textColor="#ffc7c8c9"
android:textSize="12sp" />
</LinearLayout>
<ImageView
android: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="動態消息"
android:textColor="#ff1e1f20"
android:textSize="16sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="主播發佈新動態通知"
android:textColor="#ffc7c8c9"
android:textSize="12sp" />
</LinearLayout>
<ImageView
android: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="動態消息"
android:textColor="#ff1e1f20"
android:textSize="16sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="主播發佈新動態通知"
android:textColor="#ffc7c8c9"
android:textSize="12sp" />
</LinearLayout>
<ImageView
android: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>
</LinearLayout>
</ScrollView>
</LinearLayout>