Merge branch 'yinyou_v3.6.4' into yinyou_develop
# Conflicts: # app/src/main/AndroidManifest.xml # app/src/main/java/com/yizhuan/erban/avroom/adapter/BaseMicroViewAdapter.java # app/src/main/java/com/yizhuan/erban/avroom/anotherroompk/RoomPKBoardView.kt # app/src/main/res/layout/layout_room_pk_board_view.xml # core/src/main/java/com/yizhuan/xchat_android_core/manager/AvRoomDataManager.java # core/src/main/java/com/yizhuan/xchat_android_core/room/bean/RoomInfo.java
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
app/aliyun-libs/rpsdk-4.13.1-open.aar
Normal file
BIN
app/aliyun-libs/rpsdk-4.13.1-open.aar
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -6,8 +6,6 @@ apply plugin: 'com.android.application'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
apply plugin: 'com.huawei.agconnect'
|
||||
apply plugin: 'android-junk-code'
|
||||
|
||||
|
||||
android {
|
||||
compileSdkVersion 29
|
||||
@@ -24,13 +22,7 @@ android {
|
||||
|
||||
ndk {
|
||||
//设置支持的SO库架构
|
||||
if (ndk_abi_filters == "x86") {
|
||||
abiFilters "x86"
|
||||
} else if (ndk_abi_filters == "arm_x86") {
|
||||
abiFilters "armeabi-v7a", "x86"
|
||||
} else {
|
||||
abiFilters "armeabi-v7a"
|
||||
}
|
||||
abiFilters "armeabi-v7a", "arm64-v8a"
|
||||
}
|
||||
|
||||
flavorDimensions 'default'
|
||||
@@ -42,7 +34,7 @@ android {
|
||||
variant ->
|
||||
variant.outputs.all {
|
||||
def date = new Date().format("MMddHHmm", TimeZone.getTimeZone("GMT+08"))
|
||||
outputFileName = "yinyou_" + buildType.name + "_v${Boolean.parseBoolean(with_jenkins) ? "" : (defaultConfig.versionName + "-" + date)}.apk"
|
||||
outputFileName = "yinyou_${buildType.name}_${channel}_v${defaultConfig.versionName}-${date}.apk"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,12 +182,8 @@ android {
|
||||
productFlavors {
|
||||
accompany {
|
||||
dimension 'default'
|
||||
manifestPlaceholders = [CHANNEL_VALUE: channel]
|
||||
}
|
||||
|
||||
oppo {
|
||||
dimension 'default'
|
||||
}
|
||||
|
||||
}
|
||||
buildToolsVersion = '28.0.3'
|
||||
|
||||
@@ -260,12 +248,10 @@ dependencies {
|
||||
implementation files("libs/vivo_pushsdk-v2.9.0.0.aar")
|
||||
|
||||
//阿里云实名认证
|
||||
api(name: 'windvane', ext: 'aar')
|
||||
api(name: 'oss-android-sdk-2.9.2', ext: 'aar')
|
||||
api(name: 'rpsdk-4.5.0-open', ext: 'aar')
|
||||
api(name: 'rpsdk-4.13.1-open', ext: 'aar')
|
||||
api(name: 'MiddleTierSDK-external-release-5.5.13874142', ext: 'aar')
|
||||
api(name: 'SecurityBodySDK-external-release-5.5.19', ext: 'aar')
|
||||
api(name: 'SecurityGuardSDK-external-release-5.5.14240408', ext: 'aar')
|
||||
api(name: 'SecurityBodySDK-external-release-5.5.15071314', ext: 'aar')
|
||||
api(name: 'SecurityGuardSDK-external-release-5.5.15071059', ext: 'aar')
|
||||
|
||||
//数字滚动效果
|
||||
implementation 'com.github.YvesCheung:RollingText:1.2.3'
|
||||
@@ -321,23 +307,3 @@ repositories {
|
||||
url "$storageUrl/download.flutter.io"
|
||||
}
|
||||
}
|
||||
|
||||
android.applicationVariants.all { variant ->
|
||||
print("variant.name=" + variant.name)
|
||||
switch (variant.name) {//变体名称,如果没有设置productFlavors就是buildType名称,如果有设置productFlavors就是flavor+buildType,例如(freeRelease、proRelease)
|
||||
case "oppoRelease":
|
||||
androidJunkCode.configMap.put(variant.name, {
|
||||
packageBase = "com.mango.plugin.ui" //生成java类根包名
|
||||
packageCount = 30 //生成包数量
|
||||
activityCountPerPackage = 30 //每个包下生成Activity类数量
|
||||
excludeActivityJavaFile = false
|
||||
//是否排除生成Activity的Java文件,默认false(layout和写入AndroidManifest.xml还会执行),主要用于处理类似神策全埋点编译过慢问题
|
||||
otherCountPerPackage = 50 //每个包下生成其它类的数量
|
||||
methodCountPerClass = 20 //每个类下生成方法数量
|
||||
resPrefix = "mango_" //生成的layout、drawable、string等资源名前缀
|
||||
drawableCount = 300 //生成drawable资源数量
|
||||
stringCount = 300 //生成string数量
|
||||
})
|
||||
break
|
||||
}
|
||||
}
|
||||
|
@@ -89,12 +89,11 @@
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/MyMaterialTheme"
|
||||
android:usesCleartextTraffic="true"
|
||||
android:networkSecurityConfig="@xml/network_security_config"
|
||||
tools:replace="android:name, android:allowBackup">
|
||||
tools:replace="android:name,android:allowBackup">
|
||||
|
||||
<meta-data
|
||||
android:name="CHANNEL"
|
||||
android:value="official" />
|
||||
android:value="${CHANNEL_VALUE}" />
|
||||
|
||||
<!-- 刘海屏适配 begin -->
|
||||
<!-- 小米 -->
|
||||
@@ -684,6 +683,9 @@
|
||||
<activity
|
||||
android:name=".ui.webview.CommonWebViewActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".ui.webview.SimpleWebViewActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".bills.activities.RedBagBillsActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
@@ -33,6 +33,7 @@ import android.util.Log;
|
||||
|
||||
import androidx.multidex.MultiDex;
|
||||
|
||||
import com.alibaba.security.realidentity.RPVerify;
|
||||
import com.alibaba.security.rp.RPSDK;
|
||||
import com.bumptech.glide.request.target.ViewTarget;
|
||||
import com.bytedance.hume.readapk.HumeSDK;
|
||||
@@ -137,306 +138,7 @@ import io.realm.RealmConfiguration;
|
||||
|
||||
public class XChatApplication extends Application {
|
||||
public static final String TAG = "XChatApplication";
|
||||
private static XChatApplication instance;
|
||||
|
||||
public static XChatApplication instance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
//生命周期监听
|
||||
private ActivityLifeManager lifeManager;
|
||||
|
||||
//static 代码段可以防止内存泄露
|
||||
static {
|
||||
SmartRefreshLayout.setDefaultRefreshHeaderCreater(
|
||||
(context, layout) -> {
|
||||
layout.setEnableHeaderTranslationContent(false);
|
||||
MaterialHeader materialHeader = new MaterialHeader(context);
|
||||
materialHeader.setShowBezierWave(false);
|
||||
return materialHeader;
|
||||
});
|
||||
SmartRefreshLayout.setDefaultRefreshFooterCreater(
|
||||
(context, layout) -> new ClassicsFooter(context).setDrawableSize(20));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
long startTime = System.currentTimeMillis();
|
||||
super.onCreate();
|
||||
instance = this;
|
||||
String channel = "";
|
||||
try {
|
||||
ApplicationInfo appInfo = getPackageManager().getApplicationInfo(getPackageName(), PackageManager.GET_META_DATA);
|
||||
channel = appInfo.metaData.getString("CHANNEL");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (TextUtils.isEmpty(channel)) {
|
||||
channel = "official";
|
||||
}
|
||||
|
||||
BasicConfig.INSTANCE.setOriginalChannel(channel);
|
||||
|
||||
//头条分包渠道
|
||||
if (BasicConfig.INSTANCE.isByteDanceChannel()) {
|
||||
String byteDanceChannel = HumeSDK.getChannel(this);
|
||||
if (!TextUtils.isEmpty(byteDanceChannel)) {
|
||||
channel = byteDanceChannel;
|
||||
}
|
||||
}
|
||||
BasicConfig.INSTANCE.setChannel(channel);
|
||||
|
||||
LogUtils.d(channel + "");
|
||||
initEnv();
|
||||
|
||||
//延迟初始化云信
|
||||
NIMClient.init(this, null, options());
|
||||
|
||||
//logger 配置
|
||||
Logger.addLogAdapter(new AndroidLogAdapter() {
|
||||
@Override
|
||||
public boolean isLoggable(int priority, String tag) {
|
||||
return BuildConfig.DEBUG;
|
||||
}
|
||||
});
|
||||
|
||||
ToastUtils.init(this);
|
||||
|
||||
if (inMainProcess(this)) {
|
||||
// 注册自定义推送消息处理,这个是可选项
|
||||
NIMPushClient.registerMixPushMessageHandler(new PushMessageHandler());
|
||||
|
||||
RxJavaPlugins.setErrorHandler(throwable -> {
|
||||
if (BuildConfig.DEBUG) {
|
||||
Log.e(TAG, "the subscribe() method default error handler", throwable);
|
||||
}
|
||||
});
|
||||
|
||||
//需要完善资料错误码全局处理
|
||||
GsonConverterPlugins.setResultHandler(result -> {
|
||||
if (result instanceof ServiceResult<?>) {
|
||||
ServiceResult<?> serviceResult = (ServiceResult<?>) result;
|
||||
if (serviceResult.getCode() == ServiceResult.CODE_NEED_COMPLETE_USER_INFO) {
|
||||
SingleToastUtil.showToast(serviceResult.getMessage());
|
||||
EventBus.getDefault().post(new NeedCompleteInfoEvent());
|
||||
throw new ServerException(serviceResult.getMessage(), serviceResult.getCode());
|
||||
}
|
||||
}
|
||||
return null;
|
||||
});
|
||||
GsonConverterPlugins.lockdown();
|
||||
|
||||
//fixed: Glide Exception:"You must not call setTag() on a view Glide is targeting"
|
||||
ViewTarget.setTagId(R.id.tag_glide);
|
||||
|
||||
// 初始化 sp
|
||||
SharedPreferenceUtils.init(this);
|
||||
|
||||
init(channel);
|
||||
|
||||
initLinkedMe();
|
||||
|
||||
if (!TextUtils.isEmpty(channel)) {
|
||||
CrashReport.setAppChannel(this, channel);
|
||||
}
|
||||
|
||||
initBuglyUpdate();
|
||||
Bugly.init(this, BuildConfig.DEBUG ? XChatConstants.BUGLY_KEY_DEBUG : XChatConstants.BUGLY_KEY_RELEASE, BuildConfig.DEBUG);
|
||||
if (!TextUtils.isEmpty(channel)) {
|
||||
Bugly.setAppChannel(this, channel);
|
||||
}
|
||||
|
||||
//生命周期监听
|
||||
if (lifeManager == null) {
|
||||
lifeManager = new ActivityLifeManager();
|
||||
}
|
||||
registerActivityLifecycleCallback(lifeManager);
|
||||
ActivityMgr.INST.init(this);
|
||||
|
||||
boolean isShowPrivacyAgreement = (boolean) SharedPreferenceUtils.get(SplashActivity.SHOW_PRIVACY_AGREEMENT, true);
|
||||
if (!isShowPrivacyAgreement) {
|
||||
initOtherSDK();
|
||||
}
|
||||
}
|
||||
dealHuaWeiCrash();
|
||||
|
||||
if (BuildConfig.APPLICATION_ID.equals(getProcessName(this))) {
|
||||
FlutterBoost.instance().setup(this, new XplanFlutterBoostDelegate(), new XplanFlutterBoostCallback());
|
||||
}
|
||||
LogUtils.d("init time = " + (System.currentTimeMillis() - startTime) + "ms");
|
||||
}
|
||||
|
||||
private static boolean isInitOtherSDK = false;
|
||||
|
||||
public static void initOtherSDK() {
|
||||
|
||||
if (isInitOtherSDK) return;
|
||||
|
||||
isInitOtherSDK = true;
|
||||
Context context = BasicConfig.INSTANCE.getAppContext();
|
||||
LinkedME.getInstance().setImmediate(true);
|
||||
// 网易易盾初始化
|
||||
watchman.init(context, XChatConstants.YI_DUN_PRODUCT_NUMBER); // 网易易盾初始化
|
||||
MobSDK.init(context);
|
||||
MobSDK.submitPolicyGrantResult(true, null);
|
||||
// 友盟统计初始化
|
||||
UMConfigure.init(context, XChatConstants.UMENG_APP_KEY,
|
||||
BasicConfig.INSTANCE.getChannel(), UMConfigure.DEVICE_TYPE_PHONE, null);
|
||||
// 选用MANUAL页面采集模式
|
||||
MobclickAgent.setPageCollectionMode(MobclickAgent.PageMode.MANUAL);
|
||||
// 支持在子进程中统计自定义事件
|
||||
UMConfigure.setProcessEvent(true);
|
||||
// 日志加密
|
||||
UMConfigure.setEncryptEnabled(true);
|
||||
// 集成测试
|
||||
UMConfigure.setLogEnabled(BuildConfig.DEBUG);
|
||||
//实人认证
|
||||
RPSDK.initialize(context);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 初始化linkedMe
|
||||
*/
|
||||
private void initLinkedMe() {
|
||||
LinkedME.getInstance(this, XChatConstants.LINKED_ME_KEY);
|
||||
if (isDebug()) {
|
||||
//设置debug模式下打印LinkedME日志
|
||||
LinkedME.getInstance().setDebug();
|
||||
}
|
||||
//初始时请设置为false
|
||||
LinkedME.getInstance().setImmediate(false);
|
||||
//设置处理跳转逻辑的中转页,MiddleActivity详见后续配置
|
||||
LinkedME.getInstance().setHandleActivity(MiddleActivity.class.getName());
|
||||
}
|
||||
|
||||
private void initEnv() {
|
||||
BasicConfig.INSTANCE.setAppContext(this.getApplicationContext());
|
||||
|
||||
//首先初始化环境
|
||||
Env.initEnv(BuildConfig.BUILD_TYPE, BuildConfig.DEBUG);
|
||||
//切换生产坏境和测试环境 true/测试环境 false/生产环境
|
||||
BasicConfig.INSTANCE.setDebuggable(Env.isDebug());
|
||||
BasicConfig.INSTANCE.setRootDir(Constants.ERBAN_DIR_NAME);
|
||||
BasicConfig.INSTANCE.setLogDir(Constants.LOG_DIR);
|
||||
BasicConfig.INSTANCE.setConfigDir(Constants.CONFIG_DIR);
|
||||
BasicConfig.INSTANCE.setVoiceDir(Constants.VOICE_DIR);
|
||||
BasicConfig.INSTANCE.setCacheDir(Constants.CACHE_DIR);
|
||||
BasicConfig.INSTANCE.setImageDir(Constants.IMAGE_CACHE_DIR);
|
||||
}
|
||||
|
||||
|
||||
private void dealHuaWeiCrash() {
|
||||
String brand = Build.BRAND;
|
||||
String manufacturer = Build.MANUFACTURER;
|
||||
if (!TextUtils.isEmpty(brand) && (
|
||||
"HUAWEI".toLowerCase().equals(brand.toLowerCase())
|
||||
|| "HONOR".toLowerCase().equals(brand.toLowerCase())
|
||||
|| "HUAWEI".equals(manufacturer))) {
|
||||
LoadedApkHuaWei.hookHuaWeiVerifier(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void attachBaseContext(Context base) {
|
||||
super.attachBaseContext(base);
|
||||
MultiDex.install(base);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onTerminate() {
|
||||
super.onTerminate();
|
||||
CrashReport.closeBugly();
|
||||
if (lifeManager != null) {
|
||||
unregisterActivityLifecycleCallbacks(lifeManager);
|
||||
}
|
||||
GlobalHandleManager.get().unInit();
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
|
||||
public void registerActivityLifecycleCallback(Application.ActivityLifecycleCallbacks callbacks) {
|
||||
this.registerActivityLifecycleCallbacks(callbacks);
|
||||
}
|
||||
|
||||
/**
|
||||
* 云信配置
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public SDKOptions options() {
|
||||
SDKOptions options = new SDKOptions();
|
||||
options.disableAwake = true;
|
||||
options.asyncInitSDK = true;
|
||||
// options.customPushContentType = "";
|
||||
if (isDebug()) {
|
||||
options.checkManifestConfig = true;
|
||||
}
|
||||
// 如果将新消息通知提醒托管给 SDK 完成,需要添加以下配置。否则无需设置。
|
||||
StatusBarNotificationConfig config = new StatusBarNotificationConfig();
|
||||
// 点击通知栏跳转到该Activity
|
||||
config.notificationEntrance = NimMiddleActivity.class;
|
||||
// config.notificationSmallIconId = R.drawable.icon_msg_normal;
|
||||
// 呼吸灯配置
|
||||
config.ledARGB = Color.GREEN;
|
||||
config.ledOnMs = 1000;
|
||||
config.ledOffMs = 1500;
|
||||
config.notificationFoldStyle = NotificationFoldStyle.CONTACT;
|
||||
// 通知铃声的uri字符串
|
||||
config.notificationSound = "android.resource://com.netease.nim.demo/raw/msg";
|
||||
options.statusBarNotificationConfig = config;
|
||||
// 定制通知栏提醒文案(可选,如果不定制将采用SDK默认文案)
|
||||
options.messageNotifierCustomization = messageNotifierCustomization;
|
||||
|
||||
options.appKey = Constants.nimAppKey;
|
||||
|
||||
// 配置保存图片,文件,log 等数据的目录
|
||||
// 如果 options 中没有设置这个值,SDK 会使用下面代码示例中的位置作为 SDK 的数据目录。
|
||||
// 该目录目前包含 log, file, image, audio, video, thumb 这6个目录。
|
||||
// 如果第三方 APP 需要缓存清理功能, 清理这个目录下面个子目录的内容即可。
|
||||
String sdkPath = null;
|
||||
try {
|
||||
sdkPath = Environment.getExternalStorageDirectory() + "/" + this.getPackageName() + "/nim";
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
|
||||
}
|
||||
options.sdkStorageRootPath = sdkPath;
|
||||
|
||||
// 配置是否需要预下载附件缩略图,默认为 true
|
||||
options.preloadAttach = true;
|
||||
|
||||
// 配置附件缩略图的尺寸大小。表示向服务器请求缩略图文件的大小
|
||||
// 该值一般应根据屏幕尺寸来确定, 默认值为 Screen.width / 2
|
||||
int widthPixels = this.getResources().getDisplayMetrics().widthPixels;
|
||||
options.thumbnailSize = widthPixels / 2;
|
||||
// // save cache,留做切换账号备用
|
||||
DemoCache.setNotificationConfig(config);
|
||||
|
||||
MixPushConfig mixPushConfig = new MixPushConfig();
|
||||
//华为推送
|
||||
mixPushConfig.hwAppId = HW_APP_ID;
|
||||
mixPushConfig.hwCertificateName = HW_CERTIFICATE_NAME;
|
||||
//小米推送
|
||||
mixPushConfig.xmAppId = XM_APP_ID;
|
||||
mixPushConfig.xmAppKey = XM_APP_KEY;
|
||||
mixPushConfig.xmCertificateName = XM_CERTIFICATE_NAME;
|
||||
//魅族推送
|
||||
mixPushConfig.mzAppId = MZ_APP_ID;
|
||||
mixPushConfig.mzAppKey = MZ_APP_KEY;
|
||||
mixPushConfig.mzCertificateName = MZ_CERTIFICATE_NAME;
|
||||
//vivo推送
|
||||
mixPushConfig.vivoCertificateName = VIVO_CERTIFICATE_NAME;
|
||||
//oppo推送
|
||||
mixPushConfig.oppoAppId = OPPO_APP_ID;
|
||||
mixPushConfig.oppoAppKey = OPPO_APP_KEY;
|
||||
mixPushConfig.oppoAppSercet = OPPO_SECRET;
|
||||
mixPushConfig.oppoCertificateName = OPPO_CERTIFICATE_NAME;
|
||||
options.mixPushConfig = mixPushConfig;
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
private final MessageNotifierCustomization messageNotifierCustomization = new MessageNotifierCustomization() {
|
||||
private static final MessageNotifierCustomization messageNotifierCustomization = new MessageNotifierCustomization() {
|
||||
@Override
|
||||
public String makeNotifyContent(String nick, IMMessage message) {
|
||||
if (message.getMsgType() == MsgTypeEnum.custom) {
|
||||
@@ -486,6 +188,272 @@ public class XChatApplication extends Application {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
private static XChatApplication instance;
|
||||
//生命周期监听
|
||||
private static ActivityLifeManager lifeManager;
|
||||
private static boolean isInitOtherSDK = false;
|
||||
|
||||
//static 代码段可以防止内存泄露
|
||||
static {
|
||||
SmartRefreshLayout.setDefaultRefreshHeaderCreater(
|
||||
(context, layout) -> {
|
||||
layout.setEnableHeaderTranslationContent(false);
|
||||
MaterialHeader materialHeader = new MaterialHeader(context);
|
||||
materialHeader.setShowBezierWave(false);
|
||||
return materialHeader;
|
||||
});
|
||||
SmartRefreshLayout.setDefaultRefreshFooterCreater(
|
||||
(context, layout) -> new ClassicsFooter(context).setDrawableSize(20));
|
||||
}
|
||||
|
||||
public static XChatApplication instance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public static void initOtherSDK() {
|
||||
if (isInitOtherSDK) return;
|
||||
isInitOtherSDK = true;
|
||||
Context context = BasicConfig.INSTANCE.getAppContext();
|
||||
Application application = (Application) context.getApplicationContext();
|
||||
// 初始化 sp
|
||||
long startTime = System.currentTimeMillis();
|
||||
|
||||
String channel = "";
|
||||
try {
|
||||
ApplicationInfo appInfo = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA);
|
||||
channel = appInfo.metaData.getString("CHANNEL");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (TextUtils.isEmpty(channel)) {
|
||||
channel = "official";
|
||||
}
|
||||
|
||||
BasicConfig.INSTANCE.setOriginalChannel(channel);
|
||||
|
||||
//头条分包渠道
|
||||
if (BasicConfig.INSTANCE.isByteDanceChannel()) {
|
||||
String byteDanceChannel = HumeSDK.getChannel(context);
|
||||
if (!TextUtils.isEmpty(byteDanceChannel)) {
|
||||
channel = byteDanceChannel;
|
||||
}
|
||||
}
|
||||
BasicConfig.INSTANCE.setChannel(channel);
|
||||
|
||||
LogUtils.d(channel + "");
|
||||
initEnv();
|
||||
|
||||
//延迟初始化云信
|
||||
NIMClient.init(context, null, options());
|
||||
|
||||
//logger 配置
|
||||
Logger.addLogAdapter(new AndroidLogAdapter() {
|
||||
@Override
|
||||
public boolean isLoggable(int priority, String tag) {
|
||||
return BuildConfig.DEBUG;
|
||||
}
|
||||
});
|
||||
|
||||
ToastUtils.init(application);
|
||||
|
||||
if (inMainProcess(context)) {
|
||||
// 注册自定义推送消息处理,这个是可选项
|
||||
NIMPushClient.registerMixPushMessageHandler(new PushMessageHandler());
|
||||
|
||||
RxJavaPlugins.setErrorHandler(throwable -> {
|
||||
if (BuildConfig.DEBUG) {
|
||||
Log.e(TAG, "the subscribe() method default error handler", throwable);
|
||||
}
|
||||
});
|
||||
|
||||
//需要完善资料错误码全局处理
|
||||
GsonConverterPlugins.setResultHandler(result -> {
|
||||
if (result instanceof ServiceResult<?>) {
|
||||
ServiceResult<?> serviceResult = (ServiceResult<?>) result;
|
||||
if (serviceResult.getCode() == ServiceResult.CODE_NEED_COMPLETE_USER_INFO) {
|
||||
SingleToastUtil.showToast(serviceResult.getMessage());
|
||||
EventBus.getDefault().post(new NeedCompleteInfoEvent());
|
||||
throw new ServerException(serviceResult.getMessage(), serviceResult.getCode());
|
||||
}
|
||||
}
|
||||
return null;
|
||||
});
|
||||
GsonConverterPlugins.lockdown();
|
||||
|
||||
//fixed: Glide Exception:"You must not call setTag() on a view Glide is targeting"
|
||||
ViewTarget.setTagId(R.id.tag_glide);
|
||||
|
||||
|
||||
init(channel);
|
||||
|
||||
if (!TextUtils.isEmpty(channel)) {
|
||||
CrashReport.setAppChannel(context, channel);
|
||||
}
|
||||
|
||||
initBuglyUpdate();
|
||||
Bugly.init(context, BuildConfig.DEBUG ? XChatConstants.BUGLY_KEY_DEBUG : XChatConstants.BUGLY_KEY_RELEASE, BuildConfig.DEBUG);
|
||||
if (!TextUtils.isEmpty(channel)) {
|
||||
Bugly.setAppChannel(context, channel);
|
||||
}
|
||||
|
||||
//生命周期监听
|
||||
if (lifeManager == null) {
|
||||
lifeManager = new ActivityLifeManager();
|
||||
}
|
||||
registerActivityLifecycleCallback(lifeManager);
|
||||
|
||||
|
||||
}
|
||||
dealHuaWeiCrash();
|
||||
|
||||
if (BuildConfig.APPLICATION_ID.equals(getProcessName(context))) {
|
||||
FlutterBoost.instance().setup((Application) context.getApplicationContext(), new XplanFlutterBoostDelegate(), new XplanFlutterBoostCallback());
|
||||
}
|
||||
LogUtils.d("init time = " + (System.currentTimeMillis() - startTime) + "ms");
|
||||
initLinkedMe();
|
||||
ActivityMgr.INST.init((Application) context);
|
||||
LinkedME.getInstance().setImmediate(true);
|
||||
// 网易易盾初始化
|
||||
watchman.init(context, XChatConstants.YI_DUN_PRODUCT_NUMBER); // 网易易盾初始化
|
||||
MobSDK.init(context);
|
||||
MobSDK.submitPolicyGrantResult(true, null);
|
||||
// 友盟统计初始化
|
||||
UMConfigure.init(context, XChatConstants.UMENG_APP_KEY,
|
||||
BasicConfig.INSTANCE.getChannel(), UMConfigure.DEVICE_TYPE_PHONE, null);
|
||||
// 选用MANUAL页面采集模式
|
||||
MobclickAgent.setPageCollectionMode(MobclickAgent.PageMode.MANUAL);
|
||||
// 支持在子进程中统计自定义事件
|
||||
UMConfigure.setProcessEvent(true);
|
||||
// 日志加密
|
||||
UMConfigure.setEncryptEnabled(true);
|
||||
// 集成测试
|
||||
UMConfigure.setLogEnabled(BuildConfig.DEBUG);
|
||||
//实人认证
|
||||
RPVerify.init(context);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 初始化linkedMe
|
||||
*/
|
||||
private static void initLinkedMe() {
|
||||
LinkedME.getInstance(BasicConfig.INSTANCE.getAppContext(), XChatConstants.LINKED_ME_KEY);
|
||||
if (isDebug()) {
|
||||
//设置debug模式下打印LinkedME日志
|
||||
LinkedME.getInstance().setDebug();
|
||||
}
|
||||
//初始时请设置为false
|
||||
LinkedME.getInstance().setImmediate(false);
|
||||
//设置处理跳转逻辑的中转页,MiddleActivity详见后续配置
|
||||
LinkedME.getInstance().setHandleActivity(MiddleActivity.class.getName());
|
||||
}
|
||||
|
||||
private static void initEnv() {
|
||||
//首先初始化环境
|
||||
Env.initEnv(BuildConfig.BUILD_TYPE, BuildConfig.DEBUG);
|
||||
//切换生产坏境和测试环境 true/测试环境 false/生产环境
|
||||
BasicConfig.INSTANCE.setDebuggable(Env.isDebug());
|
||||
BasicConfig.INSTANCE.setRootDir(Constants.ERBAN_DIR_NAME);
|
||||
BasicConfig.INSTANCE.setLogDir(Constants.LOG_DIR);
|
||||
BasicConfig.INSTANCE.setConfigDir(Constants.CONFIG_DIR);
|
||||
BasicConfig.INSTANCE.setVoiceDir(Constants.VOICE_DIR);
|
||||
BasicConfig.INSTANCE.setCacheDir(Constants.CACHE_DIR);
|
||||
BasicConfig.INSTANCE.setImageDir(Constants.IMAGE_CACHE_DIR);
|
||||
}
|
||||
|
||||
|
||||
private static void dealHuaWeiCrash() {
|
||||
String brand = Build.BRAND;
|
||||
String manufacturer = Build.MANUFACTURER;
|
||||
if (!TextUtils.isEmpty(brand) && (
|
||||
"HUAWEI".toLowerCase().equals(brand.toLowerCase())
|
||||
|| "HONOR".toLowerCase().equals(brand.toLowerCase())
|
||||
|| "HUAWEI".equals(manufacturer))) {
|
||||
LoadedApkHuaWei.hookHuaWeiVerifier((Application) BasicConfig.INSTANCE.getAppContext().getApplicationContext());
|
||||
}
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
|
||||
public static void registerActivityLifecycleCallback(Application.ActivityLifecycleCallbacks callbacks) {
|
||||
((Application) BasicConfig.INSTANCE.getAppContext().getApplicationContext()).registerActivityLifecycleCallbacks(callbacks);
|
||||
}
|
||||
|
||||
/**
|
||||
* 云信配置
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static SDKOptions options() {
|
||||
SDKOptions options = new SDKOptions();
|
||||
options.disableAwake = true;
|
||||
options.asyncInitSDK = true;
|
||||
// options.customPushContentType = "";
|
||||
if (isDebug()) {
|
||||
options.checkManifestConfig = true;
|
||||
}
|
||||
// 如果将新消息通知提醒托管给 SDK 完成,需要添加以下配置。否则无需设置。
|
||||
StatusBarNotificationConfig config = new StatusBarNotificationConfig();
|
||||
// 点击通知栏跳转到该Activity
|
||||
config.notificationEntrance = NimMiddleActivity.class;
|
||||
// config.notificationSmallIconId = R.drawable.icon_msg_normal;
|
||||
// 呼吸灯配置
|
||||
config.ledARGB = Color.GREEN;
|
||||
config.ledOnMs = 1000;
|
||||
config.ledOffMs = 1500;
|
||||
config.notificationFoldStyle = NotificationFoldStyle.CONTACT;
|
||||
// 通知铃声的uri字符串
|
||||
config.notificationSound = "android.resource://com.netease.nim.demo/raw/msg";
|
||||
options.statusBarNotificationConfig = config;
|
||||
// 定制通知栏提醒文案(可选,如果不定制将采用SDK默认文案)
|
||||
options.messageNotifierCustomization = messageNotifierCustomization;
|
||||
|
||||
options.appKey = Constants.nimAppKey;
|
||||
|
||||
// 配置保存图片,文件,log 等数据的目录
|
||||
// 如果 options 中没有设置这个值,SDK 会使用下面代码示例中的位置作为 SDK 的数据目录。
|
||||
// 该目录目前包含 log, file, image, audio, video, thumb 这6个目录。
|
||||
// 如果第三方 APP 需要缓存清理功能, 清理这个目录下面个子目录的内容即可。
|
||||
String sdkPath = null;
|
||||
try {
|
||||
sdkPath = Environment.getExternalStorageDirectory() + "/" + BasicConfig.INSTANCE.getAppContext().getPackageName() + "/nim";
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
|
||||
}
|
||||
options.sdkStorageRootPath = sdkPath;
|
||||
|
||||
// 配置是否需要预下载附件缩略图,默认为 true
|
||||
options.preloadAttach = true;
|
||||
|
||||
// 配置附件缩略图的尺寸大小。表示向服务器请求缩略图文件的大小
|
||||
// 该值一般应根据屏幕尺寸来确定, 默认值为 Screen.width / 2
|
||||
int widthPixels = BasicConfig.INSTANCE.getAppContext().getResources().getDisplayMetrics().widthPixels;
|
||||
options.thumbnailSize = widthPixels / 2;
|
||||
// // save cache,留做切换账号备用
|
||||
DemoCache.setNotificationConfig(config);
|
||||
|
||||
MixPushConfig mixPushConfig = new MixPushConfig();
|
||||
//华为推送
|
||||
mixPushConfig.hwAppId = HW_APP_ID;
|
||||
mixPushConfig.hwCertificateName = HW_CERTIFICATE_NAME;
|
||||
//小米推送
|
||||
mixPushConfig.xmAppId = XM_APP_ID;
|
||||
mixPushConfig.xmAppKey = XM_APP_KEY;
|
||||
mixPushConfig.xmCertificateName = XM_CERTIFICATE_NAME;
|
||||
//魅族推送
|
||||
mixPushConfig.mzAppId = MZ_APP_ID;
|
||||
mixPushConfig.mzAppKey = MZ_APP_KEY;
|
||||
mixPushConfig.mzCertificateName = MZ_CERTIFICATE_NAME;
|
||||
//vivo推送
|
||||
mixPushConfig.vivoCertificateName = VIVO_CERTIFICATE_NAME;
|
||||
//oppo推送
|
||||
mixPushConfig.oppoAppId = OPPO_APP_ID;
|
||||
mixPushConfig.oppoAppKey = OPPO_APP_KEY;
|
||||
mixPushConfig.oppoAppSercet = OPPO_SECRET;
|
||||
mixPushConfig.oppoCertificateName = OPPO_CERTIFICATE_NAME;
|
||||
options.mixPushConfig = mixPushConfig;
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断当前进程是否主进程
|
||||
@@ -502,7 +470,7 @@ public class XChatApplication extends Application {
|
||||
/**
|
||||
* 初始化bugly版本升级
|
||||
*/
|
||||
private void initBuglyUpdate() {
|
||||
private static void initBuglyUpdate() {
|
||||
/***** Beta高级设置 *****/
|
||||
/**
|
||||
* true表示app启动自动初始化升级模块;
|
||||
@@ -592,7 +560,7 @@ public class XChatApplication extends Application {
|
||||
* @param url
|
||||
*/
|
||||
@SuppressLint("CheckResult")
|
||||
public void initRxNet(Context context, String url) {
|
||||
public static void initRxNet(Context context, String url) {
|
||||
Map<String, String> httpParams = new ArrayMap<>();
|
||||
httpParams.put("os", "android");
|
||||
httpParams.put("osVersion", Build.VERSION.RELEASE);
|
||||
@@ -616,14 +584,13 @@ public class XChatApplication extends Application {
|
||||
initModel();
|
||||
}
|
||||
|
||||
|
||||
private void init(String channel) {
|
||||
private static void init(String channel) {
|
||||
initNimUIKit();
|
||||
UriProvider.initUri(BuildConfig.BASE_URL_DEBUG, BuildConfig.BASE_URL_STAGING, BuildConfig.BASE_URL_RELEASE);
|
||||
SVGAParser.Companion.shareParser().init(this);
|
||||
SVGAParser.Companion.shareParser().init(BasicConfig.INSTANCE.getAppContext());
|
||||
try {
|
||||
/** svga动画缓存路径 */
|
||||
File cacheDir = new File(this.getApplicationContext().getExternalCacheDir(), "http");
|
||||
File cacheDir = new File(BasicConfig.INSTANCE.getAppContext().getApplicationContext().getExternalCacheDir(), "http");
|
||||
if (!cacheDir.exists()) cacheDir.mkdirs();
|
||||
HttpResponseCache.install(cacheDir, 1024 * 1024 * 128);
|
||||
} catch (IOException e) {
|
||||
@@ -632,7 +599,7 @@ public class XChatApplication extends Application {
|
||||
|
||||
initRxNet(BasicConfig.INSTANCE.getAppContext(), UriProvider.JAVA_WEB_URL);
|
||||
|
||||
ConnectiveChangedReceiver.getInstance().init(this.getApplicationContext());
|
||||
ConnectiveChangedReceiver.getInstance().init(BasicConfig.INSTANCE.getAppContext());
|
||||
/**
|
||||
* 使用到realm 数据库,这里配置数据库 这里必须先于模块初始化前进行初始化配置
|
||||
*/
|
||||
@@ -652,7 +619,7 @@ public class XChatApplication extends Application {
|
||||
/**
|
||||
* 一些单例的 model
|
||||
*/
|
||||
private void initModel() {
|
||||
private static void initModel() {
|
||||
DynamicFaceModel.get().init();
|
||||
PayModel.get();
|
||||
UserModel.get();
|
||||
@@ -682,9 +649,9 @@ public class XChatApplication extends Application {
|
||||
|
||||
}
|
||||
|
||||
private void initNimUIKit() {
|
||||
private static void initNimUIKit() {
|
||||
// 初始化
|
||||
NimUIKit.init(this);
|
||||
NimUIKit.init(BasicConfig.INSTANCE.getAppContext());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -702,4 +669,36 @@ public class XChatApplication extends Application {
|
||||
public static boolean isRealDebug() {
|
||||
return Env.isRealDebug();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 用户没同意隐私协议之前,啥也不干!!
|
||||
*/
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
instance = this;
|
||||
BasicConfig.INSTANCE.setAppContext(this.getApplicationContext());
|
||||
SharedPreferenceUtils.init(this);
|
||||
boolean isShowPrivacyAgreement = (boolean) SharedPreferenceUtils.get(SplashActivity.SHOW_PRIVACY_AGREEMENT, true);
|
||||
if (!isShowPrivacyAgreement) {
|
||||
initOtherSDK();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void attachBaseContext(Context base) {
|
||||
super.attachBaseContext(base);
|
||||
MultiDex.install(base);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTerminate() {
|
||||
super.onTerminate();
|
||||
CrashReport.closeBugly();
|
||||
if (lifeManager != null) {
|
||||
unregisterActivityLifecycleCallbacks(lifeManager);
|
||||
}
|
||||
GlobalHandleManager.get().unInit();
|
||||
}
|
||||
}
|
||||
|
@@ -15,11 +15,8 @@ import android.widget.PopupWindow;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.alibaba.security.biometrics.build.G;
|
||||
import com.coorchice.library.SuperTextView;
|
||||
import com.netease.nim.uikit.common.util.string.StringUtil;
|
||||
import com.netease.nim.uikit.support.glide.GlideApp;
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMember;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.common.widget.CircleImageView;
|
||||
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
|
||||
@@ -39,10 +36,7 @@ import com.yizhuan.xchat_android_core.room.giftvalue.helper.GiftValueFormat;
|
||||
import com.yizhuan.xchat_android_core.room.pk.bean.PKTeamInfo;
|
||||
import com.yizhuan.xchat_android_core.room.queue.bean.MicMemberInfo;
|
||||
import com.yizhuan.xchat_android_core.user.UserModel;
|
||||
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
|
||||
import com.yizhuan.xchat_android_core.utils.ActivityUtil;
|
||||
import com.yizhuan.xchat_android_core.utils.LogUtils;
|
||||
import com.yizhuan.xchat_android_library.utils.CommonUtils;
|
||||
import com.yizhuan.xchat_android_library.utils.config.BasicConfig;
|
||||
|
||||
/**
|
||||
|
@@ -8,6 +8,7 @@ import android.util.AttributeSet
|
||||
import android.view.Gravity
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.widget.FrameLayout
|
||||
import android.widget.PopupWindow
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.view.isVisible
|
||||
@@ -54,14 +55,14 @@ class RoomPKBoardView @JvmOverloads constructor(
|
||||
if (CommonUtils.isFastDoubleClick(1000)) return@setOnClickListener
|
||||
binding.groupRank.isVisible = !binding.groupRank.isVisible
|
||||
if (binding.groupRank.isVisible) {
|
||||
binding.root.setBackgroundResource(R.drawable.bg_room_pk_board)
|
||||
binding.root.updateLayoutParams<LayoutParams> {
|
||||
binding.clRoot.setBackgroundResource(R.drawable.bg_room_pk_board)
|
||||
binding.clRoot.updateLayoutParams<FrameLayout.LayoutParams> {
|
||||
width = ScreenUtil.dip2px(339f)
|
||||
height = ScreenUtil.dip2px(233f)
|
||||
}
|
||||
} else {
|
||||
binding.root.setBackgroundResource(R.drawable.bg_room_pk_board_small)
|
||||
binding.root.updateLayoutParams<LayoutParams> {
|
||||
binding.clRoot.setBackgroundResource(R.drawable.bg_room_pk_board_small)
|
||||
binding.clRoot.updateLayoutParams<FrameLayout.LayoutParams> {
|
||||
width = ScreenUtil.dip2px(339f)
|
||||
height = ScreenUtil.dip2px(137f)
|
||||
}
|
||||
@@ -84,7 +85,7 @@ class RoomPKBoardView @JvmOverloads constructor(
|
||||
|
||||
binding.tvGoAnotherRoom.setOnClickListener {
|
||||
roomPkBean?.let {
|
||||
AVRoomActivity.startForFromType(context, it.aUid, AVRoomActivity.FROM_TYPE_ROOM_PK)
|
||||
AVRoomActivity.start(context, it.aUid)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,7 +138,7 @@ class RoomPKBoardView @JvmOverloads constructor(
|
||||
binding.tvTime.text = roomPkBean?.endTime?.let {
|
||||
val remainTime = (it - CurrentTimeUtils.getCurrentTime()).toInt() / 1000
|
||||
binding.tvTime.setTextColor(Color.parseColor(if (remainTime <= 30) "#ff87a1" else "#fff600"))
|
||||
binding.tvTime.isVisible = remainTime > 0
|
||||
binding.tvTime.isVisible = remainTime > 0
|
||||
binding.tvEndHint.isVisible = remainTime <= 0
|
||||
TimeUtil.secToTime(remainTime)
|
||||
} ?: "00:00"
|
||||
|
@@ -58,21 +58,21 @@ class RoomPKCreateActivity : BaseViewBindingActivity<ActivityRoomPkCreateBinding
|
||||
}
|
||||
|
||||
binding.rbMin10.setOnCheckedChangeListener { _, isChecked ->
|
||||
if (isChecked){
|
||||
if (isChecked) {
|
||||
pkTime = 10
|
||||
binding.editTime.setText("")
|
||||
checkCommitEnable()
|
||||
}
|
||||
}
|
||||
binding.rbMin20.setOnCheckedChangeListener { _, isChecked ->
|
||||
if (isChecked){
|
||||
if (isChecked) {
|
||||
pkTime = 20
|
||||
binding.editTime.setText("")
|
||||
checkCommitEnable()
|
||||
}
|
||||
}
|
||||
binding.rbMin30.setOnCheckedChangeListener { _, isChecked ->
|
||||
if (isChecked){
|
||||
if (isChecked) {
|
||||
pkTime = 30
|
||||
binding.editTime.setText("")
|
||||
checkCommitEnable()
|
||||
@@ -84,12 +84,6 @@ class RoomPKCreateActivity : BaseViewBindingActivity<ActivityRoomPkCreateBinding
|
||||
override fun afterTextChanged(s: Editable?) {
|
||||
s?.toString().ifNotNullOrEmpty {
|
||||
pkTime = it.toIntOrDef(0)
|
||||
if (pkTime > 180) {
|
||||
binding.editTime.setText("180")
|
||||
}
|
||||
if (pkTime < 5) {
|
||||
binding.editTime.setText("5")
|
||||
}
|
||||
if (pkTime != 0) {
|
||||
binding.rg.clearCheck()
|
||||
}
|
||||
@@ -99,7 +93,10 @@ class RoomPKCreateActivity : BaseViewBindingActivity<ActivityRoomPkCreateBinding
|
||||
})
|
||||
|
||||
binding.tvOk.setOnClickListener {
|
||||
if (!checkCommitEnable()) return@setOnClickListener
|
||||
if (pkTime < 5 || pkTime > 180) {
|
||||
"PK时长在5-180分钟内,请重新输入!".toast()
|
||||
return@setOnClickListener
|
||||
}
|
||||
currSimpleRoomInfo?.let {
|
||||
RoomPKModel.initiateRoomPK(
|
||||
it.roomUid,
|
||||
@@ -114,7 +111,7 @@ class RoomPKCreateActivity : BaseViewBindingActivity<ActivityRoomPkCreateBinding
|
||||
"发起邀请成功!".toast()
|
||||
finish()
|
||||
}, { throwable ->
|
||||
dialogManager.showTipsDialog(throwable.message,null)
|
||||
dialogManager.showTipsDialog(throwable.message, null)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
@@ -135,6 +135,7 @@ public class AvRoomPresenter extends BaseMvpPresenter<IAvRoomView> {
|
||||
AvRoomDataManager.get().gender = roomInfo.getGender();
|
||||
AvRoomDataManager.get().avatar = roomInfo.getAvatar();
|
||||
AvRoomDataManager.get().isRoomFans = roomInfo.isRoomFans();
|
||||
AvRoomDataManager.get().trtcSig = roomInfo.getTrtcSig();
|
||||
AvRoomDataManager.get().setRedEnvelopeOpen(roomInfo.isRedEnvelopeOpen());
|
||||
StatisticManager.Instance().onEvent(StatisticsProtocol.Event.EVENT_ROOM_LIST_TYPE,
|
||||
"区分房间类型:" + roomInfo.getRoomTypeLable());
|
||||
|
@@ -2311,9 +2311,6 @@ public class MessageView extends FrameLayout {
|
||||
enterText = " 的邀请,进入了房间";
|
||||
}
|
||||
|
||||
if (fromType == AVRoomActivity.FROM_TYPE_ROOM_PK) {
|
||||
enterText = " 从PK方进入了房间";
|
||||
}
|
||||
text.append(enterText, new ForegroundColorSpan(whiteColor));
|
||||
|
||||
//如果自己在麦上,增加一个欢迎ta的按钮,并且这条消息不是自己的
|
||||
|
@@ -7,6 +7,7 @@ import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.animation.AlphaAnimation;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
@@ -17,22 +18,20 @@ import com.yizhuan.erban.MainActivity;
|
||||
import com.yizhuan.erban.NimMiddleActivity;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.application.XChatApplication;
|
||||
import com.yizhuan.erban.base.BaseActivity;
|
||||
import com.yizhuan.erban.databinding.ActivitySplashBinding;
|
||||
import com.yizhuan.erban.other.SplashBitmapTransformation;
|
||||
import com.yizhuan.erban.other.dialog.PrivacyAgreementDialog;
|
||||
import com.yizhuan.xchat_android_core.utils.OaidUtil;
|
||||
import com.yizhuan.xchat_android_constants.XChatConstants;
|
||||
import com.yizhuan.xchat_android_core.channel_page.model.ChannelPageModel;
|
||||
import com.yizhuan.xchat_android_core.initial.InitialModel;
|
||||
import com.yizhuan.xchat_android_core.initial.SplashComponent;
|
||||
import com.yizhuan.xchat_android_core.utils.OaidUtil;
|
||||
import com.yizhuan.xchat_android_core.utils.SharedPreferenceUtils;
|
||||
|
||||
/**
|
||||
* @author xiaoyu
|
||||
* @date 2017/12/30
|
||||
*/
|
||||
public class SplashActivity extends BaseActivity implements View.OnClickListener, PrivacyAgreementDialog.OnCallBack {
|
||||
public class SplashActivity extends AppCompatActivity implements View.OnClickListener, PrivacyAgreementDialog.OnCallBack {
|
||||
|
||||
public static final String SHOW_PRIVACY_AGREEMENT = "show_privacy_agreement";
|
||||
private static final int COUNT_DOWN_TIME = 3;
|
||||
@@ -59,8 +58,8 @@ public class SplashActivity extends BaseActivity implements View.OnClickListener
|
||||
// 从堆栈恢复,不再重复解析之前的intent
|
||||
setIntent(new Intent());
|
||||
}
|
||||
|
||||
initiate();
|
||||
StatusBarUtil.transparencyBar(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -163,18 +162,6 @@ public class SplashActivity extends BaseActivity implements View.OnClickListener
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected boolean needSteepStateBar() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setStatusBar() {
|
||||
super.setStatusBar();
|
||||
StatusBarUtil.transparencyBar(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish(boolean isConfirm) {
|
||||
if (isConfirm) {
|
||||
|
@@ -5,7 +5,6 @@ import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
import androidx.annotation.NonNull;
|
||||
import android.text.SpannableString;
|
||||
import android.text.Spanned;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
@@ -16,9 +15,11 @@ import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.common.widget.OriginalDrawStatusClickSpan;
|
||||
import com.yizhuan.erban.ui.webview.CommonWebViewActivity;
|
||||
import com.yizhuan.erban.ui.webview.SimpleWebViewActivity;
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.buildins.UIUtil;
|
||||
import com.yizhuan.xchat_android_core.UriProvider;
|
||||
import com.yizhuan.xchat_android_library.utils.ScreenUtils;
|
||||
@@ -56,14 +57,14 @@ public class PrivacyAgreementDialog extends Dialog implements View.OnClickListen
|
||||
ss.setSpan(new OriginalDrawStatusClickSpan() {
|
||||
@Override
|
||||
public void onClick(@NonNull View widget) {
|
||||
CommonWebViewActivity.start(getContext(), UriProvider.getPrivacyAgreement());
|
||||
SimpleWebViewActivity.start(getContext(), UriProvider.getPrivacyAgreement());
|
||||
}
|
||||
}, privacyAgreementTipIndex, privacyAgreementTipIndex + privacyAgreementTip.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
ss.setSpan(new ForegroundColorSpan(Color.parseColor("#34a7ff")), userAgreementTipIndex, userAgreementTipIndex + userAgreementTip.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
ss.setSpan(new OriginalDrawStatusClickSpan() {
|
||||
@Override
|
||||
public void onClick(@NonNull View widget) {
|
||||
CommonWebViewActivity.start(getContext(), UriProvider.getUserProtocolUrl());
|
||||
SimpleWebViewActivity.start(getContext(), UriProvider.getUserProtocolUrl());
|
||||
}
|
||||
}, userAgreementTipIndex, userAgreementTipIndex + privacyAgreementTip.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
|
||||
@@ -85,16 +86,14 @@ public class PrivacyAgreementDialog extends Dialog implements View.OnClickListen
|
||||
|
||||
window.setAttributes(lp);
|
||||
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
cancel();
|
||||
if (onCallBack != null) {
|
||||
onCallBack.onFinish(v.getId() == R.id.tv_confirm);
|
||||
}
|
||||
cancel();
|
||||
}
|
||||
|
||||
public interface OnCallBack {
|
||||
|
@@ -17,7 +17,6 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.security.realidentity.RPEventListener;
|
||||
import com.alibaba.security.realidentity.RPResult;
|
||||
import com.alibaba.security.realidentity.RPVerify;
|
||||
import com.alibaba.security.rp.RPSDK;
|
||||
import com.netease.nim.uikit.common.util.log.LogUtil;
|
||||
import com.orhanobut.logger.Logger;
|
||||
import com.umeng.commonsdk.statistics.common.DeviceConfig;
|
||||
|
@@ -0,0 +1,123 @@
|
||||
package com.yizhuan.erban.ui.webview;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.webkit.JavascriptInterface;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.orhanobut.logger.Logger;
|
||||
import com.yizhuan.xchat_android_constants.XChatConstants;
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_library.utils.AppMetaDataUtil;
|
||||
import com.yizhuan.xchat_android_library.utils.AppUtils;
|
||||
import com.yizhuan.xchat_android_library.utils.VersionUtil;
|
||||
|
||||
/**
|
||||
* <p> html js 与webview 交互接口</p>
|
||||
* Created by ${user} on 2017/11/6.
|
||||
*/
|
||||
public class SimpleJSInterface {
|
||||
private static final String TAG = SimpleJSInterface.class.getSimpleName();
|
||||
private final Context context;
|
||||
|
||||
public SimpleJSInterface(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备ID
|
||||
*
|
||||
* @return 设备id
|
||||
*/
|
||||
@JavascriptInterface
|
||||
public String getDeviceId() {
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取uid
|
||||
*
|
||||
* @return uid
|
||||
*/
|
||||
@JavascriptInterface
|
||||
public String getUid() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void initNav(String json) {
|
||||
Logger.e("initNav: " + json);
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭浏览器
|
||||
*/
|
||||
@JavascriptInterface
|
||||
public void closeWebView() {
|
||||
if (context instanceof Activity) {
|
||||
((Activity) context).finish();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户ticket
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@JavascriptInterface
|
||||
public String getTicket() {
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取应用版本号
|
||||
*/
|
||||
@JavascriptInterface
|
||||
public String getAppVersion() {
|
||||
return VersionUtil.getLocalName(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取渠道
|
||||
*
|
||||
* @return 渠道名称
|
||||
*/
|
||||
@JavascriptInterface
|
||||
public String getChannel() {
|
||||
String channel = "";
|
||||
try {
|
||||
ApplicationInfo appInfo = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA);
|
||||
channel = appInfo.metaData.getString("CHANNEL");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (TextUtils.isEmpty(channel)) {
|
||||
channel = "official";
|
||||
}
|
||||
return channel;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取 deviceInfo
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@JavascriptInterface
|
||||
public String getDeviceInfo() {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("os", "android");
|
||||
jsonObject.put("app", XChatConstants.APP_MARK);
|
||||
jsonObject.put("appVersion", VersionUtil.getLocalName(context));
|
||||
jsonObject.put("appVersionCode", String.valueOf(AppUtils.getVersionCode(context)));
|
||||
jsonObject.put("channel", getChannel());
|
||||
Log.e(TAG, "getDeviceInfo: " + jsonObject);
|
||||
return jsonObject.toJSONString();
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,226 @@
|
||||
package com.yizhuan.erban.ui.webview;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.net.http.SslError;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.webkit.SslErrorHandler;
|
||||
import android.webkit.ValueCallback;
|
||||
import android.webkit.WebChromeClient;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.LayoutRes;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.netease.nim.uikit.StatusBarUtil;
|
||||
import com.orhanobut.logger.Logger;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.utils.WebViewUtils;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
|
||||
/**
|
||||
* 最简单的H5页面,用于隐私协议弹窗,不继承BaseActivity
|
||||
*/
|
||||
public class SimpleWebViewActivity extends AppCompatActivity {
|
||||
|
||||
protected FrameLayout layoutTitleBar;
|
||||
protected WebView webView;
|
||||
private ProgressBar mProgressBar;
|
||||
private WebChromeClient wvcc;
|
||||
private ImageView mIvBack;
|
||||
private ImageView mIvClose;
|
||||
private TextView mTitle;
|
||||
private String url;
|
||||
|
||||
private int mProgress;
|
||||
|
||||
private Handler mHandler = new Handler();
|
||||
|
||||
private ProgressRunnable mProgressRunnable = new ProgressRunnable(this);
|
||||
|
||||
public static void start(Context context, String url) {
|
||||
Intent intent = new Intent(context, SimpleWebViewActivity.class);
|
||||
intent.putExtra("url", url);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(getLayoutId());
|
||||
Intent intent = getIntent();
|
||||
url = intent.getStringExtra("url");
|
||||
StatusBarUtil.transparencyBar(this);
|
||||
initView();
|
||||
initData();
|
||||
setListener();
|
||||
showWebView(url);
|
||||
}
|
||||
|
||||
@LayoutRes
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_simple_web_view;
|
||||
}
|
||||
|
||||
private void setListener() {
|
||||
mIvBack.setOnClickListener(v -> {
|
||||
if (webView.canGoBack()) {
|
||||
webView.goBack();
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
mIvClose.setOnClickListener(v -> {
|
||||
finish();
|
||||
});
|
||||
}
|
||||
|
||||
@SuppressLint("SetJavaScriptEnabled")
|
||||
private void initData() {
|
||||
mHandler.post(mProgressRunnable);
|
||||
webView.getSettings().setJavaScriptEnabled(true);
|
||||
webView.getSettings().setUseWideViewPort(true);
|
||||
webView.getSettings().setLoadWithOverviewMode(true);
|
||||
// 设置 WebView 可以在 HTTPS 通道上加载 HTTP 资源,Android 4.4 后的暗坑
|
||||
// 因为 Android 4.4 后默认不允许在 HTTPS 通道上加载 HTTP 资源
|
||||
webView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_COMPATIBILITY_MODE);
|
||||
webView.getSettings().setTextZoom(100);
|
||||
SimpleJSInterface jsInterface = new SimpleJSInterface(this);
|
||||
webView.addJavascriptInterface(jsInterface, "androidJsObj");
|
||||
webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
|
||||
webView.setWebViewClient(new WebViewClient() {
|
||||
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
|
||||
if (!(url.startsWith("http") || url.startsWith("https"))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
view.loadUrl(url);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
|
||||
// super.onReceivedSslError(view, handler, error); //一定要去掉
|
||||
// handler.cancel();// Android默认的处理方式
|
||||
handler.proceed();// 接受所有网站的证书
|
||||
// handleMessage(Message msg);// 进行其他处理
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageFinished(WebView view, String url) {
|
||||
Logger.e("onPageFinished--------" + url);
|
||||
mProgressBar.setProgress(100);
|
||||
mProgressBar.setVisibility(View.GONE);
|
||||
super.onPageFinished(view, url);
|
||||
}
|
||||
});
|
||||
//获取webviewtitle作为titlebar的title
|
||||
wvcc = new WebChromeClient() {
|
||||
|
||||
@Override
|
||||
public void onReceivedTitle(WebView view, String title) {
|
||||
super.onReceivedTitle(view, title);
|
||||
mTitle.setText(title + "");
|
||||
}
|
||||
|
||||
// For Android >= 4.1
|
||||
public void openFileChooser(ValueCallback<Uri> uploadMsg,
|
||||
String acceptType, String capture) {
|
||||
|
||||
}
|
||||
|
||||
// For Lollipop 5.0+ Devices
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
public boolean onShowFileChooser(WebView mWebView,
|
||||
ValueCallback<Uri[]> filePathCallback,
|
||||
FileChooserParams fileChooserParams) {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
};
|
||||
// 设置setWebChromeClient对象
|
||||
webView.setWebChromeClient(wvcc);
|
||||
// 设置Webview的user-agent
|
||||
webView.getSettings().setUserAgentString(webView.getSettings().getUserAgentString() + " tutuAppAndroid erbanAppAndroid");
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
layoutTitleBar = findViewById(R.id.layout_title_bar);
|
||||
webView = (WebView) findViewById(R.id.webview);
|
||||
mProgressBar = (ProgressBar) findViewById(R.id.progress_bar);
|
||||
mIvBack = findViewById(R.id.iv_back);
|
||||
mIvClose = findViewById(R.id.iv_close);
|
||||
mTitle = findViewById(R.id.tv_title);
|
||||
}
|
||||
|
||||
public void showWebView(String url) {
|
||||
Logger.d("ShowWebView--------" + url);
|
||||
if (!TextUtils.isEmpty(url)) {
|
||||
webView.loadUrl(url);
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if (webView.canGoBack()) {
|
||||
webView.goBack();
|
||||
|
||||
} else {
|
||||
this.finish();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
if (mHandler != null) {
|
||||
mHandler.removeCallbacks(mProgressRunnable);
|
||||
mProgressRunnable = null;
|
||||
mHandler = null;
|
||||
}
|
||||
super.onDestroy();
|
||||
WebViewUtils.releaseWeb(webView);
|
||||
}
|
||||
|
||||
private static class ProgressRunnable implements Runnable {
|
||||
private WeakReference<SimpleWebViewActivity> mWeakReference;
|
||||
|
||||
ProgressRunnable(SimpleWebViewActivity activity) {
|
||||
mWeakReference = new WeakReference<>(activity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
SimpleWebViewActivity activity = mWeakReference.get();
|
||||
if (activity == null) return;
|
||||
if (activity.mProgress < 96) {
|
||||
activity.mProgress += 3;
|
||||
activity.mProgressBar.setProgress(activity.mProgress);
|
||||
activity.mHandler.postDelayed(activity.mProgressRunnable, 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -12,7 +12,6 @@ import android.view.View;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.alibaba.security.biometrics.build.G;
|
||||
import com.netease.nim.uikit.common.ui.draggablebubbles.BubbleMessageTouchListener;
|
||||
import com.netease.nim.uikit.common.ui.draggablebubbles.BubbleView;
|
||||
import com.netease.nim.uikit.common.ui.draggablebubbles.MessageBubbleView;
|
||||
|
@@ -186,6 +186,7 @@
|
||||
android:background="@drawable/bg_room_pk_common_btn"
|
||||
android:hint="自定义(5-180)"
|
||||
android:inputType="number"
|
||||
android:maxLength="3"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="50dp"
|
||||
android:textColor="@color/text_title_white"
|
||||
@@ -223,9 +224,9 @@
|
||||
android:layout_marginEnd="12dp"
|
||||
android:background="@drawable/bg_room_pk_common_btn"
|
||||
android:hint="选填,10个字以内"
|
||||
android:maxLength="10"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="50dp"
|
||||
android:maxLength="10"
|
||||
android:textColor="@color/text_title_white"
|
||||
android:textColorHint="@color/white_transparent_50"
|
||||
android:textSize="15sp"
|
||||
|
85
app/src/main/res/layout/activity_simple_web_view.xml
Normal file
85
app/src/main/res/layout/activity_simple_web_view.xml
Normal file
@@ -0,0 +1,85 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/bg_normal_1c1b22"
|
||||
tools:context="com.yizhuan.erban.ui.webview.CommonWebViewActivity">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/layout_title_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_marginTop="@dimen/dp_25"
|
||||
android:layout_height="48dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_back"
|
||||
android:layout_width="45dp"
|
||||
android:layout_height="45dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/arrow_left_white" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_close"
|
||||
android:layout_width="45dp"
|
||||
android:layout_height="45dp"
|
||||
android:scaleType="center"
|
||||
android:layout_gravity="center_vertical|start"
|
||||
android:src="@drawable/icon_close_labe" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="match_parent"
|
||||
android:textColor="@color/text_title_white"
|
||||
android:gravity="center"
|
||||
tools:text="这是标题"
|
||||
android:layout_gravity="center"
|
||||
android:textSize="18sp"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_share"
|
||||
android:layout_width="22dp"
|
||||
android:layout_height="22dp"
|
||||
android:layout_gravity="center_vertical|end"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:src="@drawable/ic_share_white"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title_right"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:layout_gravity="center_vertical|end"
|
||||
tools:text="常见问题"
|
||||
android:textSize="14sp"
|
||||
android:visibility="gone"
|
||||
android:textColor="@color/text_normal_c6c6e9"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</FrameLayout>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress_bar"
|
||||
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:max="100"
|
||||
android:progress="0"
|
||||
android:progressDrawable="@drawable/progress_drawable" />
|
||||
|
||||
<WebView
|
||||
android:id="@+id/webview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
</WebView>
|
||||
</LinearLayout>
|
@@ -1,276 +1,283 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="339dp"
|
||||
android:layout_height="233dp"
|
||||
android:background="@drawable/bg_room_pk_board"
|
||||
android:orientation="horizontal"
|
||||
tools:contentDescription="PK记分板">
|
||||
android:layout_height="233dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:includeFontPadding="false"
|
||||
android:text="00:00"
|
||||
android:textColor="#fffff600"
|
||||
android:textSize="16dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.69"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_root"
|
||||
android:layout_width="339dp"
|
||||
android:layout_height="233dp"
|
||||
android:background="@drawable/bg_room_pk_board"
|
||||
android:orientation="horizontal"
|
||||
tools:contentDescription="PK记分板">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_end_hint"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:includeFontPadding="false"
|
||||
android:text="PK结果计算中..."
|
||||
android:textColor="#fffff600"
|
||||
android:textSize="11dp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.72"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
<TextView
|
||||
android:id="@+id/tv_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:includeFontPadding="false"
|
||||
android:text="00:00"
|
||||
android:textColor="#fffff600"
|
||||
android:textSize="16dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.69"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view_help_anchor"
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginStart="72dp"
|
||||
android:layout_marginTop="33dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
<TextView
|
||||
android:id="@+id/tv_end_hint"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:includeFontPadding="false"
|
||||
android:text="PK结果计算中..."
|
||||
android:textColor="#fffff600"
|
||||
android:textSize="11dp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.72"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_help"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:src="@drawable/ic_room_pk_board_help"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.45"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
<View
|
||||
android:id="@+id/view_help_anchor"
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginStart="72dp"
|
||||
android:layout_marginTop="33dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_room_name_left"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="40dp"
|
||||
android:textColor="@color/text_title_white"
|
||||
android:textSize="14dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="厅的名字七个字" />
|
||||
<ImageView
|
||||
android:id="@+id/iv_help"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:src="@drawable/ic_room_pk_board_help"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.45"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_room_name_right"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="40dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:textColor="@color/text_title_white"
|
||||
android:textSize="14dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="厅的名字七个字" />
|
||||
<TextView
|
||||
android:id="@+id/tv_room_name_left"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="40dp"
|
||||
android:textColor="@color/text_title_white"
|
||||
android:textSize="14dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="厅的名字七个字" />
|
||||
|
||||
<com.yizhuan.erban.common.widget.CircleImageView
|
||||
android:id="@+id/iv_avatar_left"
|
||||
android:layout_width="44dp"
|
||||
android:layout_height="44dp"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:src="@drawable/default_avatar"
|
||||
app:cborder_color="#FFFF4D73"
|
||||
app:cborder_width="1dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_room_name_left" />
|
||||
<TextView
|
||||
android:id="@+id/tv_room_name_right"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="40dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:textColor="@color/text_title_white"
|
||||
android:textSize="14dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="厅的名字七个字" />
|
||||
|
||||
<com.yizhuan.erban.common.widget.CircleImageView
|
||||
android:id="@+id/iv_avatar_right"
|
||||
android:layout_width="44dp"
|
||||
android:layout_height="44dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:src="@drawable/default_avatar"
|
||||
app:cborder_color="#FF45C0FF"
|
||||
app:cborder_width="1dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_room_name_right" />
|
||||
<com.yizhuan.erban.common.widget.CircleImageView
|
||||
android:id="@+id/iv_avatar_left"
|
||||
android:layout_width="44dp"
|
||||
android:layout_height="44dp"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:src="@drawable/default_avatar"
|
||||
app:cborder_color="#FFFF4D73"
|
||||
app:cborder_width="1dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_room_name_left" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_send_gift"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="18dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:background="@drawable/bg_room_pk_send_gift"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:text="助攻"
|
||||
android:textColor="#ffffffff"
|
||||
android:textSize="12dp"
|
||||
app:layout_constraintStart_toEndOf="@id/iv_avatar_left"
|
||||
app:layout_constraintTop_toTopOf="@id/iv_avatar_left" />
|
||||
<com.yizhuan.erban.common.widget.CircleImageView
|
||||
android:id="@+id/iv_avatar_right"
|
||||
android:layout_width="44dp"
|
||||
android:layout_height="44dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:src="@drawable/default_avatar"
|
||||
app:cborder_color="#FF45C0FF"
|
||||
app:cborder_width="1dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_room_name_right" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_go_another_room"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="18dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:background="@drawable/bg_room_pk_go_another_room"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:text="去围观"
|
||||
android:textColor="#ffffffff"
|
||||
android:textSize="12dp"
|
||||
app:layout_constraintEnd_toStartOf="@id/iv_avatar_right"
|
||||
app:layout_constraintTop_toTopOf="@id/iv_avatar_right" />
|
||||
<TextView
|
||||
android:id="@+id/tv_send_gift"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="18dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:background="@drawable/bg_room_pk_send_gift"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:text="助攻"
|
||||
android:textColor="#ffffffff"
|
||||
android:textSize="12dp"
|
||||
app:layout_constraintStart_toEndOf="@id/iv_avatar_left"
|
||||
app:layout_constraintTop_toTopOf="@id/iv_avatar_left" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/pb_score"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="12dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:max="100"
|
||||
android:progress="50"
|
||||
android:progressDrawable="@drawable/bg_room_pk_board_pb"
|
||||
app:layout_constraintBottom_toBottomOf="@id/iv_avatar_left"
|
||||
app:layout_constraintEnd_toStartOf="@id/iv_avatar_right"
|
||||
app:layout_constraintStart_toEndOf="@id/iv_avatar_left" />
|
||||
<TextView
|
||||
android:id="@+id/tv_go_another_room"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="18dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:background="@drawable/bg_room_pk_go_another_room"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:text="去围观"
|
||||
android:textColor="#ffffffff"
|
||||
android:textSize="12dp"
|
||||
app:layout_constraintEnd_toStartOf="@id/iv_avatar_right"
|
||||
app:layout_constraintTop_toTopOf="@id/iv_avatar_right" />
|
||||
|
||||
<com.opensource.svgaplayer.SVGAImageView
|
||||
android:id="@+id/svga_hot"
|
||||
android:layout_width="18dp"
|
||||
android:layout_height="27dp"
|
||||
android:layout_marginBottom="18dp"
|
||||
app:autoPlay="true"
|
||||
app:layout_constraintBottom_toBottomOf="@id/iv_details"
|
||||
app:layout_constraintEnd_toStartOf="@id/iv_avatar_right"
|
||||
app:layout_constraintHorizontal_bias="0"
|
||||
app:layout_constraintStart_toEndOf="@id/iv_avatar_left"
|
||||
app:source="svga/room_pk_pb_indicator.svga" />
|
||||
<ProgressBar
|
||||
android:id="@+id/pb_score"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="12dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:max="100"
|
||||
android:progress="50"
|
||||
android:progressDrawable="@drawable/bg_room_pk_board_pb"
|
||||
app:layout_constraintBottom_toBottomOf="@id/iv_avatar_left"
|
||||
app:layout_constraintEnd_toStartOf="@id/iv_avatar_right"
|
||||
app:layout_constraintStart_toEndOf="@id/iv_avatar_left" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_score_left"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5dp"
|
||||
android:fontFamily="sans-serif"
|
||||
android:includeFontPadding="false"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="9dp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/pb_score"
|
||||
app:layout_constraintStart_toStartOf="@id/pb_score"
|
||||
app:layout_constraintTop_toTopOf="@id/pb_score"
|
||||
tools:text="123456" />
|
||||
<com.opensource.svgaplayer.SVGAImageView
|
||||
android:id="@+id/svga_hot"
|
||||
android:layout_width="18dp"
|
||||
android:layout_height="27dp"
|
||||
android:layout_marginBottom="18dp"
|
||||
app:autoPlay="true"
|
||||
app:layout_constraintBottom_toBottomOf="@id/iv_details"
|
||||
app:layout_constraintEnd_toStartOf="@id/iv_avatar_right"
|
||||
app:layout_constraintHorizontal_bias="0"
|
||||
app:layout_constraintStart_toEndOf="@id/iv_avatar_left"
|
||||
app:source="svga/room_pk_pb_indicator.svga" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_score_right"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:fontFamily="sans-serif"
|
||||
android:includeFontPadding="false"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="9dp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/pb_score"
|
||||
app:layout_constraintEnd_toEndOf="@id/pb_score"
|
||||
app:layout_constraintTop_toTopOf="@id/pb_score"
|
||||
tools:text="123456" />
|
||||
<TextView
|
||||
android:id="@+id/tv_score_left"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5dp"
|
||||
android:fontFamily="sans-serif"
|
||||
android:includeFontPadding="false"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="9dp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/pb_score"
|
||||
app:layout_constraintStart_toStartOf="@id/pb_score"
|
||||
app:layout_constraintTop_toTopOf="@id/pb_score"
|
||||
tools:text="123456" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_score_right"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:fontFamily="sans-serif"
|
||||
android:includeFontPadding="false"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="9dp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/pb_score"
|
||||
app:layout_constraintEnd_toEndOf="@id/pb_score"
|
||||
app:layout_constraintTop_toTopOf="@id/pb_score"
|
||||
tools:text="123456" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_details"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="20dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_room_pk_top"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/pb_score" />
|
||||
<ImageView
|
||||
android:id="@+id/iv_details"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="20dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_room_pk_top"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/pb_score" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_contribute_title"
|
||||
android:layout_width="53dp"
|
||||
android:layout_height="22dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@drawable/bg_room_pk_contribute_text"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:text="神豪"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14dp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_details" />
|
||||
<TextView
|
||||
android:id="@+id/tv_contribute_title"
|
||||
android:layout_width="53dp"
|
||||
android:layout_height="22dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@drawable/bg_room_pk_contribute_text"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:text="神豪"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14dp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_details" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_charm_title"
|
||||
android:layout_width="53dp"
|
||||
android:layout_height="22dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:background="@drawable/bg_room_pk_charm_text"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:text="魅力"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14dp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_contribute_title" />
|
||||
<TextView
|
||||
android:id="@+id/tv_charm_title"
|
||||
android:layout_width="53dp"
|
||||
android:layout_height="22dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:background="@drawable/bg_room_pk_charm_text"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:text="魅力"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14dp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_contribute_title" />
|
||||
|
||||
|
||||
<com.yizhuan.erban.avroom.anotherroompk.RoomPKRankListView
|
||||
android:id="@+id/view_rank_list_contribute_left"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tv_contribute_title"
|
||||
app:layout_constraintEnd_toStartOf="@id/tv_contribute_title"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_contribute_title" />
|
||||
<com.yizhuan.erban.avroom.anotherroompk.RoomPKRankListView
|
||||
android:id="@+id/view_rank_list_contribute_left"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tv_contribute_title"
|
||||
app:layout_constraintEnd_toStartOf="@id/tv_contribute_title"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_contribute_title" />
|
||||
|
||||
<com.yizhuan.erban.avroom.anotherroompk.RoomPKRankListView
|
||||
android:id="@+id/view_rank_list_charm_left"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tv_charm_title"
|
||||
app:layout_constraintEnd_toStartOf="@id/tv_charm_title"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_charm_title" />
|
||||
<com.yizhuan.erban.avroom.anotherroompk.RoomPKRankListView
|
||||
android:id="@+id/view_rank_list_charm_left"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tv_charm_title"
|
||||
app:layout_constraintEnd_toStartOf="@id/tv_charm_title"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_charm_title" />
|
||||
|
||||
<com.yizhuan.erban.avroom.anotherroompk.RoomPKRankListView
|
||||
android:id="@+id/view_rank_list_contribute_right"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tv_contribute_title"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/tv_contribute_title"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_contribute_title" />
|
||||
<com.yizhuan.erban.avroom.anotherroompk.RoomPKRankListView
|
||||
android:id="@+id/view_rank_list_contribute_right"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tv_contribute_title"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/tv_contribute_title"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_contribute_title" />
|
||||
|
||||
<com.yizhuan.erban.avroom.anotherroompk.RoomPKRankListView
|
||||
android:id="@+id/view_rank_list_charm_right"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tv_charm_title"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/tv_charm_title"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_charm_title" />
|
||||
<com.yizhuan.erban.avroom.anotherroompk.RoomPKRankListView
|
||||
android:id="@+id/view_rank_list_charm_right"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tv_charm_title"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/tv_charm_title"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_charm_title" />
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/group_rank"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:constraint_referenced_ids="view_rank_list_charm_right,view_rank_list_contribute_right,view_rank_list_charm_left,view_rank_list_contribute_left,tv_charm_title,tv_contribute_title" />
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/group_rank"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:constraint_referenced_ids="view_rank_list_charm_right,view_rank_list_contribute_right,view_rank_list_charm_left,view_rank_list_contribute_left,tv_charm_title,tv_contribute_title" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
@@ -14,7 +14,6 @@
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:lineSpacingExtra="3dp"
|
||||
android:text="@string/room_pk_help"
|
||||
android:textColor="@color/text_title_white"
|
||||
android:textSize="12sp" />
|
||||
|
@@ -12,7 +12,6 @@ import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.alibaba.security.biometrics.build.V;
|
||||
import com.netease.nim.uikit.support.glide.GlideApp;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
|
||||
|
@@ -26,8 +26,6 @@ buildscript {
|
||||
classpath 'com.tencent.mm:AndResGuard-gradle-plugin:1.2.16'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
classpath 'com.huawei.agconnect:agcp:1.3.1.300'
|
||||
classpath "com.github.qq549631030:android-junk-code:1.0.7"
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -105,6 +105,8 @@ dependencies {
|
||||
api project(':nim_uikit')
|
||||
api project(':library')
|
||||
api project(':agora-ktv-kit-release')
|
||||
api 'com.tencent.liteav:LiteAVSDK_TRTC:latest.release'
|
||||
|
||||
}
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
BIN
core/libs/arm64-v8a/libc++_shared.so
Normal file
BIN
core/libs/arm64-v8a/libc++_shared.so
Normal file
Binary file not shown.
BIN
core/libs/arm64-v8a/libzegoliveroom.so
Normal file
BIN
core/libs/arm64-v8a/libzegoliveroom.so
Normal file
Binary file not shown.
BIN
core/libs/armeabi-v7a/libc++_shared.so
Normal file
BIN
core/libs/armeabi-v7a/libc++_shared.so
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -47,8 +47,8 @@ public class UriProvider {
|
||||
/**
|
||||
* 默认以下生产环境地址
|
||||
*/
|
||||
public static String JAVA_WEB_URL = "http://www.daxiaomao.com";
|
||||
public static String IM_SERVER_URL = "https://www.daxiaomao.com";
|
||||
public static String JAVA_WEB_URL = "https://api.lecheng163.com/";
|
||||
public static String IM_SERVER_URL = "https://api.lecheng163.com/";
|
||||
|
||||
/**
|
||||
* @return
|
||||
|
@@ -3,6 +3,7 @@ package com.yizhuan.xchat_android_core.manager;
|
||||
|
||||
import com.netease.nim.uikit.common.util.log.LogUtil;
|
||||
import com.yizhuan.xchat_android_core.manager.agora.RtcEngineManager;
|
||||
import com.yizhuan.xchat_android_core.manager.trtc.TRtcEngineManager;
|
||||
import com.yizhuan.xchat_android_core.manager.wj.WJAudioConstant;
|
||||
import com.yizhuan.xchat_android_core.manager.wj.WJAudioEngineManager;
|
||||
import com.yizhuan.xchat_android_core.manager.zego.ZegoEngineManager;
|
||||
@@ -42,6 +43,9 @@ public class AudioEngineManager {
|
||||
case TYPE_ZEGO:
|
||||
this.iAudioEngine = ZegoEngineManager.get();
|
||||
break;
|
||||
case TYPE_TRTC:
|
||||
this.iAudioEngine = TRtcEngineManager.get();
|
||||
break;
|
||||
case TYPE_AGORA:
|
||||
default:
|
||||
this.iAudioEngine = RtcEngineManager.get();
|
||||
@@ -64,7 +68,9 @@ public class AudioEngineManager {
|
||||
case RoomAudioSdkType.ZEGO:
|
||||
initRtcEngine(EngineType.TYPE_ZEGO);
|
||||
break;
|
||||
|
||||
case RoomAudioSdkType.TRTC:
|
||||
initRtcEngine(EngineType.TYPE_TRTC);
|
||||
break;
|
||||
default:
|
||||
initRtcEngine(EngineType.TYPE_AGORA);
|
||||
break;
|
||||
|
@@ -6,4 +6,5 @@ public enum EngineType {
|
||||
TYPE_WJ,
|
||||
TYPE_QTT_AUDIO,
|
||||
TYPE_ZEGO,
|
||||
TYPE_TRTC,
|
||||
}
|
||||
|
@@ -0,0 +1,896 @@
|
||||
package com.yizhuan.xchat_android_core.manager.trtc;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
|
||||
import com.tencent.rtmp.ui.TXCloudVideoView;
|
||||
import com.tencent.trtc.TRTCCloud;
|
||||
import com.tencent.trtc.TRTCCloudDef;
|
||||
|
||||
import io.agora.rtc.IAudioEffectManager;
|
||||
import io.agora.rtc.IAudioFrameObserver;
|
||||
import io.agora.rtc.IMetadataObserver;
|
||||
import io.agora.rtc.IRtcEngineEventHandler;
|
||||
import io.agora.rtc.internal.LastmileProbeConfig;
|
||||
import io.agora.rtc.live.LiveInjectStreamConfig;
|
||||
import io.agora.rtc.live.LiveTranscoding;
|
||||
import io.agora.rtc.mediaio.IVideoSink;
|
||||
import io.agora.rtc.mediaio.IVideoSource;
|
||||
import io.agora.rtc.models.UserInfo;
|
||||
import io.agora.rtc.video.AgoraImage;
|
||||
import io.agora.rtc.video.AgoraVideoFrame;
|
||||
import io.agora.rtc.video.BeautyOptions;
|
||||
import io.agora.rtc.video.CameraCapturerConfiguration;
|
||||
import io.agora.rtc.video.ChannelMediaRelayConfiguration;
|
||||
import io.agora.rtc.video.VideoCanvas;
|
||||
import io.agora.rtc.video.VideoEncoderConfiguration;
|
||||
import io.agora.rtc.video.WatermarkOptions;
|
||||
|
||||
/**
|
||||
* 默认实现所有的IRTCEngine,避免两个adapter需要实现所有的接口
|
||||
*/
|
||||
public class BaseAdapterImpl implements IRTCEngine {
|
||||
@Override
|
||||
public void setNetworkQosParam(TRTCCloudDef.TRTCNetworkQosParam param) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showDebugView(int showType) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDebugViewMargin(int userId, TRTCCloud.TRTCViewMargin margin) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startRemoteSubStreamView(int userId, TXCloudVideoView view) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopRemoteSubStreamView(int userId) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRemoteSubStreamViewFillMode(int userId, int mode) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEyeScaleLevel(int eyeScaleLevel) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFaceSlimLevel(int faceScaleLevel) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFaceVLevel(int faceVLevel) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFaceShortLevel(int faceShortlevel) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setChinLevel(int chinLevel) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNoseSlimLevel(int noseSlimLevel) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setGreenScreenFile(String file) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void selectMotionTmpl(String motionPath) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMotionMute(boolean motionMute) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFilter(Bitmap image) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFilterConcentration(float concentration) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLocalViewRotation(int rotation) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVideoEncoderMirror(boolean mirror) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGSensorMode(int mode) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ConnectOtherRoom(String param) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void DisconnectOtherRoom() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMixTranscodingConfig(TRTCCloudDef.TRTCTranscodingConfig config) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startCdnPlayerWithUrl(String url, TXCloudVideoView view) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopCdnPlayer() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setChannelProfile(int profile) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setClientRole(int role) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int joinChannel(String token, String channelName, String optionalInfo, int optionalUid) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int switchChannel(String token, String channelName) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int leaveChannel() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int renewToken(String token) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int registerLocalUserAccount(String appId, String userAccount) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int joinChannelWithUserAccount(String token, String channelName, String userAccount) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getUserInfoByUserAccount(String userAccount, UserInfo userInfo) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getUserInfoByUid(int uid, UserInfo userInfo) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int enableWebSdkInteroperability(boolean enabled) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getConnectionState() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int enableAudio() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int disableAudio() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int pauseAudio() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int resumeAudio() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setAudioProfile(int profile, int scenario) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setHighQualityAudioParameters(boolean fullband, boolean stereo, boolean fullBitrate) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int adjustRecordingSignalVolume(int volume) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int adjustPlaybackSignalVolume(int volume) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int enableAudioVolumeIndication(int interval, int smooth, boolean report_vad) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int enableAudioQualityIndication(boolean enabled) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int enableLocalAudio(boolean enabled) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int muteLocalAudioStream(boolean muted) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int muteRemoteAudioStream(int uid, boolean muted) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int muteAllRemoteAudioStreams(boolean muted) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setDefaultMuteAllRemoteAudioStreams(boolean muted) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int enableVideo() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int disableVideo() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setVideoProfile(int profile, boolean swapWidthAndHeight) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setVideoProfile(int width, int height, int frameRate, int bitrate) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setVideoEncoderConfiguration(VideoEncoderConfiguration config) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setCameraCapturerConfiguration(CameraCapturerConfiguration config) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setupLocalVideo(VideoCanvas local) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setupRemoteVideo(VideoCanvas remote) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setLocalRenderMode(int mode) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setRemoteRenderMode(int uid, int mode) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int startPreview() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int stopPreview() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int enableLocalVideo(boolean enabled) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int muteLocalVideoStream(boolean muted) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int muteRemoteVideoStream(int uid, boolean muted) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int muteAllRemoteVideoStreams(boolean muted) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setDefaultMuteAllRemoteVideoStreams(boolean muted) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setBeautyEffectOptions(boolean enabled, BeautyOptions options) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setDefaultAudioRoutetoSpeakerphone(boolean defaultToSpeaker) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setEnableSpeakerphone(boolean enabled) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSpeakerphoneEnabled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int enableInEarMonitoring(boolean enabled) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setInEarMonitoringVolume(int volume) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int useExternalAudioDevice() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setLocalVoicePitch(double pitch) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setLocalVoiceEqualization(int bandFrequency, int bandGain) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setLocalVoiceReverb(int reverbKey, int value) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setLocalVoiceChanger(int voiceChanger) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setLocalVoiceReverbPreset(int preset) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int enableSoundPositionIndication(boolean enabled) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setRemoteVoicePosition(int uid, double pan, double gain) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int startAudioMixing(String filePath, boolean loopback, boolean replace, int cycle) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int stopAudioMixing() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int pauseAudioMixing() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int resumeAudioMixing() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int adjustAudioMixingVolume(int volume) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int adjustAudioMixingPlayoutVolume(int volume) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int adjustAudioMixingPublishVolume(int volume) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAudioMixingPlayoutVolume() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAudioMixingPublishVolume() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAudioMixingDuration() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAudioMixingCurrentPosition() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setAudioMixingPosition(int pos) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAudioEffectManager getAudioEffectManager() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int startAudioRecording(String filePath, int quality) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int startAudioRecording(String filePath, int sampleRate, int quality) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int stopAudioRecording() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int startEchoTest() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int startEchoTest(int intervalInSeconds) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int stopEchoTest() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int enableLastmileTest() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int disableLastmileTest() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int startLastmileProbeTest(LastmileProbeConfig config) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int stopLastmileProbeTest() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setVideoSource(IVideoSource source) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setLocalVideoRenderer(IVideoSink render) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setRemoteVideoRenderer(int uid, IVideoSink render) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setExternalAudioSink(boolean enabled, int sampleRate, int channels) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int pullPlaybackAudioFrame(byte[] data, int lengthInByte) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setExternalAudioSource(boolean enabled, int sampleRate, int channels) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int pushExternalAudioFrame(byte[] data, long timestamp) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExternalVideoSource(boolean enable, boolean useTexture, boolean pushMode) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean pushExternalVideoFrame(AgoraVideoFrame frame) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTextureEncodeSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int registerAudioFrameObserver(IAudioFrameObserver observer) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setRecordingAudioFrameParameters(int sampleRate, int channel, int mode, int samplesPerCall) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setPlaybackAudioFrameParameters(int sampleRate, int channel, int mode, int samplesPerCall) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setMixedAudioFrameParameters(int sampleRate, int samplesPerCall) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addVideoWatermark(AgoraImage watermark) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addVideoWatermark(String watermarkUrl, WatermarkOptions options) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int clearVideoWatermarks() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setRemoteUserPriority(int uid, int userPriority) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setLocalPublishFallbackOption(int option) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setRemoteSubscribeFallbackOption(int option) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int enableDualStreamMode(boolean enabled) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setRemoteVideoStreamType(int uid, int streamType) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setRemoteDefaultVideoStreamType(int streamType) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setEncryptionSecret(String secret) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setEncryptionMode(String encryptionMode) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addInjectStreamUrl(String url, LiveInjectStreamConfig config) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int removeInjectStreamUrl(String url) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addPublishStreamUrl(String url, boolean transcodingEnabled) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int removePublishStreamUrl(String url) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setLiveTranscoding(LiveTranscoding transcoding) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int createDataStream(boolean reliable, boolean ordered) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int sendStreamMessage(int streamId, byte[] message) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setVideoQualityParameters(boolean preferFrameRateOverImageQuality) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setLocalVideoMirrorMode(int mode) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int switchCamera() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCameraZoomSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCameraTorchSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCameraFocusSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCameraExposurePositionSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCameraAutoFocusFaceModeSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setCameraZoomFactor(float factor) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getCameraMaxZoomFactor() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setCameraFocusPositionInPreview(float positionX, float positionY) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setCameraExposurePosition(float positionXinView, float positionYinView) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setCameraTorchOn(boolean isOn) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setCameraAutoFocusFaceModeEnabled(boolean enabled) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCallId() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int rate(String callId, int rating, String description) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int complain(String callId, String description) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setLogFile(String filePath) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setLogFilter(int filter) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setLogFileSize(int fileSizeInKBytes) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getNativeHandle() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addHandler(IRtcEngineEventHandler handler) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeHandler(IRtcEngineEventHandler handler) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean enableHighPerfWifiMode(boolean enable) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void monitorHeadsetEvent(boolean monitor) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void monitorBluetoothHeadsetEvent(boolean monitor) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPreferHeadset(boolean enabled) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setParameters(String parameters) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParameter(String parameter, String args) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int registerMediaMetadataObserver(IMetadataObserver observer, int type) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int startChannelMediaRelay(ChannelMediaRelayConfiguration channelMediaRelayConfiguration) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int stopChannelMediaRelay() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateChannelMediaRelay(ChannelMediaRelayConfiguration channelMediaRelayConfiguration) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int startDumpVideoReceiveTrack(int uid) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int stopDumpVideoReceiveTrack() {
|
||||
return 0;
|
||||
}
|
||||
}
|
@@ -0,0 +1,155 @@
|
||||
package com.yizhuan.xchat_android_core.manager.trtc;
|
||||
|
||||
import android.graphics.Rect;
|
||||
|
||||
import io.agora.rtc.IRtcEngineEventHandler;
|
||||
import io.agora.rtc.models.UserInfo;
|
||||
|
||||
/**
|
||||
* 对齐IRtcEngineEventHandler的所有接口
|
||||
*/
|
||||
interface BaseAgoraHandlerInterface {
|
||||
void onWarning(int warn);
|
||||
|
||||
void onError(int err);
|
||||
|
||||
void onJoinChannelSuccess(String channel, int uid, int elapsed);
|
||||
|
||||
void onRejoinChannelSuccess(String channel, int uid, int elapsed);
|
||||
|
||||
void onLeaveChannel(IRtcEngineEventHandler.RtcStats stats);
|
||||
|
||||
void onClientRoleChanged(int oldRole, int newRole);
|
||||
|
||||
@Version(agora = "2.9.2")
|
||||
void onLocalUserRegistered(int uid, String userAccount);
|
||||
|
||||
@Version(agora = "2.9.2")
|
||||
void onUserInfoUpdated(int uid, UserInfo userInfo);
|
||||
|
||||
void onUserJoined(int uid, int elapsed);
|
||||
|
||||
void onUserOffline(int uid, int reason);
|
||||
|
||||
void onConnectionStateChanged(int state, int reason);
|
||||
|
||||
void onConnectionLost();
|
||||
|
||||
@Version(agora = "3.0.0")
|
||||
void onConnectionInterrupted();
|
||||
|
||||
@Version(agora = "3.0.0")
|
||||
void onAudioQuality(int uid, int quality, short delay, short lost);
|
||||
|
||||
void onApiCallExecuted(int error, String api, String result);
|
||||
|
||||
void onTokenPrivilegeWillExpire(String token);
|
||||
|
||||
void onRequestToken();
|
||||
|
||||
void onMicrophoneEnabled(boolean enabled);
|
||||
|
||||
void onAudioVolumeIndication(IRtcEngineEventHandler.AudioVolumeInfo[] speakers, int totalVolume);
|
||||
|
||||
void onActiveSpeaker(int uid);
|
||||
|
||||
void onFirstLocalAudioFrame(int elapsed);
|
||||
|
||||
void onFirstRemoteAudioFrame(int uid, int elapsed);
|
||||
|
||||
void onFirstRemoteAudioDecoded(int uid, int elapsed);
|
||||
|
||||
void onVideoStopped();
|
||||
|
||||
void onFirstLocalVideoFrame(int width, int height, int elapsed);
|
||||
|
||||
void onFirstRemoteVideoDecoded(int uid, int width, int height, int elapsed);
|
||||
|
||||
void onFirstRemoteVideoFrame(int uid, int width, int height, int elapsed);
|
||||
|
||||
void onUserMuteAudio(int uid, boolean muted);
|
||||
|
||||
void onUserMuteVideo(int uid, boolean muted);
|
||||
|
||||
void onUserEnableVideo(int uid, boolean enabled);
|
||||
|
||||
void onUserEnableLocalVideo(int uid, boolean enabled);
|
||||
|
||||
void onVideoSizeChanged(int uid, int width, int height, int rotation);
|
||||
|
||||
@Version(agora = "2.9.2")
|
||||
void onRemoteAudioStateChanged(int uid, int state, int reason, int elapsed);
|
||||
|
||||
@Version(agora = "2.9.2")
|
||||
void onRemoteVideoStateChanged(int uid, int state, int reason, int elapsed);
|
||||
|
||||
@Version(agora = "2.9.2")
|
||||
void onChannelMediaRelayStateChanged(int state, int code);
|
||||
|
||||
@Version(agora = "2.9.2")
|
||||
void onChannelMediaRelayEvent(int code);
|
||||
|
||||
void onLocalPublishFallbackToAudioOnly(boolean isFallbackOrRecover);
|
||||
|
||||
void onRemoteSubscribeFallbackToAudioOnly(int uid, boolean isFallbackOrRecover);
|
||||
|
||||
void onAudioRouteChanged(int routing);
|
||||
|
||||
void onCameraReady();
|
||||
|
||||
void onCameraFocusAreaChanged(Rect rect);
|
||||
|
||||
void onCameraExposureAreaChanged(Rect rect);
|
||||
|
||||
void onRtcStats(IRtcEngineEventHandler.RtcStats stats);
|
||||
|
||||
void onLastmileQuality(int quality);
|
||||
|
||||
void onLastmileProbeResult(IRtcEngineEventHandler.LastmileProbeResult result);
|
||||
|
||||
void onNetworkQuality(int uid, int txQuality, int rxQuality);
|
||||
|
||||
void onLocalVideoStats(IRtcEngineEventHandler.LocalVideoStats stats);
|
||||
|
||||
void onRemoteVideoStats(IRtcEngineEventHandler.RemoteVideoStats stats);
|
||||
|
||||
void onLocalAudioStats(IRtcEngineEventHandler.LocalAudioStats stats);
|
||||
|
||||
@Version(agora = "2.9.2")
|
||||
void onRemoteAudioStats(IRtcEngineEventHandler.RemoteAudioStats stats);
|
||||
|
||||
void onRemoteAudioTransportStats(int uid, int delay, int lost, int rxKBitRate);
|
||||
|
||||
void onRemoteVideoTransportStats(int uid, int delay, int lost, int rxKBitRate);
|
||||
|
||||
void onAudioMixingStateChanged(int state, int errorCode);
|
||||
|
||||
void onAudioMixingFinished();
|
||||
|
||||
void onAudioEffectFinished(int soundId);
|
||||
|
||||
@Version(agora = "2.9.2")
|
||||
void onLocalAudioStateChanged(int state, int error);
|
||||
|
||||
@Version(agora = "2.9.2")
|
||||
void onLocalVideoStateChanged(int localVideoState, int error);
|
||||
|
||||
@Version(agora = "2.9.2")
|
||||
void onRtmpStreamingStateChanged(String url, int state, int errCode);
|
||||
|
||||
void onStreamPublished(String url, int error);
|
||||
|
||||
void onStreamUnpublished(String url);
|
||||
|
||||
void onTranscodingUpdated();
|
||||
|
||||
void onStreamInjectedStatus(String url, int uid, int status);
|
||||
|
||||
void onStreamMessage(int uid, int streamId, byte[] data);
|
||||
|
||||
void onStreamMessageError(int uid, int streamId, int error, int missed, int cached);
|
||||
|
||||
void onMediaEngineLoadSuccess();
|
||||
|
||||
void onMediaEngineStartCallSuccess();
|
||||
}
|
@@ -0,0 +1,352 @@
|
||||
package com.yizhuan.xchat_android_core.manager.trtc;
|
||||
|
||||
import io.agora.rtc.IAudioEffectManager;
|
||||
import io.agora.rtc.IAudioFrameObserver;
|
||||
import io.agora.rtc.IMetadataObserver;
|
||||
import io.agora.rtc.IRtcEngineEventHandler;
|
||||
import io.agora.rtc.internal.LastmileProbeConfig;
|
||||
import io.agora.rtc.live.LiveInjectStreamConfig;
|
||||
import io.agora.rtc.live.LiveTranscoding;
|
||||
import io.agora.rtc.mediaio.IVideoSink;
|
||||
import io.agora.rtc.mediaio.IVideoSource;
|
||||
import io.agora.rtc.models.UserInfo;
|
||||
import io.agora.rtc.video.AgoraImage;
|
||||
import io.agora.rtc.video.AgoraVideoFrame;
|
||||
import io.agora.rtc.video.BeautyOptions;
|
||||
import io.agora.rtc.video.CameraCapturerConfiguration;
|
||||
import io.agora.rtc.video.ChannelMediaRelayConfiguration;
|
||||
import io.agora.rtc.video.VideoCanvas;
|
||||
import io.agora.rtc.video.VideoEncoderConfiguration;
|
||||
import io.agora.rtc.video.WatermarkOptions;
|
||||
|
||||
/**
|
||||
* 接口类,和声网所有接口保持一致
|
||||
*/
|
||||
@Version(agora = "3.0.0", trtc = "6.8")
|
||||
public interface BaseAgoraInterface {
|
||||
int setChannelProfile(int profile);
|
||||
|
||||
int setClientRole(int role);
|
||||
|
||||
int joinChannel(String token, String channelName, String optionalInfo, int optionalUid);
|
||||
|
||||
int switchChannel(String token, String channelName);
|
||||
|
||||
int leaveChannel();
|
||||
|
||||
int renewToken(String token);
|
||||
|
||||
int registerLocalUserAccount(String appId, String userAccount);
|
||||
|
||||
int joinChannelWithUserAccount(String token, String channelName, String userAccount);
|
||||
|
||||
int getUserInfoByUserAccount(String userAccount, UserInfo userInfo);
|
||||
|
||||
int getUserInfoByUid(int uid, UserInfo userInfo);
|
||||
|
||||
int enableWebSdkInteroperability(boolean enabled);
|
||||
|
||||
int getConnectionState();
|
||||
|
||||
int enableAudio();
|
||||
|
||||
int disableAudio();
|
||||
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
int pauseAudio();
|
||||
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
int resumeAudio();
|
||||
|
||||
int setAudioProfile(int profile, int scenario);
|
||||
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
int setHighQualityAudioParameters(boolean fullband, boolean stereo, boolean fullBitrate);
|
||||
|
||||
int adjustRecordingSignalVolume(int volume);
|
||||
|
||||
int adjustPlaybackSignalVolume(int volume);
|
||||
|
||||
int enableAudioVolumeIndication(int interval, int smooth, boolean report_vad);
|
||||
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
int enableAudioQualityIndication(boolean enabled);
|
||||
|
||||
int enableLocalAudio(boolean enabled);
|
||||
|
||||
int muteLocalAudioStream(boolean muted);
|
||||
|
||||
int muteRemoteAudioStream(int uid, boolean muted);
|
||||
|
||||
int muteAllRemoteAudioStreams(boolean muted);
|
||||
|
||||
int setDefaultMuteAllRemoteAudioStreams(boolean muted);
|
||||
|
||||
int enableVideo();
|
||||
|
||||
int disableVideo();
|
||||
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
int setVideoProfile(int profile, boolean swapWidthAndHeight);
|
||||
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
int setVideoProfile(int width, int height, int frameRate, int bitrate);
|
||||
|
||||
int setVideoEncoderConfiguration(VideoEncoderConfiguration config);
|
||||
|
||||
int setCameraCapturerConfiguration(CameraCapturerConfiguration config);
|
||||
|
||||
int setupLocalVideo(VideoCanvas local);
|
||||
|
||||
int setupRemoteVideo(VideoCanvas remote);
|
||||
|
||||
int setLocalRenderMode(int mode);
|
||||
|
||||
int setRemoteRenderMode(int uid, int mode);
|
||||
|
||||
int startPreview();
|
||||
|
||||
int stopPreview();
|
||||
|
||||
int enableLocalVideo(boolean enabled);
|
||||
|
||||
int muteLocalVideoStream(boolean muted);
|
||||
|
||||
int muteRemoteVideoStream(int uid, boolean muted);
|
||||
|
||||
int muteAllRemoteVideoStreams(boolean muted);
|
||||
|
||||
int setDefaultMuteAllRemoteVideoStreams(boolean muted);
|
||||
|
||||
int setBeautyEffectOptions(boolean enabled, BeautyOptions options);
|
||||
|
||||
int setDefaultAudioRoutetoSpeakerphone(boolean defaultToSpeaker);
|
||||
|
||||
int setEnableSpeakerphone(boolean enabled);
|
||||
|
||||
boolean isSpeakerphoneEnabled();
|
||||
|
||||
int enableInEarMonitoring(boolean enabled);
|
||||
|
||||
int setInEarMonitoringVolume(int volume);
|
||||
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
int useExternalAudioDevice();
|
||||
|
||||
int setLocalVoicePitch(double pitch);
|
||||
|
||||
int setLocalVoiceEqualization(int bandFrequency, int bandGain);
|
||||
|
||||
int setLocalVoiceReverb(int reverbKey, int value);
|
||||
|
||||
int setLocalVoiceChanger(int voiceChanger);
|
||||
|
||||
int setLocalVoiceReverbPreset(int preset);
|
||||
|
||||
int enableSoundPositionIndication(boolean enabled);
|
||||
|
||||
int setRemoteVoicePosition(int uid, double pan, double gain);
|
||||
|
||||
int startAudioMixing(String filePath, boolean loopback, boolean replace, int cycle);
|
||||
|
||||
int stopAudioMixing();
|
||||
|
||||
int pauseAudioMixing();
|
||||
|
||||
int resumeAudioMixing();
|
||||
|
||||
int adjustAudioMixingVolume(int volume);
|
||||
|
||||
int adjustAudioMixingPlayoutVolume(int volume);
|
||||
|
||||
int adjustAudioMixingPublishVolume(int volume);
|
||||
|
||||
int getAudioMixingPlayoutVolume();
|
||||
|
||||
int getAudioMixingPublishVolume();
|
||||
|
||||
int getAudioMixingDuration();
|
||||
|
||||
int getAudioMixingCurrentPosition();
|
||||
|
||||
int setAudioMixingPosition(int pos);
|
||||
|
||||
IAudioEffectManager getAudioEffectManager();
|
||||
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
int startAudioRecording(String filePath, int quality);
|
||||
|
||||
int startAudioRecording(String filePath, int sampleRate, int quality);
|
||||
|
||||
int stopAudioRecording();
|
||||
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
int startEchoTest();
|
||||
|
||||
int startEchoTest(int intervalInSeconds);
|
||||
|
||||
int stopEchoTest();
|
||||
|
||||
int enableLastmileTest();
|
||||
|
||||
int disableLastmileTest();
|
||||
|
||||
int startLastmileProbeTest(LastmileProbeConfig config);
|
||||
|
||||
int stopLastmileProbeTest();
|
||||
|
||||
int setVideoSource(IVideoSource source);
|
||||
|
||||
int setLocalVideoRenderer(IVideoSink render);
|
||||
|
||||
int setRemoteVideoRenderer(int uid, IVideoSink render);
|
||||
|
||||
int setExternalAudioSink(boolean enabled, int sampleRate, int channels);
|
||||
|
||||
int pullPlaybackAudioFrame(byte[] data, int lengthInByte);
|
||||
|
||||
int setExternalAudioSource(boolean enabled, int sampleRate, int channels);
|
||||
|
||||
int pushExternalAudioFrame(byte[] data, long timestamp);
|
||||
|
||||
void setExternalVideoSource(boolean enable, boolean useTexture, boolean pushMode);
|
||||
|
||||
boolean pushExternalVideoFrame(AgoraVideoFrame frame);
|
||||
|
||||
boolean isTextureEncodeSupported();
|
||||
|
||||
int registerAudioFrameObserver(IAudioFrameObserver observer);
|
||||
|
||||
int setRecordingAudioFrameParameters(int sampleRate, int channel, int mode, int samplesPerCall);
|
||||
|
||||
int setPlaybackAudioFrameParameters(int sampleRate, int channel, int mode, int samplesPerCall);
|
||||
|
||||
int setMixedAudioFrameParameters(int sampleRate, int samplesPerCall);
|
||||
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
int addVideoWatermark(AgoraImage watermark);
|
||||
|
||||
int addVideoWatermark(String watermarkUrl, WatermarkOptions options);
|
||||
|
||||
int clearVideoWatermarks();
|
||||
|
||||
int setRemoteUserPriority(int uid, int userPriority);
|
||||
|
||||
int setLocalPublishFallbackOption(int option);
|
||||
|
||||
int setRemoteSubscribeFallbackOption(int option);
|
||||
|
||||
int enableDualStreamMode(boolean enabled);
|
||||
|
||||
int setRemoteVideoStreamType(int uid, int streamType);
|
||||
|
||||
int setRemoteDefaultVideoStreamType(int streamType);
|
||||
|
||||
int setEncryptionSecret(String secret);
|
||||
|
||||
int setEncryptionMode(String encryptionMode);
|
||||
|
||||
int addInjectStreamUrl(String url, LiveInjectStreamConfig config);
|
||||
|
||||
int removeInjectStreamUrl(String url);
|
||||
|
||||
int addPublishStreamUrl(String url, boolean transcodingEnabled);
|
||||
|
||||
int removePublishStreamUrl(String url);
|
||||
|
||||
int setLiveTranscoding(LiveTranscoding transcoding);
|
||||
|
||||
int createDataStream(boolean reliable, boolean ordered);
|
||||
|
||||
int sendStreamMessage(int streamId, byte[] message);
|
||||
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
int setVideoQualityParameters(boolean preferFrameRateOverImageQuality);
|
||||
|
||||
int setLocalVideoMirrorMode(int mode);
|
||||
|
||||
int switchCamera();
|
||||
|
||||
boolean isCameraZoomSupported();
|
||||
|
||||
boolean isCameraTorchSupported();
|
||||
|
||||
boolean isCameraFocusSupported();
|
||||
|
||||
boolean isCameraExposurePositionSupported();
|
||||
|
||||
boolean isCameraAutoFocusFaceModeSupported();
|
||||
|
||||
int setCameraZoomFactor(float factor);
|
||||
|
||||
float getCameraMaxZoomFactor();
|
||||
|
||||
int setCameraFocusPositionInPreview(float positionX, float positionY);
|
||||
|
||||
int setCameraExposurePosition(float positionXinView, float positionYinView);
|
||||
|
||||
int setCameraTorchOn(boolean isOn);
|
||||
|
||||
int setCameraAutoFocusFaceModeEnabled(boolean enabled);
|
||||
|
||||
String getCallId();
|
||||
|
||||
int rate(String callId, int rating, String description);
|
||||
|
||||
int complain(String callId, String description);
|
||||
|
||||
int setLogFile(String filePath);
|
||||
|
||||
int setLogFilter(int filter);
|
||||
|
||||
int setLogFileSize(int fileSizeInKBytes);
|
||||
|
||||
long getNativeHandle();
|
||||
|
||||
void addHandler(IRtcEngineEventHandler handler);
|
||||
|
||||
void removeHandler(IRtcEngineEventHandler handler);
|
||||
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
boolean enableHighPerfWifiMode(boolean enable);
|
||||
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
void monitorHeadsetEvent(boolean monitor);
|
||||
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
void monitorBluetoothHeadsetEvent(boolean monitor);
|
||||
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
void setPreferHeadset(boolean enabled);
|
||||
|
||||
int setParameters(String parameters);
|
||||
|
||||
String getParameter(String parameter, String args);
|
||||
|
||||
int registerMediaMetadataObserver(IMetadataObserver observer, int type);
|
||||
|
||||
int startChannelMediaRelay(ChannelMediaRelayConfiguration channelMediaRelayConfiguration);
|
||||
|
||||
int stopChannelMediaRelay();
|
||||
|
||||
int updateChannelMediaRelay(ChannelMediaRelayConfiguration channelMediaRelayConfiguration);
|
||||
|
||||
int startDumpVideoReceiveTrack(int uid);
|
||||
|
||||
int stopDumpVideoReceiveTrack();
|
||||
}
|
@@ -0,0 +1,66 @@
|
||||
package com.yizhuan.xchat_android_core.manager.trtc;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
|
||||
import com.tencent.rtmp.ui.TXCloudVideoView;
|
||||
import com.tencent.trtc.TRTCCloud;
|
||||
import com.tencent.trtc.TRTCCloudDef;
|
||||
|
||||
/**
|
||||
* 接口类,包括声网和TRTC自己的函数,可以增加自定义的接口,然后让两套适配层进行适配
|
||||
*/
|
||||
public interface IRTCEngine extends BaseAgoraInterface {
|
||||
/**
|
||||
* ====================这些都是TRTC特有的函数=============
|
||||
*/
|
||||
void setNetworkQosParam(TRTCCloudDef.TRTCNetworkQosParam param);
|
||||
|
||||
void showDebugView(int showType);
|
||||
|
||||
void setDebugViewMargin(int userId, TRTCCloud.TRTCViewMargin margin);
|
||||
|
||||
void startRemoteSubStreamView(int userId, TXCloudVideoView view);
|
||||
|
||||
void stopRemoteSubStreamView(int userId);
|
||||
|
||||
void setRemoteSubStreamViewFillMode(int userId, int mode);
|
||||
|
||||
void setEyeScaleLevel(int eyeScaleLevel);
|
||||
|
||||
void setFaceSlimLevel(int faceScaleLevel);
|
||||
|
||||
void setFaceVLevel(int faceVLevel);
|
||||
|
||||
void setFaceShortLevel(int faceShortlevel);
|
||||
|
||||
void setChinLevel(int chinLevel);
|
||||
|
||||
void setNoseSlimLevel(int noseSlimLevel);
|
||||
|
||||
boolean setGreenScreenFile(String file);
|
||||
|
||||
void selectMotionTmpl(String motionPath);
|
||||
|
||||
void setMotionMute(boolean motionMute);
|
||||
|
||||
void setFilter(Bitmap image);
|
||||
|
||||
void setFilterConcentration(float concentration);
|
||||
|
||||
void setLocalViewRotation(int rotation);
|
||||
|
||||
void setVideoEncoderMirror(boolean mirror);
|
||||
|
||||
void setGSensorMode(int mode);
|
||||
|
||||
void ConnectOtherRoom(String param);
|
||||
|
||||
void DisconnectOtherRoom();
|
||||
|
||||
//设置云端的混流转码参数
|
||||
void setMixTranscodingConfig(TRTCCloudDef.TRTCTranscodingConfig config);
|
||||
|
||||
void startCdnPlayerWithUrl(String url, TXCloudVideoView view);
|
||||
|
||||
void stopCdnPlayer();
|
||||
}
|
@@ -0,0 +1,21 @@
|
||||
package com.yizhuan.xchat_android_core.manager.trtc;
|
||||
|
||||
import com.tencent.trtc.TRTCCloudDef;
|
||||
|
||||
/**
|
||||
* 包括声网和腾讯云的回调
|
||||
*/
|
||||
interface IRTCEngineHandler extends BaseAgoraHandlerInterface {
|
||||
|
||||
void onUserSubStreamAvailable(int userId, boolean available);
|
||||
|
||||
void onSpeedTest(TRTCCloudDef.TRTCSpeedTestResult currentResult, int finishedCount, int totalCount);
|
||||
|
||||
void onRecvSEIMsg(int userId, byte[] data);
|
||||
|
||||
void onSetMixTranscodingConfig(int err, String errMsg);
|
||||
|
||||
void onConnectOtherRoom(int userID, int err, String errMsg);
|
||||
|
||||
void onDisConnectOtherRoom(int err, String errMsg);
|
||||
}
|
@@ -0,0 +1,33 @@
|
||||
package com.yizhuan.xchat_android_core.manager.trtc;
|
||||
|
||||
public class SDKConfig {
|
||||
/**
|
||||
* 声网appid,需要替换为尽自己账号下的声网appid
|
||||
*/
|
||||
public static String AGORA_APPID = "";
|
||||
/**
|
||||
* 腾讯云 SDKAppId,需要替换为您自己账号下的 SDKAppId。
|
||||
* <p>
|
||||
* 进入腾讯云云通信[控制台](https://console.cloud.tencent.com/avc) 创建应用,即可看到 SDKAppId,
|
||||
* 它是腾讯云用于区分客户的唯一标识。
|
||||
*/
|
||||
public static int TX_SDKAPPID = 1400600174;//
|
||||
|
||||
/**
|
||||
* 腾讯云 bizid和appid
|
||||
* 腾讯云的bizid https://console.cloud.tencent.com/rav 点击【应用】【帐号信息】在【直播信息】中可以看到bizid和appid, 分别填到下面这两个符号
|
||||
*/
|
||||
public static int TX_BIZID = 0;//
|
||||
public static int TX_APPID = 0;//
|
||||
|
||||
/**
|
||||
* 混流播放地址,请填写您的播放地址
|
||||
*/
|
||||
public static String TX_PLAYDOMAIN = "";
|
||||
/**
|
||||
* 表示房间号是否为整型值
|
||||
* 0:表示房间号为字符串房间号,不能直接转换为整型,如:"111_222","namme1"
|
||||
* 1:表示房间号为整型房间号,如:"111","123"
|
||||
*/
|
||||
public static int TX_CHANNELNAME_INT = 1;
|
||||
}
|
@@ -0,0 +1,167 @@
|
||||
package com.yizhuan.xchat_android_core.manager.trtc;
|
||||
|
||||
import com.tencent.liteav.audio.TXAudioEffectManager;
|
||||
import com.tencent.trtc.TRTCCloud;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import io.agora.rtc.IAudioEffectManager;
|
||||
|
||||
/**
|
||||
* 音效的控制类
|
||||
*/
|
||||
public class TRTCEffectManager implements IAudioEffectManager {
|
||||
// SDK 核心类
|
||||
private TRTCCloud mTRTCCloud;
|
||||
private double mEffectsVolume;
|
||||
private Set<Integer> mEffectIdSet;
|
||||
private TXAudioEffectManager.TXMusicPlayObserver mMusicPlayObserver;
|
||||
|
||||
public TRTCEffectManager(TRTCCloud trtcCloud) {
|
||||
mTRTCCloud = trtcCloud;
|
||||
mEffectIdSet = new HashSet<>();
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
stopAllAudioEffects();
|
||||
}
|
||||
|
||||
/**
|
||||
* ==================================音效面板控制==================================
|
||||
*/
|
||||
private void playAudioEffect(int effectId, String path, int count, boolean publish, double volume) {
|
||||
if (mTRTCCloud != null) {
|
||||
TXAudioEffectManager.AudioMusicParam audioMusicParam = new TXAudioEffectManager.AudioMusicParam(effectId, path);
|
||||
audioMusicParam.loopCount = count;
|
||||
audioMusicParam.publish = publish;
|
||||
audioMusicParam.isShortFile = true;
|
||||
if (mMusicPlayObserver != null) {
|
||||
mTRTCCloud.getAudioEffectManager().setMusicObserver(effectId, mMusicPlayObserver);
|
||||
}
|
||||
mTRTCCloud.getAudioEffectManager().startPlayMusic(audioMusicParam);
|
||||
mEffectIdSet.add(effectId);
|
||||
}
|
||||
}
|
||||
|
||||
private void stopAudioEffect(int effectId) {
|
||||
if (mTRTCCloud != null) {
|
||||
mTRTCCloud.getAudioEffectManager().stopPlayMusic(effectId);
|
||||
mEffectIdSet.remove(effectId);
|
||||
}
|
||||
}
|
||||
|
||||
private void setAudioEffectVolume(int effectId, int gain) {
|
||||
if (mTRTCCloud != null) {
|
||||
mTRTCCloud.getAudioEffectManager().setMusicPublishVolume(effectId, gain);
|
||||
mTRTCCloud.getAudioEffectManager().setMusicPlayoutVolume(effectId, gain);
|
||||
}
|
||||
}
|
||||
|
||||
private void stopAllAudioEffects() {
|
||||
if (mTRTCCloud != null) {
|
||||
for (int i : mEffectIdSet) {
|
||||
mTRTCCloud.getAudioEffectManager().stopPlayMusic(i);
|
||||
}
|
||||
mEffectIdSet.clear();
|
||||
}
|
||||
}
|
||||
|
||||
private void setAllAudioEffectsVolume(int gain) {
|
||||
mEffectsVolume = gain;
|
||||
if (mTRTCCloud != null) {
|
||||
mTRTCCloud.getAudioEffectManager().setAllMusicVolume(gain);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getEffectsVolume() {
|
||||
return mEffectsVolume;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setEffectsVolume(double volume) {
|
||||
setAllAudioEffectsVolume((int) volume);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setVolumeOfEffect(int soundId, double volume) {
|
||||
setAudioEffectVolume(soundId, (int) volume);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int playEffect(int soundId, String filePath, int loop, double pitch, double pan, double gain) {
|
||||
playAudioEffect(soundId, filePath, loop, true, gain);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int playEffect(int soundId, String filePath, int loopCount, double pitch, double pan, double gain, boolean publish) {
|
||||
playAudioEffect(soundId, filePath, loopCount, publish, gain);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int stopEffect(int soundId) {
|
||||
stopAudioEffect(soundId);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int stopAllEffects() {
|
||||
stopAllAudioEffects();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int preloadEffect(int soundId, String filePath) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int unloadEffect(int soundId) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int pauseEffect(int soundId) {
|
||||
if (mTRTCCloud != null) {
|
||||
mTRTCCloud.getAudioEffectManager().pausePlayMusic(soundId);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int pauseAllEffects() {
|
||||
if (mTRTCCloud != null) {
|
||||
for (int i : mEffectIdSet) {
|
||||
mTRTCCloud.getAudioEffectManager().pausePlayMusic(i);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int resumeEffect(int soundId) {
|
||||
if (mTRTCCloud != null) {
|
||||
mTRTCCloud.getAudioEffectManager().resumePlayMusic(soundId);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int resumeAllEffects() {
|
||||
if (mTRTCCloud != null) {
|
||||
for (int i : mEffectIdSet) {
|
||||
mTRTCCloud.getAudioEffectManager().resumePlayMusic(i);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void setMusicObserver(TXAudioEffectManager.TXMusicPlayObserver observer) {
|
||||
mMusicPlayObserver = observer;
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,427 @@
|
||||
package com.yizhuan.xchat_android_core.manager.trtc;
|
||||
|
||||
import android.graphics.Rect;
|
||||
import android.os.Message;
|
||||
|
||||
import com.orhanobut.logger.Logger;
|
||||
import com.tencent.trtc.TRTCCloudDef;
|
||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
|
||||
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
|
||||
import com.yizhuan.xchat_android_core.manager.RoomEvent;
|
||||
import com.yizhuan.xchat_android_core.manager.agora.RtcEngineHandler;
|
||||
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
|
||||
|
||||
import io.agora.rtc.Constants;
|
||||
import io.agora.rtc.IRtcEngineEventHandler;
|
||||
import io.agora.rtc.models.UserInfo;
|
||||
|
||||
/**
|
||||
* @author by 梁馨 on 2020/9/14.
|
||||
*/
|
||||
public class TRtcEngineEventHandler implements IRTCEngineHandler {
|
||||
|
||||
public static String TAG = TRtcEngineEventHandler.class.getSimpleName();
|
||||
|
||||
@Override
|
||||
public void onWarning(int warn) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int err) {
|
||||
Logger.t(TAG).d("onError" + err);
|
||||
switch (err) {
|
||||
case 1107: {
|
||||
SingleToastUtil.showToast("发生未知错误,请退出房间重新进入");
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onJoinChannelSuccess(String channel, int uid, int elapsed) {
|
||||
Logger.t(TAG).d("onJoinChannelSuccess" + channel + "uid:" + uid);
|
||||
//声网进入频道成功日志
|
||||
TRtcEngineManager manager = TRtcEngineManager.get();
|
||||
if (manager != null) {
|
||||
Message message = manager.mRtcEngineHandler.obtainMessage();
|
||||
message.what = RtcEngineHandler.notifyJoinAvRoom;
|
||||
manager.mRtcEngineHandler.sendMessage(message);
|
||||
manager.uid = uid;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onRejoinChannelSuccess(String channel, int uid, int elapsed) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLeaveChannel(IRtcEngineEventHandler.RtcStats stats) {
|
||||
Logger.t(TAG).d("onLeaveChannel");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUserJoined(int uid, int elapsed) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUserOffline(int uid, int reason) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectionStateChanged(int state, int reason) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActiveSpeaker(int uid) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLastmileQuality(int quality) {
|
||||
if (quality >= 3) {
|
||||
IMNetEaseManager.postRoomEvent(new RoomEvent().setEvent(RoomEvent.RTC_ENGINE_NETWORK_BAD)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLastmileProbeResult(IRtcEngineEventHandler.LastmileProbeResult result) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNetworkQuality(int uid, int txQuality, int rxQuality) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLocalVideoStats(IRtcEngineEventHandler.LocalVideoStats stats) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemoteVideoStats(IRtcEngineEventHandler.RemoteVideoStats stats) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLocalAudioStats(IRtcEngineEventHandler.LocalAudioStats stats) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectionInterrupted() {
|
||||
IMNetEaseManager.postRoomEvent(new RoomEvent().setEvent(RoomEvent.RTC_ENGINE_NETWORK_CLOSE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAudioQuality(int uid, int quality, short delay, short lost) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onApiCallExecuted(int error, String api, String result) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTokenPrivilegeWillExpire(String token) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestToken() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMicrophoneEnabled(boolean enabled) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectionLost() {
|
||||
IMNetEaseManager.postRoomEvent(new RoomEvent().setEvent(RoomEvent.RTC_ENGINE_NETWORK_CLOSE));
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户音量提示回调。
|
||||
*
|
||||
* @param speakers
|
||||
* @param totalVolume
|
||||
*/
|
||||
@Override
|
||||
public void onAudioVolumeIndication(IRtcEngineEventHandler.AudioVolumeInfo[] speakers, int totalVolume) {
|
||||
TRtcEngineManager manager = TRtcEngineManager.get();
|
||||
Message message = manager.mRtcEngineHandler.obtainMessage();
|
||||
message.what = RtcEngineHandler.onAudioVolumeIndication;
|
||||
message.obj = speakers;
|
||||
manager.mRtcEngineHandler.sendMessage(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUserMuteAudio(int uid, boolean muted) {
|
||||
TRtcEngineManager manager = TRtcEngineManager.get();
|
||||
if (muted) {
|
||||
Message message = manager.mRtcEngineHandler.obtainMessage();
|
||||
message.what = RtcEngineHandler.onUserMuteAudio;
|
||||
message.obj = uid;
|
||||
manager.mRtcEngineHandler.sendMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUserMuteVideo(int uid, boolean muted) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUserEnableVideo(int uid, boolean enabled) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUserEnableLocalVideo(int uid, boolean enabled) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVideoSizeChanged(int uid, int width, int height, int rotation) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClientRoleChanged(int oldRole, int newRole) {
|
||||
//角色切换 麦克风切换
|
||||
if (newRole == Constants.CLIENT_ROLE_BROADCASTER) {
|
||||
TRtcEngineManager.get().setMute(TRtcEngineManager.get().isMute);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLocalUserRegistered(int uid, String userAccount) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUserInfoUpdated(int uid, UserInfo userInfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAudioMixingFinished() {//伴奏播放已结束回调
|
||||
IMNetEaseManager.get().getChatRoomEventObservable().onNext(
|
||||
new RoomEvent().setEvent(RoomEvent.METHOD_ON_AUDIO_MIXING_FINISHED)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAudioEffectFinished(int soundId) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLocalAudioStateChanged(int state, int error) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLocalVideoStateChanged(int localVideoState, int error) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRtmpStreamingStateChanged(String url, int state, int errCode) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStreamPublished(String url, int error) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStreamUnpublished(String url) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTranscodingUpdated() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStreamInjectedStatus(String url, int uid, int status) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStreamMessage(int uid, int streamId, byte[] data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStreamMessageError(int uid, int streamId, int error, int missed, int cached) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMediaEngineLoadSuccess() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMediaEngineStartCallSuccess() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFirstLocalAudioFrame(int i) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFirstRemoteAudioFrame(int uid, int elapsed) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFirstRemoteAudioDecoded(int uid, int elapsed) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVideoStopped() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFirstLocalVideoFrame(int width, int height, int elapsed) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFirstRemoteVideoDecoded(int uid, int width, int height, int elapsed) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFirstRemoteVideoFrame(int uid, int width, int height, int elapsed) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemoteAudioStateChanged(int i, int i1, int i2, int i3) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemoteVideoStateChanged(int uid, int state, int reason, int elapsed) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChannelMediaRelayStateChanged(int state, int code) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChannelMediaRelayEvent(int code) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLocalPublishFallbackToAudioOnly(boolean isFallbackOrRecover) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemoteSubscribeFallbackToAudioOnly(int uid, boolean isFallbackOrRecover) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAudioRouteChanged(int routing) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCameraReady() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCameraFocusAreaChanged(Rect rect) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCameraExposureAreaChanged(Rect rect) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRtcStats(IRtcEngineEventHandler.RtcStats stats) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemoteAudioStats(IRtcEngineEventHandler.RemoteAudioStats remoteAudioStats) {
|
||||
Logger.t(TAG).d("onRemoteAudioStats uid%d", remoteAudioStats.uid);
|
||||
long uid = (long) remoteAudioStats.uid;
|
||||
// 如果麦上没有这个人,不接收这个人的声音
|
||||
TRtcEngineManager.get().setRemoteMute(uid, !AvRoomDataManager.get().checkIsOnMicByAccount(uid + ""));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemoteAudioTransportStats(int uid, int delay, int lost, int rxKBitRate) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemoteVideoTransportStats(int uid, int delay, int lost, int rxKBitRate) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAudioMixingStateChanged(int state, int errorCode) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUserSubStreamAvailable(int userId, boolean available) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSpeedTest(TRTCCloudDef.TRTCSpeedTestResult currentResult, int finishedCount, int totalCount) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRecvSEIMsg(int userId, byte[] data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSetMixTranscodingConfig(int err, String errMsg) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectOtherRoom(int userID, int err, String errMsg) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisConnectOtherRoom(int err, String errMsg) {
|
||||
|
||||
}
|
||||
}
|
@@ -0,0 +1,88 @@
|
||||
package com.yizhuan.xchat_android_core.manager.trtc;
|
||||
|
||||
import static io.agora.rtc.Constants.AUDIO_RECORDING_QUALITY_LOW;
|
||||
|
||||
import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.manager.AudioEngineManager;
|
||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
|
||||
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
|
||||
import com.yizhuan.xchat_android_core.manager.RoomEvent;
|
||||
import com.yizhuan.xchat_android_core.manager.agora.RtcEngineManager;
|
||||
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
|
||||
import com.yizhuan.xchat_android_library.utils.config.BasicConfig;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import io.agora.rtc.Constants;
|
||||
import io.agora.rtc.IRtcEngineEventHandler;
|
||||
|
||||
/**
|
||||
* @author by 梁馨 on 2020/9/14.
|
||||
*/
|
||||
|
||||
|
||||
public class TRtcEngineHandler extends Handler {
|
||||
|
||||
public static int notifyJoinAvRoom = 0;
|
||||
public static int onAudioVolumeIndication = 1;
|
||||
public static int onUserMuteAudio = 2;
|
||||
|
||||
@Override
|
||||
public void handleMessage(@NotNull Message msg) {
|
||||
super.handleMessage(msg);
|
||||
TRtcEngineManager rtcEngineManager = TRtcEngineManager.get();
|
||||
if (rtcEngineManager == null) return;
|
||||
if (msg.what == notifyJoinAvRoom) {
|
||||
if (!rtcEngineManager.inRoom) {
|
||||
IMNetEaseManager.get().joinAvRoom();
|
||||
}
|
||||
rtcEngineManager.inRoom = true;
|
||||
if (rtcEngineManager.needRecord && rtcEngineManager.mRtcEngine != null) {
|
||||
rtcEngineManager.mRtcEngine.startAudioRecording(Environment.getExternalStorageDirectory()
|
||||
+ File.separator + BasicConfig.INSTANCE.getAppContext().getPackageName()
|
||||
+ "/audio/" + System.currentTimeMillis() + ".aac", AUDIO_RECORDING_QUALITY_LOW);
|
||||
}
|
||||
|
||||
} else if (msg.what == onAudioVolumeIndication) {//onAudioVolumeIndication 说话声音音量提示回调
|
||||
IRtcEngineEventHandler.AudioVolumeInfo[] speakers = (IRtcEngineEventHandler.AudioVolumeInfo[]) msg.obj;
|
||||
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo == null) return;
|
||||
if (rtcEngineManager.speakQueueMembersPosition.size() > 0) {
|
||||
rtcEngineManager.speakQueueMembersPosition.clear();
|
||||
}
|
||||
if (speakers == null || speakers.length == 0) return;
|
||||
for (IRtcEngineEventHandler.AudioVolumeInfo speaker : speakers) {
|
||||
// 0 代表的是房主,其他代表的是uid
|
||||
long uid = speaker.uid == 0 ? rtcEngineManager.uid : speaker.uid;
|
||||
int micPosition = AvRoomDataManager.get().getMicPosition(uid);
|
||||
// 如果是房主的话,并且房主的mic位置没有的啊,则把房主的位置设置为-1(兼容ios轻聊房光晕)
|
||||
if (uid == AvRoomDataManager.get().mCurrentRoomInfo.getUid() &&
|
||||
AvRoomDataManager.get().mCurrentRoomInfo.getType() == RoomInfo.ROOMTYPE_LIGHT_CHAT
|
||||
&& micPosition == Integer.MIN_VALUE) {
|
||||
micPosition = -1;
|
||||
}
|
||||
if (micPosition == Integer.MIN_VALUE &&
|
||||
uid == AuthModel.get().getCurrentUid()) {
|
||||
// 如果麦上没有自己,并且自己在说话,要把自己变成听众
|
||||
AudioEngineManager.get().setRole(Constants.CLIENT_ROLE_AUDIENCE);
|
||||
} else if (micPosition == Integer.MIN_VALUE &&
|
||||
uid != AuthModel.get().getCurrentUid()) {
|
||||
// 如果麦上没有这个人,要把他静音
|
||||
AudioEngineManager.get().setRemoteMute(uid, true);
|
||||
}
|
||||
if (micPosition == Integer.MIN_VALUE) continue;
|
||||
rtcEngineManager.speakQueueMembersPosition.add(micPosition);
|
||||
}
|
||||
IMNetEaseManager.get().getChatRoomEventObservable().onNext(
|
||||
new RoomEvent().setEvent(RoomEvent.SPEAK_STATE_CHANGE)
|
||||
.setMicPositionList(rtcEngineManager.speakQueueMembersPosition)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,268 @@
|
||||
package com.yizhuan.xchat_android_core.manager.trtc;
|
||||
|
||||
import static io.agora.rtc.Constants.AUDIO_PROFILE_MUSIC_STANDARD;
|
||||
import static io.agora.rtc.Constants.AUDIO_SCENARIO_GAME_STREAMING;
|
||||
|
||||
import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.orhanobut.logger.Logger;
|
||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
|
||||
import com.yizhuan.xchat_android_core.manager.BaseEngine;
|
||||
import com.yizhuan.xchat_android_core.music.db.bean.LocalMusicBean;
|
||||
import com.yizhuan.xchat_android_core.music.model.PlayerModel;
|
||||
import com.yizhuan.xchat_android_library.utils.config.BasicConfig;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Locale;
|
||||
|
||||
import io.agora.rtc.Constants;
|
||||
|
||||
|
||||
/**
|
||||
* @author by 梁馨 on 2020/9/14.
|
||||
*/
|
||||
public class TRtcEngineManager extends BaseEngine {
|
||||
public static String TAG = TRtcEngineManager.class.getSimpleName();
|
||||
@Nullable
|
||||
public TRTCEngineAdapter mRtcEngine;
|
||||
@NonNull
|
||||
public final Handler mRtcEngineHandler = new TRtcEngineHandler();
|
||||
@NonNull
|
||||
public final TRtcEngineEventHandler mEngineEventHandler = new TRtcEngineEventHandler();
|
||||
|
||||
private static final class Helper {
|
||||
private static final TRtcEngineManager INSTANCE = new TRtcEngineManager();
|
||||
}
|
||||
|
||||
private TRtcEngineManager() {
|
||||
super();
|
||||
}
|
||||
|
||||
public static TRtcEngineManager get() {
|
||||
return TRtcEngineManager.Helper.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enterChannel(long channelId, long uid) {
|
||||
Logger.t(TAG).d("enterChannel channelId:%d", channelId);
|
||||
if (mRtcEngine == null) {
|
||||
try {
|
||||
mRtcEngine = TRTCEngineAdapter.create(BasicConfig.INSTANCE.getAppContext(),String.valueOf(SDKConfig.TX_SDKAPPID), mEngineEventHandler);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(
|
||||
"NEED TO check rtc sdk init fatal error\n" + Log.getStackTraceString(e));
|
||||
}
|
||||
//设置频道模式为直播
|
||||
mRtcEngine.setChannelProfile(Constants.CHANNEL_PROFILE_LIVE_BROADCASTING);
|
||||
mRtcEngine.setAudioProfile(AUDIO_PROFILE_MUSIC_STANDARD, AUDIO_SCENARIO_GAME_STREAMING);
|
||||
mRtcEngine.enableAudioVolumeIndication(600, 3, false);
|
||||
mRtcEngine.setDefaultAudioRoutetoSpeakerphone(true);
|
||||
mRtcEngine.setExternalVideoSource(true, false, true);
|
||||
mRtcEngine.enableDualStreamMode(true);
|
||||
mRtcEngine.setLogFile(Environment.getExternalStorageDirectory()
|
||||
+ File.separator + BasicConfig.INSTANCE.getAppContext().getPackageName()
|
||||
+ "/log/agora-rtc.log");
|
||||
}
|
||||
mRtcEngine.joinChannel(AvRoomDataManager.get().trtcSig, String.valueOf(channelId), null, (int) uid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int stopAudioMixing() {
|
||||
Logger.t(TAG).d("stopAudioMixing ");
|
||||
if (mRtcEngine != null) {
|
||||
int result = mRtcEngine.stopAudioMixing();
|
||||
isMusicPlaying = false;
|
||||
return result;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetChannel() {
|
||||
Logger.t(TAG).d("resetChannel ");
|
||||
|
||||
if (mRtcEngine != null) {
|
||||
stopAudioMixing();
|
||||
mRtcEngine.leaveChannel();
|
||||
mRtcEngine = null;
|
||||
}
|
||||
mRtcEngineHandler.removeCallbacksAndMessages(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reEnterChannel(long channelId, long uid) {
|
||||
enterChannel(channelId, uid);
|
||||
setRemoteMute(isRemoteMute);
|
||||
setMute(isMute);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public synchronized void leaveChannel() {
|
||||
Logger.t(TAG).d("leaveChannel ");
|
||||
if (mRtcEngine != null) {
|
||||
stopAudioMixing();
|
||||
mRtcEngine.leaveChannel();
|
||||
mRtcEngine = null;
|
||||
TRTCEngineAdapter.destroy();
|
||||
}
|
||||
mRtcEngineHandler.removeCallbacksAndMessages(null);
|
||||
isMute = false;
|
||||
isRemoteMute = false;
|
||||
needRecord = false;
|
||||
inRoom = false;
|
||||
isAudienceRole = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRemoteMute(boolean mute) {
|
||||
Logger.t(TAG).d("setRemoteMute mute=" + mute);
|
||||
if (mRtcEngine != null) {
|
||||
int result = mRtcEngine.muteAllRemoteAudioStreams(mute);
|
||||
if (result == 0) {
|
||||
isRemoteMute = mute;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnableLoopBack() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRemoteMute(long uid, boolean mute) {
|
||||
Logger.t(TAG).d("setRemoteMute uid:%s mute:%s", uid, mute);
|
||||
|
||||
if (mRtcEngine != null) {
|
||||
mRtcEngine.muteRemoteAudioStream((int) uid, mute);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setRole(int role) {
|
||||
Logger.t(TAG).d("setRole role=" + role + ",isAudienceRole:" + isAudienceRole);
|
||||
|
||||
if (mRtcEngine != null) {
|
||||
mRtcEngine.setClientRole(role);
|
||||
isAudienceRole = role == Constants.CLIENT_ROLE_AUDIENCE;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMute(boolean mute) {
|
||||
Logger.t(TAG).d("setMute bool:" + mute);
|
||||
if (mRtcEngine == null) {
|
||||
return;
|
||||
}
|
||||
mRtcEngine.muteLocalAudioStream(mute);
|
||||
isMute = mute;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustAudioMixingVolume(int volume) {
|
||||
Logger.t(TAG).d("adjustAudioMixingVolume" + volume);
|
||||
|
||||
if (mRtcEngine != null) {
|
||||
mRtcEngine.adjustAudioMixingVolume(volume);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustRecordingSignalVolume(int volume) {
|
||||
Logger.t(TAG).d("adjustRecordingSignalVolume volume=" + volume);
|
||||
|
||||
if (mRtcEngine != null) {
|
||||
mRtcEngine.adjustRecordingSignalVolume(volume);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int resumeAudioMixing() {
|
||||
Logger.t(TAG).d("resumeAudioMixing");
|
||||
|
||||
if (mRtcEngine == null) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int currentPosition = mRtcEngine.getAudioMixingCurrentPosition();
|
||||
int result = 0;
|
||||
if (currentPosition > 0) {
|
||||
result = mRtcEngine.resumeAudioMixing();
|
||||
} else {
|
||||
LocalMusicBean current = PlayerModel.get().getCurrent();
|
||||
startAudioMixing(current.getLocalUri(), false, 1);
|
||||
}
|
||||
|
||||
isMusicPlaying = true;
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int pauseAudioMixing() {
|
||||
Logger.t(TAG).d("pauseAudioMixing");
|
||||
if (mRtcEngine == null) {
|
||||
return -1;
|
||||
}
|
||||
int result = mRtcEngine.pauseAudioMixing();
|
||||
isMusicPlaying = false;
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int startAudioMixing(String filePath, boolean loopback, int cycle) {
|
||||
Logger.t(TAG).d("startAudioMixing filePath=" + filePath + " loopback=" + loopback + " cycle=" + cycle);
|
||||
if (mRtcEngine == null || TextUtils.isEmpty(filePath)) {
|
||||
return -1;
|
||||
}
|
||||
mRtcEngine.stopAudioMixing();
|
||||
int result;
|
||||
try {
|
||||
result = mRtcEngine.startAudioMixing(filePath, loopback, false, cycle);
|
||||
} catch (Exception e) {
|
||||
return -1;
|
||||
}
|
||||
isMusicPlaying = true;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//新方法还没有翻译 还没有验证
|
||||
@Override
|
||||
public int getAudioMixingCurrentPosition() {
|
||||
|
||||
if (mRtcEngine != null) {
|
||||
return -1;
|
||||
}
|
||||
int currentPosition = mRtcEngine.getAudioMixingCurrentPosition();
|
||||
|
||||
Logger.t(TAG).d("getAudioMixingCurrentPosition() returned: " + currentPosition);
|
||||
return currentPosition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAudioMixingDuration() {
|
||||
if (mRtcEngine == null) {
|
||||
return -1;
|
||||
}
|
||||
return mRtcEngine.getAudioMixingDuration();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setChatRoomOnlineStatus(boolean status) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setASMRMode(boolean enable) {
|
||||
|
||||
}
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
package com.yizhuan.xchat_android_core.manager.trtc;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Unsupport {
|
||||
}
|
@@ -0,0 +1,58 @@
|
||||
package com.yizhuan.xchat_android_core.manager.trtc;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
|
||||
public class Utils {
|
||||
|
||||
private static boolean isSpace(final String s) {
|
||||
if (s == null) return true;
|
||||
for (int i = 0, len = s.length(); i < len; ++i) {
|
||||
if (!Character.isWhitespace(s.charAt(i))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return bitmap.
|
||||
*
|
||||
* @param filePath The path of file.
|
||||
* @param maxWidth The maximum width.
|
||||
* @param maxHeight The maximum height.
|
||||
* @return bitmap
|
||||
*/
|
||||
public static Bitmap getBitmap(final String filePath, final int maxWidth, final int maxHeight) {
|
||||
if (isSpace(filePath)) return null;
|
||||
BitmapFactory.Options options = new BitmapFactory.Options();
|
||||
options.inJustDecodeBounds = true;
|
||||
BitmapFactory.decodeFile(filePath, options);
|
||||
options.inSampleSize = calculateInSampleSize(options, maxWidth, maxHeight);
|
||||
options.inJustDecodeBounds = false;
|
||||
return BitmapFactory.decodeFile(filePath, options);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the sample size.
|
||||
*
|
||||
* @param options The options.
|
||||
* @param maxWidth The maximum width.
|
||||
* @param maxHeight The maximum height.
|
||||
* @return the sample size
|
||||
*/
|
||||
private static int calculateInSampleSize(final BitmapFactory.Options options,
|
||||
final int maxWidth,
|
||||
final int maxHeight) {
|
||||
int height = options.outHeight;
|
||||
int width = options.outWidth;
|
||||
int inSampleSize = 1;
|
||||
while (height > maxHeight || width > maxWidth) {
|
||||
height >>= 1;
|
||||
width >>= 1;
|
||||
inSampleSize <<= 1;
|
||||
}
|
||||
return inSampleSize;
|
||||
}
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
package com.yizhuan.xchat_android_core.manager.trtc;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface Version {
|
||||
String agora() default "";
|
||||
String trtc() default "";
|
||||
}
|
@@ -167,11 +167,6 @@ public class ZegoEngineManager extends BaseEngine {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ZegoAuxData onAuxCallback(int i) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPublishQualityUpdate(String s, ZegoPublishStreamQuality zegoPublishStreamQuality) {
|
||||
|
||||
|
@@ -77,4 +77,9 @@ public class ZegoMediaPlayerCallbackWrapper implements IZegoMediaPlayerWithIndex
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReadEOF(int i) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -183,6 +183,10 @@ public final class AvRoomDataManager {
|
||||
*/
|
||||
private boolean isParty;
|
||||
private boolean redEnvelopeOpen;
|
||||
|
||||
//TRTC SIG
|
||||
public String trtcSig;
|
||||
|
||||
/**
|
||||
* 缓存师父的 UID
|
||||
*/
|
||||
|
@@ -7,5 +7,6 @@ public interface RoomAudioSdkType {
|
||||
String SHENGWANG = "shengwang"; //声网
|
||||
String WUJIE = "wujie"; //无界
|
||||
String ZEGO = "zego"; //zego
|
||||
String TRTC = "trtc"; //trtc
|
||||
|
||||
}
|
||||
|
@@ -186,6 +186,8 @@ public class RoomInfo implements Parcelable,Serializable {
|
||||
*/
|
||||
private String audioSdkType;
|
||||
|
||||
private String trtcSig;
|
||||
|
||||
private boolean isReselect;
|
||||
|
||||
private long mgId;
|
||||
|
@@ -16,10 +16,11 @@ android.enableD8=true
|
||||
android.injected.testOnly=false
|
||||
android.useAndroidX=true
|
||||
android.enableJetifier=true
|
||||
with_jenkins=false
|
||||
#\u6253\u652F\u6301x86\u7684\u6A21\u62DF\u5668\u5305\u4F7F\u7528
|
||||
ndk_abi_filters=arm
|
||||
|
||||
version_name=3.3.0
|
||||
version_code=330
|
||||
with_flutter_aar=true
|
||||
version_name=3.6.4
|
||||
version_code=364
|
||||
|
||||
with_flutter_aar=true
|
||||
with_jenkins=false
|
||||
|
||||
channel=official
|
||||
|
@@ -48,6 +48,7 @@ public class TimeUtils {
|
||||
|
||||
public static final String DATE_FORMAT = "yyyy-MM-dd";
|
||||
public static final String TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
|
||||
public static final long MILLIS_OF_SEC = 1000;
|
||||
|
||||
public static String getCurrentDateStr() {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT, Locale.getDefault());
|
||||
@@ -157,8 +158,6 @@ public class TimeUtils {
|
||||
return c.getTimeInMillis();
|
||||
}
|
||||
|
||||
public static final long MILLIS_OF_SEC = 1000;
|
||||
|
||||
/**
|
||||
* Get current time in secs.
|
||||
*
|
||||
@@ -427,6 +426,308 @@ public class TimeUtils {
|
||||
return t * scale;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将毫秒转换为年月日时分秒 ,只拿时分秒
|
||||
*
|
||||
* @author GaoHuanjie
|
||||
*/
|
||||
public static String getYearMonthDayHourMinuteSecond(long timeMillis) {
|
||||
int timezone = 8; // 时区
|
||||
long totalSeconds = timeMillis / 1000;
|
||||
totalSeconds += 60 * 60 * timezone;
|
||||
int second = (int) (totalSeconds % 60);// 秒
|
||||
long totalMinutes = totalSeconds / 60;
|
||||
int minute = (int) (totalMinutes % 60);// 分
|
||||
long totalHours = totalMinutes / 60;
|
||||
int hour = (int) (totalHours % 24);// 时
|
||||
int totalDays = (int) (totalHours / 24);
|
||||
int _year = 1970;
|
||||
int year = _year + totalDays / 366;
|
||||
int month = 1;
|
||||
int day = 1;
|
||||
int diffDays;
|
||||
boolean leapYear;
|
||||
while (true) {
|
||||
int diff = (year - _year) * 365;
|
||||
diff += (year - 1) / 4 - (_year - 1) / 4;
|
||||
diff -= ((year - 1) / 100 - (_year - 1) / 100);
|
||||
diff += (year - 1) / 400 - (_year - 1) / 400;
|
||||
diffDays = totalDays - diff;
|
||||
leapYear = (year % 4 == 0) && (year % 100 != 0) || (year % 400 == 0);
|
||||
if (!leapYear && diffDays < 365 || leapYear && diffDays < 366) {
|
||||
break;
|
||||
} else {
|
||||
year++;
|
||||
}
|
||||
}
|
||||
|
||||
int[] monthDays;
|
||||
if (diffDays >= 59 && leapYear) {
|
||||
monthDays = new int[]{-1, 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335};
|
||||
} else {
|
||||
monthDays = new int[]{-1, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};
|
||||
}
|
||||
for (int i = monthDays.length - 1; i >= 1; i--) {
|
||||
if (diffDays >= monthDays[i]) {
|
||||
month = i;
|
||||
day = diffDays - monthDays[i] + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
String hours;
|
||||
String minutes;
|
||||
String seconds;
|
||||
if (hour < 10) {
|
||||
hours = "0" + hour;
|
||||
} else {
|
||||
hours = "" + hour;
|
||||
}
|
||||
if (minute < 10) {
|
||||
minutes = "0" + minute;
|
||||
} else {
|
||||
minutes = "" + minute;
|
||||
}
|
||||
if (second < 10) {
|
||||
seconds = "0" + second;
|
||||
} else {
|
||||
seconds = "" + second;
|
||||
}
|
||||
|
||||
// return year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + second;
|
||||
return hours + ":" + minutes + ":" + seconds;
|
||||
}
|
||||
|
||||
public static Date getTimesnight(int i) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.set(Calendar.HOUR_OF_DAY, i);
|
||||
cal.set(Calendar.SECOND, 0);
|
||||
cal.set(Calendar.MINUTE, 0);
|
||||
cal.set(Calendar.MILLISECOND, 0);
|
||||
return cal.getTime();
|
||||
}
|
||||
|
||||
/*获得指定天数的0点和24点*/
|
||||
public static Date getTimesnights(Date time) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(time);
|
||||
cal.set(Calendar.HOUR_OF_DAY, 0);
|
||||
cal.set(Calendar.SECOND, 0);
|
||||
cal.set(Calendar.MINUTE, 0);
|
||||
cal.set(Calendar.MILLISECOND, 0);
|
||||
return cal.getTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* 将时间戳ms 转成星座
|
||||
* 白羊:0321~0420 天秤:0924~1023
|
||||
* 金牛:0421~0521 天蝎:1024~1122
|
||||
* 双子:0522~0621 射手:1123~1221
|
||||
* 巨蟹:0622~0722 摩羯:1222~0120
|
||||
* 狮子:0723~0823 水瓶:0121~0219
|
||||
* 处女:0824~0923 双鱼:0220~0320
|
||||
*/
|
||||
public static String msToConstellation(long ms) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(ms);
|
||||
int month = calendar.get(Calendar.MONTH) + 1;
|
||||
int day = calendar.get(Calendar.DAY_OF_MONTH);
|
||||
Log.e("mouse_debug", month + ", " + day);
|
||||
String xingzuo = "";
|
||||
switch (month) {
|
||||
case 1:
|
||||
xingzuo = day < 21 ? "摩羯座" : "水瓶座";
|
||||
break;
|
||||
case 2:
|
||||
xingzuo = day < 20 ? "水瓶座" : "双鱼座";
|
||||
break;
|
||||
case 3:
|
||||
xingzuo = day < 21 ? "双鱼座" : "白羊座";
|
||||
break;
|
||||
case 4:
|
||||
xingzuo = day < 21 ? "白羊座" : "金牛座";
|
||||
break;
|
||||
case 5:
|
||||
xingzuo = day < 22 ? "金牛座" : "双子座";
|
||||
break;
|
||||
case 6:
|
||||
xingzuo = day < 22 ? "双子座" : "巨蟹座";
|
||||
break;
|
||||
case 7:
|
||||
xingzuo = day < 23 ? "巨蟹座" : "狮子座";
|
||||
break;
|
||||
case 8:
|
||||
xingzuo = day < 24 ? "狮子座" : "处女座";
|
||||
break;
|
||||
case 9:
|
||||
xingzuo = day < 24 ? "处女座" : "天秤座";
|
||||
break;
|
||||
case 10:
|
||||
xingzuo = day < 24 ? "天秤座" : "天蝎座";
|
||||
break;
|
||||
case 11:
|
||||
xingzuo = day < 23 ? "天蝎座" : "射手座";
|
||||
break;
|
||||
case 12:
|
||||
xingzuo = day < 22 ? "射手座" : "摩羯座";
|
||||
break;
|
||||
}
|
||||
return xingzuo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是不是 第二天
|
||||
*
|
||||
* @param cacheTime 和 当前时间对比,判断现在是不是第二天了
|
||||
* @return
|
||||
*/
|
||||
public static boolean isTomorrow(long cacheTime) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
int currYear = calendar.get(Calendar.YEAR);
|
||||
int currMonth = calendar.get(Calendar.MONTH);
|
||||
int currDayOfMonth = calendar.get(Calendar.DAY_OF_MONTH);
|
||||
calendar.setTimeInMillis(cacheTime);
|
||||
int cacheYear = calendar.get(Calendar.YEAR);
|
||||
int cacheMonth = calendar.get(Calendar.MONTH);
|
||||
int cacheDayOfMonth = calendar.get(Calendar.DAY_OF_MONTH);
|
||||
if (currYear > cacheYear) {
|
||||
return true;
|
||||
}
|
||||
boolean equalYear = currYear == cacheYear;
|
||||
if (equalYear && currMonth > cacheMonth) {
|
||||
return true;
|
||||
}
|
||||
return equalYear && currMonth == cacheMonth && currDayOfMonth > cacheDayOfMonth;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cacheTime 和 当前时间对比,判断现在是不是当天
|
||||
* @return -
|
||||
*/
|
||||
public static boolean isToday(long cacheTime) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
int currYear = calendar.get(Calendar.YEAR);
|
||||
int currMonth = calendar.get(Calendar.MONTH);
|
||||
int currDayOfMonth = calendar.get(Calendar.DAY_OF_MONTH);
|
||||
calendar.setTimeInMillis(cacheTime);
|
||||
int cacheYear = calendar.get(Calendar.YEAR);
|
||||
int cacheMonth = calendar.get(Calendar.MONTH);
|
||||
int cacheDayOfMonth = calendar.get(Calendar.DAY_OF_MONTH);
|
||||
return currYear == cacheYear && currMonth == cacheMonth && currDayOfMonth == cacheDayOfMonth;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cacheTime 和 当前时间对比,是不是同一年
|
||||
* @return -
|
||||
*/
|
||||
public static boolean isSameYear(long cacheTime) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
int currYear = calendar.get(Calendar.YEAR);
|
||||
calendar.setTimeInMillis(cacheTime);
|
||||
int cacheYear = calendar.get(Calendar.YEAR);
|
||||
return currYear == cacheYear;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得系统时间 年、月、日、小时、分钟
|
||||
*
|
||||
* @return HashMap
|
||||
*/
|
||||
public static int getTime24() {
|
||||
SimpleDateFormat hh = new SimpleDateFormat("HH", Locale.CHINA);
|
||||
SimpleDateFormat mm = new SimpleDateFormat("mm", Locale.CHINA);
|
||||
hh.setTimeZone(TimeZone.getTimeZone("GMT+08")); // 获取指定时区的时间
|
||||
mm.setTimeZone(TimeZone.getTimeZone("GMT+08"));
|
||||
Date date = new Date();
|
||||
String hour = hh.format(date);
|
||||
String minute = mm.format(date);
|
||||
return Integer.parseInt(hour + minute);
|
||||
}
|
||||
|
||||
public static boolean getTimeLimit(int start_hour, int end_hour) {
|
||||
if (start_hour == end_hour) return false;
|
||||
SimpleDateFormat hh = new SimpleDateFormat("HH", Locale.CHINA);
|
||||
SimpleDateFormat mm = new SimpleDateFormat("mm", Locale.CHINA);
|
||||
hh.setTimeZone(TimeZone.getTimeZone("GMT+08")); // 获取指定时区的时间
|
||||
mm.setTimeZone(TimeZone.getTimeZone("GMT+08"));
|
||||
Date date = new Date();
|
||||
String hour = hh.format(date);
|
||||
String minute = mm.format(date);
|
||||
Log.i("stf", "--hour:minute-->" + hour + ":" + minute);
|
||||
int currentTime = Integer.parseInt(hour + minute);
|
||||
LogUtil.print("start" + start_hour);
|
||||
LogUtil.print("end" + end_hour);
|
||||
LogUtil.print("minuteOfDay" + currentTime);
|
||||
if (currentTime >= start_hour && currentTime <= end_hour) {
|
||||
LogUtil.print("工作时间内" + hour + ":" + minute);
|
||||
return true;
|
||||
} else {
|
||||
if (start_hour > end_hour) {
|
||||
if (currentTime >= start_hour || currentTime <= end_hour) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
LogUtil.print("工作时间外" + hour + ":" + minute);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定年月的第一天
|
||||
*
|
||||
* @param ym yyyy-MM
|
||||
* @return
|
||||
*/
|
||||
public static String getFirstDayOfMonth(String ym) {
|
||||
String arr[] = ym.split("-");
|
||||
|
||||
int year = Integer.parseInt(arr[0]);
|
||||
int month = Integer.parseInt(arr[1]);
|
||||
|
||||
Calendar cal = Calendar.getInstance();
|
||||
//设置年份
|
||||
cal.set(Calendar.YEAR, year);
|
||||
|
||||
//设置月份
|
||||
cal.set(Calendar.MONTH, month - 1);
|
||||
//获取某月最小天数
|
||||
int firstDay = cal.getMinimum(Calendar.DATE);
|
||||
//设置日历中月份的最小天数
|
||||
cal.set(Calendar.DAY_OF_MONTH, firstDay);
|
||||
//格式化日期
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
return sdf.format(cal.getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定年月的最后一天
|
||||
*
|
||||
* @param ym
|
||||
* @return
|
||||
*/
|
||||
public static String getLastDayOfMonth(String ym) {
|
||||
String arr[] = ym.split("-");
|
||||
|
||||
int year = Integer.parseInt(arr[0]);
|
||||
int month = Integer.parseInt(arr[1]);
|
||||
|
||||
Calendar cal = Calendar.getInstance();
|
||||
//设置年份
|
||||
cal.set(Calendar.YEAR, year);
|
||||
//设置月份
|
||||
cal.set(Calendar.MONTH, month - 1);
|
||||
//获取某月最大天数
|
||||
int lastDay = cal.getActualMaximum(Calendar.DATE);
|
||||
//设置日历中月份的最大天数
|
||||
cal.set(Calendar.DAY_OF_MONTH, lastDay);
|
||||
//格式化日期
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
return sdf.format(cal.getTime());
|
||||
}
|
||||
|
||||
public static class YEARS {
|
||||
public static long toMillis(long years) {
|
||||
return checkOverflow(years, DAYS_OF_YEAR * HOURS_OF_DAY * MINUTES_OF_HOUR * SECONDS_OF_MINUTE * MILLIS_OF_SECOND);
|
||||
@@ -609,311 +910,6 @@ public class TimeUtils {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将毫秒转换为年月日时分秒 ,只拿时分秒
|
||||
*
|
||||
* @author GaoHuanjie
|
||||
*/
|
||||
public static String getYearMonthDayHourMinuteSecond(long timeMillis) {
|
||||
int timezone = 8; // 时区
|
||||
long totalSeconds = timeMillis / 1000;
|
||||
totalSeconds += 60 * 60 * timezone;
|
||||
int second = (int) (totalSeconds % 60);// 秒
|
||||
long totalMinutes = totalSeconds / 60;
|
||||
int minute = (int) (totalMinutes % 60);// 分
|
||||
long totalHours = totalMinutes / 60;
|
||||
int hour = (int) (totalHours % 24);// 时
|
||||
int totalDays = (int) (totalHours / 24);
|
||||
int _year = 1970;
|
||||
int year = _year + totalDays / 366;
|
||||
int month = 1;
|
||||
int day = 1;
|
||||
int diffDays;
|
||||
boolean leapYear;
|
||||
while (true) {
|
||||
int diff = (year - _year) * 365;
|
||||
diff += (year - 1) / 4 - (_year - 1) / 4;
|
||||
diff -= ((year - 1) / 100 - (_year - 1) / 100);
|
||||
diff += (year - 1) / 400 - (_year - 1) / 400;
|
||||
diffDays = totalDays - diff;
|
||||
leapYear = (year % 4 == 0) && (year % 100 != 0) || (year % 400 == 0);
|
||||
if (!leapYear && diffDays < 365 || leapYear && diffDays < 366) {
|
||||
break;
|
||||
} else {
|
||||
year++;
|
||||
}
|
||||
}
|
||||
|
||||
int[] monthDays;
|
||||
if (diffDays >= 59 && leapYear) {
|
||||
monthDays = new int[]{-1, 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335};
|
||||
} else {
|
||||
monthDays = new int[]{-1, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};
|
||||
}
|
||||
for (int i = monthDays.length - 1; i >= 1; i--) {
|
||||
if (diffDays >= monthDays[i]) {
|
||||
month = i;
|
||||
day = diffDays - monthDays[i] + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
String hours;
|
||||
String minutes;
|
||||
String seconds;
|
||||
if (hour < 10) {
|
||||
hours = "0" + hour;
|
||||
} else {
|
||||
hours = "" + hour;
|
||||
}
|
||||
if (minute < 10) {
|
||||
minutes = "0" + minute;
|
||||
} else {
|
||||
minutes = "" + minute;
|
||||
}
|
||||
if (second < 10) {
|
||||
seconds = "0" + second;
|
||||
} else {
|
||||
seconds = "" + second;
|
||||
}
|
||||
|
||||
// return year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + second;
|
||||
return hours + ":" + minutes + ":" + seconds;
|
||||
}
|
||||
|
||||
public static Date getTimesnight(int i) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.set(Calendar.HOUR_OF_DAY, i);
|
||||
cal.set(Calendar.SECOND, 0);
|
||||
cal.set(Calendar.MINUTE, 0);
|
||||
cal.set(Calendar.MILLISECOND, 0);
|
||||
return cal.getTime();
|
||||
}
|
||||
|
||||
/*获得指定天数的0点和24点*/
|
||||
public static Date getTimesnights(Date time) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(time);
|
||||
cal.set(Calendar.HOUR_OF_DAY, 0);
|
||||
cal.set(Calendar.SECOND, 0);
|
||||
cal.set(Calendar.MINUTE, 0);
|
||||
cal.set(Calendar.MILLISECOND, 0);
|
||||
return cal.getTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* 将时间戳ms 转成星座
|
||||
* 白羊:0321~0420 天秤:0924~1023
|
||||
* 金牛:0421~0521 天蝎:1024~1122
|
||||
* 双子:0522~0621 射手:1123~1221
|
||||
* 巨蟹:0622~0722 摩羯:1222~0120
|
||||
* 狮子:0723~0823 水瓶:0121~0219
|
||||
* 处女:0824~0923 双鱼:0220~0320
|
||||
*/
|
||||
public static String msToConstellation(long ms) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(ms);
|
||||
int month = calendar.get(Calendar.MONTH) + 1;
|
||||
int day = calendar.get(Calendar.DAY_OF_MONTH);
|
||||
Log.e("mouse_debug", month + ", " + day);
|
||||
String xingzuo = "";
|
||||
switch (month) {
|
||||
case 1:
|
||||
xingzuo = day < 21 ? "摩羯座" : "水瓶座";
|
||||
break;
|
||||
case 2:
|
||||
xingzuo = day < 20 ? "水瓶座" : "双鱼座";
|
||||
break;
|
||||
case 3:
|
||||
xingzuo = day < 21 ? "双鱼座" : "白羊座";
|
||||
break;
|
||||
case 4:
|
||||
xingzuo = day < 21 ? "白羊座" : "金牛座";
|
||||
break;
|
||||
case 5:
|
||||
xingzuo = day < 22 ? "金牛座" : "双子座";
|
||||
break;
|
||||
case 6:
|
||||
xingzuo = day < 22 ? "双子座" : "巨蟹座";
|
||||
break;
|
||||
case 7:
|
||||
xingzuo = day < 23 ? "巨蟹座" : "狮子座";
|
||||
break;
|
||||
case 8:
|
||||
xingzuo = day < 24 ? "狮子座" : "处女座";
|
||||
break;
|
||||
case 9:
|
||||
xingzuo = day < 24 ? "处女座" : "天秤座";
|
||||
break;
|
||||
case 10:
|
||||
xingzuo = day < 24 ? "天秤座" : "天蝎座";
|
||||
break;
|
||||
case 11:
|
||||
xingzuo = day < 23 ? "天蝎座" : "射手座";
|
||||
break;
|
||||
case 12:
|
||||
xingzuo = day < 22 ? "射手座" : "摩羯座";
|
||||
break;
|
||||
}
|
||||
return xingzuo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是不是 第二天
|
||||
*
|
||||
* @param cacheTime 和 当前时间对比,判断现在是不是第二天了
|
||||
* @return
|
||||
*/
|
||||
public static boolean isTomorrow(long cacheTime) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
int currYear = calendar.get(Calendar.YEAR);
|
||||
int currMonth = calendar.get(Calendar.MONTH);
|
||||
int currDayOfMonth = calendar.get(Calendar.DAY_OF_MONTH);
|
||||
calendar.setTimeInMillis(cacheTime);
|
||||
int cacheYear = calendar.get(Calendar.YEAR);
|
||||
int cacheMonth = calendar.get(Calendar.MONTH);
|
||||
int cacheDayOfMonth = calendar.get(Calendar.DAY_OF_MONTH);
|
||||
if (currYear > cacheYear) {
|
||||
return true;
|
||||
}
|
||||
boolean equalYear = currYear == cacheYear;
|
||||
if (equalYear && currMonth > cacheMonth) {
|
||||
return true;
|
||||
}
|
||||
return equalYear && currMonth == cacheMonth && currDayOfMonth > cacheDayOfMonth;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param cacheTime 和 当前时间对比,判断现在是不是当天
|
||||
* @return -
|
||||
*/
|
||||
public static boolean isToday(long cacheTime) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
int currYear = calendar.get(Calendar.YEAR);
|
||||
int currMonth = calendar.get(Calendar.MONTH);
|
||||
int currDayOfMonth = calendar.get(Calendar.DAY_OF_MONTH);
|
||||
calendar.setTimeInMillis(cacheTime);
|
||||
int cacheYear = calendar.get(Calendar.YEAR);
|
||||
int cacheMonth = calendar.get(Calendar.MONTH);
|
||||
int cacheDayOfMonth = calendar.get(Calendar.DAY_OF_MONTH);
|
||||
return currYear == cacheYear && currMonth == cacheMonth && currDayOfMonth == cacheDayOfMonth;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param cacheTime 和 当前时间对比,是不是同一年
|
||||
* @return -
|
||||
*/
|
||||
public static boolean isSameYear(long cacheTime) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
int currYear = calendar.get(Calendar.YEAR);
|
||||
calendar.setTimeInMillis(cacheTime);
|
||||
int cacheYear = calendar.get(Calendar.YEAR);
|
||||
return currYear == cacheYear;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获得系统时间 年、月、日、小时、分钟
|
||||
* @return HashMap
|
||||
*/
|
||||
public static int getTime24(){
|
||||
SimpleDateFormat hh = new SimpleDateFormat("HH", Locale.CHINA);
|
||||
SimpleDateFormat mm = new SimpleDateFormat("mm", Locale.CHINA);
|
||||
hh.setTimeZone(TimeZone.getTimeZone("GMT+08")); // 获取指定时区的时间
|
||||
mm.setTimeZone(TimeZone.getTimeZone("GMT+08"));
|
||||
Date date = new Date();
|
||||
String hour = hh.format(date);
|
||||
String minute = mm.format(date);
|
||||
return Integer.parseInt(hour +minute);
|
||||
}
|
||||
|
||||
public static boolean getTimeLimit(int start_hour,int end_hour) {
|
||||
SimpleDateFormat hh = new SimpleDateFormat("HH", Locale.CHINA);
|
||||
SimpleDateFormat mm = new SimpleDateFormat("mm", Locale.CHINA);
|
||||
hh.setTimeZone(TimeZone.getTimeZone("GMT+08")); // 获取指定时区的时间
|
||||
mm.setTimeZone(TimeZone.getTimeZone("GMT+08"));
|
||||
Date date = new Date();
|
||||
String hour = hh.format(date);
|
||||
String minute = mm.format(date);
|
||||
Log.i("stf", "--hour:minute-->" + hour + ":" + minute);
|
||||
int currentTime = Integer.parseInt(hour +minute);
|
||||
LogUtil.print("start" +start_hour);
|
||||
LogUtil.print("end" +end_hour);
|
||||
LogUtil.print("minuteOfDay" +currentTime);
|
||||
if (currentTime >= start_hour && currentTime <= end_hour) {
|
||||
LogUtil.print("工作时间内" + hour + ":" + minute);
|
||||
return true;
|
||||
} else {
|
||||
if (start_hour > end_hour){
|
||||
if (currentTime >= start_hour || currentTime <= end_hour){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
LogUtil.print( "工作时间外" + hour + ":" + minute);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定年月的第一天
|
||||
* @param ym yyyy-MM
|
||||
* @return
|
||||
*/
|
||||
public static String getFirstDayOfMonth(String ym) {
|
||||
String arr[] = ym.split("-");
|
||||
|
||||
int year = Integer.parseInt(arr[0]);
|
||||
int month = Integer.parseInt(arr[1]);
|
||||
|
||||
Calendar cal = Calendar.getInstance();
|
||||
//设置年份
|
||||
cal.set(Calendar.YEAR, year);
|
||||
|
||||
//设置月份
|
||||
cal.set(Calendar.MONTH, month - 1);
|
||||
//获取某月最小天数
|
||||
int firstDay = cal.getMinimum(Calendar.DATE);
|
||||
//设置日历中月份的最小天数
|
||||
cal.set(Calendar.DAY_OF_MONTH, firstDay);
|
||||
//格式化日期
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
return sdf.format(cal.getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定年月的最后一天
|
||||
* @param ym
|
||||
* @return
|
||||
*/
|
||||
public static String getLastDayOfMonth(String ym) {
|
||||
String arr[] = ym.split("-");
|
||||
|
||||
int year = Integer.parseInt(arr[0]);
|
||||
int month = Integer.parseInt(arr[1]);
|
||||
|
||||
Calendar cal = Calendar.getInstance();
|
||||
//设置年份
|
||||
cal.set(Calendar.YEAR, year);
|
||||
//设置月份
|
||||
cal.set(Calendar.MONTH, month - 1);
|
||||
//获取某月最大天数
|
||||
int lastDay = cal.getActualMaximum(Calendar.DATE);
|
||||
//设置日历中月份的最大天数
|
||||
cal.set(Calendar.DAY_OF_MONTH, lastDay);
|
||||
//格式化日期
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
return sdf.format(cal.getTime());
|
||||
}
|
||||
|
||||
|
||||
|
||||
// public static boolean getTimeLimit() {
|
||||
// SimpleDateFormat hh = new SimpleDateFormat("HH", Locale.CHINA);
|
||||
|
Reference in New Issue
Block a user