Commit cb8081b3 by upwork.021

feat: 逻辑优化,ui优化,组件升级

parent 891d74ed
......@@ -33,7 +33,7 @@ ext {
//-------------- 功能组件 --------------
//mdt 组件
"ydl-tuicore" : "0.0.14",
"ydl-tuicore" : "0.0.15",
// "m-tuicore-ydl" : "0.0.10",
//第一步
"ydl-platform" : "0.0.40.95",
......
......@@ -111,7 +111,7 @@ public class TRTCCalling {
/**
* 当前是否在TRTC房间中
*/
private boolean mIsInRoom = false;
public boolean mIsInRoom = false;
private long mEnterRoomTime = 0;
/**
* 当前邀请列表
......@@ -318,8 +318,7 @@ public class TRTCCalling {
*/
private V2TIMSignalingListener mTIMSignallingListener = new V2TIMSignalingListener() {
@Override
public void onReceiveNewInvitation(String inviteID, String inviter, String groupID,
List<String> inviteeList, String data) {
public void onReceiveNewInvitation(String inviteID, String inviter, String groupID, List<String> inviteeList, String data) {
TRTCLogger.e(TAG, "onReceiveNewInvitation inviteID:" + inviteID + ", inviter:" + inviter
+ ", groupID:" + groupID + ", inviteeList:" + inviteeList + " data:" + data);
......@@ -336,8 +335,10 @@ public class TRTCCalling {
}
}
// 响铃
startRing();
if (!mIsInRoom){
// 响铃
startRing();
}
}
@Override
......@@ -927,6 +928,7 @@ public class TRTCCalling {
@Override
public void onExitRoom(int reason) {
TRTCLogger.d(TAG, "onExitRoom reason:" + reason);
mIsInRoom = false;
}
@Override
......@@ -1039,7 +1041,6 @@ public class TRTCCalling {
TRTCLogger.d(TAG, "stopCall");
mInviteMap.clear();
isOnCalling = false;
mIsInRoom = false;
mIsBeingCalled = true;
mEnterRoomTime = 0;
mCurCallID = "";
......@@ -1275,6 +1276,7 @@ public class TRTCCalling {
* trtc 退房
*/
private void exitRoom() {
mIsInRoom = false;
mTRTCCloud.stopLocalPreview();
mTRTCCloud.stopLocalAudio();
mTRTCCloud.exitRoom();
......
......@@ -22,6 +22,7 @@ import com.tencent.liteav.device.TXDeviceManager;
import com.tencent.qcloud.tuicore.R;
import com.tencent.qcloud.tuicore.calling.basic.UserModel;
import com.tencent.qcloud.tuicore.calling.basic.UserModelManager;
import com.tencent.qcloud.tuicore.calling.trtccalling.model.TRTCCalling;
import com.tencent.qcloud.tuicore.calling.trtccalling.model.impl.base.CallingInfoManager;
import com.tencent.qcloud.tuicore.util.StatusBarUtil;
import com.tencent.rtmp.ui.TXCloudVideoView;
......@@ -74,6 +75,8 @@ public class VideoCallingActivity extends TRTCBaseActivity implements View.OnCli
private List<ImageView> mIvNetWorkViewList;
private List<ImageView> mIvAudioViewList;
private List<TextView> mTvNameViewList;
private TextView tvAudio;
private TextView tvVideo;
private int mUserCount = 0;
private String mRoomId;
......@@ -81,6 +84,7 @@ public class VideoCallingActivity extends TRTCBaseActivity implements View.OnCli
private boolean mAudioRouteFlag = true;
private UserModel mUserModel;
@SuppressLint("NewApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
......@@ -88,28 +92,12 @@ public class VideoCallingActivity extends TRTCBaseActivity implements View.OnCli
StatusBarUtil.StatusBarLightMode(this);
handleIntent();
setContentView(R.layout.videocall_activity_calling);
// initStatusBar();
if (checkPermission()) {
initView();
enterRoom();
}
}
// @RequiresApi(api = Build.VERSION_CODES.M)
// private void initStatusBar() {
// Window window = getWindow();
// //取消设置透明状态栏,使 ContentView 内容不再覆盖状态栏
// window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
// //需要设置这个 flag 才能调用 setStatusBarColor 来设置状态栏颜色
// window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
// //设置状态栏颜色
//// window.setStatusBarColor(color);
// //状态栏白底黑字的实现方法
// window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
// //去掉系统状态栏下的windowContentOverlay
// findViewById(android.R.id.content).setForeground(null);
// }
private void handleIntent() {
Intent intent = getIntent();
if (null != intent) {
......@@ -132,7 +120,9 @@ public class VideoCallingActivity extends TRTCBaseActivity implements View.OnCli
btnVideo.setSelected(true);
btnAudio.setSelected(false);
ivVideo = findViewById(R.id.iv_video);
tvVideo = findViewById(R.id.tv_video);
ivAudio = findViewById(R.id.iv_audio);
tvAudio = findViewById(R.id.tv_audio);
tvLeave = findViewById(R.id.tv_leave);
ivNetworkMe = findViewById(R.id.iv_network_me);
ivAudioMe = findViewById(R.id.iv_audio_me);
......@@ -217,6 +207,7 @@ public class VideoCallingActivity extends TRTCBaseActivity implements View.OnCli
}
private void exitRoom() {
TRTCCalling.sharedInstance(this).mIsInRoom = false;
if (mTRTCCloud != null) {
mTRTCCloud.stopLocalAudio();
mTRTCCloud.stopLocalPreview();
......@@ -261,9 +252,13 @@ public class VideoCallingActivity extends TRTCBaseActivity implements View.OnCli
if (isSelected) {
mTRTCCloud.stopLocalPreview();
ivVideo.setImageResource(R.drawable.trtccalling_ic_me_video_close);
tvVideo.setText("摄像头已关闭");
llMe.setVisibility(View.GONE);
} else {
mTRTCCloud.startLocalPreview(mIsFrontCamera, mTXCVVLocalPreviewView);
ivVideo.setImageResource(R.drawable.trtccalling_ic_me_video_open);
tvVideo.setText("摄像头已开启");
llMe.setVisibility(View.VISIBLE);
}
btnVideo.setSelected(!isSelected);
}
......@@ -276,10 +271,12 @@ public class VideoCallingActivity extends TRTCBaseActivity implements View.OnCli
if (!isSelected) {
mTRTCCloud.muteLocalAudio(true);
ivAudio.setImageResource(R.drawable.trtccalling_ic_me_audio_close);
tvAudio.setText("麦克风已关闭");
ivAudioMe.setImageResource(R.drawable.trtccalling_ic_other_audio_close);
} else {
mTRTCCloud.muteLocalAudio(false);
ivAudio.setImageResource(R.drawable.trtccalling_ic_me_audio_open);
tvAudio.setText("麦克风已开启");
ivAudioMe.setImageResource(R.drawable.trtccalling_ic_other_audio_open);
}
btnAudio.setSelected(!isSelected);
......@@ -335,6 +332,7 @@ public class VideoCallingActivity extends TRTCBaseActivity implements View.OnCli
@Override
public void onEnterRoom(long result) {
super.onEnterRoom(result);
TRTCCalling.sharedInstance(VideoCallingActivity.this).mIsInRoom = true;
llMe.setVisibility(View.VISIBLE);
if (mUserModel != null) {
tvMe.setText(mUserModel.userName);
......@@ -347,6 +345,7 @@ public class VideoCallingActivity extends TRTCBaseActivity implements View.OnCli
@Override
public void onExitRoom(int reason) {
super.onExitRoom(reason);
TRTCCalling.sharedInstance(VideoCallingActivity.this).mIsInRoom = false;
finish();
}
......@@ -431,9 +430,11 @@ public class VideoCallingActivity extends TRTCBaseActivity implements View.OnCli
if (i < mRemoteUidList.size()) {
String remoteUid = mRemoteUidList.get(i);
mRemoteViewList.get(i).setVisibility(View.VISIBLE);
mLlUserViewList.get(i).setVisibility(View.VISIBLE);
mTRTCCloud.startRemoteView(remoteUid, TRTCCloudDef.TRTC_VIDEO_STREAM_TYPE_SMALL, mRemoteViewList.get(i));
} else {
mRemoteViewList.get(i).setVisibility(View.GONE);
mLlUserViewList.get(i).setVisibility(View.GONE);
}
}
}
......
......@@ -19,7 +19,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="15dp"
android:background="@drawable/common_ic_back" />
android:background="@drawable/ic_back_video" />
<TextView
android:id="@+id/tv_room_number"
......@@ -458,15 +458,16 @@
<ImageView
android:id="@+id/iv_audio"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="30dp"
android:layout_height="30dp"
android:src="@drawable/trtccalling_ic_me_audio_open" />
<TextView
android:id="@+id/tv_audio"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:text="麦克风"
android:text="麦克风已开启"
android:textColor="@color/color_8595a9"
android:textSize="14sp" />
</LinearLayout>
......@@ -481,15 +482,16 @@
<ImageView
android:id="@+id/iv_video"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="30dp"
android:layout_height="30dp"
android:src="@drawable/trtccalling_ic_me_video_open" />
<TextView
android:id="@+id/tv_video"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:text="摄像头"
android:text="摄像头已开启"
android:textColor="@color/color_8595a9"
android:textSize="14sp" />
</LinearLayout>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment