Commit 5383ebb2 by upwork.021

feat: 修改ui

parent 0a951fc3
...@@ -19,6 +19,7 @@ import com.tencent.rtmp.ui.TXCloudVideoView; ...@@ -19,6 +19,7 @@ import com.tencent.rtmp.ui.TXCloudVideoView;
import com.tencent.trtc.TRTCCloud; import com.tencent.trtc.TRTCCloud;
import com.tencent.trtc.TRTCCloudDef; import com.tencent.trtc.TRTCCloudDef;
import com.tencent.trtc.TRTCCloudListener; import com.tencent.trtc.TRTCCloudListener;
import com.yidianling.common.tools.LogUtil;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -39,8 +40,8 @@ import java.util.List; ...@@ -39,8 +40,8 @@ import java.util.List;
*/ */
public class VideoCallingActivity extends TRTCBaseActivity implements View.OnClickListener { public class VideoCallingActivity extends TRTCBaseActivity implements View.OnClickListener {
private static final String TAG = "VideoCallingActivity"; private static final String TAG = "VideoCallingActivity";
private static final int OVERLAY_PERMISSION_REQ_CODE = 1234; private static final int OVERLAY_PERMISSION_REQ_CODE = 1234;
private TextView mTextTitle; private TextView mTextTitle;
private TXCloudVideoView mTXCVVLocalPreviewView; private TXCloudVideoView mTXCVVLocalPreviewView;
...@@ -56,6 +57,9 @@ public class VideoCallingActivity extends TRTCBaseActivity implements View.OnCli ...@@ -56,6 +57,9 @@ public class VideoCallingActivity extends TRTCBaseActivity implements View.OnCli
private boolean mIsFrontCamera = true; private boolean mIsFrontCamera = true;
private List<String> mRemoteUidList; private List<String> mRemoteUidList;
private List<TXCloudVideoView> mRemoteViewList; private List<TXCloudVideoView> mRemoteViewList;
private List<ImageView> mIvNetWorkViewList;
private List<ImageView> mIvAudioViewList;
private List<LinearLayout> mLlUserViewList;
private int mUserCount = 0; private int mUserCount = 0;
private String mRoomId; private String mRoomId;
private String mUserId; private String mUserId;
...@@ -118,14 +122,33 @@ public class VideoCallingActivity extends TRTCBaseActivity implements View.OnCli ...@@ -118,14 +122,33 @@ public class VideoCallingActivity extends TRTCBaseActivity implements View.OnCli
mRemoteUidList = new ArrayList<>(); mRemoteUidList = new ArrayList<>();
mRemoteViewList = new ArrayList<>(); mRemoteViewList = new ArrayList<>();
mIvNetWorkViewList = new ArrayList<>();
mIvAudioViewList = new ArrayList<>();
mLlUserViewList = new ArrayList<>();
mRemoteViewList.add(findViewById(R.id.trtc_view_1)); mRemoteViewList.add(findViewById(R.id.trtc_view_1));
mRemoteViewList.add(findViewById(R.id.trtc_view_2)); mRemoteViewList.add(findViewById(R.id.trtc_view_2));
mRemoteViewList.add(findViewById(R.id.trtc_view_3)); mRemoteViewList.add(findViewById(R.id.trtc_view_3));
mRemoteViewList.add(findViewById(R.id.trtc_view_4)); mRemoteViewList.add(findViewById(R.id.trtc_view_4));
mRemoteViewList.add(findViewById(R.id.trtc_view_5)); mRemoteViewList.add(findViewById(R.id.trtc_view_5));
mRemoteViewList.add(findViewById(R.id.trtc_view_6)); mRemoteViewList.add(findViewById(R.id.trtc_view_6));
mRemoteViewList.add(findViewById(R.id.trtc_view_main)); mIvNetWorkViewList.add(findViewById(R.id.iv_network_1));
mIvNetWorkViewList.add(findViewById(R.id.iv_network_2));
mIvNetWorkViewList.add(findViewById(R.id.iv_network_3));
mIvNetWorkViewList.add(findViewById(R.id.iv_network_4));
mIvNetWorkViewList.add(findViewById(R.id.iv_network_5));
mIvNetWorkViewList.add(findViewById(R.id.iv_network_6));
mIvAudioViewList.add(findViewById(R.id.iv_other_audio_1));
mIvAudioViewList.add(findViewById(R.id.iv_other_audio_2));
mIvAudioViewList.add(findViewById(R.id.iv_other_audio_3));
mIvAudioViewList.add(findViewById(R.id.iv_other_audio_4));
mIvAudioViewList.add(findViewById(R.id.iv_other_audio_5));
mIvAudioViewList.add(findViewById(R.id.iv_other_audio_6));
mLlUserViewList.add(findViewById(R.id.ll_user_1));
mLlUserViewList.add(findViewById(R.id.ll_user_2));
mLlUserViewList.add(findViewById(R.id.ll_user_3));
mLlUserViewList.add(findViewById(R.id.ll_user_4));
mLlUserViewList.add(findViewById(R.id.ll_user_5));
mLlUserViewList.add(findViewById(R.id.ll_user_6));
} }
private void enterRoom() { private void enterRoom() {
...@@ -137,6 +160,7 @@ public class VideoCallingActivity extends TRTCBaseActivity implements View.OnCli ...@@ -137,6 +160,7 @@ public class VideoCallingActivity extends TRTCBaseActivity implements View.OnCli
trtcParams.sdkAppId = userModel.appId; trtcParams.sdkAppId = userModel.appId;
trtcParams.userId = mUserId; trtcParams.userId = mUserId;
trtcParams.roomId = Integer.parseInt(mRoomId); trtcParams.roomId = Integer.parseInt(mRoomId);
LogUtil.d("userSig",userModel.userSig);
trtcParams.userSig = userModel.userSig; trtcParams.userSig = userModel.userSig;
mTRTCCloud.startLocalPreview(mIsFrontCamera, mTXCVVLocalPreviewView); mTRTCCloud.startLocalPreview(mIsFrontCamera, mTXCVVLocalPreviewView);
...@@ -251,6 +275,7 @@ public class VideoCallingActivity extends TRTCBaseActivity implements View.OnCli ...@@ -251,6 +275,7 @@ public class VideoCallingActivity extends TRTCBaseActivity implements View.OnCli
} }
} }
private class TRTCCloudImplListener extends TRTCCloudListener { private class TRTCCloudImplListener extends TRTCCloudListener {
private WeakReference<VideoCallingActivity> mContext; private WeakReference<VideoCallingActivity> mContext;
...@@ -267,13 +292,9 @@ public class VideoCallingActivity extends TRTCBaseActivity implements View.OnCli ...@@ -267,13 +292,9 @@ public class VideoCallingActivity extends TRTCBaseActivity implements View.OnCli
*/ */
@Override @Override
public void onNetworkQuality(TRTCCloudDef.TRTCQuality localQuality, ArrayList<TRTCCloudDef.TRTCQuality> remoteQuality) { public void onNetworkQuality(TRTCCloudDef.TRTCQuality localQuality, ArrayList<TRTCCloudDef.TRTCQuality> remoteQuality) {
// public static final int TRTC_QUALITY_UNKNOWN = 0; // if (remoteQuality.size()>0){
// public static final int TRTC_QUALITY_Excellent = 1; // refreshNetWorkStatus(remoteQuality);
// public static final int TRTC_QUALITY_Good = 2; // }
// public static final int TRTC_QUALITY_Poor = 3;
// public static final int TRTC_QUALITY_Bad = 4;
// public static final int TRTC_QUALITY_Vbad = 5;
// public static final int TRTC_QUALITY_Down = 6;
} }
/** /**
...@@ -283,7 +304,10 @@ public class VideoCallingActivity extends TRTCBaseActivity implements View.OnCli ...@@ -283,7 +304,10 @@ public class VideoCallingActivity extends TRTCBaseActivity implements View.OnCli
*/ */
@Override @Override
public void onUserAudioAvailable(String userId, boolean available) { public void onUserAudioAvailable(String userId, boolean available) {
Log.e(TAG, "onUserAudioAvailable userId " + userId + ", mUserCount " + mUserCount + ",available " + available);
if (!TextUtils.isEmpty(userId)){
refreshAudioStatus(userId, available);
}
} }
/** /**
...@@ -293,7 +317,7 @@ public class VideoCallingActivity extends TRTCBaseActivity implements View.OnCli ...@@ -293,7 +317,7 @@ public class VideoCallingActivity extends TRTCBaseActivity implements View.OnCli
*/ */
@Override @Override
public void onUserVideoAvailable(String userId, boolean available) { public void onUserVideoAvailable(String userId, boolean available) {
Log.d(TAG, "onUserVideoAvailable userId " + userId + ", mUserCount " + mUserCount + ",available " + available); Log.e(TAG, "onUserVideoAvailable userId " + userId + ", mUserCount " + mUserCount + ",available " + available);
int index = mRemoteUidList.indexOf(userId); int index = mRemoteUidList.indexOf(userId);
if (available) { if (available) {
if (index != -1) { if (index != -1) {
...@@ -323,6 +347,36 @@ public class VideoCallingActivity extends TRTCBaseActivity implements View.OnCli ...@@ -323,6 +347,36 @@ public class VideoCallingActivity extends TRTCBaseActivity implements View.OnCli
} }
} }
private void refreshAudioStatus(String userId,boolean available){
if (mRemoteUidList.size()>0){
for (int i = 0; i < mIvAudioViewList.size(); i++) {
if (userId.equals(mRemoteUidList.get(i))){
if (available){
mIvAudioViewList.get(i).setImageResource(R.drawable.trtccalling_ic_other_audio_open);
}else {
mIvAudioViewList.get(i).setImageResource(R.drawable.trtccalling_ic_other_audio_close);
}
return;
}
}
}
}
private void refreshNetWorkStatus(ArrayList<TRTCCloudDef.TRTCQuality> remoteQuality){
for (int i = 0; i < mIvNetWorkViewList.size(); i++) {
int quality = remoteQuality.get(i).quality;
if (quality==TRTCCloudDef.TRTC_QUALITY_Excellent){
mIvNetWorkViewList.get(i).setImageResource(R.drawable.trtccalling_ic_network_excellent);
}else if (quality==TRTCCloudDef.TRTC_QUALITY_Good){
mIvNetWorkViewList.get(i).setImageResource(R.drawable.trtccalling_ic_network_good);
}else if (quality==TRTCCloudDef.TRTC_QUALITY_Poor){
mIvNetWorkViewList.get(i).setImageResource(R.drawable.trtccalling_ic_network_poor);
}else if (quality==TRTCCloudDef.TRTC_QUALITY_Bad){
mIvNetWorkViewList.get(i).setImageResource(R.drawable.trtccalling_ic_network_bad);
}
}
}
@Override @Override
public void onError(int errCode, String errMsg, Bundle extraInfo) { public void onError(int errCode, String errMsg, Bundle extraInfo) {
Log.d(TAG, "sdk callback onError"); Log.d(TAG, "sdk callback onError");
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"
>
<solid android:color="@color/white" />
<corners android:radius="10dp" />
</shape>
\ No newline at end of file
...@@ -26,4 +26,5 @@ ...@@ -26,4 +26,5 @@
<color name="trtccalling_color_green">#FF29CC85</color> <color name="trtccalling_color_green">#FF29CC85</color>
<color name="color_8595a9">#859aa9</color> <color name="color_8595a9">#859aa9</color>
<color name="color_F0504A">#F0504A</color> <color name="color_F0504A">#F0504A</color>
<color name="color_2D2F33">#2D2F33</color>
</resources> </resources>
\ No newline at end of file
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