悬浮窗修改

This commit is contained in:
18401019693 2022-11-15 13:54:28 +08:00
parent da3398f1f9
commit 383e8c0859
3 changed files with 48 additions and 15 deletions

View File

@ -261,5 +261,5 @@ public interface PDLiveApi {
* 任务领取接口
*/
@GET("/api/public/?service=Task.sendTaskGift")
Observable<ResponseModel<Observable>> sendTaskGift(@Query("flag") String flag, @Query("type") String type);
Observable<ResponseModel<List<Observable>>> sendTaskGift(@Query("flag") String flag, @Query("type") String type);
}

View File

@ -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));
}
}
});

View File

@ -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<FloatCallbacks.Builder, Unit> {
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<FloatCallbacks.Builder, Unit> {
}
});
ViewClicksAntiShake.clicksAntiShake(magnetView.findViewById(R.id.btn_close), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
@ -200,9 +204,6 @@ public class LiveFloatView implements Function1<FloatCallbacks.Builder, Unit> {
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<FloatCallbacks.Builder, Unit> {
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() {