Merge branch 'master' into dev_20221020

# Conflicts:
#	settings.gradle
This commit is contained in:
zlzw 2022-10-20 11:17:52 +08:00
commit 79aadad668
15 changed files with 109 additions and 272 deletions

View File

@ -189,4 +189,7 @@ dependencies {
implementation 'com.github.tajchert:WaitingDots:0.6.1' implementation 'com.github.tajchert:WaitingDots:0.6.1'
// //
api 'com.github.princekin-f:EasyFloat:2.0.4' api 'com.github.princekin-f:EasyFloat:2.0.4'
// api project(path: ':recognizer')
} }

View File

@ -1,5 +1,7 @@
package com.yunbao.common.manager.imrongcloud; package com.yunbao.common.manager.imrongcloud;
import static com.yunbao.common.CommonAppContext.isReady;
import android.app.Application; import android.app.Application;
import android.content.Context; import android.content.Context;
import android.util.Log; import android.util.Log;
@ -17,8 +19,6 @@ import com.yunbao.common.manager.IMLoginManager;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
import java.util.ArrayList;
import io.rong.imkit.GlideKitImageEngine; import io.rong.imkit.GlideKitImageEngine;
import io.rong.imkit.IMCenter; import io.rong.imkit.IMCenter;
import io.rong.imkit.RongIM; import io.rong.imkit.RongIM;
@ -26,9 +26,7 @@ import io.rong.imkit.config.RongConfigCenter;
import io.rong.imlib.RongIMClient; import io.rong.imlib.RongIMClient;
import io.rong.imlib.model.Conversation; import io.rong.imlib.model.Conversation;
import io.rong.imlib.model.Message; import io.rong.imlib.model.Message;
import io.rong.imlib.model.MessageContent; import io.rong.recognizer.Recognizer;
import static com.yunbao.common.CommonAppContext.isReady;
/** /**
* 会话列表 * 会话列表
@ -41,6 +39,7 @@ public class RongcloudIMManager {
public static String RONG_IM_KEY = "pvxdm17jpd3hr"; public static String RONG_IM_KEY = "pvxdm17jpd3hr";
private static final String CLASSNAME = "RongcloudIMManager"; private static final String CLASSNAME = "RongcloudIMManager";
static {//自动切换key static {//自动切换key
if (CommonAppConfig.HOST.contains("ceshi")) { if (CommonAppConfig.HOST.contains("ceshi")) {
RONG_IM_KEY = "pvxdm17jpd3hr"; //测试服key RONG_IM_KEY = "pvxdm17jpd3hr"; //测试服key
@ -61,13 +60,13 @@ public class RongcloudIMManager {
Log.e(CLASSNAME, "initRongIM:"); Log.e(CLASSNAME, "initRongIM:");
initPhotoGlide(); initPhotoGlide();
//初始化科大讯飞语音转文字
Recognizer.setAppId("af2efca9");
} }
private static RongIMClient.OnReceiveMessageWrapperListener mListener; private static RongIMClient.OnReceiveMessageWrapperListener mListener;
/** /**
*
* 设置消息接受监听器 * 设置消息接受监听器
*/ */
public static void addRongcloudIMOnReceiveMessageListener(RongIMClient.OnReceiveMessageWrapperListener listener) { public static void addRongcloudIMOnReceiveMessageListener(RongIMClient.OnReceiveMessageWrapperListener listener) {

View File

@ -266,6 +266,27 @@
android:textColor="#FF9A9A9A" android:textColor="#FF9A9A9A"
android:textSize="12sp" /> android:textSize="12sp" />
</LinearLayout> </LinearLayout>
<LinearLayout
android:id="@+id/float_settings_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="23dp"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:src="@mipmap/live_more_icon_fenestrule" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:text="@string/small_window"
android:textColor="#FF9A9A9A"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/system_notice" android:id="@+id/system_notice"

View File

@ -926,4 +926,10 @@
<string name="star_change">%s星挑战</string> <string name="star_change">%s星挑战</string>
<string name="star_success">恭喜 %s完成了%s %s星 挑戰,快去一睹主播芳容吧!</string> <string name="star_success">恭喜 %s完成了%s %s星 挑戰,快去一睹主播芳容吧!</string>
<string name="star"></string> <string name="star"></string>
<string name="small_window_settings">小窗播放設置</string>
<string name="small_window">小窗播放</string>
<string name="app_window">APP內小窗播放</string>
<string name="app_window_hint">讓直播間內容在本APP主頁面中小窗播放</string>
<string name="system_window">APP全應用小窗播放</string>
<string name="system_window_hint">讓直播間內容在所有APP及頁面中小窗播放</string>
</resources> </resources>

View File

@ -16,6 +16,7 @@
android:name=".activity.LiveAudienceActivity" android:name=".activity.LiveAudienceActivity"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:theme="@style/AppTheme" android:theme="@style/AppTheme"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustPan|stateAlwaysHidden" /> android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
<activity <activity
android:name=".activity.LiveChooseClassActivity" android:name=".activity.LiveChooseClassActivity"

View File

@ -36,10 +36,12 @@ import com.yunbao.common.activity.WebViewActivity;
import com.yunbao.common.bean.AnchorRecommendItemModel; import com.yunbao.common.bean.AnchorRecommendItemModel;
import com.yunbao.common.bean.AnchorRecommendModel; import com.yunbao.common.bean.AnchorRecommendModel;
import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.bean.LiveGiftBean; import com.yunbao.common.bean.LiveGiftBean;
import com.yunbao.common.bean.SlideInfoModel; import com.yunbao.common.bean.SlideInfoModel;
import com.yunbao.common.bean.UserBean; import com.yunbao.common.bean.UserBean;
import com.yunbao.common.dialog.EffectsSettingsDialog; import com.yunbao.common.dialog.EffectsSettingsDialog;
import com.yunbao.common.dialog.FloatSettingsDialog;
import com.yunbao.common.dialog.LiveChargeDialogFragment; import com.yunbao.common.dialog.LiveChargeDialogFragment;
import com.yunbao.common.dialog.SlideSettingsDialog; import com.yunbao.common.dialog.SlideSettingsDialog;
import com.yunbao.common.event.FollowEvent; import com.yunbao.common.event.FollowEvent;
@ -64,7 +66,6 @@ import com.yunbao.common.views.weight.VerticalViewPager;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.adapter.VerticalPagerAdapter; import com.yunbao.live.adapter.VerticalPagerAdapter;
import com.yunbao.live.bean.ImUserBean; import com.yunbao.live.bean.ImUserBean;
import com.yunbao.common.bean.LiveBean;
import com.yunbao.live.bean.LiveChatBean; import com.yunbao.live.bean.LiveChatBean;
import com.yunbao.live.dialog.LiveFansFragment; import com.yunbao.live.dialog.LiveFansFragment;
import com.yunbao.live.dialog.LiveGiftDialogFragment; import com.yunbao.live.dialog.LiveGiftDialogFragment;
@ -267,7 +268,6 @@ public class LiveAudienceActivity extends LiveActivity {
// 满足此种条件表明需要加载直播视频以及聊天室了 // 满足此种条件表明需要加载直播视频以及聊天室了
if (viewGroup.getId() == mCurrentItem && (position == 0) && mCurrentItem != mLastPosition) { if (viewGroup.getId() == mCurrentItem && (position == 0) && mCurrentItem != mLastPosition) {
loadData(viewGroup, mCurrentItem); loadData(viewGroup, mCurrentItem);
manager.onPause();
} }
} }
@ -768,6 +768,11 @@ public class LiveAudienceActivity extends LiveActivity {
EffectsSettingsDialog effectsSettingsDialog = new EffectsSettingsDialog(); EffectsSettingsDialog effectsSettingsDialog = new EffectsSettingsDialog();
effectsSettingsDialog.show(getSupportFragmentManager(), "EffectsSettingsDialog"); effectsSettingsDialog.show(getSupportFragmentManager(), "EffectsSettingsDialog");
break; break;
case FLOAT_SETTING:
FloatSettingsDialog floatSettingsDialog = new FloatSettingsDialog();
floatSettingsDialog.show(getSupportFragmentManager(), "FloatSettingsDialog");
manager.setQuitF(true);
break;
case WISH_LIST: case WISH_LIST:
LiveWishListDialogFragment4Audience fragment4Audience = new LiveWishListDialogFragment4Audience(); LiveWishListDialogFragment4Audience fragment4Audience = new LiveWishListDialogFragment4Audience();
bundle.putString(Constants.LIVE_UID, mLiveUid); bundle.putString(Constants.LIVE_UID, mLiveUid);

View File

@ -10,13 +10,13 @@ import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.R; import com.yunbao.common.R;
import com.yunbao.common.bean.ActiveModel; import com.yunbao.common.bean.ActiveModel;
import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.dialog.AbsDialogFragment; import com.yunbao.common.dialog.AbsDialogFragment;
import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.Bus;
import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.live.adapter.FunGamesAdapter; import com.yunbao.live.adapter.FunGamesAdapter;
import com.yunbao.common.bean.LiveBean;
import com.yunbao.live.event.LiveAudienceEvent; import com.yunbao.live.event.LiveAudienceEvent;
import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.Subscribe;
@ -149,6 +149,13 @@ public class LiveTotalDialog extends AbsDialogFragment {
.setType(LiveAudienceEvent.LiveAudienceType.SLIDE_SETTINGS)); .setType(LiveAudienceEvent.LiveAudienceType.SLIDE_SETTINGS));
dismiss(); dismiss();
}); });
//悬浮窗设置
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.float_settings_layout), () -> {
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.FLOAT_SETTING));
dismiss();
}
);
} }
@Override @Override

View File

@ -4,8 +4,8 @@ import com.yunbao.common.bean.ActiveModel;
import com.yunbao.common.bean.AiAutomaticSpeechModel; import com.yunbao.common.bean.AiAutomaticSpeechModel;
import com.yunbao.common.bean.AnchorRecommendItemModel; import com.yunbao.common.bean.AnchorRecommendItemModel;
import com.yunbao.common.bean.BaseModel; import com.yunbao.common.bean.BaseModel;
import com.yunbao.common.bean.MsgModel;
import com.yunbao.common.bean.LiveBean; import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.bean.MsgModel;
import com.yunbao.live.bean.OpenParametersModel; import com.yunbao.live.bean.OpenParametersModel;
public class LiveAudienceEvent extends BaseModel { public class LiveAudienceEvent extends BaseModel {
@ -148,7 +148,8 @@ public class LiveAudienceEvent extends BaseModel {
START_MESSAGE(25, "星级消息"), START_MESSAGE(25, "星级消息"),
AI_AUTOMATIC_SPEECH(26, "机器人助手"), AI_AUTOMATIC_SPEECH(26, "机器人助手"),
STAR_CHALLENGE_UPGRADE_NOTIFY(27, "星级挑战成功"), STAR_CHALLENGE_UPGRADE_NOTIFY(27, "星级挑战成功"),
MESSAGE_BOTTOM(28, "聊天消息滚动到底部"); MESSAGE_BOTTOM(28, "聊天消息滚动到底部"),
FLOAT_SETTING(29, "悬浮窗设置");
private int type; private int type;
private String name; private String name;

View File

@ -1,148 +0,0 @@
package com.yunbao.live.views;
import android.app.Activity;
import android.text.TextUtils;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import com.lzf.easyfloat.EasyFloat;
import com.lzf.easyfloat.enums.ShowPattern;
import com.lzf.easyfloat.interfaces.FloatCallbacks;
import com.lzf.easyfloat.interfaces.OnInvokeView;
import com.tencent.live2.V2TXLivePlayer;
import com.tencent.live2.impl.V2TXLivePlayerImpl;
import com.tencent.rtmp.ui.TXCloudVideoView;
import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.live.R;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
/**
* 直播间悬浮窗管理
*/
public class LiveFloatView implements Function1<FloatCallbacks.Builder, Unit> {
private static LiveFloatView instance;
private LiveOnInvokeView liveOnInvokeView = null;
private Activity mContext;
private String url;
private LiveBean mLiveBean;
private int mLiveType;
private int mLiveSDK;
private int mLiveTypeVal;
private FloatCallbacks.Builder builder;
private String TAG = "LiveFloatView";
private V2TXLivePlayer mPlayer;
public static LiveFloatView getInstance() {
if (instance == null) {
instance = new LiveFloatView();
}
return instance;
}
public void builderFloat(Activity mContext, String url) {
liveOnInvokeView = new LiveOnInvokeView();
this.mContext = mContext;
this.url = url;
EasyFloat.with(mContext)
.setTag(TAG)
.setLayout(R.layout.view_flaot_live, liveOnInvokeView)
.setShowPattern(ShowPattern.CURRENT_ACTIVITY)
.setGravity(Gravity.END | Gravity.CENTER_VERTICAL, 0, 200)
.registerCallback(this)
.show();
}
public void builderSystemFloat(Activity mContext, String url) {
liveOnInvokeView = new LiveOnInvokeView();
this.mContext = mContext;
this.url = url;
EasyFloat.with(mContext)
.setTag(TAG)
.setLayout(R.layout.view_flaot_live, liveOnInvokeView)
.setShowPattern(ShowPattern.ALL_TIME)
.setGravity(Gravity.END | Gravity.CENTER_VERTICAL, 0, 200)
.registerCallback(this)
.show();
}
public LiveFloatView cacheLiveData(LiveBean mLiveBean, int mLiveType, int mLiveSDK, int mLiveTypeVal) {
this.mLiveBean = mLiveBean;
this.mLiveType = mLiveType;
this.mLiveSDK = mLiveSDK;
this.mLiveTypeVal = mLiveTypeVal;
return instance;
}
@Override
public Unit invoke(FloatCallbacks.Builder builder) {
this.builder = builder;
builder.createResult((aBoolean, s, view) -> {
Log.e("LiveFloatView", "aBoolean:" + aBoolean + "---------------------s:" + s);
if (callback != null) {
callback.invoke(aBoolean);
}
builder.dismiss(() -> {
if (mPlayer != null && mPlayer.isPlaying() == 1) {
mPlayer.stopPlay();
}
return null;
});
builder.hide(view12 -> {
if (mPlayer != null && mPlayer.isPlaying() == 1) {
mPlayer.pauseAudio();
mPlayer.pauseVideo();
}
return null;
});
return null;
});
return null;
}
/**
* 悬浮窗布局管理
*/
private class LiveOnInvokeView implements OnInvokeView {
@Override
public void invoke(View view) {
TXCloudVideoView videoView = view.findViewById(R.id.video_view);
mPlayer = new V2TXLivePlayerImpl(mContext);
mPlayer.setRenderView(videoView);
mPlayer.startPlay(url);
ViewClicksAntiShake.clicksAntiShake(view.findViewById(R.id.btn_close), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
mPlayer.stopPlay();
EasyFloat.dismiss("LiveFloatView", true);
}
});
ViewClicksAntiShake.clicksAntiShake(videoView, () -> {
mPlayer.stopPlay();
RouteUtil.forwardLiveAudienceActivity(mLiveBean, mLiveType, mLiveSDK, mLiveTypeVal);
});
}
}
private LiveFloatViewCallback callback;
public LiveFloatView setCallback(LiveFloatViewCallback callback) {
this.callback = callback;
return this;
}
public interface LiveFloatViewCallback {
void invoke(Boolean aBoolean);
}
}

View File

@ -30,6 +30,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.blankj.utilcode.util.GsonUtils; import com.blankj.utilcode.util.GsonUtils;
import com.facebook.appevents.AppEventsLogger; import com.facebook.appevents.AppEventsLogger;
import com.lzf.easyfloat.EasyFloat;
import com.lzf.easyfloat.permission.PermissionUtils; import com.lzf.easyfloat.permission.PermissionUtils;
import com.tencent.imsdk.v2.V2TIMCallback; import com.tencent.imsdk.v2.V2TIMCallback;
import com.tencent.imsdk.v2.V2TIMManager; import com.tencent.imsdk.v2.V2TIMManager;
@ -57,6 +58,7 @@ import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.utils.formatBigNum; import com.yunbao.common.utils.formatBigNum;
import com.yunbao.common.views.weight.LiveFloatView;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.activity.LiveAudienceActivity; import com.yunbao.live.activity.LiveAudienceActivity;
@ -175,6 +177,13 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
private OpenParametersModel openParametersModel = null; private OpenParametersModel openParametersModel = null;
//星级活动地址 //星级活动地址
private String activityUrl = ""; private String activityUrl = "";
//标记是调用正常退出还是手动切后台
private boolean isQuitF = false;
public PortraitLiveManager setQuitF(boolean quitF) {
isQuitF = quitF;
return this;
}
public PortraitLiveManager(Activity context, Intent intent) { public PortraitLiveManager(Activity context, Intent intent) {
this.mContext = context; this.mContext = context;
@ -348,70 +357,23 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveRyLinkMicPkPresenter.release(); mLiveRyLinkMicPkPresenter.release();
} }
if (isQuit) { if (isQuit) {
isQuitF = true;
if (PermissionUtils.checkPermission(mContext)) { if (PermissionUtils.checkPermission(mContext)) {
LiveFloatView.getInstance() LiveFloatView.getInstance()
.cacheLiveData(mLiveBean, mLiveType, mLiveSDK, mLiveTypeVal) .cacheLiveData(mLiveBean, mLiveType, mLiveSDK, mLiveTypeVal)
.builderSystemFloat(mContext, mLiveBean.getPull()); .builderSystemFloat(mContext, mLiveBean.getPull());
mContext.finish(); mContext.finish();
} else { } else {
if (mContext instanceof LiveAudienceActivity) {
if (IMLoginManager.get(mContext).isFloat()) { if (IMLoginManager.get(mContext).isFloat()) {
DialogUitl.showSimpleDialog(mContext, null, "您未打开悬浮窗权限,是否打开", false, new DialogUitl.SimpleCallback3() {
@Override
public void onConfirmClick(Dialog dialog) {
LiveFloatView.getInstance()
.setCallback(new LiveFloatView.LiveFloatViewCallback() {
@Override
public void invoke(Boolean aBoolean) {
if (aBoolean) {
mContext.finish();
} else {
EventBus.getDefault() EventBus.getDefault()
.post(new LiveFloatEvent() .post(new LiveFloatEvent()
.setmLiveBean(mLiveBean) .setmLiveBean(mLiveBean)
.setmLiveSDK(mLiveSDK) .setmLiveSDK(mLiveSDK)
.setmLiveType(mLiveType) .setmLiveType(mLiveType)
.setmLiveTypeVal(mLiveTypeVal)); .setmLiveTypeVal(mLiveTypeVal));
mContext.finish();
IMLoginManager.get(mContext).initFloat(true);
}
}
})
.cacheLiveData(mLiveBean, mLiveType, mLiveSDK, mLiveTypeVal)
.builderSystemFloat(mContext, mLiveBean.getPull());
} }
@Override
public void onCancel() {
EventBus.getDefault()
.post(new LiveFloatEvent()
.setmLiveBean(mLiveBean)
.setmLiveSDK(mLiveSDK)
.setmLiveType(mLiveType)
.setmLiveTypeVal(mLiveTypeVal));
mContext.finish(); mContext.finish();
IMLoginManager.get(mContext).initFloat(false);
}
});
} else {
EventBus.getDefault()
.post(new LiveFloatEvent()
.setmLiveBean(mLiveBean)
.setmLiveSDK(mLiveSDK)
.setmLiveType(mLiveType)
.setmLiveTypeVal(mLiveTypeVal));
mContext.finish();
}
}
// PermissionUtils.requestPermission(mContext, new OnPermissionResult() {
// @Override
// public void permissionResult(boolean b) {
// ToastUtil.show("悬浮窗权限:"+b);
// }
// });
} }
} }
} }
@ -430,12 +392,23 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
public void onResume() { public void onResume() {
// if (mLivePlayViewHolder != null) // if (mLivePlayViewHolder != null)
// mLivePlayViewHolder.onResume(); // mLivePlayViewHolder.onResume();
//判断是否有直播悬浮窗有直接关闭
if (EasyFloat.isShow("LiveFloatView")) {
EasyFloat.dismiss("LiveFloatView", true);
}
} }
@Override @Override
public void onPause() { public void onPause() {
// if (mLivePlayViewHolder != null) // if (mLivePlayViewHolder != null)
// mLivePlayViewHolder.onPause(); // mLivePlayViewHolder.onPause();
if (mLiveBean != null && !isQuitF) {
LiveFloatView.getInstance()
.cacheLiveData(mLiveBean, mLiveType, mLiveSDK, mLiveTypeVal)
.builderSystemFloat(mContext, mLiveBean.getPull());
mContext.finish();
}
isQuitF = false;
} }
@Override @Override
@ -1033,7 +1006,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
@Override @Override
public void onHourRank(LiveChatBean bean, JSONObject ranks) { public void onHourRank(LiveChatBean bean, JSONObject ranks) {
if (mLiveRoomViewHolder != null) { if (mLiveRoomViewHolder != null && !TextUtils.isEmpty(liveID)) {
mLiveRoomViewHolder.setHourRankData(ranks.getInteger(liveID)); mLiveRoomViewHolder.setHourRankData(ranks.getInteger(liveID));
} }
} }

View File

@ -1,6 +1,7 @@
package com.yunbao.live.views; package com.yunbao.live.views;
import android.app.Activity; import android.app.Activity;
import android.app.Dialog;
import android.view.View; import android.view.View;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
@ -11,6 +12,7 @@ import com.ms.banner.Banner;
import com.yunbao.common.activity.WebViewActivity; import com.yunbao.common.activity.WebViewActivity;
import com.yunbao.common.bean.SlideInfoModel; import com.yunbao.common.bean.SlideInfoModel;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.views.SlideInBannerViewHolder; import com.yunbao.common.views.SlideInBannerViewHolder;
import com.yunbao.live.R; import com.yunbao.live.R;
@ -26,11 +28,13 @@ import java.util.Map;
public class SidebarViewHoler extends RecyclerView.ViewHolder { public class SidebarViewHoler extends RecyclerView.ViewHolder {
//侧边栏轮播 //侧边栏轮播
private Banner mBanner; private Banner mBanner;
private Dialog mShowLoadingDialog;
public SidebarViewHoler(@NonNull View itemView) { public SidebarViewHoler(@NonNull View itemView) {
super(itemView); super(itemView);
//侧边栏轮播 //侧边栏轮播
mBanner = itemView.findViewById(R.id.banner); mBanner = itemView.findViewById(R.id.banner);
mShowLoadingDialog = DialogUitl.loadingDialog(itemView.getContext());
} }
@ -52,6 +56,7 @@ public class SidebarViewHoler extends RecyclerView.ViewHolder {
if (p >= 0 && p < data.size()) { if (p >= 0 && p < data.size()) {
SlideInfoModel bean = data.get(p); SlideInfoModel bean = data.get(p);
if (bean != null) { if (bean != null) {
showLoadingDialog();
String link = bean.getSlideUrl(); String link = bean.getSlideUrl();
if (link.contains("http")) { if (link.contains("http")) {
WebViewActivity.forward(itemView.getContext(), link, true); WebViewActivity.forward(itemView.getContext(), link, true);
@ -76,6 +81,7 @@ public class SidebarViewHoler extends RecyclerView.ViewHolder {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
LiveRoomCheckLivePresenter mCheckLivePresenter = new LiveRoomCheckLivePresenter(itemView.getContext(), (liveBean1, liveType, liveTypeVal, liveSdk) -> { LiveRoomCheckLivePresenter mCheckLivePresenter = new LiveRoomCheckLivePresenter(itemView.getContext(), (liveBean1, liveType, liveTypeVal, liveSdk) -> {
if (liveBean1 == null) { if (liveBean1 == null) {
mShowLoadingDialog.dismiss();
return; return;
} }
Map<String, String> map = null; Map<String, String> map = null;
@ -84,15 +90,23 @@ public class SidebarViewHoler extends RecyclerView.ViewHolder {
map.put("OPEN", "NEWUSER"); map.put("OPEN", "NEWUSER");
} }
LiveAudienceActivity.forward(itemView.getContext(), liveBean1, liveType, liveTypeVal, "", map, 0, liveSdk); LiveAudienceActivity.forward(itemView.getContext(), liveBean1, liveType, liveTypeVal, "", map, 0, liveSdk);
mShowLoadingDialog.dismiss();
((Activity) itemView.getContext()).finish(); ((Activity) itemView.getContext()).finish();
}); });
mCheckLivePresenter.checkLive(liveBean); mCheckLivePresenter.checkLive(liveBean);
} else { } else {
mShowLoadingDialog.dismiss();
RouteUtil.forwardUserHome(itemView.getContext(), liveId, 0); RouteUtil.forwardUserHome(itemView.getContext(), liveId, 0);
((Activity) itemView.getContext()).finish(); ((Activity) itemView.getContext()).finish();
} }
} }
}); });
} }
/**
* Banner双击可能会导致进入两次直播间点击Banner后需要展示加载中动画
*/
private void showLoadingDialog(){
mShowLoadingDialog.show();
}
} }

View File

@ -1,38 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="210dp"
android:layout_height="wrap_content">
<androidx.cardview.widget.CardView
android:layout_width="230dp"
android:layout_height="130dp"
android:layout_marginStart="25dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
app:cardCornerRadius="4dp"
app:cardElevation="0dp">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="1dp"
app:cardCornerRadius="4dp"
app:cardElevation="0dp">
<com.tencent.rtmp.ui.TXCloudVideoView
android:id="@+id/video_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</androidx.cardview.widget.CardView>
</androidx.cardview.widget.CardView>
<ImageView
android:id="@+id/btn_close"
android:layout_width="50dp"
android:layout_height="50dp"
android:paddingBottom="30dp"
android:src="@mipmap/icon_live_close_3" />
</RelativeLayout>

View File

@ -91,7 +91,7 @@ import com.yunbao.live.http.LiveHttpUtil;
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
import com.yunbao.live.utils.LiveStorge; import com.yunbao.live.utils.LiveStorge;
import com.yunbao.live.views.ChatListViewHolder; import com.yunbao.live.views.ChatListViewHolder;
import com.yunbao.live.views.LiveFloatView; import com.yunbao.common.views.weight.LiveFloatView;
import com.yunbao.main.R; import com.yunbao.main.R;
import com.yunbao.main.dialog.MainStartDialogFragment; import com.yunbao.main.dialog.MainStartDialogFragment;
import com.yunbao.main.dialog.ReturnUserDialog; import com.yunbao.main.dialog.ReturnUserDialog;

View File

@ -36,9 +36,7 @@ import com.opensource.svgaplayer.SVGAVideoEntity;
import com.yunbao.common.activity.AbsActivity; import com.yunbao.common.activity.AbsActivity;
import com.yunbao.common.activity.WebViewActivity; import com.yunbao.common.activity.WebViewActivity;
import com.yunbao.common.bean.ImUserInfoModel; import com.yunbao.common.bean.ImUserInfoModel;
import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.custom.TabButtonGroup; import com.yunbao.common.custom.TabButtonGroup;
import com.yunbao.common.event.LiveFloatEvent;
import com.yunbao.common.event.MessageIMEvent; import com.yunbao.common.event.MessageIMEvent;
import com.yunbao.common.event.UpdateTablePointMe; import com.yunbao.common.event.UpdateTablePointMe;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
@ -50,18 +48,12 @@ import com.yunbao.common.manager.imrongcloud.MessageIMManager;
import com.yunbao.common.utils.DeviceUtils; import com.yunbao.common.utils.DeviceUtils;
import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.ProcessResultUtil; import com.yunbao.common.utils.ProcessResultUtil;
import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.SVGAViewUtils; import com.yunbao.common.utils.SVGAViewUtils;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.live.activity.LiveAudienceActivity;
import com.yunbao.live.activity.SystemMessageActivity; import com.yunbao.live.activity.SystemMessageActivity;
import com.yunbao.live.bean.ImUserBean; import com.yunbao.live.bean.ImUserBean;
import com.yunbao.live.event.RecommendLiveRoomEvent;
import com.yunbao.live.http.ImHttpUtil; import com.yunbao.live.http.ImHttpUtil;
import com.yunbao.live.http.LiveHttpUtil;
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
import com.yunbao.live.views.LiveFloatView;
import com.yunbao.main.R; import com.yunbao.main.R;
import com.yunbao.main.adapter.SystemMessageAdapter; import com.yunbao.main.adapter.SystemMessageAdapter;
import com.yunbao.main.dialog.MainStartDialogFragment; import com.yunbao.main.dialog.MainStartDialogFragment;

View File

@ -1,3 +1,4 @@
include ':app', ':video', ':common', ':main', ':live', ':lib_country_code' include ':app', ':video', ':common', ':main', ':baidu', ':live', ':lib_country_code'
include ':FaceUnity' include ':FaceUnity'
//include ':baidu' //include ':baidu'
//include ':recognizer'//