Skip to content

Commit 1bb530a

Browse files
sevenhhearchurcode
authored andcommitted
移植 rtc 的拨打接听音视频电话界面
http://tapd.oa.com/NEW_IOT/prong/stories/view/1020393192859567379 Change-Id: I0110d5f774f175fb075d20e87febb55adf70dd32
1 parent b377856 commit 1bb530a

File tree

58 files changed

+3611
-84
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+3611
-84
lines changed

app/build.gradle

+2
Original file line numberDiff line numberDiff line change
@@ -183,4 +183,6 @@ dependencies {
183183
implementation 'cn.aigestudio.wheelpicker:WheelPicker:1.1.3'
184184
implementation 'com.chauthai.swipereveallayout:swipe-reveal-layout:1.4.1'
185185
implementation 'com.github.Jay-Goo:RangeSeekBar:v3.0.0'
186+
implementation project(path: ':trtc')
187+
186188
}

app/src/main/AndroidManifest.xml

+3
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@
116116
<activity android:name=".kitlink.activity.BindMobilePhoneActivity" />
117117
<activity android:name=".kitlink.activity.AboutUsActivity" />
118118
<activity android:name=".kitlink.activity.HelpCenterActivity" />
119+
<activity android:name="com.tencent.iot.explorer.trtc.ui.audiocall.TRTCAudioCallActivity" />
120+
<activity android:name="com.tencent.iot.explorer.trtc.ui.videocall.TRTCVideoCallActivity" />
121+
119122
<activity
120123
android:name=".kitlink.activity.ConfigNetFailedActivity"
121124
android:launchMode="singleTask" />

app/src/main/java/com/tencent/iot/explorer/link/kitlink/activity/MainActivity.kt

+1-48
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
package com.tencent.iot.explorer.link.kitlink.activity
22

3-
import android.app.Activity
43
import android.app.AlertDialog
54
import android.content.DialogInterface
6-
import android.content.Intent
75
import android.text.TextUtils
86
import android.view.View
97
import androidx.fragment.app.Fragment
@@ -119,7 +117,6 @@ class MainActivity : PActivity(), MyCallback {
119117
FirebaseCrashlytics.getInstance().setUserId(userId)
120118
FirebaseAnalytics.getInstance(this).setUserId(userId)
121119
openXGPush()
122-
// home_bottom_view.addUnclickAbleItem(2) // 限定2号位置不可选中
123120
home_bottom_view.addMenu(
124121
BottomItemEntity(
125122
getString(R.string.main_tab_1),
@@ -135,13 +132,6 @@ class MainActivity : PActivity(), MyCallback {
135132
R.mipmap.smart_unpressed, R.mipmap.smart_pressed
136133
)
137134
)
138-
// .addMenu(
139-
// BottomItemEntity(
140-
// "",
141-
// resources.getColor(R.color.translucent), resources.getColor(R.color.translucent),
142-
// R.color.translucent, R.color.translucent
143-
// )
144-
// )
145135
.addMenu(
146136
BottomItemEntity(
147137
getString(R.string.main_tab_4),
@@ -168,47 +158,11 @@ class MainActivity : PActivity(), MyCallback {
168158
.commit()
169159
}
170160

171-
// private fun showOptionDialog() {
172-
// if (addDialog == null) {
173-
// var options = ArrayList<String>()
174-
// options.add(getString(R.string.smart_option_1))
175-
// options.add(getString(R.string.smart_option_2))
176-
// addDialog = ListOptionsDialog(this, options)
177-
// addDialog?.setOnDismisListener(onItemClickedListener)
178-
// }
179-
// addDialog?.show()
180-
// }
181-
//
182-
// private var onItemClickedListener = ListOptionsDialog.OnDismisListener {
183-
// if (it == 0) {
184-
// jumpActivity(AddManualTaskActivity::class.java)
185-
// } else if (it == 1) {
186-
// jumpActivity(AddAutoicTaskActivity::class.java)
187-
// }
188-
// }
189-
190161
override fun setListener() {
191-
iv_main_add.setOnClickListener{
192-
// showOptionDialog()
193-
}
162+
iv_main_add.setOnClickListener{}
194163

195164
home_bottom_view.setOnItemClickListener { _, position, previewPosition ->
196-
// if (position == 2) {
197-
// return@setOnItemClickListener
198-
// }
199-
//
200-
// var tagPos = position
201-
// if (tagPos > 2) {
202-
// tagPos = tagPos - 1
203-
// }
204165
showFragment(position)
205-
// if (tagPos == 1) {
206-
// window.decorView.systemUiVisibility =
207-
// View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_LAYOUT_STABLE
208-
// } else {
209-
// window.decorView.systemUiVisibility =
210-
// View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
211-
// }
212166
}
213167
(fragments[0] as? HomeFragment)?.run {
214168
popupListener = object : HomeFragment.PopupListener {
@@ -322,7 +276,6 @@ class MainActivity : PActivity(), MyCallback {
322276
timestamp = t
323277
T.show(getString(R.string.tap_more_exit)) //再按一下退出应用
324278
}
325-
// super.onBackPressed()
326279
}
327280

328281
private fun showCancelAccountStoppedDialog(time: Long){

gradle.properties

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@ android.enableJetifier=true
2121
kotlin.code.style=official
2222
signing.keyId=MY_KEY_ID
2323
signing.password=MY_PASSWORD
24-
signing.secretKeyRingFile=MY_KEY_RING_FILE
24+
signing.secretKeyRingFile=MY_KEY_RING_FILE
25+
android.injected.testOnly = false

sdkdemo/build.gradle

+2
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,6 @@ dependencies {
9797
implementation 'com.alibaba:fastjson:1.2.73'
9898
implementation "com.tencent.iot.thirdparty.android:esptouch:0.3.7.2"
9999
implementation 'com.android.support:multidex:1.0.3'
100+
implementation project(path: ':trtc')
101+
100102
}

trtc/build.gradle

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
apply plugin: 'com.android.library'
22
apply plugin: 'maven-publish'
33
apply plugin: 'signing'
4+
apply plugin: 'kotlin-android'
5+
apply plugin: 'kotlin-android-extensions'
46

57
android {
68
compileSdkVersion 29
@@ -12,7 +14,6 @@ android {
1214
versionCode 1
1315
versionName "1.0"
1416

15-
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1617
consumerProguardFiles "consumer-rules.pro"
1718

1819
ndk {
@@ -34,11 +35,13 @@ android {
3435

3536
dependencies {
3637
implementation 'androidx.appcompat:appcompat:1.2.0'
37-
implementation 'com.google.android.material:material:1.2.1'
38-
testImplementation 'junit:junit:4.+'
39-
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
40-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
38+
implementation 'com.squareup.retrofit2:converter-gson:2.0.2'
39+
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
4140
implementation 'com.tencent.liteav:LiteAVSDK_TRTC:latest.release'
41+
// implementation 'com.squareup.picasso:picasso:2.5.2'
42+
implementation 'com.squareup.picasso:picasso:2.71828'
43+
implementation 'com.alibaba:fastjson:1.2.73'
44+
4245
}
4346

4447
task androidJavadocs(type: Javadoc) {

trtc/src/androidTest/java/com/tencent/iot/explorer/trtc/ExampleInstrumentedTest.java

-26
This file was deleted.

trtc/src/main/java/com/tencent/iot/explorer/trtc/Test.java

-4
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.tencent.iot.explorer.trtc.model;
2+
3+
import com.tencent.iot.explorer.trtc.ui.audiocall.TRTCAudioCallActivity;
4+
5+
import java.io.Serializable;
6+
import java.util.List;
7+
8+
public class IntentParams implements Serializable {
9+
public List<UserInfo> mUserInfos;
10+
11+
public IntentParams(List<UserInfo> userInfos) {
12+
mUserInfos = userInfos;
13+
}
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.tencent.iot.explorer.trtc.model
2+
3+
open class RoomKey {
4+
var appId = 0
5+
var roomId = ""
6+
var callType = TRTCCalling.TYPE_AUDIO_CALL
7+
var userId = ""
8+
var userSig = ""
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.tencent.iot.explorer.trtc.model;
2+
3+
public abstract class TRTCCalling {
4+
public static final int TYPE_UNKNOWN = 0;
5+
public static final int TYPE_AUDIO_CALL = 1;
6+
public static final int TYPE_VIDEO_CALL = 2;
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
package com.tencent.iot.explorer.trtc.model;
2+
3+
import java.util.List;
4+
import java.util.Map;
5+
6+
public interface TRTCCallingDelegate {
7+
/**
8+
* sdk内部发生了错误
9+
* @param code 错误码
10+
* @param msg 错误消息
11+
*/
12+
void onError(int code, String msg);
13+
14+
/**
15+
* 被邀请通话回调
16+
* @param sponsor 邀请者
17+
* @param userIdList 同时还被邀请的人
18+
* @param isFromGroup 是否IM群组邀请
19+
* @param callType 邀请类型 1-语音通话,2-视频通话
20+
*/
21+
void onInvited(String sponsor, List<String> userIdList, boolean isFromGroup, int callType);
22+
23+
/**
24+
* 正在IM群组通话时,如果其他与会者邀请他人,会收到此回调
25+
* 例如 A-B-C 正在IM群组中,A邀请[D、E]进入通话,B、C会收到[D、E]的回调
26+
* 如果此时 A 再邀请 F 进入群聊,那么B、C会收到[D、E、F]的回调
27+
* @param userIdList 邀请群组
28+
*/
29+
void onGroupCallInviteeListUpdate(List<String> userIdList);
30+
31+
/**
32+
* 如果有用户同意进入通话,那么会收到此回调
33+
* @param userId 进入通话的用户
34+
*/
35+
void onUserEnter(String userId);
36+
37+
/**
38+
* 如果有用户同意离开通话,那么会收到此回调
39+
* @param userId 离开通话的用户
40+
*/
41+
void onUserLeave(String userId);
42+
43+
/**
44+
* 1. 在C2C通话中,只有发起方会收到拒绝回调
45+
* 例如 A 邀请 B、C 进入通话,B拒绝,A可以收到该回调,但C不行
46+
*
47+
* 2. 在IM群组通话中,所有被邀请人均能收到该回调
48+
* 例如 A 邀请 B、C 进入通话,B拒绝,A、C均能收到该回调
49+
* @param userId 拒绝通话的用户
50+
*/
51+
void onReject(String userId);
52+
53+
/**
54+
* 1. 在C2C通话中,只有发起方会收到无人应答的回调
55+
* 例如 A 邀请 B、C 进入通话,B不应答,A可以收到该回调,但C不行
56+
*
57+
* 2. 在IM群组通话中,所有被邀请人均能收到该回调
58+
* 例如 A 邀请 B、C 进入通话,B不应答,A、C均能收到该回调
59+
* @param userId
60+
*/
61+
void onNoResp(String userId);
62+
63+
/**
64+
* 邀请方忙线
65+
* @param userId 忙线用户
66+
*/
67+
void onLineBusy(String userId);
68+
69+
/**
70+
* 作为被邀请方会收到,收到该回调说明本次通话被取消了
71+
*/
72+
void onCallingCancel();
73+
74+
/**
75+
* 作为被邀请方会收到,收到该回调说明本次通话超时未应答
76+
*/
77+
void onCallingTimeout();
78+
79+
/**
80+
* 收到该回调说明本次通话结束了
81+
*/
82+
void onCallEnd();
83+
84+
/**
85+
* 远端用户开启/关闭了摄像头
86+
* @param userId 远端用户ID
87+
* @param isVideoAvailable true:远端用户打开摄像头 false:远端用户关闭摄像头
88+
*/
89+
void onUserVideoAvailable(String userId, boolean isVideoAvailable);
90+
91+
/**
92+
* 远端用户开启/关闭了麦克风
93+
* @param userId 远端用户ID
94+
* @param isVideoAvailable true:远端用户打开麦克风 false:远端用户关闭麦克风
95+
*/
96+
void onUserAudioAvailable(String userId, boolean isVideoAvailable);
97+
98+
/**
99+
* 用户说话音量回调
100+
* @param volumeMap 音量表,根据每个userid可以获取对应的音量大小,音量最小值0,音量最大值100
101+
*/
102+
void onUserVoiceVolume(Map<String, Integer> volumeMap);
103+
104+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.tencent.iot.explorer.trtc.model;
2+
3+
import com.tencent.iot.explorer.trtc.ui.utils.Utils;
4+
5+
import java.io.Serializable;
6+
7+
public class UserInfo implements Serializable {
8+
private String userId;
9+
public String userAvatar;
10+
public String userName;
11+
12+
public void setUserId(String userId) {
13+
this.userId = userId;
14+
userAvatar = Utils.getAvatarUrl(this.userId);
15+
userName = this.userId;
16+
}
17+
18+
public String getUserId() {
19+
return userId;
20+
}
21+
}

0 commit comments

Comments
 (0)