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 #82

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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Android/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,3 @@ build/
.cxx
*.codecc/
/build.yml
tuicore
tuiofflinepush
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ public void onClick(View v) {
private void login() {
String userId = mEditUserId.getText().toString().trim();
final UserModel userModel = new UserModel();
userModel.appId = GenerateTestUserSig.SDKAPPID;
userModel.userId = userId;
userModel.userName = userId;
int index = new Random().nextInt(AvatarConstant.USER_AVATAR_ARRAY.length);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import android.widget.TextView;


import com.blankj.utilcode.util.ToastUtils;

import com.tencent.imsdk.v2.V2TIMGroupInfoResult;
import com.tencent.liteav.basic.IntentUtils;
import com.tencent.liteav.basic.UserModel;
Expand Down Expand Up @@ -168,13 +168,13 @@ public void onSuccess(V2TIMGroupInfoResult result) {
if (isRoomExist(result)) {
realEnterRoom(roomIdStr);
} else {
ToastUtils.showLong(R.string.room_not_exist);
ToastUtil.toastLongMessage(getString(R.string.room_not_exist));
}
}

@Override
public void onFailed(int code, String msg) {
ToastUtils.showLong(msg);
ToastUtil.toastLongMessage(msg);
}
});
}
Expand Down
12 changes: 9 additions & 3 deletions Android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

ext.kotlin_version = '1.5.31'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.4'
classpath 'com.android.tools.build:gradle:4.2.1'



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 @@ -29,5 +34,6 @@ task clean(type: Delete) {

ext {
liteavSdk = "com.tencent.liteav:LiteAVSDK_TRTC:latest.release"
imSdk = "com.tencent.imsdk:imsdk-plus:latest.release"
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
2 changes: 1 addition & 1 deletion Android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
12 changes: 6 additions & 6 deletions Android/tuivoiceroom/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ android {
dependencies {
api fileTree(dir: 'libs', include: ['*.jar'])
api "androidx.multidex:multidex:2.0.0"
api "androidx.recyclerview:recyclerview:1.0.0"
api "androidx.appcompat:appcompat:1.3.1"
api "androidx.recyclerview:recyclerview:1.2.1"
api "androidx.appcompat:appcompat:1.0.0"
api "com.google.android.material:material:1.0.0"
api "androidx.constraintlayout:constraintlayout:1.1.3"
api "com.squareup.okhttp3:logging-interceptor:3.8.1"
Expand All @@ -36,9 +36,9 @@ dependencies {
api "com.github.ctiao:DanmakuFlameMaster:0.3.8"
api "de.hdodenhof:circleimageview:3.1.0"
api "com.google.code.gson:gson:2.3.1"
api "com.blankj:utilcode:1.30.7"
api rootProject.ext.liteavSdk
api rootProject.ext.imSdk
api 'com.tencent.liteav.tuikit:tuicore:latest.release'
api project(':debug')

def projects = this.rootProject.getAllprojects().stream().map { project -> project.name }.collect()
api projects.contains("tuicore") ? project(':tuicore') : "com.tencent.liteav.tuikit:tuicore:latest.release"
api rootProject.getProperties().containsKey("liteavSdk") ? rootProject.ext.liteavSdk : "com.tencent.liteav:LiteAVSDK_TRTC: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
@@ -0,0 +1,23 @@
package com.tencent.liteav.basic;

import android.view.View;

/**
* 作用:防止快速点击按钮引起的错误
* 使用:Button.setOnClickListener 时,使用此类作的实现类作为Listener
*/
public abstract class OnSingleClickListener implements View.OnClickListener {
private static final long MIN_CLICK_DELAY_TIME = 500;
private long mLastClickTime = 0;

@Override
public void onClick(View v) {
long curClickTime = System.currentTimeMillis();
if ((curClickTime - mLastClickTime) >= MIN_CLICK_DELAY_TIME) {
mLastClickTime = curClickTime;
onSingleClick(v);
}
}

public abstract void onSingleClick(View v);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package com.tencent.liteav.basic;

import android.content.ContentValues;
import android.content.Context;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Build;
import android.provider.MediaStore;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.OutputStream;

public class PictureUtils {
private static final String TAG = "PictureUtils";

/**
* 保存 Bitmap 到图库
* @param context
* @param bitmap
* @return
*/
public static boolean saveBitmap2Gallery(Context context, Bitmap bitmap) {
if (context == null || bitmap == null) {
return false;
}
if (Build.VERSION.SDK_INT >= 29) {
//返回出一个URI
Uri insert = context.getContentResolver()
.insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, new ContentValues());
if (insert == null) {
return false;
}

//这个打开了输出流 直接保存图片就好了
OutputStream outputStream = null;
try {
outputStream = context.getContentResolver().openOutputStream(insert);
if (outputStream == null) {
return false;
} else {
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, outputStream);
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} finally {
try {
if (outputStream != null) {
outputStream.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
} else {
MediaStore.Images.Media.insertImage(context.getContentResolver(), bitmap, "snapshot", "desc");
}
return true;
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package com.tencent.liteav.basic;

import android.annotation.SuppressLint;
import android.app.Application;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.text.TextUtils;

import java.lang.reflect.InvocationTargetException;

public class RTCubeUtils {
private static final String RTCUBE_PACKAGE_NAME = "com.tencent.trtc";
Expand All @@ -19,10 +22,39 @@ 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;
}

public static boolean isRTCubeApp(Context context) {
return RTCUBE_PACKAGE_NAME.equals(context.getPackageName());
}

public static String getPackageName() {
return getApplicationByReflect().getPackageName();
}

public static Application getApplicationByReflect() {
try {
@SuppressLint("PrivateApi") Class<?> activityThread = Class.forName("android.app.ActivityThread");
Object thread = activityThread.getMethod("currentActivityThread").invoke(null);
Object app = activityThread.getMethod("getApplication").invoke(thread);
if (app == null) {
throw new NullPointerException("You should init first.");
}
return (Application) app;
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
throw new NullPointerException("You should init first.");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package com.tencent.liteav.basic;

import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.util.TypedValue;

import androidx.annotation.StringRes;

public class ResourceUtils {

private static final String TYPE_QUOTE_PREFIX = "@";
private static final String TYPE_COLOR_PREFIX = "#";

private static final String TYPE_STRING = "string";
private static final String TYPE_COLOR = "color";
private static final String TYPE_DRAWABLE = "drawable";

public static int getDrawableId(String resName) {
if (resName.startsWith(TYPE_QUOTE_PREFIX)) {
return getResources().getIdentifier(resName, TYPE_DRAWABLE, RTCubeUtils.getPackageName());
}
throw new IllegalArgumentException("\"" + resName + "\" is illegal, must start with \"@\".");
}

public static int getStringId(String resName) {
return getResources().getIdentifier(resName, TYPE_STRING, RTCubeUtils.getPackageName());
}

public static String getString(String resName) {
if (resName.startsWith(TYPE_QUOTE_PREFIX)) {
return getResources().getString(getStringId(resName.substring(1)));
}
return resName;
}

public static String getString(@StringRes int resId) {
return getResources().getString(resId);
}

public static int getColor(String resName) {
if (resName.startsWith(TYPE_COLOR_PREFIX)) {
return Color.parseColor(resName);
}
if (resName.startsWith(TYPE_QUOTE_PREFIX)) {
return getResources().getColor(getColorId(resName));
}
throw new IllegalArgumentException("\"" + resName + "\" is unknown color.");
}

public static int getColorId(String resName) {
return getResources().getIdentifier(resName, TYPE_COLOR, RTCubeUtils.getPackageName());
}

public static Resources getResources() {
return RTCubeUtils.getApplicationByReflect().getResources();
}

public static int dip2px(float dpValue) {
final float scale = getResources().getDisplayMetrics().density;
return (int) (dpValue * scale + 0.5f);
}

public static Bitmap decodeResource(int id) {
TypedValue value = new TypedValue();
getResources().openRawResource(id, value);
BitmapFactory.Options opts = new BitmapFactory.Options();
opts.inTargetDensity = value.density;
return BitmapFactory.decodeResource(getResources(), id, opts);
}
}
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
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ public void run() {
public void run() {
TRTCLogger.i(TAG, "you are already in the seat");
if (callback != null) {
callback.onCallback(-1, "you are already in the seat");
callback.onCallback(0, "you are already in the seat");
}
}
});
Expand Down
Loading