Skip to content

Commit fd44789

Browse files
lanqiiliuAbySwifter
authored andcommitted
【TUILiveKit】【Android】Published version 2.9.0
1 parent 0cce03e commit fd44789

File tree

144 files changed

+2989
-1711
lines changed

Some content is hidden

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

144 files changed

+2989
-1711
lines changed

Android/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ dependencies {
3434
api project(':debug')
3535
api project(':tuilivekit:livekit')
3636

37-
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.7'
37+
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.14'
3838
implementation 'androidx.appcompat:appcompat:1.3.1'
3939
implementation 'javax.annotation:javax.annotation-api:1.3.2'
4040
}

Android/app/src/main/java/com/trtc/uikit/livekit/example/BaseActivity.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,8 @@ public boolean onTouchEvent(MotionEvent event) {
2727
}
2828
return super.onTouchEvent(event);
2929
}
30+
31+
@Override
32+
public void onBackPressed() {
33+
}
3034
}

Android/app/src/main/java/com/trtc/uikit/livekit/example/view/main/MainActivity.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
import androidx.recyclerview.widget.GridLayoutManager;
88
import androidx.recyclerview.widget.RecyclerView;
99

10-
import com.trtc.tuikit.common.FullScreenActivity;
1110
import com.trtc.tuikit.common.imageloader.ImageLoader;
11+
import com.trtc.uikit.livekit.example.BaseActivity;
1212
import com.trtc.uikit.livekit.example.R;
1313
import com.trtc.uikit.livekit.example.store.AppStore;
1414
import com.trtc.uikit.livekit.example.view.main.adapter.MainAdapter;
@@ -19,7 +19,7 @@
1919
import java.util.ArrayList;
2020
import java.util.List;
2121

22-
public class MainActivity extends FullScreenActivity {
22+
public class MainActivity extends BaseActivity {
2323

2424
private final List<MainItemData> mDataList = new ArrayList<>();
2525

Android/app/src/main/java/com/trtc/uikit/livekit/example/view/me/MeActivity.java

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,30 @@
11
package com.trtc.uikit.livekit.example.view.me;
22

3+
import android.content.Intent;
34
import android.os.Bundle;
45
import android.widget.ImageView;
56
import android.widget.TextView;
67

78
import androidx.annotation.Nullable;
89

10+
import com.tencent.cloud.tuikit.engine.common.TUICommonDefine;
11+
import com.tencent.cloud.tuikit.engine.room.TUIRoomDefine;
912
import com.tencent.qcloud.tuicore.TUILogin;
10-
import com.trtc.tuikit.common.FullScreenActivity;
13+
import com.tencent.qcloud.tuicore.interfaces.TUICallback;
1114
import com.trtc.tuikit.common.imageloader.ImageLoader;
15+
import com.trtc.tuikit.common.ui.ConfirmWithCheckboxDialog;
16+
import com.trtc.uikit.livekit.example.BaseActivity;
1217
import com.trtc.uikit.livekit.example.R;
1318
import com.trtc.uikit.livekit.example.service.ICallBack;
1419
import com.trtc.uikit.livekit.example.service.IMManager;
1520
import com.trtc.uikit.livekit.example.store.AppStore;
21+
import com.trtc.uikit.livekit.example.view.login.LoginActivity;
22+
import com.trtc.uikit.livekit.livestream.VideoLiveKit;
1623

1724

18-
public class MeActivity extends FullScreenActivity {
25+
public class MeActivity extends BaseActivity {
26+
private ImageView mImageLogout;
27+
private ImageView mImageBack;
1928
private ImageView mImageAvatar;
2029
private TextView mTextNickname;
2130
private TextView mTextMyFollowCount;
@@ -33,12 +42,26 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
3342
}
3443

3544
protected void initView() {
45+
initLogoutView();
46+
initBackView();
3647
initNickNameView();
3748
initMyFollowCountView();
3849
initFollowMeCountView();
3950
initAvatarView();
4051
}
4152

53+
private void initLogoutView() {
54+
mImageLogout.setOnClickListener(v -> {
55+
showLogoutDialog();
56+
});
57+
}
58+
59+
private void initBackView() {
60+
mImageBack.setOnClickListener(v -> {
61+
finish();
62+
});
63+
}
64+
4265
private void initDate() {
4366
IMManager.getUserFollowInfo(AppStore.userId, new ICallBack() {
4467
@Override
@@ -85,9 +108,48 @@ private void initMyFollowCountView() {
85108
}
86109

87110
private void bindViewId() {
111+
mImageLogout = findViewById(R.id.iv_logout);
112+
mImageBack = findViewById(R.id.iv_back);
88113
mTextNickname = findViewById(R.id.tv_nickname);
89114
mTextMyFollowCount = findViewById(R.id.tv_likes_count);
90115
mTextFollowMeCount = findViewById(R.id.tv_follows_count);
91116
mImageAvatar = findViewById(R.id.iv_avatar);
92117
}
118+
119+
private void showLogoutDialog() {
120+
ConfirmWithCheckboxDialog dialog = new ConfirmWithCheckboxDialog(this);
121+
dialog.setTitle(getString(R.string.app_tips_title));
122+
dialog.setContent(getString(R.string.app_logout_tips));
123+
dialog.setNegativeText(getString(R.string.app_cancel), negativeView -> dialog.dismiss());
124+
dialog.setPositiveText(getString(R.string.app_logout), positiveView -> {
125+
VideoLiveKit.createInstance(getApplicationContext()).stopLive(new TUIRoomDefine.ActionCallback() {
126+
@Override
127+
public void onSuccess() {
128+
TUILogin.logout(new TUICallback() {
129+
@Override
130+
public void onSuccess() {
131+
}
132+
133+
@Override
134+
public void onError(int errorCode, String errorMessage) {
135+
}
136+
});
137+
}
138+
139+
@Override
140+
public void onError(TUICommonDefine.Error error, String s) {
141+
}
142+
});
143+
144+
Intent intent = new Intent(MeActivity.this, LoginActivity.class);
145+
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
146+
startActivity(intent);
147+
finish();
148+
});
149+
dialog.show();
150+
151+
152+
}
153+
154+
93155
}

Android/app/src/main/java/com/trtc/uikit/livekit/example/view/scene/VideoLiveActivity.java

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,24 @@
33
import android.content.Intent;
44
import android.net.Uri;
55
import android.os.Bundle;
6-
import android.view.View;
6+
import android.text.TextUtils;
77

88
import androidx.fragment.app.FragmentManager;
99
import androidx.fragment.app.FragmentTransaction;
1010

1111
import com.tencent.qcloud.tuicore.TUILogin;
12-
import com.trtc.tuikit.common.FullScreenActivity;
12+
import com.tencent.qcloud.tuicore.util.ToastUtil;
1313
import com.trtc.tuikit.common.util.ActivityLauncher;
14-
import com.trtc.uikit.livekit.livestream.VideoLiveKit;
15-
import com.trtc.uikit.livekit.example.R;
16-
import com.trtc.uikit.livekit.example.store.AppStore;
1714
import com.trtc.uikit.livekit.LiveIdentityGenerator;
15+
import com.trtc.uikit.livekit.component.floatwindow.service.FloatWindowManager;
1816
import com.trtc.uikit.livekit.component.roomlist.TUILiveListFragment;
17+
import com.trtc.uikit.livekit.example.BaseActivity;
18+
import com.trtc.uikit.livekit.example.R;
19+
import com.trtc.uikit.livekit.example.store.AppStore;
20+
import com.trtc.uikit.livekit.livestream.VideoLiveKit;
21+
import com.trtc.uikit.livekit.livestream.state.RoomState;
1922

20-
public class VideoLiveActivity extends FullScreenActivity {
23+
public class VideoLiveActivity extends BaseActivity {
2124

2225
@Override
2326
protected void onCreate(Bundle savedInstanceState) {
@@ -40,14 +43,23 @@ private void initWebsiteLinkView() {
4043

4144
private void initStartLiveView() {
4245
findViewById(R.id.iv_start).setOnClickListener(view -> {
46+
FloatWindowManager floatWindowManager = FloatWindowManager.getInstance();
47+
if (floatWindowManager.isShowingFloatWindow()) {
48+
RoomState roomState = floatWindowManager.getLiveStreamManager().getRoomState();
49+
if (TextUtils.equals(roomState.ownerInfo.userId, TUILogin.getUserId())) {
50+
ToastUtil.toastShortMessage(
51+
view.getContext().getString(com.trtc.uikit.livekit.R.string.livekit_exit_float_window_tip));
52+
return;
53+
}
54+
}
4355
LiveIdentityGenerator identityGenerator = LiveIdentityGenerator.getInstance();
4456
String roomId = identityGenerator.generateId(TUILogin.getUserId(), LiveIdentityGenerator.RoomType.LIVE);
4557
VideoLiveKit.createInstance(getApplicationContext()).startLive(roomId);
4658
});
4759
}
4860

4961
private void initBackButton() {
50-
findViewById(R.id.iv_back).setOnClickListener(v -> onBackPressed());
62+
findViewById(R.id.iv_back).setOnClickListener(v -> finish());
5163
}
5264

5365
private void initLiveListFragment() {

Android/app/src/main/java/com/trtc/uikit/livekit/example/view/scene/VoiceRoomActivity.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@
88
import androidx.fragment.app.FragmentTransaction;
99

1010
import com.tencent.qcloud.tuicore.TUILogin;
11-
import com.trtc.tuikit.common.FullScreenActivity;
1211
import com.trtc.tuikit.common.util.ActivityLauncher;
13-
import com.trtc.uikit.livekit.voiceroom.VoiceRoomDefine;
14-
import com.trtc.uikit.livekit.voiceroom.VoiceRoomKit;
15-
import com.trtc.uikit.livekit.example.R;
16-
import com.trtc.uikit.livekit.example.store.AppStore;
1712
import com.trtc.uikit.livekit.LiveIdentityGenerator;
1813
import com.trtc.uikit.livekit.component.roomlist.TUILiveListFragment;
14+
import com.trtc.uikit.livekit.example.BaseActivity;
15+
import com.trtc.uikit.livekit.example.R;
16+
import com.trtc.uikit.livekit.example.store.AppStore;
17+
import com.trtc.uikit.livekit.voiceroom.VoiceRoomDefine;
18+
import com.trtc.uikit.livekit.voiceroom.VoiceRoomKit;
1919

20-
public class VoiceRoomActivity extends FullScreenActivity {
20+
public class VoiceRoomActivity extends BaseActivity {
2121

2222
@Override
2323
protected void onCreate(Bundle savedInstanceState) {
@@ -49,7 +49,7 @@ private void initCreateRoomView() {
4949
}
5050

5151
private void initBackButton() {
52-
findViewById(R.id.iv_back).setOnClickListener(v -> onBackPressed());
52+
findViewById(R.id.iv_back).setOnClickListener(v -> finish());
5353
}
5454

5555
private void initLiveListFragment() {

Android/app/src/main/res/layout/app_fragment_me.xml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,30 @@
66
android:layout_height="match_parent"
77
android:background="@android:color/transparent">
88

9+
<ImageView
10+
android:id="@+id/iv_back"
11+
android:layout_width="@dimen/livekit_top_btn_size"
12+
android:layout_height="@dimen/livekit_top_btn_size"
13+
android:padding="3dp"
14+
android:layout_alignParentEnd="true"
15+
android:layout_marginTop="48dp"
16+
android:layout_marginStart="16dp"
17+
app:layout_constraintTop_toTopOf="parent"
18+
app:layout_constraintStart_toStartOf="parent"
19+
android:src="@drawable/app_ic_back" />
20+
21+
<ImageView
22+
android:id="@+id/iv_logout"
23+
android:layout_width="@dimen/livekit_top_btn_size"
24+
android:layout_height="@dimen/livekit_top_btn_size"
25+
android:layout_alignParentEnd="true"
26+
android:layout_marginTop="48dp"
27+
android:layout_marginEnd="16dp"
28+
app:layout_constraintTop_toTopOf="parent"
29+
app:layout_constraintEnd_toEndOf="parent"
30+
android:background="@drawable/livekit_ic_audience_exit"
31+
android:importantForAccessibility="no" />
32+
933
<androidx.constraintlayout.utils.widget.ImageFilterView
1034
android:id="@+id/iv_avatar"
1135
android:layout_width="100dp"
@@ -15,7 +39,7 @@
1539
app:layout_constraintStart_toStartOf="parent"
1640
app:layout_constraintEnd_toEndOf="parent"
1741
app:layout_constraintTop_toTopOf="parent"
18-
android:layout_marginTop="57dp"
42+
android:layout_marginTop="67dp"
1943
app:round="50dp" />
2044
<TextView
2145
android:id="@+id/tv_nickname"

Android/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,5 @@ ext {
3838
liteavSdk = "com.tencent.liteav:LiteAVSDK_Professional:latest.release"
3939
roomEngineSdk = "io.trtc.uikit:rtc_room_engine:latest.release"
4040
imSdk = "com.tencent.imsdk:imsdk-plus:latest.release"
41+
common = "io.trtc.uikit:common:2.8.0.634"
4142
}

Android/tceffectplayerkit/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ android {
2727
dependencies {
2828
api 'com.tencent.mediacloud:TCMediaX:2.1.0.112'
2929
implementation 'com.tencent.mediacloud:TCEffectPlayer:2.1.0.112'
30-
implementation "com.tencent.liteav.tuikit:tuicore:latest.release"
30+
implementation rootProject.getChildProjects().containsKey("tuicore") ? project(':tuicore') : "com.tencent.liteav.tuikit:tuicore:latest.release"
3131
}

Android/tebeautykit/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ dependencies {
3636

3737
implementation 'com.tencent.mediacloud:TencentEffect_S1-07:latest.release'
3838

39-
implementation "com.tencent.liteav.tuikit:tuicore:latest.release"
39+
implementation rootProject.getChildProjects().containsKey("tuicore") ? project(':tuicore') : "com.tencent.liteav.tuikit:tuicore:latest.release"
4040

4141

4242
}

0 commit comments

Comments
 (0)