Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release-11.4.13189 #58

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import androidx.appcompat.app.AppCompatActivity;

import com.blankj.utilcode.util.ToastUtils;

import com.tencent.liteav.basic.UserModelManager;
import com.tencent.liteav.demo.R;
import com.tencent.liteav.demo.app.KeepAliveService;
Expand Down Expand Up @@ -89,7 +89,7 @@ public void onSuccess() {
if (FloatWindow.mIsShowing) {
FloatWindow.getInstance().destroy();
}
ToastUtils.showShort(getString(R.string.app_logoff_account_ok));
ToastUtil.toastShortMessage(getString(R.string.app_logoff_account_ok));
if (UserModelManager.getInstance().haveBackstage()) {
startLoginActivity();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import android.widget.EditText;
import android.widget.TextView;

import com.blankj.utilcode.util.ToastUtils;

import com.google.android.material.bottomsheet.BottomSheetDialog;
import com.tencent.liteav.basic.UserModel;
import com.tencent.liteav.basic.UserModelManager;
Expand Down Expand Up @@ -45,7 +45,7 @@ public void onClick(View v) {
private void setProfile() {
String userName = mEditUserName.getText().toString().trim();
if (TextUtils.isEmpty(userName) || mUserModel.userId == null) {
ToastUtils.showLong(mContext.getString(R.string.app_toast_set_username));
ToastUtil.toastLongMessage(mContext.getString(R.string.app_toast_set_username));
return;
}
String reg = "^[a-z0-9A-Z\\u4e00-\\u9fa5\\_]{2,20}$";
Expand All @@ -57,14 +57,14 @@ private void setProfile() {
ProfileManager.getInstance().setNickName(userName, new ProfileManager.ActionCallback() {
@Override
public void onSuccess() {
ToastUtils.showLong(mContext.getString(R.string.app_toast_success_to_set_username));
ToastUtil.toastLongMessage(mContext.getString(R.string.app_toast_success_to_set_username));
mListener.onSuccess();
dismiss();
}

@Override
public void onFailed(int code, String msg) {
ToastUtils.showLong(mContext.getString(R.string.app_toast_failed_to_set_username, msg));
ToastUtil.toastLongMessage(mContext.getString(R.string.app_toast_failed_to_set_username, msg));
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@

import androidx.core.app.NotificationCompat;

import com.blankj.utilcode.util.ServiceUtils;
import com.tencent.liteav.demo.R;

public class KeepAliveService extends Service {
private static final int NOTIFICATION_ID = 1001;

public static void start(Context context) {
if (ServiceUtils.isServiceRunning(KeepAliveService.class)) {
if (isServiceRunning(context, KeepAliveService.class.getName())) {
return;
}
Intent starter = new Intent(context, KeepAliveService.class);
Expand All @@ -34,6 +33,23 @@ public static void stop(Context context) {
context.stopService(intent);
}

private static boolean isServiceRunning(Context context, String className) {
if (context == null || TextUtils.isEmpty(className)) {
return false;
}
ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
List<ActivityManager.RunningServiceInfo> info = am.getRunningServices(0x7FFFFFFF);
if (info == null || info.size() == 0) {
return false;
}
for (ActivityManager.RunningServiceInfo aInfo : info) {
if (className.equals(aInfo.service.getClassName())) {
return true;
}
}
return false;
}

@Override
public void onCreate() {
super.onCreate();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ mLiveItemEntityList, new OnItemClickListener() {
public void onItemClick(int position) {
LiveItemEntity entity = mLiveItemEntityList.get(position);
// if (entity.mTargetClass == ShoppingLiveEntranceActivity.class) {
// ToastUtils.showShort(R.string.app_more_function_please_wait);
// ToastUtil.toastShortMessage(R.string.app_more_function_please_wait);
// return;
// }
Intent intent = new Intent(mContext, entity.mTargetClass);
Expand Down
4 changes: 3 additions & 1 deletion Android/basic/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ android {
dependencies {
api fileTree(include: ['*.jar'], dir: 'libs')

api "com.blankj:utilcode:1.30.7"
api "com.google.code.gson:gson:2.3.1"
api "de.hdodenhof:circleimageview:3.1.0"
api "com.github.ctiao:DanmakuFlameMaster:0.3.8"
Expand All @@ -35,5 +34,8 @@ dependencies {
api "androidx.multidex:multidex:2.0.0"
api 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
api 'me.dm7.barcodescanner:zxing:1.8.4'

def projects = this.rootProject.getAllprojects().stream().map { project -> project.name }.collect()
api projects.contains("tuicore") ? project(':tuicore') : "com.tencent.liteav.tuikit:tuicore:latest.release"
}

Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static void safeStartActivity(Context context, Intent intent) {
}
context.startActivity(intent);
} catch (ActivityNotFoundException e) {
Log.e("TAG", "ActivityNotFoundException : " + intent.toString());
Log.e(TAG, "ActivityNotFoundException : " + intent.toString());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ public static String getApplicationName(Context context) {
applicationInfo = null;
}
String applicationName = (String) packageManager.getApplicationLabel(applicationInfo);
if (applicationInfo != null) {
applicationName = context.getResources().getString(applicationInfo.labelRes);
}

return TextUtils.isEmpty(applicationName) ? "" : applicationName;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import android.util.Log;

import com.blankj.utilcode.util.GsonUtils;
import com.blankj.utilcode.util.SPUtils;
import com.google.gson.Gson;
import com.tencent.qcloud.tuicore.util.SPUtils;

import java.text.SimpleDateFormat;
import java.util.Date;
Expand Down Expand Up @@ -43,7 +43,7 @@ public synchronized UserModel getUserModel() {
public synchronized void setUserModel(UserModel model) {
mUserModel = model;
try {
SPUtils.getInstance(PER_DATA).put(PER_USER_MODEL, GsonUtils.toJson(mUserModel));
SPUtils.getInstance(PER_DATA).put(PER_USER_MODEL, new Gson().toJson(mUserModel));
} catch (Exception e) {
Log.d(TAG, "");
}
Expand All @@ -52,7 +52,7 @@ public synchronized void setUserModel(UserModel model) {
private void loadUserModel() {
try {
String json = SPUtils.getInstance(PER_DATA).getString(PER_USER_MODEL);
mUserModel = GsonUtils.fromJson(json, UserModel.class);
mUserModel = new Gson().fromJson(json, UserModel.class);
} catch (Exception e) {
Log.d(TAG, "loadUserModel failed:" + e.getMessage());
}
Expand Down
6 changes: 5 additions & 1 deletion Android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ buildscript {


classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

// 添加神策分析 android-gradle-plugin2 依赖
classpath 'com.sensorsdata.analytics.android:android-gradle-plugin2:3.5.3'
}
}

Expand All @@ -31,5 +34,6 @@ task clean(type: Delete) {

ext {
liteavSdk="com.tencent.liteav:LiteAVSDK_Live:latest.release"
imSdk = "com.tencent.imsdk:imsdk-plus:7.1.3925"
roomEngineSdk = "com.tencent.liteav.tuikit:tuiroomengine:latest.release"
imSdk = "com.tencent.imsdk:imsdk-plus:7.4.4643"
}
2 changes: 1 addition & 1 deletion Android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
org.gradle.jvmargs=-Xmx4608M
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
import android.text.TextUtils;
import android.util.Log;

import com.blankj.utilcode.util.SPUtils;
import com.blankj.utilcode.util.ToastUtils;
import com.tencent.imsdk.v2.V2TIMCallback;
import com.tencent.imsdk.v2.V2TIMManager;
import com.tencent.imsdk.v2.V2TIMSDKConfig;
Expand Down Expand Up @@ -335,7 +333,7 @@ public void onCallback(int errorCode, String message) {
callback.onSuccess();
} else {
callback.onFailed(errorCode, message);
ToastUtils.showLong(mContext.getString(R.string.login_toast_failed_to_set_username),
ToastUtil.toastLongMessage(mContext.getString(R.string.login_toast_failed_to_set_username),
message);
}
}
Expand Down Expand Up @@ -597,7 +595,7 @@ public void onResponse(Call<ResponseEntityEmpty> call, retrofit2.Response<Respon
callback.onSuccess();
} else {
callback.onFailed(errCode, errMsg);
ToastUtils.showLong(mContext.getString(R.string.login_toast_failed_to_set_username), errMsg);
ToastUtil.toastLongMessage(mContext.getString(R.string.login_toast_failed_to_set_username), errMsg);
}
}

Expand Down Expand Up @@ -682,15 +680,15 @@ public void onFailed(int code, String msg) {
public void setNickName(final String nickname, final ActionCallback callback) {
IMManager.sharedInstance().setNickname(nickname, new IMManager.Callback() {
@Override
public void onCallback(int errorCode, String message) {
public void onCallback(int errorCode, String msg) {
if (errorCode == 0) {
UserModel userModel = UserModelManager.getInstance().getUserModel();
userModel.userName = nickname;
UserModelManager.getInstance().setUserModel(userModel);
callback.onSuccess();
} else {
callback.onFailed(errorCode, message);
ToastUtils.showLong(mContext.getString(R.string.login_toast_failed_to_set_username), message);
callback.onFailed(errorCode, msg);
ToastUtil.toastLongMessage(mContext.getString(R.string.login_toast_failed_to_set_username), msg);
}
}
});
Expand All @@ -699,15 +697,15 @@ public void onCallback(int errorCode, String message) {
public void setAvatar(final String avatar, final ActionCallback callback) {
IMManager.sharedInstance().setAvatar(avatar, new IMManager.Callback() {
@Override
public void onCallback(int errorCode, String message) {
public void onCallback(int errorCode, String msg) {
if (errorCode == 0) {
UserModel userModel = UserModelManager.getInstance().getUserModel();
userModel.userAvatar = avatar;
UserModelManager.getInstance().setUserModel(userModel);
callback.onSuccess();
} else {
callback.onFailed(errorCode, message);
ToastUtils.showLong(mContext.getString(R.string.login_toast_failed_to_set_username), message);
callback.onFailed(errorCode, msg);
ToastUtil.toastLongMessage(mContext.getString(R.string.login_toast_failed_to_set_username), msg);
}
}
});
Expand All @@ -727,21 +725,21 @@ public void onSuccess() {
@Override
public void onFailed(int code, String msg) {
callback.onFailed(code, msg);
ToastUtils.showLong(mContext.getString(R.string.login_toast_failed_to_set_username), msg);
ToastUtil.toastLongMessage(mContext.getString(R.string.login_toast_failed_to_set_username), msg);
}
});
IMManager.sharedInstance().setNicknameAndAvatar(nickname, avatar, new IMManager.Callback() {
@Override
public void onCallback(int errorCode, String message) {
public void onCallback(int errorCode, String msg) {
if (errorCode == 0) {
UserModel userModel = UserModelManager.getInstance().getUserModel();
userModel.userAvatar = avatar;
userModel.userName = nickname;
UserModelManager.getInstance().setUserModel(userModel);
callback.onSuccess();
} else {
callback.onFailed(errorCode, message);
ToastUtils.showLong(mContext.getString(R.string.login_toast_failed_to_set_username), message);
callback.onFailed(errorCode, msg);
ToastUtil.toastLongMessage(mContext.getString(R.string.login_toast_failed_to_set_username), msg);
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import android.widget.EditText;
import android.widget.TextView;

import com.blankj.utilcode.util.ToastUtils;

import com.tencent.liteav.basic.AvatarConstant;
import com.tencent.liteav.login.R;
import com.tencent.liteav.login.model.ProfileManager;
Expand Down Expand Up @@ -183,7 +183,7 @@ private void login() {
final String username = mEditUserName.getText().toString().trim();
String password = mEditPassword.getText().toString().trim();
if (TextUtils.isEmpty(username) || TextUtils.isEmpty(password)) {
ToastUtils.showLong(R.string.login_tips_input_correct_info);
ToastUtil.toastLongMessage(R.string.login_tips_input_correct_info);
return;
}
handleLoginStatus(STATUS_LOGGING_IN);
Expand Down Expand Up @@ -223,14 +223,14 @@ private void initializeUserProfile(String userName) {
ProfileManager.getInstance().setNicknameAndAvatar(userName, avatarUrl, new ProfileManager.ActionCallback() {
@Override
public void onSuccess() {
ToastUtils.showLong(getString(R.string.login_toast_register_success_and_logging_in));
ToastUtil.toastLongMessage(getString(R.string.login_toast_register_success_and_logging_in));
startMainActivity();
finish();
}

@Override
public void onFailed(int code, String msg) {
ToastUtils.showLong(getString(R.string.login_toast_failed_to_set_username, msg));
ToastUtil.toastLongMessage(getString(R.string.login_toast_failed_to_set_username, msg));
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import android.widget.EditText;
import android.widget.TextView;

import com.blankj.utilcode.util.ToastUtils;

import com.tencent.liteav.login.R;
import com.tencent.liteav.login.model.ProfileManager;

Expand Down Expand Up @@ -119,15 +119,15 @@ private void register() {
String username = mEditUserName.getText().toString().trim();
String password = mEditPassword.getText().toString().trim();
if (TextUtils.isEmpty(username) || TextUtils.isEmpty(password)) {
ToastUtils.showLong(R.string.login_tips_input_correct_info);
ToastUtil.toastLongMessage(R.string.login_tips_input_correct_info);
return;
}

final ProfileManager profileManager = ProfileManager.getInstance();
profileManager.register(username, password, new ProfileManager.ActionCallback() {
@Override
public void onSuccess() {
ToastUtils.showShort(R.string.login_toast_register_success_and_logging_in);
ToastUtil.toastShortMessage(R.string.login_toast_register_success_and_logging_in);
Intent starter = new Intent(RegisterActivity.this, LoginActivity.class);
startActivity(starter);
finish();
Expand All @@ -136,12 +136,12 @@ public void onSuccess() {
@Override
public void onFailed(int code, String msg) {
if (code == ERROR_CODE_NEED_REGISTER) {
ToastUtils.showShort(R.string.login_toast_register_success_and_logging_in);
ToastUtil.toastShortMessage(R.string.login_toast_register_success_and_logging_in);
Intent starter = new Intent(RegisterActivity.this, LoginActivity.class);
startActivity(starter);
finish();
} else {
ToastUtils.showLong(msg);
ToastUtil.toastLongMessage(msg);
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.blankj.utilcode.util.ToastUtils;

import com.google.android.material.bottomsheet.BottomSheetDialog;
import com.tencent.liteav.basic.AvatarConstant;
import com.tencent.liteav.basic.UserModel;
Expand Down Expand Up @@ -63,14 +63,14 @@ private void setProfile(final String avatarUrl) {
ProfileManager.getInstance().setAvatar(avatarUrl, new ProfileManager.ActionCallback() {
@Override
public void onSuccess() {
ToastUtils.showLong(mContext.getString(R.string.login_toast_success_to_set_username));
ToastUtil.toastLongMessage(mContext.getString(R.string.login_toast_success_to_set_username));
mListener.onSuccess();
dismiss();
}

@Override
public void onFailed(int code, String msg) {
ToastUtils.showLong(mContext.getString(R.string.login_toast_failed_to_set_username, msg));
ToastUtil.toastLongMessage(mContext.getString(R.string.login_toast_failed_to_set_username, msg));
}
});
}
Expand Down
Loading