From 0ff76e1e476a56640bf0518c67bd7dda708e83f2 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Wed, 19 Jun 2024 15:24:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=AD=A5PD=E4=BF=AE=E5=A4=8D=E5=86=85?= =?UTF-8?q?=E5=AE=B9=EF=BC=9A=20fix[=E4=BF=AE=E5=BE=A9=E5=B0=8F=E7=AA=97?= =?UTF-8?q?=E6=92=AD=E6=94=BE=E7=99=BD=E5=B1=8F=E5=95=8F=E9=A1=8C]=20?= =?UTF-8?q?=E6=BD=98=E5=A4=9A=E6=8B=89=EF=BC=9A=20=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E5=9B=9E=E8=9E=8D=E4=BA=91=E6=8B=A6=E6=88=AA=E5=A3=B0=E9=9F=B3?= =?UTF-8?q?&=E9=9C=87=E5=8A=A8=20=E6=B6=88=E6=81=AF=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E8=B0=83=E7=94=A8=E5=A3=B0=E9=9F=B3&=E9=9C=87=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/shayu/phonelive/AppContext.java | 2 ++ .../dialog/MessageSayHiNotifyDialog.java | 19 ++----------- .../com/yunbao/common/utils/SoundUtils.java | 28 +++++++++++++++++++ config.gradle | 6 ++-- .../live/activity/SudRyGameActivity.java | 5 ++++ .../live/activity/SudSwGameActivity.java | 6 ++-- .../live/views/LivePlaySwViewHolder.java | 3 ++ .../yunbao/main/activity/MainActivity.java | 4 +-- main/src/main/res/values/rc_config.xml | 4 +-- 9 files changed, 51 insertions(+), 26 deletions(-) create mode 100644 common/src/main/java/com/yunbao/common/utils/SoundUtils.java diff --git a/app/src/main/java/com/shayu/phonelive/AppContext.java b/app/src/main/java/com/shayu/phonelive/AppContext.java index 414d111f3..48eb61e90 100644 --- a/app/src/main/java/com/shayu/phonelive/AppContext.java +++ b/app/src/main/java/com/shayu/phonelive/AppContext.java @@ -58,6 +58,7 @@ import com.yunbao.common.utils.GoogleUtils; import com.yunbao.common.utils.L; import com.yunbao.common.utils.MessageChatNotifyManager; import com.yunbao.common.utils.MessageSayHiNotifyManager; +import com.yunbao.common.utils.SoundUtils; import com.yunbao.common.utils.SpUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.live.activity.LiveActivity; @@ -369,6 +370,7 @@ public class AppContext extends CommonAppContext { if (message.getReceivedStatus().isRead()) { return false; } + SoundUtils.playNotificationSound(AppManager.getInstance().getMainActivity()); RongIMClient.getInstance().getUnreadCount(Conversation.ConversationType.PRIVATE, message.getTargetId(), new RongIMClient.ResultCallback() { @Override public void onSuccess(Integer integer) { diff --git a/common/src/main/java/com/yunbao/common/dialog/MessageSayHiNotifyDialog.java b/common/src/main/java/com/yunbao/common/dialog/MessageSayHiNotifyDialog.java index 25b19bbb8..b4d000cbb 100644 --- a/common/src/main/java/com/yunbao/common/dialog/MessageSayHiNotifyDialog.java +++ b/common/src/main/java/com/yunbao/common/dialog/MessageSayHiNotifyDialog.java @@ -26,6 +26,7 @@ import com.yunbao.common.custom.RatioRoundImageView; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.utils.DpUtil; +import com.yunbao.common.utils.SoundUtils; import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ViewUtils; @@ -128,7 +129,7 @@ public class MessageSayHiNotifyDialog extends AbsDialogCenterPopupWindow { ) ); showTag(); - playNotificationSound(); + SoundUtils.playNotificationSound(mContext); } private void showTag() { @@ -182,21 +183,5 @@ public class MessageSayHiNotifyDialog extends AbsDialogCenterPopupWindow { }); } - public void playNotificationSound() { - try { - Uri ringUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); - MediaPlayer mMediaPlayer = new MediaPlayer(); - mMediaPlayer.setDataSource(mContext, ringUri); - mMediaPlayer.setAudioStreamType(AudioManager.STREAM_NOTIFICATION); - mMediaPlayer.setLooping(false); - mMediaPlayer.prepare(); - mMediaPlayer.start(); - - Vibrator vibrator = (Vibrator) mContext.getSystemService(Context.VIBRATOR_SERVICE); - vibrator.vibrate(new long[]{150, 250, 150, 250}, -1); - } catch (Exception e) { - e.printStackTrace(); - } - } } diff --git a/common/src/main/java/com/yunbao/common/utils/SoundUtils.java b/common/src/main/java/com/yunbao/common/utils/SoundUtils.java new file mode 100644 index 000000000..4d9caf0bd --- /dev/null +++ b/common/src/main/java/com/yunbao/common/utils/SoundUtils.java @@ -0,0 +1,28 @@ +package com.yunbao.common.utils; + +import android.content.Context; +import android.media.AudioManager; +import android.media.MediaPlayer; +import android.media.RingtoneManager; +import android.net.Uri; +import android.os.Vibrator; + +public class SoundUtils { + public static void playNotificationSound(Context mContext) { + try { + + Uri ringUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); + MediaPlayer mMediaPlayer = new MediaPlayer(); + mMediaPlayer.setDataSource(mContext, ringUri); + mMediaPlayer.setAudioStreamType(AudioManager.STREAM_NOTIFICATION); + mMediaPlayer.setLooping(false); + mMediaPlayer.prepare(); + mMediaPlayer.start(); + + Vibrator vibrator = (Vibrator) mContext.getSystemService(Context.VIBRATOR_SERVICE); + vibrator.vibrate(new long[]{150, 250, 150, 250}, -1); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/config.gradle b/config.gradle index 934289805..de86dd339 100644 --- a/config.gradle +++ b/config.gradle @@ -4,8 +4,8 @@ ext { buildToolsVersion: "29.0.2", minSdkVersion : 23, targetSdkVersion : 33, - versionCode : 529, - versionName : "6.7.0", + versionCode : 531, + versionName : "6.7.1", namespace : "com.pandoralive.shayu" ] manifestPlaceholders = [ @@ -26,7 +26,7 @@ ext { // true表示谷歌支付 false // isGooglePlay : false, // true表示谷歌支付 false 0 链接包(isPluginModel-> true) 1 谷歌包 2华为包 3 samsung包 - isGooglePlay : 0, + isGooglePlay : 1, //是否上报异常日志 isUploadLog : true, diff --git a/live/src/main/java/com/yunbao/live/activity/SudRyGameActivity.java b/live/src/main/java/com/yunbao/live/activity/SudRyGameActivity.java index 719666c70..1a568cb1f 100644 --- a/live/src/main/java/com/yunbao/live/activity/SudRyGameActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/SudRyGameActivity.java @@ -19,6 +19,7 @@ import com.alibaba.android.arouter.facade.annotation.Route; import com.alibaba.fastjson.JSONObject; import com.google.gson.Gson; import com.lxj.xpopup.XPopup; +import com.lzf.easyfloat.EasyFloat; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; import com.yunbao.common.R; @@ -56,6 +57,7 @@ import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.common.views.LiveSudGameHistoryPopup; import com.yunbao.common.views.TopGradual; +import com.yunbao.common.views.floatingview.APPEasyFloat; import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.live.dialog.LiveUserDialogFragment; @@ -102,6 +104,9 @@ public class SudRyGameActivity extends AbsActivity implements GameRyMicManager.M Bus.getOn(this); super.main(); initView(); + //进游戏房就关掉小窗 + EasyFloat.dismiss("LiveFloatView", true); + APPEasyFloat.getInstance().dismiss(mContext); initDate(); } diff --git a/live/src/main/java/com/yunbao/live/activity/SudSwGameActivity.java b/live/src/main/java/com/yunbao/live/activity/SudSwGameActivity.java index d8cd07071..8d442c8db 100644 --- a/live/src/main/java/com/yunbao/live/activity/SudSwGameActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/SudSwGameActivity.java @@ -58,6 +58,7 @@ import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.common.views.LiveSudGameHistoryPopup; import com.yunbao.common.views.TopGradual; +import com.yunbao.common.views.floatingview.APPEasyFloat; import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.live.dialog.LiveUserDialogFragment; @@ -110,6 +111,9 @@ public class SudSwGameActivity extends AbsActivity implements GameSwMicManager.M Bus.getOn(this); super.main(); initView(); + //进游戏房就关掉小窗 + EasyFloat.dismiss("LiveFloatView", true); + APPEasyFloat.getInstance().dismiss(mContext); initDate(); } @@ -133,8 +137,6 @@ public class SudSwGameActivity extends AbsActivity implements GameSwMicManager.M } }); - //进游戏房就关掉小窗 - EasyFloat.dismiss("LiveFloatView", true); // 设置禁用麦克风采集 //RCRTCEngine.getInstance().getDefaultAudioStream().setMicrophoneDisable(disable); diff --git a/live/src/main/java/com/yunbao/live/views/LivePlaySwViewHolder.java b/live/src/main/java/com/yunbao/live/views/LivePlaySwViewHolder.java index 8ce62f8a6..d72767c8e 100644 --- a/live/src/main/java/com/yunbao/live/views/LivePlaySwViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LivePlaySwViewHolder.java @@ -630,6 +630,9 @@ public class LivePlaySwViewHolder extends LiveRoomPlayViewHolder { mEnd = true; mStarted = false; Bus.getOff(this); + if(ry_view!=null){ + ry_view.removeAllViews(); + } EventBus.getDefault().unregister(this); //swAuManager.exitChannelAll(); L.e(TAG, "release------->"); diff --git a/main/src/main/java/com/yunbao/main/activity/MainActivity.java b/main/src/main/java/com/yunbao/main/activity/MainActivity.java index 6fcea97c5..28706b7b0 100644 --- a/main/src/main/java/com/yunbao/main/activity/MainActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MainActivity.java @@ -479,7 +479,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene } isInstructor(); - /*RongConfigCenter.notificationConfig().setInterceptor(new NotificationConfig.Interceptor() { + RongConfigCenter.notificationConfig().setInterceptor(new NotificationConfig.Interceptor() { @Override public boolean isNotificationIntercepted(Message message) { return true; @@ -499,7 +499,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene public NotificationChannel onRegisterChannel(NotificationChannel notificationChannel) { return null; } - });*/ + }); RxView.clicks(findViewById(R.id.banner_click)).throttleFirst(2, TimeUnit.SECONDS).subscribe(new Observer() { @Override public void onSubscribe(Disposable d) { diff --git a/main/src/main/res/values/rc_config.xml b/main/src/main/res/values/rc_config.xml index d7d420bc4..7d5e06dcd 100644 --- a/main/src/main/res/values/rc_config.xml +++ b/main/src/main/res/values/rc_config.xml @@ -75,9 +75,9 @@ false - true + false - true + false