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;
...@@ -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
...@@ -3,12 +3,13 @@ ...@@ -3,12 +3,13 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="#1B1B1B"> android:background="#f6f7f9">
<LinearLayout <LinearLayout
android:id="@+id/ll_bar" android:id="@+id/ll_bar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="60dp" android:layout_height="60dp"
android:background="@color/white"
app:layout_constraintTop_toTopOf="parent"> app:layout_constraintTop_toTopOf="parent">
<ImageView <ImageView
...@@ -27,7 +28,7 @@ ...@@ -27,7 +28,7 @@
android:layout_marginTop="15dp" android:layout_marginTop="15dp"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:text="1111" android:text="1111"
android:textColor="@android:color/white" android:textColor="#0C1D31"
android:textSize="20sp" /> android:textSize="20sp" />
<TextView <TextView
...@@ -55,6 +56,51 @@ ...@@ -55,6 +56,51 @@
app:layout_constraintTop_toBottomOf="@id/ll_bar" app:layout_constraintTop_toBottomOf="@id/ll_bar"
app:layout_constraintVertical_weight="1" /> app:layout_constraintVertical_weight="1" />
<LinearLayout
android:id="@+id/ll_user_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintStart_toStartOf="@id/trtc_view_1"
app:layout_constraintBottom_toBottomOf="@id/trtc_view_1"
android:layout_marginStart="4dp"
android:layout_marginBottom="4dp"
android:background="@drawable/trtccalling_shape_white_r_10"
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:gravity="center_vertical"
android:paddingTop="4dp"
android:paddingBottom="4dp"
android:visibility="gone"
>
<TextView
android:id="@+id/tv_name_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/color_2D2F33"
android:textSize="12sp"
/>
<ImageView
android:id="@+id/iv_network_1"
android:layout_width="17dp"
android:layout_height="10dp"
android:src="@drawable/trtccalling_ic_network_excellent"
android:layout_marginStart="8dp"
/>
<ImageView
android:id="@+id/iv_other_audio_1"
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_marginStart="8dp"
android:src="@drawable/trtccalling_ic_other_audio_open" />
</LinearLayout>
<com.tencent.rtmp.ui.TXCloudVideoView <com.tencent.rtmp.ui.TXCloudVideoView
android:id="@+id/trtc_view_2" android:id="@+id/trtc_view_2"
android:layout_width="0dp" android:layout_width="0dp"
...@@ -68,6 +114,49 @@ ...@@ -68,6 +114,49 @@
app:layout_constraintTop_toBottomOf="@id/ll_bar" app:layout_constraintTop_toBottomOf="@id/ll_bar"
app:layout_constraintVertical_weight="1" /> app:layout_constraintVertical_weight="1" />
<LinearLayout
android:id="@+id/ll_user_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintStart_toStartOf="@id/trtc_view_2"
app:layout_constraintBottom_toBottomOf="@id/trtc_view_2"
android:layout_marginStart="4dp"
android:layout_marginBottom="4dp"
android:background="@drawable/trtccalling_shape_white_r_10"
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:gravity="center_vertical"
android:paddingTop="4dp"
android:paddingBottom="4dp"
android:visibility="gone"
>
<TextView
android:id="@+id/tv_name_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/color_2D2F33"
android:textSize="12sp"
/>
<ImageView
android:id="@+id/iv_network_2"
android:layout_width="17dp"
android:layout_height="10dp"
android:src="@drawable/trtccalling_ic_network_excellent"
android:layout_marginStart="8dp"
/>
<ImageView
android:id="@+id/iv_other_audio_2"
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_marginStart="8dp"
android:src="@drawable/trtccalling_ic_other_audio_open" />
</LinearLayout>
<com.tencent.rtmp.ui.TXCloudVideoView <com.tencent.rtmp.ui.TXCloudVideoView
android:id="@+id/trtc_view_main" android:id="@+id/trtc_view_main"
android:layout_width="0dp" android:layout_width="0dp"
...@@ -93,6 +182,49 @@ ...@@ -93,6 +182,49 @@
app:layout_constraintTop_toTopOf="@id/trtc_view_main" app:layout_constraintTop_toTopOf="@id/trtc_view_main"
app:layout_constraintVertical_weight="1" /> app:layout_constraintVertical_weight="1" />
<LinearLayout
android:id="@+id/ll_user_3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintStart_toStartOf="@id/trtc_view_3"
app:layout_constraintBottom_toBottomOf="@id/trtc_view_3"
android:layout_marginStart="4dp"
android:layout_marginBottom="4dp"
android:background="@drawable/trtccalling_shape_white_r_10"
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:gravity="center_vertical"
android:paddingTop="4dp"
android:paddingBottom="4dp"
android:visibility="gone"
>
<TextView
android:id="@+id/tv_name_3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/color_2D2F33"
android:textSize="12sp"
/>
<ImageView
android:id="@+id/iv_network_3"
android:layout_width="17dp"
android:layout_height="10dp"
android:src="@drawable/trtccalling_ic_network_excellent"
android:layout_marginStart="8dp"
/>
<ImageView
android:id="@+id/iv_other_audio_3"
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_marginStart="8dp"
android:src="@drawable/trtccalling_ic_other_audio_open" />
</LinearLayout>
<com.tencent.rtmp.ui.TXCloudVideoView <com.tencent.rtmp.ui.TXCloudVideoView
android:id="@+id/trtc_view_4" android:id="@+id/trtc_view_4"
...@@ -108,6 +240,49 @@ ...@@ -108,6 +240,49 @@
app:layout_constraintTop_toTopOf="@id/trtc_view_1" app:layout_constraintTop_toTopOf="@id/trtc_view_1"
app:layout_constraintVertical_weight="1" /> app:layout_constraintVertical_weight="1" />
<LinearLayout
android:id="@+id/ll_user_4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintStart_toStartOf="@id/trtc_view_3"
app:layout_constraintBottom_toBottomOf="@id/trtc_view_3"
android:layout_marginStart="4dp"
android:layout_marginBottom="4dp"
android:background="@drawable/trtccalling_shape_white_r_10"
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:gravity="center_vertical"
android:paddingTop="4dp"
android:paddingBottom="4dp"
android:visibility="gone"
>
<TextView
android:id="@+id/tv_name_4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/color_2D2F33"
android:textSize="12sp"
/>
<ImageView
android:id="@+id/iv_network_4"
android:layout_width="17dp"
android:layout_height="10dp"
android:src="@drawable/trtccalling_ic_network_excellent"
android:layout_marginStart="8dp"
/>
<ImageView
android:id="@+id/iv_other_audio_4"
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_marginStart="8dp"
android:src="@drawable/trtccalling_ic_other_audio_open" />
</LinearLayout>
<com.tencent.rtmp.ui.TXCloudVideoView <com.tencent.rtmp.ui.TXCloudVideoView
android:id="@+id/trtc_view_5" android:id="@+id/trtc_view_5"
...@@ -121,6 +296,49 @@ ...@@ -121,6 +296,49 @@
app:layout_constraintTop_toBottomOf="@id/trtc_view_main" app:layout_constraintTop_toBottomOf="@id/trtc_view_main"
app:layout_constraintVertical_weight="1" /> app:layout_constraintVertical_weight="1" />
<LinearLayout
android:id="@+id/ll_user_5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintStart_toStartOf="@id/trtc_view_5"
app:layout_constraintBottom_toBottomOf="@id/trtc_view_5"
android:layout_marginStart="4dp"
android:layout_marginBottom="4dp"
android:background="@drawable/trtccalling_shape_white_r_10"
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:gravity="center_vertical"
android:paddingTop="4dp"
android:paddingBottom="4dp"
android:visibility="gone"
>
<TextView
android:id="@+id/tv_name_5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/color_2D2F33"
android:textSize="12sp"
/>
<ImageView
android:id="@+id/iv_network_5"
android:layout_width="17dp"
android:layout_height="10dp"
android:src="@drawable/trtccalling_ic_network_excellent"
android:layout_marginStart="8dp"
/>
<ImageView
android:id="@+id/iv_other_audio_5"
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_marginStart="8dp"
android:src="@drawable/trtccalling_ic_other_audio_open" />
</LinearLayout>
<com.tencent.rtmp.ui.TXCloudVideoView <com.tencent.rtmp.ui.TXCloudVideoView
android:id="@+id/trtc_view_6" android:id="@+id/trtc_view_6"
...@@ -133,6 +351,49 @@ ...@@ -133,6 +351,49 @@
app:layout_constraintTop_toTopOf="@id/trtc_view_5" app:layout_constraintTop_toTopOf="@id/trtc_view_5"
app:layout_constraintVertical_weight="1" /> app:layout_constraintVertical_weight="1" />
<LinearLayout
android:id="@+id/ll_user_6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintStart_toStartOf="@id/trtc_view_6"
app:layout_constraintBottom_toBottomOf="@id/trtc_view_6"
android:layout_marginStart="4dp"
android:layout_marginBottom="4dp"
android:background="@drawable/trtccalling_shape_white_r_10"
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:gravity="center_vertical"
android:paddingTop="4dp"
android:paddingBottom="4dp"
android:visibility="gone"
>
<TextView
android:id="@+id/tv_name_6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/color_2D2F33"
android:textSize="12sp"
/>
<ImageView
android:id="@+id/iv_network_6"
android:layout_width="17dp"
android:layout_height="10dp"
android:src="@drawable/trtccalling_ic_network_excellent"
android:layout_marginStart="8dp"
/>
<ImageView
android:id="@+id/iv_other_audio_6"
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_marginStart="8dp"
android:src="@drawable/trtccalling_ic_other_audio_open" />
</LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/ll_bottom" android:id="@+id/ll_bottom"
......
...@@ -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