From 845be4d7954a493052c73c8ac730d70ddda2e601 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Thu, 20 Oct 2022 15:10:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8C=89=E9=9C=80=E6=B1=82=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/dialog/FloatSettingsDialog.java | 35 ++++++++++++++ .../imrongcloud/RongcloudIMManager.java | 3 +- .../main/res/layout/view_float_settings.xml | 5 +- common/src/main/res/values-en/strings.xml | 47 ++++++++++--------- common/src/main/res/values/strings.xml | 5 +- .../live/activity/LiveAudienceActivity.java | 10 ++++ .../live/views/PortraitLiveManager.java | 16 +++---- .../main/res/layout/view_live_audience.xml | 4 +- 8 files changed, 87 insertions(+), 38 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/dialog/FloatSettingsDialog.java b/common/src/main/java/com/yunbao/common/dialog/FloatSettingsDialog.java index 248d16f9a..2cf509e94 100644 --- a/common/src/main/java/com/yunbao/common/dialog/FloatSettingsDialog.java +++ b/common/src/main/java/com/yunbao/common/dialog/FloatSettingsDialog.java @@ -1,10 +1,19 @@ package com.yunbao.common.dialog; +import android.graphics.Color; import android.os.Bundle; +import android.text.Spannable; +import android.text.SpannableStringBuilder; +import android.text.style.ClickableSpan; +import android.text.style.ForegroundColorSpan; import android.view.Gravity; +import android.view.View; import android.view.Window; import android.view.WindowManager; import android.widget.ImageView; +import android.widget.TextView; + +import androidx.annotation.NonNull; import com.lzf.easyfloat.interfaces.OnPermissionResult; import com.lzf.easyfloat.permission.PermissionUtils; @@ -18,6 +27,7 @@ import com.yunbao.common.views.weight.ViewClicksAntiShake; */ public class FloatSettingsDialog extends AbsDialogFragment { private ImageView specialSwitch, specialMountSwitch; + private TextView hint; private boolean isFloat; @Override @@ -40,6 +50,16 @@ public class FloatSettingsDialog extends AbsDialogFragment { super.onActivityCreated(savedInstanceState); specialSwitch = (ImageView) findViewById(R.id.special_switch); specialMountSwitch = (ImageView) findViewById(R.id.special_mount_switch); + hint = (TextView) findViewById(R.id.hint); + SpannableStringBuilder builder = new SpannableStringBuilder(getString(R.string.system_window_hint)); + String goTo = getString(R.string.to_open_the); + int star = builder.length(); + int end = star + goTo.length(); + builder.append(goTo); + builder.setSpan(new ForegroundColorSpan(Color.parseColor("#ffaf08")), + star, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + + hint.setText(builder); isFloat = IMLoginManager.get(getActivity()).isFloat(); if (!isFloat) { ImgLoader.display(getContext(), R.mipmap.special_icon_off, specialSwitch); @@ -80,6 +100,21 @@ public class FloatSettingsDialog extends AbsDialogFragment { }); } ); + //坐骑特效开关 + ViewClicksAntiShake.clicksAntiShake(hint, () -> { + dismiss(); + PermissionUtils.requestPermission(getActivity(), new OnPermissionResult() { + @Override + public void permissionResult(boolean isFloat) { + if (!isFloat) { + ImgLoader.display(getContext(), R.mipmap.special_icon_off, specialSwitch); + } else { + ImgLoader.display(getContext(), R.mipmap.special_icon_on, specialSwitch); + } + } + }); + } + ); } @Override diff --git a/common/src/main/java/com/yunbao/common/manager/imrongcloud/RongcloudIMManager.java b/common/src/main/java/com/yunbao/common/manager/imrongcloud/RongcloudIMManager.java index 3c5676c41..4a620249e 100644 --- a/common/src/main/java/com/yunbao/common/manager/imrongcloud/RongcloudIMManager.java +++ b/common/src/main/java/com/yunbao/common/manager/imrongcloud/RongcloudIMManager.java @@ -26,7 +26,6 @@ import io.rong.imkit.config.RongConfigCenter; import io.rong.imlib.RongIMClient; import io.rong.imlib.model.Conversation; import io.rong.imlib.model.Message; -import io.rong.recognizer.Recognizer; /** * 会话列表 @@ -61,7 +60,7 @@ public class RongcloudIMManager { Log.e(CLASSNAME, "initRongIM:"); initPhotoGlide(); //初始化科大讯飞语音转文字 - Recognizer.setAppId("af2efca9"); +// Recognizer.setAppId("af2efca9"); } private static RongIMClient.OnReceiveMessageWrapperListener mListener; diff --git a/common/src/main/res/layout/view_float_settings.xml b/common/src/main/res/layout/view_float_settings.xml index 979491a50..5a00d03f6 100644 --- a/common/src/main/res/layout/view_float_settings.xml +++ b/common/src/main/res/layout/view_float_settings.xml @@ -76,12 +76,15 @@ android:textSize="15sp" /> + android:textSize="13.5sp" + android:focusable="true" /> Login failed, please log in again onlookers - 的直播間開通了 + The live broadcast studio was opened baron - 子爵 - 侯爵 - 公爵 - 国王 - 皇帝 - 超皇 + viscount + The marquis DE + The duke + The king + The emperor + Super huang Please wait... - 滑動設置 - 上下滑動切換直播間 - \@用户昵称\t\t你好啊~ - 在线列表 - 搜索想要@的人 - 在線觀眾 - 觀眾 - 無法@自己 - 總星值 - 助力人數 - %s星挑战 - 恭喜 %s,完成了%s %s星 挑戰,快去一睹主播芳容吧! - - 小窗播放設置 - 小窗播放 + The slide set + Slide up and down to switch the broadcast room + \ @user nickname \t\t hello ~ + oline_list + Search for people who want @ + The online audience + The audience + can not \@ myself + Total star + The number of power + %sStar challenge + Congratulations %s, completed %s %s star challenge, go to meet the host face! + star + Small window play Settings + Small window to play Minimize Play Show when exiting the live room ALL Minimize Play - Show on other apps and pages + Show on other apps and pages \n Need to open the display + Go to open diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index afcd62a1e..c8c008666 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -929,7 +929,8 @@ 小窗播放設置 小窗播放 APP內小窗播放 - 讓直播間內容在本APP主頁面中小窗播放 + 退出直播間時在主界面顯示小窗 APP全應用小窗播放 - 讓直播間內容在所有APP及頁面中小窗播放 + 在其他應用上及所有界面显示小窗\n需打開懸浮窗權限。 + 前往打開 diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java index d5a00d56c..a00849c8e 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -518,6 +518,12 @@ public class LiveAudienceActivity extends LiveActivity { GiftCacheUtil.getInstance().pause(); } + @Override + protected void onStop() { + super.onStop(); + manager.onStop(); + } + /** * 点亮 */ @@ -812,6 +818,7 @@ public class LiveAudienceActivity extends LiveActivity { intent.putExtra("url", url); intent.putExtra("isFull", true); mContext.startActivity(intent); + manager.setQuitF(true); break; case LIVE_ROOM_EXCEPTION: //主播未直播时自动下滑至下一个直播间 @@ -824,6 +831,7 @@ public class LiveAudienceActivity extends LiveActivity { break; case REPORT: LiveReportActivity.forward(mContext, event.getBean().getUid()); + manager.setQuitF(true); break; case POPULAR: url = CommonAppConfig.HOST + "/h5/activity/PopularityTask/index.html"; @@ -888,6 +896,7 @@ public class LiveAudienceActivity extends LiveActivity { * @param type 1、官方通知 2、互动信息 3、在线客服 */ private void toSysMsgWeb(String type) { + manager.setQuitF(true); ImHttpUtil.getImUserInfo("", new HttpCallback() { @SuppressLint("MissingPermission") @@ -917,6 +926,7 @@ public class LiveAudienceActivity extends LiveActivity { .putExtra("uid", "") .putExtra("title", "") .putExtra("headImg", "")); + } break; } diff --git a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java index 3cccdcb31..7aa0d5626 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -32,6 +32,7 @@ import com.blankj.utilcode.util.GsonUtils; import com.facebook.appevents.AppEventsLogger; import com.lzf.easyfloat.EasyFloat; import com.lzf.easyfloat.permission.PermissionUtils; +import com.lzf.easyfloat.utils.LifecycleUtils; import com.tencent.imsdk.v2.V2TIMCallback; import com.tencent.imsdk.v2.V2TIMManager; import com.yunbao.common.CommonAppConfig; @@ -400,9 +401,13 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe @Override public void onPause() { -// if (mLivePlayViewHolder != null) -// mLivePlayViewHolder.onPause(); - if (mLiveBean != null && !isQuitF) { + + } + + @Override + public void onStop() { + boolean isForeground = LifecycleUtils.INSTANCE.isForeground(); + if (mLiveBean != null && !isQuitF && !isForeground) { LiveFloatView.getInstance() .cacheLiveData(mLiveBean, mLiveType, mLiveSDK, mLiveTypeVal) .builderSystemFloat(mContext, mLiveBean.getPull()); @@ -411,11 +416,6 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe isQuitF = false; } - @Override - public void onStop() { - - } - @Override public void onDestroy() { diff --git a/live/src/main/res/layout/view_live_audience.xml b/live/src/main/res/layout/view_live_audience.xml index a99af09ad..d78a430e6 100644 --- a/live/src/main/res/layout/view_live_audience.xml +++ b/live/src/main/res/layout/view_live_audience.xml @@ -369,8 +369,8 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:layout_centerInParent="true" - android:visibility="invisible" - android:src="@mipmap/live_icon_newpeople_en" /> + android:src="@mipmap/live_icon_newpeople_en" + android:visibility="invisible" />