From 383e8c0859c25e8607324c12a007eff8f5749337 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Tue, 15 Nov 2022 13:54:28 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=82=AC=E6=B5=AE=E7=AA=97=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/yunbao/common/http/PDLiveApi.java | 2 +- .../views/DrawerTaskChildViewHolder.java | 7 ++- .../common/views/weight/LiveFloatView.java | 54 ++++++++++++++----- 3 files changed, 48 insertions(+), 15 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java index 0b42fddcd..bf6fccf34 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -261,5 +261,5 @@ public interface PDLiveApi { * 任务领取接口 */ @GET("/api/public/?service=Task.sendTaskGift") - Observable> sendTaskGift(@Query("flag") String flag, @Query("type") String type); + Observable>> sendTaskGift(@Query("flag") String flag, @Query("type") String type); } diff --git a/common/src/main/java/com/yunbao/common/views/DrawerTaskChildViewHolder.java b/common/src/main/java/com/yunbao/common/views/DrawerTaskChildViewHolder.java index 87e60bd2f..a41e297c2 100644 --- a/common/src/main/java/com/yunbao/common/views/DrawerTaskChildViewHolder.java +++ b/common/src/main/java/com/yunbao/common/views/DrawerTaskChildViewHolder.java @@ -68,8 +68,8 @@ public class DrawerTaskChildViewHolder extends RecyclerView.ViewHolder { ViewClicksAntiShake.clicksAntiShake(toReceive, new ViewClicksAntiShake.ViewClicksCallBack() { @Override public void onViewClicks() { - Bus.get().post(new CustomDrawerPopupEvent() - .setDisMiss(true)); + + if (TextUtils.equals(model.getStatus(), "2")) { LiveNetManager.get(itemView.getContext()) @@ -86,6 +86,9 @@ public class DrawerTaskChildViewHolder extends RecyclerView.ViewHolder { ToastUtil.show(error); } }); + }else { + Bus.get().post(new CustomDrawerPopupEvent() + .setDisMiss(true)); } } }); diff --git a/common/src/main/java/com/yunbao/common/views/weight/LiveFloatView.java b/common/src/main/java/com/yunbao/common/views/weight/LiveFloatView.java index 8c68b9ff7..47abc6d2a 100644 --- a/common/src/main/java/com/yunbao/common/views/weight/LiveFloatView.java +++ b/common/src/main/java/com/yunbao/common/views/weight/LiveFloatView.java @@ -9,7 +9,6 @@ import android.view.Gravity; import android.view.View; import android.widget.RelativeLayout; -import androidx.appcompat.app.AppCompatActivity; import androidx.cardview.widget.CardView; import androidx.fragment.app.FragmentActivity; @@ -17,9 +16,6 @@ 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.V2TXLivePlayerObserver; -import com.tencent.live2.impl.V2TXLivePlayerImpl; import com.tencent.rtmp.ITXLivePlayListener; import com.tencent.rtmp.TXLivePlayer; import com.tencent.rtmp.ui.TXCloudVideoView; @@ -29,17 +25,12 @@ import com.yunbao.common.dialog.HintDialog; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpClient; import com.yunbao.common.manager.IMLoginManager; -import com.yunbao.common.utils.DeviceUtils; import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.RouteUtil; -import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.views.floatingview.APPEasyFloat; import com.yunbao.common.views.floatingview.FloatingMagnetView; import com.yunbao.common.views.floatingview.MagnetViewListener; -import java.lang.ref.WeakReference; -import java.util.List; - import kotlin.Unit; import kotlin.jvm.functions.Function1; @@ -97,6 +88,18 @@ public class LiveFloatView implements Function1 { public void onPlayEvent(int event, Bundle param) { float videoWidth = param.getInt("EVT_PARAM1", 0); float videoHeight = param.getInt("EVT_PARAM2", 0); + Log.e("视频流有", "videoWidth:" + videoWidth + " videoHeight:" + videoHeight); + if (mLiveBean.getLandscape() != 1){ + if (videoWidth > 720) { + cardParams.height = DpUtil.dp2px(130); + cardParams.width = DpUtil.dp2px(230); + } else { + cardParams.height = DpUtil.dp2px(224); + cardParams.width = DpUtil.dp2px(126); + } + layout.setLayoutParams(cardParams); + } + } @Override @@ -104,6 +107,7 @@ public class LiveFloatView implements Function1 { } }); + ViewClicksAntiShake.clicksAntiShake(magnetView.findViewById(R.id.btn_close), new ViewClicksAntiShake.ViewClicksCallBack() { @Override public void onViewClicks() { @@ -200,9 +204,6 @@ public class LiveFloatView implements Function1 { public void invoke(View view) { TXCloudVideoView videoView = view.findViewById(R.id.video_view); CardView layout = view.findViewById(R.id.layout); - mPlayer = new TXLivePlayer(mContext); - mPlayer.setPlayerView(videoView); - mPlayer.startPlay(url, TXLivePlayer.PLAY_TYPE_LIVE_FLV); RelativeLayout.LayoutParams cardParams = (RelativeLayout.LayoutParams) layout.getLayoutParams(); if (mLiveBean.getLandscape() == 1) { cardParams.height = DpUtil.dp2px(130); @@ -212,6 +213,35 @@ public class LiveFloatView implements Function1 { cardParams.width = DpUtil.dp2px(126); } layout.setLayoutParams(cardParams); + mPlayer = new TXLivePlayer(mContext); + mPlayer.setPlayerView(videoView); + mPlayer.startPlay(url, TXLivePlayer.PLAY_TYPE_LIVE_FLV); + mPlayer.setPlayListener(new ITXLivePlayListener() { + @Override + public void onPlayEvent(int event, Bundle param) { + float videoWidth = param.getInt("EVT_PARAM1", 0); + float videoHeight = param.getInt("EVT_PARAM2", 0); + Log.e("视频流有", "videoWidth:" + videoWidth + " videoHeight:" + videoHeight); + if (mLiveBean.getLandscape() != 1){ + if (videoWidth > 720) { + cardParams.height = DpUtil.dp2px(130); + cardParams.width = DpUtil.dp2px(230); + } else { + cardParams.height = DpUtil.dp2px(224); + cardParams.width = DpUtil.dp2px(126); + } + layout.setLayoutParams(cardParams); + } + + } + + @Override + public void onNetStatus(Bundle bundle) { + + } + }); + + ViewClicksAntiShake.clicksAntiShake(view.findViewById(R.id.btn_close), new ViewClicksAntiShake.ViewClicksCallBack() { @Override public void onViewClicks() { From 85971339d4e3bd077340f55f8b8fecd39b48a347 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Tue, 15 Nov 2022 16:03:41 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BE=A7=E8=BE=B9=E6=A0=8F=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/yunbao/common/adapter/DrawerTaskAdapter.java | 7 ++++--- .../yunbao/common/event/CustomDrawerPopupEvent.java | 11 +++++++++++ .../yunbao/common/views/CustomDrawerPopupView.java | 4 ++++ .../main/java/com/yunbao/live/dialog/VoiceDialog.java | 2 +- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/adapter/DrawerTaskAdapter.java b/common/src/main/java/com/yunbao/common/adapter/DrawerTaskAdapter.java index b5954d649..ad6590af4 100644 --- a/common/src/main/java/com/yunbao/common/adapter/DrawerTaskAdapter.java +++ b/common/src/main/java/com/yunbao/common/adapter/DrawerTaskAdapter.java @@ -10,6 +10,8 @@ import androidx.recyclerview.widget.RecyclerView; import com.yunbao.common.R; import com.yunbao.common.bean.CustomSidebarChildModel; +import com.yunbao.common.event.CustomDrawerPopupEvent; +import com.yunbao.common.utils.Bus; import com.yunbao.common.views.DrawerTaskChildViewHolder; import java.util.ArrayList; @@ -38,9 +40,8 @@ public class DrawerTaskAdapter extends RecyclerView.Adapter { @Override public void giftSuccess(CustomSidebarChildModel model, int index) { //将领取的任务移动至任务列表尾部 - child.remove(index); - child.add(child.size() - 1, model); - notifyDataSetChanged(); + Bus.get().post(new CustomDrawerPopupEvent() + .setDisMiss(false).setRefresh(true)); } }); } diff --git a/common/src/main/java/com/yunbao/common/event/CustomDrawerPopupEvent.java b/common/src/main/java/com/yunbao/common/event/CustomDrawerPopupEvent.java index 0d383cd5e..a5fb8c5fa 100644 --- a/common/src/main/java/com/yunbao/common/event/CustomDrawerPopupEvent.java +++ b/common/src/main/java/com/yunbao/common/event/CustomDrawerPopupEvent.java @@ -19,6 +19,17 @@ public class CustomDrawerPopupEvent extends BaseModel { private boolean online = false; //举报 private boolean reportLayout = false; + //刷新 + private boolean refresh = false; + + public boolean isRefresh() { + return refresh; + } + + public CustomDrawerPopupEvent setRefresh(boolean refresh) { + this.refresh = refresh; + return this; + } public boolean isSystemNotice() { return systemNotice; diff --git a/common/src/main/java/com/yunbao/common/views/CustomDrawerPopupView.java b/common/src/main/java/com/yunbao/common/views/CustomDrawerPopupView.java index a9c09413c..3c75b4d08 100644 --- a/common/src/main/java/com/yunbao/common/views/CustomDrawerPopupView.java +++ b/common/src/main/java/com/yunbao/common/views/CustomDrawerPopupView.java @@ -219,6 +219,10 @@ public class CustomDrawerPopupView extends DrawerPopupView { dismiss(); callBack.reportLayout(); } + + } + if (event.isRefresh()) { + initData(); } //是否关闭弹窗 if (event.isDisMiss()) { diff --git a/live/src/main/java/com/yunbao/live/dialog/VoiceDialog.java b/live/src/main/java/com/yunbao/live/dialog/VoiceDialog.java index 307559f92..db1611661 100644 --- a/live/src/main/java/com/yunbao/live/dialog/VoiceDialog.java +++ b/live/src/main/java/com/yunbao/live/dialog/VoiceDialog.java @@ -62,7 +62,7 @@ public class VoiceDialog extends AbsDialogFragment { public String sendMessage() { - return voiceChat.getText().toString(); + return WordsTypeUtil.changeTraditional(builder.toString()); } @Override