1:修改拍卖房背景

2:修改小黑屋报错问题
This commit is contained in:
2025-10-12 23:38:12 +08:00
parent 773db1da25
commit c1d13cd34c
12 changed files with 169 additions and 50 deletions

View File

@@ -29,7 +29,7 @@ isBuildModule=false
android.injected.testOnly=false
APP_VERSION_NAME=1.2.7
APP_VERSION_CODE=179
APP_VERSION_CODE=180
org.gradle.jvm.toolchain.useLegacyAdapters=false
#org.gradle.java.home=C\:\\Users\\qx\\.jdks\\ms-17.0.15

View File

@@ -184,7 +184,7 @@ dependencies {
// api( 'io.agora.rtc:agora-special-full:4.1.1.29')
api('com.github.AgoraIO-Community:LyricsView:1.1.3')
//声网集成屏幕共享
def agora_sdk_version = "4.5.2"
def agora_sdk_version = "4.6.0"
api "io.agora.rtc:full-sdk:${agora_sdk_version}"
// api("io.agora.rtc:lite-sdk:${agora_sdk_version}")
// api ("io.agora.rtc:voice-sdk:${agora_sdk_version}")

View File

@@ -2,25 +2,33 @@ package com.xscm.moduleutil.rtc;
import static com.blankj.utilcode.util.SnackbarUtils.getView;
import static io.agora.rtc2.video.VideoEncoderConfiguration.*;
import static io.agora.rtc2.video.VideoEncoderConfiguration.FRAME_RATE.FRAME_RATE_FPS_15;
import static io.agora.rtc2.video.VideoEncoderConfiguration.ORIENTATION_MODE.ORIENTATION_MODE_ADAPTIVE;
import static io.agora.rtc2.video.VideoEncoderConfiguration.STANDARD_BITRATE;
import static io.agora.rtc2.video.VideoEncoderConfiguration.VD_640x360;
import static io.agora.rtc2.video.VideoEncoderConfiguration.FRAME_RATE.FRAME_RATE_FPS_30;
import static io.agora.rtc2.video.VideoEncoderConfiguration.ORIENTATION_MODE.*;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.hardware.SensorManager;
import android.media.projection.MediaProjection;
import android.media.projection.MediaProjectionManager;
import android.os.Handler;
import android.os.Looper;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.Display;
import android.view.OrientationEventListener;
import android.view.SurfaceView;
import android.view.WindowManager;
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.blankj.utilcode.util.GsonUtils;
import com.blankj.utilcode.util.LogUtils;
import com.blankj.utilcode.util.PathUtils;
import com.blankj.utilcode.util.ThreadUtils;
import com.blankj.utilcode.util.*;
import com.liulishuo.okdownload.DownloadTask;
import com.liulishuo.okdownload.StatusUtil;
import com.liulishuo.okdownload.core.cause.EndCause;
@@ -43,6 +51,7 @@ import org.greenrobot.eventbus.EventBus;
import java.io.File;
import java.io.FileInputStream;
import java.lang.reflect.Field;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
@@ -206,21 +215,50 @@ public class AgoraManager {
/*Enable video module*/
rtcEngine.enableVideo();
// Setup video encoding configs
rtcEngine.setVideoEncoderConfiguration(new VideoEncoderConfiguration(
VD_640x360,
FRAME_RATE_FPS_15,
STANDARD_BITRATE,
ORIENTATION_MODE_ADAPTIVE
));
// rtcEngine.setVideoEncoderConfiguration(new VideoEncoderConfiguration(
// VD_640x360,
// FRAME_RATE_FPS_30,
// STANDARD_BITRATE,
// ORIENTATION_MODE_FIXED_PORTRAIT
// ));
/*Set up to play remote sound with receiver*/
rtcEngine.setDefaultAudioRoutetoSpeakerphone(true);
// OrientationEventListener orientationListener = new OrientationEventListener(context,
// SensorManager.SENSOR_DELAY_NORMAL) {
// @Override
// public void onOrientationChanged(int orientation) {
// int angle = calculateScreenAngle(orientation);
// try {
// rtcEngine.setVideoOrientation(angle); // 通知声网引擎调整视频方向
// } catch (Exception e) {
// Log.e("AgoraManager", "Set video orientation failed", e);
// }
// }
// };
// orientationListener.enable(); // 启用监听
} catch (Exception e) {
Log.e("AgoraManager", "Failed to configure RtcEngine", e);
}
}
}
}
public static int calculateScreenAngle(int orientation) {
if (orientation >= 315 || orientation < 45) {
return 0; // 竖屏0度
} else if (orientation >= 45 && orientation < 135) {
return 90; // 横屏右90度
} else if (orientation >= 135 && orientation < 225) {
return 180; // 倒竖屏180度
} else {
return 270; // 横屏左270度
}
}
/**
* 加入语音聊天房间
*/
@@ -802,14 +840,58 @@ public class AgoraManager {
// rtcEngine.setDefaultAudioRoutetoSpeakerphone(true);
ScreenCaptureParameters screenCaptureParameters = new ScreenCaptureParameters();
// screenCaptureParameters.captureVideo = true;
// screenCaptureParameters.videoCaptureParameters.width = 1440;
// screenCaptureParameters.videoCaptureParameters.height = 1940;
// screenCaptureParameters.videoCaptureParameters.framerate = 15;
// screenCaptureParameters.captureAudio = true;
// screenCaptureParameters.audioCaptureParameters.captureSignalVolume = 50;
//// screenCaptureParameters.videoCaptureParameters.bitrate = 500;
// rtcEngine.startScreenCapture(screenCaptureParameters);
WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
Display display = manager.getDefaultDisplay();
DisplayMetrics outMetrics=new DisplayMetrics();
display.getMetrics(outMetrics);
// // 设置屏幕采集的参数
screenCaptureParameters.captureVideo = true;
screenCaptureParameters.videoCaptureParameters.width = 720;
screenCaptureParameters.videoCaptureParameters.height = 920;
screenCaptureParameters.videoCaptureParameters.width = outMetrics.widthPixels;
screenCaptureParameters.videoCaptureParameters.height = outMetrics.heightPixels;
// screenCaptureParameters.videoCaptureParameters.height = (int) (3840 * 1.0f / outMetrics.widthPixels * outMetrics.heightPixels);
screenCaptureParameters.videoCaptureParameters.framerate = 15;
screenCaptureParameters.captureAudio = true;
screenCaptureParameters.audioCaptureParameters.captureSignalVolume =50;
screenCaptureParameters.videoCaptureParameters.contentHint=1 ;
rtcEngine.setVideoEncoderConfiguration(new VideoEncoderConfiguration(
VD_360x360,
FRAME_RATE_FPS_15,
STANDARD_BITRATE,
ORIENTATION_MODE_FIXED_PORTRAIT
));
rtcEngine.startScreenCapture(screenCaptureParameters);
}
}
public void setExternalMediaProjection(MediaProjection[] mediaProjection){
rtcEngine.setExternalMediaProjection(mediaProjection[0]);
}
public void isPost(){
if (rtcEngine != null){
ScreenCaptureParameters screenCaptureParameters = new ScreenCaptureParameters();
// 设置新的屏幕共享参数
screenCaptureParameters.captureVideo = true;
screenCaptureParameters.videoCaptureParameters.width = 1280;
screenCaptureParameters.videoCaptureParameters.height = 720;
screenCaptureParameters.videoCaptureParameters.framerate = 30;
// 更新屏幕共享参数
rtcEngine.updateScreenCaptureParameters(screenCaptureParameters);
}
}

View File

@@ -145,6 +145,7 @@ public class RoomMakeWheatView extends BaseWheatView {
iv_tag_type.setVisibility(GONE);
mCharmView.setVisibility(GONE);
mTvName.setText(pitBean.getNickname()!=null && !pitBean.getNickname().equals("")?pitBean.getNickname():"拍卖者");
mTvName.setBackgroundResource(com.xscm.moduleutil.R.mipmap.za_maiw_b);
}else if (pitBean.getPit_number().equals("9")){
iv_tag_type.setVisibility(VISIBLE);
mCharmView.setVisibility(GONE);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

View File

@@ -1096,8 +1096,8 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
val params = layoutParams
params.width = ConstraintLayout.LayoutParams.MATCH_CONSTRAINT
params.height = ConstraintLayout.LayoutParams.MATCH_CONSTRAINT
params.horizontalBias = 0.5f
params.verticalBias = 0.5f
// params.horizontalBias = 0.5f
// params.verticalBias = 0.5f
floatingMagnetView!!.layoutParams = params
} else {
// 如果不是ConstraintLayout.LayoutParams创建新的
@@ -3931,10 +3931,13 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
val roomBean = resp.room_info
if (roomBean!!.type_id.equals("6")){
return
}
this.mRoomBean = roomBean
this.mRoomUserBean = resp.user_info
this.mRoomOwnerBean = resp.room_owner
this.mPitList = mRoomBean!!.pit_list
this.mPitList = mRoomBean!!.pit_list!!
ImageUtils.loadHeadCC(resp.room_info.room_cover, mBinding!!.roomTop.avatar)
mBinding!!.roomTop.name.text = roomBean.room_name

View File

@@ -680,10 +680,13 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
mBinding.pB.setImageResource(com.xscm.moduleutil.R.mipmap.za_t);
mBinding.btnRelation.setImageResource(com.xscm.moduleutil.R.mipmap.za_g);
mBinding.tvRelation.setTextColor(ContextCompat.getColor(requireContext(), com.xscm.moduleutil.R.color.color_white));
mBinding.tvRelation.setBackgroundResource(com.xscm.moduleutil.R.mipmap.za_maiw_b);
mBinding.btnGift.setImageResource(com.xscm.moduleutil.R.mipmap.za_l);
mBinding.tvGift.setTextColor(ContextCompat.getColor(requireContext(), com.xscm.moduleutil.R.color.color_white));
mBinding.tvGift.setBackgroundResource(com.xscm.moduleutil.R.mipmap.za_maiw_b);
mBinding.btnTime.setImageResource(com.xscm.moduleutil.R.mipmap.za_sj);
mBinding.tvTimetg.setTextColor(ContextCompat.getColor(requireContext(), com.xscm.moduleutil.R.color.color_white));
mBinding.tvTimetg.setBackgroundResource(com.xscm.moduleutil.R.mipmap.za_maiw_b);
mBinding.ivJp.setImageResource(com.xscm.moduleutil.R.mipmap.za_ljjp);
mBinding.avatar4.setImageResource(com.xscm.moduleutil.R.mipmap.za_m);
mBinding.avatar5.setImageResource(com.xscm.moduleutil.R.mipmap.za_m);
@@ -696,10 +699,13 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
mBinding.ivAuction1.setImageResource(com.xscm.moduleutil.R.mipmap.za_m, 0, "0");
mBinding.ivAuction2.setImageResource(com.xscm.moduleutil.R.mipmap.za_m, 0, "0");
mBinding.ivAuction3.setImageResource(com.xscm.moduleutil.R.mipmap.za_m, 0, "0");
mBinding.nickName1.setTextColor(ContextCompat.getColor(requireContext(), com.xscm.moduleutil.R.color.color_white));
mBinding.nickName2.setTextColor(ContextCompat.getColor(requireContext(), com.xscm.moduleutil.R.color.color_white));
mBinding.nickName3.setTextColor(ContextCompat.getColor(requireContext(), com.xscm.moduleutil.R.color.color_white));
setparams();
mBinding.clBj1.setBackgroundResource(com.xscm.moduleutil.R.mipmap.za_maiw);
mBinding.clBj2.setBackgroundResource(com.xscm.moduleutil.R.mipmap.za_maiw);
mBinding.clBj3.setBackgroundResource(com.xscm.moduleutil.R.mipmap.za_maiw);
mBinding.clBj1.setBackgroundResource(com.xscm.moduleutil.R.mipmap.za_maiw_o);
mBinding.clBj2.setBackgroundResource(com.xscm.moduleutil.R.mipmap.za_maiw_o);
mBinding.clBj3.setBackgroundResource(com.xscm.moduleutil.R.mipmap.za_maiw_o);
} else {
layoutParams.setMargins(0, 15, 0, 0);

View File

@@ -208,7 +208,7 @@ public class RoomCabinFragment extends BaseRoomFragment<RoomCabinPresenter, Room
}
});
if (!CommonAppContext.getInstance().isShowAg){
switchMic(1);
switchMic(2);
}else {
isShow = true;
switchMic(2);
@@ -218,12 +218,12 @@ public class RoomCabinFragment extends BaseRoomFragment<RoomCabinPresenter, Room
@Override
public void onClick(View v) {
// requestScreenCapture();
if (!isMicPlace) {
joinChannel();
isMicPlace = true;
mBinding.im3.setImageResource(com.xscm.moduleutil.R.mipmap.clogs_car);
CommonAppContext.getInstance().isMicPlace = true;
} else {
isMicPlace = false;
ToastUtils.show("将停止屏幕共享");
@@ -245,7 +245,31 @@ public class RoomCabinFragment extends BaseRoomFragment<RoomCabinPresenter, Room
// mBinding.im3.setVisibility(GONE);
// }
}
// 获取 MediaProjectionManager
// MediaProjectionManager mediaProjectionManager = (MediaProjectionManager) getSelfActivity().getSystemService(Context.MEDIA_PROJECTION_SERVICE);
// private MediaProjection[] mediaProjection = new MediaProjection[1];
// private final ActivityResultLauncher<Intent> mediaProjectionLauncher = registerForActivityResult(
// new ActivityResultContracts.StartActivityForResult(), result -> {
// if (result.getResultCode() == Activity.RESULT_OK) {
// try {
// // 获取申请到的 MediaProjection
// mediaProjection[0] = mediaProjectionManager
// .getMediaProjection(result.getResultCode(), result.getData());
// // r MediaProjection需要在 startScreenCapture 之前调用
//
// AgoraManager.getInstance(getActivity()).setExternalMediaProjection(mediaProjection);
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
// }
// );
// 请求屏幕捕获
private void requestScreenCapture() {
// Intent intent = mediaProjectionManager.createScreenCaptureIntent();
// mediaProjectionLauncher.launch(intent);
}
public void handleMsgType1028(RoomMessageEvent messageEvent){
if (messageEvent.getMsgType()==1028){
mBinding.tvHeartValue2.setText(messageEvent.getText().getHot_value());
@@ -417,6 +441,7 @@ public class RoomCabinFragment extends BaseRoomFragment<RoomCabinPresenter, Room
@Override
public void onExitRoom() {
CommonAppContext.getInstance().isMicPlace = false;
// 调用退出房间方法
if (label_id!=null && label_id.equals(LABEL_ID_MOVIE)){
MvpPre.quitRoom(roomId, SpUtil.getUserId() + "");
@@ -619,7 +644,7 @@ public class RoomCabinFragment extends BaseRoomFragment<RoomCabinPresenter, Room
if (cpUserBean != null) {
countDownTime(Long.parseLong(cpUserBean.getTime_day()));
}
mediaProjectionManager = (MediaProjectionManager) getContext().getSystemService(Context.MEDIA_PROJECTION_SERVICE);
// mediaProjectionManager = (MediaProjectionManager) getContext().getSystemService(Context.MEDIA_PROJECTION_SERVICE);
}
@Override
@@ -674,22 +699,22 @@ public class RoomCabinFragment extends BaseRoomFragment<RoomCabinPresenter, Room
}
}
private MediaProjection[] mediaProjection = new MediaProjection[1];
private MediaProjectionManager mediaProjectionManager;
private final ActivityResultLauncher<Intent> mediaProjectionLauncher = registerForActivityResult(
new ActivityResultContracts.StartActivityForResult(),
result -> {
if (result.getResultCode() == Activity.RESULT_OK) {
try {
mediaProjection[0] = mediaProjectionManager
.getMediaProjection(result.getResultCode(), result.getData());
joinChannel();
} catch (Exception e) {
Log.e("RoomCabinFragment", "error msg: " + e.getMessage());
}
}
}
);
// private MediaProjection[] mediaProjection = new MediaProjection[1];
// private MediaProjectionManager mediaProjectionManager;
// private final ActivityResultLauncher<Intent> mediaProjectionLauncher = registerForActivityResult(
// new ActivityResultContracts.StartActivityForResult(),
// result -> {
// if (result.getResultCode() == Activity.RESULT_OK) {
// try {
// mediaProjection[0] = mediaProjectionManager
// .getMediaProjection(result.getResultCode(), result.getData());
// joinChannel();
// } catch (Exception e) {
// Log.e("RoomCabinFragment", "error msg: " + e.getMessage());
// }
// }
// }
// );
private void isConfig() {
@@ -818,9 +843,11 @@ public class RoomCabinFragment extends BaseRoomFragment<RoomCabinPresenter, Room
@Subscribe (threadMode = ThreadMode.MAIN)
public void roomInfoEvent(CabinEvent messageEvent) {
if (messageEvent.isJoined()){
if (CommonAppContext.getInstance().isMicPlace) {
isMicPlace = true;
}
}
}
@Override
public void onDestroy() {
@@ -831,10 +858,10 @@ public class RoomCabinFragment extends BaseRoomFragment<RoomCabinPresenter, Room
public void releaseResources(){
releaseCountDownTimer();
// ImageUtils.clearDiskCache(getActivity());
if (mediaProjection[0] != null) {
mediaProjection[0].stop();
mediaProjection[0] = null;
}
// if (mediaProjection[0] != null) {
// mediaProjection[0].stop();
// mediaProjection[0] = null;
// }
}
}