Skip to content

Commit

Permalink
【Android】update version to 2.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rulongzhang authored and AbySwifter committed Sep 14, 2024
1 parent b735292 commit 4f4d0f2
Show file tree
Hide file tree
Showing 355 changed files with 5,558 additions and 17,148 deletions.
5 changes: 2 additions & 3 deletions Android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {

defaultConfig {
applicationId 'com.tencent.liteav.tuiroom'
versionName "2.5.0"
versionCode 250
versionName "2.6.0"
versionCode 260
minSdkVersion 19
targetSdkVersion 30
multiDexEnabled true
Expand Down Expand Up @@ -40,7 +40,6 @@ dependencies {
implementation project(':tuiroomkit')
implementation project(':debug')
implementation project(':tuichat')
implementation project(':tuicontact')

implementation 'androidx.multidex:multidex:2.0.1'
implementation "androidx.navigation:navigation-fragment:2.1.0"
Expand Down
11 changes: 11 additions & 0 deletions Android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@
android:name="com.tencent.liteav.demo.ProfileActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.NoActionBar" />
<activity
android:name="com.tencent.liteav.demo.ConferenceOptionsActivity"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.NoActionBar" />
<activity
android:name="com.tencent.liteav.demo.SelectParticipants.SelectParticipantActivity"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize"
android:theme="@style/Theme.AppCompat.NoActionBar" />
<activity
android:name="com.tencent.liteav.demo.SplashActivity"
android:screenOrientation="portrait"
Expand Down
28 changes: 28 additions & 0 deletions Android/app/src/main/assets/members.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[
{
"userId": "111111",
"userName": "Olivia",
"avatarUrl": "https://liteav.sdk.qcloud.com/app/res/picture/voiceroom/avatar/user_avatar1.png"
},
{
"userId": "222222",
"userName": "Sophia",
"avatarUrl": "https://liteav.sdk.qcloud.com/app/res/picture/voiceroom/avatar/user_avatar2.png"
},
{
"userId": "333333",
"userName": "William",
"avatarUrl": "https://liteav.sdk.qcloud.com/app/res/picture/voiceroom/avatar/user_avatar3.png"
},
{
"userId": "444444",
"userName": "James",
"avatarUrl": "https://liteav.sdk.qcloud.com/app/res/picture/voiceroom/avatar/user_avatar4.png"
},
{
"userId": "555555",
"userName": "Charlotte",
"avatarUrl": "https://liteav.sdk.qcloud.com/app/res/picture/voiceroom/avatar/user_avatar5.png"
}
]

Original file line number Diff line number Diff line change
@@ -1,20 +1,33 @@
package com.tencent.liteav.demo;

import static com.tencent.cloud.tuikit.roomkit.ConferenceDefine.KEY_JOIN_CONFERENCE_PARAMS;
import static com.tencent.cloud.tuikit.roomkit.model.ConferenceEventCenter.RoomKitUIEvent.START_LOGIN;

import android.app.Activity;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.os.StrictMode;
import android.text.TextUtils;
import android.util.Log;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.multidex.MultiDexApplication;

import com.tencent.cloud.tuikit.roomkit.ConferenceDefine;
import com.tencent.cloud.tuikit.roomkit.ConferenceMainActivity;
import com.tencent.cloud.tuikit.roomkit.common.utils.UserModel;
import com.tencent.cloud.tuikit.roomkit.model.ConferenceEventCenter;
import com.tencent.cloud.tuikit.roomkit.common.utils.UserModelManager;
import com.tencent.liteav.debug.GenerateTestUserSig;
import com.tencent.qcloud.tuicore.TUIConstants;
import com.tencent.qcloud.tuicore.TUICore;
import com.tencent.qcloud.tuicore.TUILogin;
import com.tencent.qcloud.tuicore.interfaces.ITUINotification;
import com.tencent.qcloud.tuicore.interfaces.TUICallback;

import org.json.JSONObject;

import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
Expand All @@ -39,6 +52,52 @@ public void onCreate() {
closeAndroidPDialog();
ConferenceEventCenter.getInstance().subscribeUIEvent(START_LOGIN, this);
registerActivityLifecycleCallbacks(activityLifecycleCallbacks);
registerConferenceReminderEvent();
}

private void registerConferenceReminderEvent() {
TUICore.registerEvent(TUIConstants.TIMPush.EVENT_NOTIFY, TUIConstants.TIMPush.EVENT_NOTIFY_NOTIFICATION, new ITUINotification() {
@Override
public void onNotifyEvent(String key, String subKey, Map<String, Object> param) {
Log.d(TAG, "onNotifyEvent key = " + key + "subKey = " + subKey);
if (TUIConstants.TIMPush.EVENT_NOTIFY.equals(key) && TUIConstants.TIMPush.EVENT_NOTIFY_NOTIFICATION.equals(subKey) && param != null) {
String extString = (String) param.get(TUIConstants.TIMPush.NOTIFICATION_EXT_KEY);
try {
JSONObject roomObject = new JSONObject(extString);
String roomId = roomObject.getString("RoomId");
if (!TextUtils.isEmpty(roomId)) {
loginAndEnterRoom(roomId);
}
} catch (Exception e) {
}
}
}
});
}

private void loginAndEnterRoom(String roomId) {
final UserModel userModel = UserModelManager.getInstance().getUserModel();
int sdkAppId = GenerateTestUserSig.SDKAppID;
String userId = userModel.userId;
String userSig = GenerateTestUserSig.genTestUserSig(userModel.userId);
Log.d(TAG, "TUILogin.login sdkAppId=" + sdkAppId + " userId=" + userId + " userSig=" + TextUtils.isEmpty(userSig));
TUILogin.login(this.getApplicationContext(), sdkAppId, userId, userSig, new TUICallback() {
@Override
public void onSuccess() {
Log.d(TAG, "TUILogin.login onSuccess");
ConferenceDefine.JoinConferenceParams params = new ConferenceDefine.JoinConferenceParams(roomId);
Intent intent = new Intent(getApplicationContext(), ConferenceMainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra(KEY_JOIN_CONFERENCE_PARAMS, params);
getApplicationContext().startActivity(intent);
}

@Override
public void onError(int errorCode, String errorMessage) {
Log.d(TAG, "TUILogin.login onError errorCode=" + errorCode + " errorMessage=" + errorMessage);
UserModelManager.getInstance().clearUserModel();
}
});
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
package com.tencent.cloud.tuikit.roomkit.view.activity;
package com.tencent.liteav.demo;

import android.os.Bundle;
import android.view.ViewGroup;

import androidx.appcompat.app.AppCompatActivity;

import com.tencent.cloud.tuikit.roomkit.ConferenceSession;
import com.tencent.cloud.tuikit.roomkit.R;
import com.tencent.cloud.tuikit.roomkit.view.component.PrepareView;
import com.tencent.liteav.demo.SelectParticipants.SelectParticipantActivity;

public class PrepareActivity extends AppCompatActivity {
public class ConferenceOptionsActivity extends AppCompatActivity {
public static final String INTENT_ENABLE_PREVIEW = "enablePreview";

@Override
Expand All @@ -19,5 +21,11 @@ protected void onCreate(Bundle savedInstanceState) {
boolean enablePreview = getIntent().getBooleanExtra(INTENT_ENABLE_PREVIEW, true);
PrepareView prepareView = new PrepareView(this, enablePreview);
root.addView(prepareView);
configureConferenceUI();
}

private void configureConferenceUI() {
ConferenceSession.sharedInstance().enableWaterMark();
ConferenceSession.sharedInstance().setContactsViewProvider(SelectParticipantActivity.class);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,10 @@ private void setProfile() {
UserModelManager.getInstance().setUserModel(model);
Log.i(TAG, "set profile success.");
RoomToast.toastLongMessage(getString(R.string.app_toast_register_success_and_logging_in));
startPrepareActivity();
startConferenceOptionsActivity();
}

private void startPrepareActivity() {
private void startConferenceOptionsActivity() {
final UserModel userModel = UserModelManager.getInstance().getUserModel();
int sdkAppId = GenerateTestUserSig.SDKAppID;
String userId = userModel.userId;
Expand All @@ -153,7 +153,7 @@ public void onSuccess() {
TUIRoomEngine.setSelfInfo(userName, userModel.userAvatar, null);
TUIConfig.setSelfNickName(userName);
TUIConfig.setSelfFaceUrl(userModel.userAvatar);
TUICore.startActivity("PrepareActivity", null);
TUICore.startActivity("ConferenceOptionsActivity", null);
finish();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
package com.tencent.liteav.demo.SelectParticipants;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.constraintlayout.utils.widget.ImageFilterView;
import androidx.recyclerview.widget.RecyclerView;

import com.tencent.liteav.demo.R;
import com.tencent.cloud.tuikit.roomkit.common.utils.ImageLoader;
import com.tencent.cloud.tuikit.roomkit.view.page.widget.ScheduleConference.SelectScheduleParticipant.User;

import java.util.ArrayList;
import java.util.List;

public class MoreParticipantsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private List<User> mSelectedParticipants;
private final Context mContext;
private final LayoutInflater mLayoutInflater;
private deleteParticipantCallback mCallback;

public MoreParticipantsAdapter(Context context, List<User> list) {
this.mContext = context;
this.mLayoutInflater = LayoutInflater.from(mContext);
mSelectedParticipants = new ArrayList<>(list);
}

@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View contentView = mLayoutInflater.inflate(R.layout.app_item_more_participants, parent, false);
return new ViewHolderAttendee(contentView);
}

@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
User user = mSelectedParticipants.get(position);
if (holder instanceof ViewHolderAttendee) {
((ViewHolderAttendee) holder).bind(user);
}
}

@Override
public int getItemCount() {
return mSelectedParticipants.size();
}

private class ViewHolderAttendee extends RecyclerView.ViewHolder {
private ImageFilterView mImgAvatar;
private TextView mUserName;
private FrameLayout mFlDeleteParticipant;

public ViewHolderAttendee(@NonNull View itemView) {
super(itemView);
initView(itemView);
}

private void initView(View itemView) {
mFlDeleteParticipant = itemView.findViewById(R.id.fl_delete_participant);
mImgAvatar = itemView.findViewById(R.id.img_participant_avatar);
mUserName = itemView.findViewById(R.id.tv_participant_name);
}

public void bind(User user) {
ImageLoader.loadImage(mContext, mImgAvatar, user.avatarUrl, R.drawable.app_ic_avatar);
mUserName.setText(user.userName);
mFlDeleteParticipant.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mCallback.onParticipantDeleted(user);
}
});
}
}

public void setParticipantDeletedCallback(deleteParticipantCallback callback) {
mCallback = callback;
}

public interface deleteParticipantCallback {
void onParticipantDeleted(User participant);
}

public void removeParticipantItem(User participant) {
if (mSelectedParticipants.contains(participant)) {
int index = mSelectedParticipants.indexOf(participant);
mSelectedParticipants.remove(participant);
notifyItemRemoved(index);
}
}

public int getDeletedParticipantsSize() {
return mSelectedParticipants.size();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package com.tencent.liteav.demo.SelectParticipants;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.tencent.liteav.demo.R;
import com.google.android.material.bottomsheet.BottomSheetDialog;
import com.tencent.cloud.tuikit.roomkit.view.page.widget.ScheduleConference.SelectScheduleParticipant.User;

import java.util.List;
import java.util.Locale;

public class MoreParticipantsPopView extends BottomSheetDialog {
private Context mContext;
private RecyclerView mRvAttendeesView;
private TextView mTvSelectedAttendeeTitle;
private MoreParticipantsAdapter mAdapter;
private onParticipantDeletedCallback mDeletedParticipantCallback;
private ImageView mImgDismissDialog;

public MoreParticipantsPopView(@NonNull Context context) {
super(context, R.style.TUIRoomDialogFragmentTheme);
setContentView(R.layout.app_view_more_participants);
mContext = context;
initView();
}

public void setAttendees(List<User> participants) {
String text = String.format(Locale.getDefault(), getContext().getString(R.string.app_format_select_participant), mContext.getString(R.string.app_selected_text), participants.size());
mTvSelectedAttendeeTitle.setText(text);
mAdapter = new MoreParticipantsAdapter(mContext, participants);
mRvAttendeesView.setAdapter(mAdapter);
mAdapter.setParticipantDeletedCallback(new MoreParticipantsAdapter.deleteParticipantCallback() {
@Override
public void onParticipantDeleted(User participant) {
mAdapter.removeParticipantItem(participant);
if (mDeletedParticipantCallback != null) {
mDeletedParticipantCallback.onParticipantDelete(participant);
}
String text = String.format(Locale.getDefault(), getContext().getString(R.string.app_format_select_participant), mContext.getString(R.string.app_selected_text), mAdapter.getDeletedParticipantsSize());
mTvSelectedAttendeeTitle.setText(text);
}
});
}

private void initView() {
mImgDismissDialog = findViewById(R.id.img_arrow_down);
mImgDismissDialog.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
mTvSelectedAttendeeTitle = findViewById(R.id.tv_selected_participant_count_title);
mRvAttendeesView = findViewById(R.id.rv_attendee_list);
mRvAttendeesView.setLayoutManager(new LinearLayoutManager(mContext));
}

public void setDeleteParticipantCallback(onParticipantDeletedCallback callback) {
mDeletedParticipantCallback = callback;
}

public interface onParticipantDeletedCallback {
void onParticipantDelete(User user);
}
}
Loading

0 comments on commit 4f4d0f2

Please sign in to comment.