This commit is contained in:
18142669586
2024-02-23 16:07:50 +08:00
commit a02f7b2e22
5737 changed files with 438436 additions and 0 deletions

View File

@@ -0,0 +1,96 @@
{
"agcgw":{
"backurl":"connect-drcn.hispace.hicloud.com",
"url":"connect-drcn.dbankcloud.cn",
"websocketbackurl":"connect-ws-drcn.hispace.dbankcloud.com",
"websocketurl":"connect-ws-drcn.hispace.dbankcloud.cn"
},
"agcgw_all":{
"CN":"connect-drcn.dbankcloud.cn",
"CN_back":"connect-drcn.hispace.hicloud.com",
"DE":"connect-dre.dbankcloud.cn",
"DE_back":"connect-dre.hispace.hicloud.com",
"RU":"connect-drru.hispace.dbankcloud.ru",
"RU_back":"connect-drru.hispace.dbankcloud.cn",
"SG":"connect-dra.dbankcloud.cn",
"SG_back":"connect-dra.hispace.hicloud.com"
},
"websocketgw_all":{
"CN":"connect-ws-drcn.hispace.dbankcloud.cn",
"CN_back":"connect-ws-drcn.hispace.dbankcloud.com",
"DE":"connect-ws-dre.hispace.dbankcloud.cn",
"DE_back":"connect-ws-dre.hispace.dbankcloud.com",
"RU":"connect-ws-drru.hispace.dbankcloud.ru",
"RU_back":"connect-ws-drru.hispace.dbankcloud.cn",
"SG":"connect-ws-dra.hispace.dbankcloud.cn",
"SG_back":"connect-ws-dra.hispace.dbankcloud.com"
},
"client":{
"cp_id":"30852000032486141",
"product_id":"388421841221767494",
"client_id":"1283893262452580800",
"client_secret":"17BC070420691D35650C694230D6348075CB549F7BBA94EDD49FA9E61A9E5434",
"project_id":"388421841221767494",
"app_id":"109612651",
"api_key":"DAEDAAlBbTFuTuyQWQsyYBZLuyjALH9Y9BNFkVZl1GhI0tRaa6HF1LgzXWy2MZiSFrmpbn1aAvcvzP6aKZtR6MVikS8V4SbBlYUPfQ==",
"package_name":"com.pandoralive.shayu"
},
"oauth_client":{
"client_id":"109612651",
"client_type":1
},
"app_info":{
"app_id":"109612651",
"package_name":"com.pandoralive.shayu"
},
"service":{
"analytics":{
"collector_url":"datacollector-drcn.dt.hicloud.com,datacollector-drcn.dt.dbankcloud.cn",
"collector_url_ru":"datacollector-drru.dt.dbankcloud.ru,datacollector-drru.dt.hicloud.com",
"collector_url_sg":"datacollector-dra.dt.hicloud.com,datacollector-dra.dt.dbankcloud.cn",
"collector_url_de":"datacollector-dre.dt.hicloud.com,datacollector-dre.dt.dbankcloud.cn",
"collector_url_cn":"datacollector-drcn.dt.hicloud.com,datacollector-drcn.dt.dbankcloud.cn",
"resource_id":"p1",
"channel_id":""
},
"edukit":{
"edu_url":"edukit.cloud.huawei.com.cn",
"dh_url":"edukit.cloud.huawei.com.cn"
},
"search":{
"url":"https://search-drcn.cloud.huawei.com"
},
"cloudstorage":{
"storage_url_sg_back":"https://agc-storage-dra.cloud.huawei.asia",
"storage_url_ru_back":"https://agc-storage-drru.cloud.huawei.ru",
"storage_url_ru":"https://agc-storage-drru.cloud.huawei.ru",
"storage_url_de_back":"https://agc-storage-dre.cloud.huawei.eu",
"storage_url_de":"https://ops-dre.agcstorage.link",
"storage_url":"https://agc-storage-drcn.platform.dbankcloud.cn",
"storage_url_sg":"https://ops-dra.agcstorage.link",
"storage_url_cn_back":"https://agc-storage-drcn.cloud.huawei.com.cn",
"storage_url_cn":"https://agc-storage-drcn.platform.dbankcloud.cn"
},
"ml":{
"mlservice_url":"ml-api-drcn.ai.dbankcloud.com,ml-api-drcn.ai.dbankcloud.cn"
}
},
"region":"CN",
"configuration_version":"3.0",
"appInfos":[
{
"package_name":"com.pandoralive.shayu",
"client":{
"app_id":"109612651"
},
"app_info":{
"package_name":"com.pandoralive.shayu",
"app_id":"109612651"
},
"oauth_client":{
"client_type":1,
"client_id":"109612651"
}
}
]
}

297
app/build.gradle Normal file
View File

@@ -0,0 +1,297 @@
apply plugin: 'com.android.application'
apply plugin: 'img-optimizer'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'com.alibaba.arouter'
android {
dexOptions {
jumboMode = true
}
project.tasks.getByName("tasks").doFirst {
}
/* applicationVariants.all { variant ->
variant.mergeAssetsProvider.configure {
doLast {
delete(fileTree(dir: outputDir, includes: [
'model/ai_bgseg_green.bundle',
'model/ai_face_processor.bundle',
'model/ai_face_processor_lite.bundle',
'model/ai_hairseg.bundle',
'model/ai_hand_processor.bundle',
'model/ai_human_processor.bundle',
'model/ai_human_processor_gpu.bundle',
'model/ai_human_processor_mb_fast.bundle',
'graphics/body_slim.bundle',
'graphics/controller_cpp.bundle',
'graphics/face_beautification.bundle',
'graphics/face_makeup.bundle',
'graphics/fuzzytoonfilter.bundle',
'graphics/fxaa.bundle',
'graphics/tongue.bundle'
]))
}
}
}*/
compileSdkVersion rootProject.ext.android.compileSdkVersion
buildToolsVersion rootProject.ext.android.buildToolsVersion
packagingOptions {
pickFirst "lib/armeabi/libyuvutils.so"
pickFirst "lib/arm64-v8a/libyuvutils.so"
pickFirst "lib/armeabi-v7a/libyuvutils.so"
pickFirst "lib/armeabi/libyuvtools.so"
pickFirst "lib/arm64-v8a/libyuvtools.so"
pickFirst "lib/armeabi-v7a/libyuvtools.so"
exclude "lib/arm64-v8a/libmmcv_api_handgesture.so"
exclude "lib/arm64-v8a/libmmcv_api_express.so"
exclude "lib/arm64-v8a/libMediaEncoder.so"
exclude "lib/arm64-v8a/libarcore_sdk_c.so"
exclude "lib/arm64-v8a/libmediadecoder.so"
exclude "lib/arm64-v8a/libMediaMuxer.so"
exclude "lib/arm64-v8a/libarcore_sdk_jni.so"
exclude "lib/arm64-v8a/libMediaUtils.so"
exclude "lib/arm64-v8a/libcosmosffmpeg.so"
//旧美颜so
exclude 'lib/arm64-v8a/libxeengine.so'
exclude 'lib/arm64-v8a/libmmcv_base.so'
exclude 'lib/arm64-v8a/libmmcrypto.so'
exclude 'lib/arm64-v8a/libMNN.so'
exclude 'lib/arm64-v8a/libc++_shared.so'
exclude 'lib/arm64-v8a/libmmcv_api_base.so'
exclude 'lib/arm64-v8a/libmmcv_api_beauty.so'
exclude 'lib/arm64-v8a/libmmcv_api_bodylandmark.so'
exclude 'lib/arm64-v8a/libmmcv_api_express.so'
exclude 'lib/arm64-v8a/libmmcv_api_faceattributes.so'
exclude 'lib/arm64-v8a/libmmcv_api_facefeatures.so'
exclude 'lib/arm64-v8a/libmmcv_api_faceprocessor.so'
exclude 'lib/arm64-v8a/libmmcv_api_facerecognition.so'
exclude 'lib/arm64-v8a/libmmcv_api_handgesture.so'
exclude 'lib/arm64-v8a/libmmcv_api_imagequality.so'
exclude 'lib/arm64-v8a/libmmcv_api_objectdetect.so'
exclude 'lib/arm64-v8a/libmmcv_api_segmentation.so'
exclude 'lib/arm64-v8a/libmmcv_api_videoprocessor.so'
exclude 'lib/arm64-v8a/libmmlic.so'
exclude 'lib/arm64-v8a/libMNN_CL.so'
exclude 'lib/arm64-v8a/libMNN_Express.so'
exclude 'lib/armeabi-v7a/libxeengine.so'
exclude 'lib/armeabi-v7a/libmmcv_base.so'
exclude 'lib/armeabi-v7a/libmmcrypto.so'
exclude 'lib/armeabi-v7a/libMNN.so'
exclude 'lib/armeabi-v7a/libc++_shared.so'
exclude 'lib/armeabi-v7a/libmmcv_api_base.so'
exclude 'lib/armeabi-v7a/libmmcv_api_beauty.so'
exclude 'lib/armeabi-v7a/libmmcv_api_bodylandmark.so'
exclude 'lib/armeabi-v7a/libmmcv_api_express.so'
exclude 'lib/armeabi-v7a/libmmcv_api_faceattributes.so'
exclude 'lib/armeabi-v7a/libmmcv_api_facefeatures.so'
exclude 'lib/armeabi-v7a/libmmcv_api_faceprocessor.so'
exclude 'lib/armeabi-v7a/libmmcv_api_facerecognition.so'
exclude 'lib/armeabi-v7a/libmmcv_api_handgesture.so'
exclude 'lib/armeabi-v7a/libmmcv_api_imagequality.so'
exclude 'lib/armeabi-v7a/libmmcv_api_objectdetect.so'
exclude 'lib/armeabi-v7a/libmmcv_api_segmentation.so'
exclude 'lib/armeabi-v7a/libmmcv_api_videoprocessor.so'
exclude 'lib/armeabi-v7a/libmmlic.so'
exclude 'lib/armeabi-v7a/libMNN_CL.so'
exclude 'lib/armeabi-v7a/libMNN_Express.so'
//美颜
if (rootProject.ext.manifestPlaceholders.isPluginModel) {
exclude 'lib/armeabi-v7a/libCNamaSDK.so'
exclude 'lib/arm64-v8a/libCNamaSDK.so'
exclude 'lib/armeabi-v7a/libfuai.so'
exclude 'lib/arm64-v8a/libfuai.so'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
applicationVariants.all { variant ->
println "清空build文件夹";
for (final def project in rootProject.getAllprojects()) {
delete project.buildDir
println project.buildDir
}
String variantName = variant.name.capitalize()
def processManifestTask = project.tasks.getByName("process${variantName}Manifest")
processManifestTask.doLast { pm ->
String manifestPath = "build/intermediates/bundle_manifest/release/bundle-manifest/AndroidManifest.xml"
def isGooglePlay = rootProject.ext.manifestPlaceholders.isGooglePlay
if (file(manifestPath).exists() && isGooglePlay) {
def manifestContent = file(manifestPath).getText()
manifestContent = manifestContent.replace('<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />', '')
file(manifestPath).write(manifestContent)
} else {
print "not Exists = " + manifestPath
}
}
variant.mergeAssetsProvider.configure {
doLast {
delete(fileTree(dir: outputDir, includes: ['model/ai_bgseg_green.bundle',
'model/ai_face_processor.bundle',
//'model/ai_face_processor_lite.bundle',
'model/ai_hairseg.bundle',
'model/ai_hand_processor.bundle',
'model/ai_human_processor.bundle',
'model/ai_human_processor_gpu.bundle',
'model/ai_human_processor_mb_fast.bundle',
'graphics/body_slim.bundle',
'graphics/controller_cpp.bundle',
//'graphics/face_beautification.bundle',
'graphics/face_makeup.bundle',
'graphics/fuzzytoonfilter.bundle',
'graphics/fxaa.bundle',
'graphics/tongue.bundle',
//旧美颜
'model-all.zip',
'filterData.zip',
'KSYResource/*',
'Resources/*',
'Asset/*',
'image_effect_shaders/*',
'internal/*'
//美颜基础组件
]))
println "isPluginModel = " + rootProject.ext.manifestPlaceholders.isPluginModel
if (rootProject.ext.manifestPlaceholders.isPluginModel) {
delete(fileTree(dir: outputDir, includes: ['model/ai_face_processor_lite.bundle',
'graphics/face_beautification.bundle']))
} else {
println "不删除bundle"
}
}
}
variant.outputs.all {
def isGoogle = "链接"
if (rootProject.ext.manifestPlaceholders.isGooglePlay == 1) {
isGoogle = "谷歌"
} else if (rootProject.ext.manifestPlaceholders.isGooglePlay == 2) {
isGoogle = "Huawei"
}else if (rootProject.ext.manifestPlaceholders.isGooglePlay == 3) {
isGoogle = "Samsung"
}
def isPlugin = "完整"
if (rootProject.ext.manifestPlaceholders.isPluginModel) {
isPlugin = "插件"
}
def isTest = "测试服"
if (rootProject.ext.manifestPlaceholders.serverHost == "https://napi.yaoulive.com") {
isTest = "正式服"
}
outputFileName = "[${new Date().format("yyyy-MM-dd", TimeZone.getTimeZone("GMT+8"))}]PDLive-${defaultConfig.versionName}-${isGoogle}-${isPlugin}-${variant.buildType.name}-${isTest}.apk"
}
}
signingConfigs {
release {
keyAlias 'phonelive'
keyPassword 'phonelive'
storeFile file('../hdl.jks')
storePassword 'phonelive'
}
//陌陌本地配置需要
config {//TODO BEAUTYSDK 这里需要配置keystore相关信息
keyAlias 'phonelive'
keyPassword 'phonelive'
storeFile file('../hdl.jks')//keystore的存放路径
storePassword 'phonelive'
v2SigningEnabled true // android 5.0-8.0必须用V2否则会有安全问题
v1SigningEnabled true
}
}
aaptOptions {
cruncherEnabled = false
useNewCruncher = false
}
packagingOptions {//加上这写代码 为了mob兼容性androidx
// pickFirst 'META-INF/*'
}
defaultConfig {
// applicationId "myname.pdlive.shayu"
applicationId "com.pandoralive.shayu"
minSdkVersion rootProject.ext.android.minSdkVersion
//版本在这里修改
targetSdkVersion rootProject.ext.android.targetSdkVersion
versionCode rootProject.ext.android.versionCode
versionName rootProject.ext.android.versionName
manifestPlaceholders = rootProject.ext.manifestPlaceholders
multiDexEnabled true
ndk {
// TODO: 谷歌商城需要兼容两个平台
abiFilters "armeabi-v7a", "arm64-v8a"
}
javaCompileOptions {
annotationProcessorOptions {
arguments = [AROUTER_MODULE_NAME: project.getName()]
}
}
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
zipAlignEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
debug {
minifyEnabled false
shrinkResources false
zipAlignEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
}
repositories {
flatDir {
dirs 'libs', '../libs'
}
}
dependencies {
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
//implementation platform('com.google.firebase:firebase-bom:30.5.0')
//implementation 'com.google.firebase:firebase-crashlytics'
//直播
api project(':main')
//短视频
api project(':video')
annotationProcessor rootProject.ext.dependencies["arouter-compiler"]
// implementation rootProject.ext.dependencies["leakcanary"]
//debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.10'
}
// 链接包需要注释掉 否正无法更新 谷歌包需要打开
/*
project.afterEvaluate {
android.applicationVariants.all { variant ->
variant.outputs.each { output ->
output.processResources.doFirst { pm->
String manifestPath = output.processResources.manifestFile;
def manifestContent = file(manifestPath).getText()
manifestContent = manifestContent.replace('android.permission.REQUEST_INSTALL_PACKAGES', '')
file(manifestPath).write(manifestContent)
}
}
}
}*/

70
app/google-services.json Normal file
View File

@@ -0,0 +1,70 @@
{
"project_info": {
"project_number": "292494634914",
"project_id": "pdlive-1631521064967",
"storage_bucket": "pdlive-1631521064967.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:292494634914:android:d8db197d7e7a6c3a3a4cfb",
"android_client_info": {
"package_name": "com.pandoralive.shayu"
}
},
"oauth_client": [
{
"client_id": "292494634914-8nuhhoeo061ki1jevbcsrl7dfdl6dlm0.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.pandoralive.shayu",
"certificate_hash": "38cc19306c9facee36a9224e9a4070bc0be15c7d"
}
},
{
"client_id": "292494634914-ctr3fptp5mkv2qqr4gkgjo9uluq2joqb.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.pandoralive.shayu",
"certificate_hash": "15fc5e70cf238323bf7111c8c627803985478e87"
}
},
{
"client_id": "292494634914-ejtqvaj86a2lldv0di2pr3d5gngprahd.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.pandoralive.shayu",
"certificate_hash": "b66dc8d21cfcf6c729577ddcf0c312b2a31ed872"
}
},
{
"client_id": "292494634914-ha2kbgtclkv20hl3a1l8r7861a1a0m5i.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyDVnuGnQzjI_vDrxh20Hv_S1OMUD7Vp3zU"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "292494634914-ha2kbgtclkv20hl3a1l8r7861a1a0m5i.apps.googleusercontent.com",
"client_type": 3
},
{
"client_id": "292494634914-v9j4rei86q2pfh9as4seotb23vr2744a.apps.googleusercontent.com",
"client_type": 2,
"ios_info": {
"bundle_id": "com.live.pd"
}
}
]
}
}
}
],
"configuration_version": "1"
}

20
app/img_optimizer.log Normal file
View File

@@ -0,0 +1,20 @@
2019-11-01 13:58:25 info: Task optimizeAppRelease begin:
----------------------------------------
2019-11-01 13:58:25 info: 6 images need to be optimized.
----------------------------------------
2019-11-01 13:58:25 info: Succeed! 21139B-->2066B, 90.22659% saved! /Users/yaling/Documents/bayue/denglong_release4/app/src/main/res/mipmap-mdpi/ic_launcher.png
----------------------------------------
2019-11-01 13:58:25 info: Succeed! 22015B-->2465B, 88.803085% saved! /Users/yaling/Documents/bayue/denglong_release4/app/src/main/res/mipmap-hdpi/ic_launcher.png
----------------------------------------
2019-11-01 13:58:25 info: Succeed! 115988B-->13798B, 88.10394% saved! /Users/yaling/Documents/bayue/denglong_release4/app/src/main/res/mipmap-xxxhdpi/screen.png
----------------------------------------
2019-11-01 13:58:25 info: Succeed! 37339B-->8295B, 77.78462% saved! /Users/yaling/Documents/bayue/denglong_release4/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
----------------------------------------
2019-11-01 13:58:25 info: Succeed! 26351B-->4102B, 84.43323% saved! /Users/yaling/Documents/bayue/denglong_release4/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
----------------------------------------
2019-11-01 13:58:25 info: Succeed! 24070B-->3315B, 86.22767% saved! /Users/yaling/Documents/bayue/denglong_release4/app/src/main/res/mipmap-xhdpi/ic_launcher.png
----------------------------------------
2019-11-01 13:58:25 info: Total: 6, Succeed: 6, Skipped: 0, Failed: 0, Saved: 207.8720703125KB
----------------------------------------
2019-11-01 13:58:25 info: Task optimizeAppRelease executed successfully.
----------------------------------------

294
app/proguard-rules.pro vendored Normal file
View File

@@ -0,0 +1,294 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/macpro/Library/Android/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
-keepclassmembers class fqcn.of.javascript.interface.for.webview {
public *;
}
# Uncomment this to preserve the groupLast number information for
# debugging stack traces.
-keepattributes SourceFile,LineNumberTable
# If you keep the groupLast number information, uncomment this to
# hide the original source file name.
-renamesourcefileattribute SourceFile
-keep class com.yunbao.**{
public <methods>;
protected <methods>;
}
-keep class * implements com.yunbao.common.bean.BaseModel {
*;
}
-keep class com.yunbao.common.bean.** {
*;
}
-keep class com.yunbao.common.views.weight.VerticalViewPager$LayoutParams{
*;
}
-keep class android.**{
*;
}
-keep class **.R$* {
public static <fields>;
}
-keep class com.tencent.** { *; }
-keep class com.adjust.sdk.**{ *; }
-keep class com.google.android.gms.common.ConnectionResult {
int SUCCESS;
}
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient {
com.google.android.gms.ads.identifier.AdvertisingIdClient$Info getAdvertisingIdInfo(android.content.Context);
}
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info {
java.lang.String getId();
boolean isLimitAdTrackingEnabled();
}
-keep public class com.android.installreferrer.**{ *; }
-keep class * implements android.os.Parcelable.**{*;}
-keep class * implements android.os.Serializable.**{*;}
-dontwarn javax.annotation.**
-dontwarn javax.inject.**
# OkHttp3
-dontwarn okhttp3.logging.**
-keep class okhttp3.internal.**{*;}
-dontwarn okio.**
#okhttp
-dontwarn okhttp3.**
-keep class okhttp3.**{*;}
#okio
-dontwarn okio.**
-keep class okio.**{*;}
# Retrofit
-dontwarn retrofit2.**
-keep class retrofit2.** { *; }
-keepattributes Signature-keepattributes,Exceptions
# RxJava RxAndroid
-dontwarn java.util.concurrent.Flow*
-dontwarn sun.misc.**
-keepclassmembers class rx.internal.util.unsafe.*ArrayQueue*Field* {
long producerIndex;
long consumerIndex;
}
-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueProducerNodeRef* {
rx.internal.util.atomic.LinkedQueueNode* producerNode;
}
-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueConsumerNodeRef* {
rx.internal.util.atomic.LinkedQueueNode* consumerNode;
}
# Gson
-keep class com.google.gson.stream.** { *; }
##---------------Begin: proguard configuration for Gson ----------
# Gson uses generic type information stored in a class file when working with fields. Proguard
# removes such information by default, so configure it to keep all of it.
-keepattributes Signature
# For using GSON @Expose annotation
-keepattributes *Annotation*
# Gson specific classes
-dontwarn sun.misc.**
#-keep class com.google.gson.stream.** { *; }
# Application classes that will be serialized/deserialized over Gson
-keep class com.google.gson.examples.android.model.** { <fields>; }
# Prevent proguard from stripping interface information from TypeAdapter, TypeAdapterFactory,
# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)
-keep class * extends com.google.gson.TypeAdapter
-keep class * implements com.google.gson.TypeAdapterFactory
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer
# Prevent R8 from leaving Data object members always null
-keepclassmembers,allowobfuscation class * {
@com.google.gson.annotations.SerializedName <fields>;
}
# Retain generic signatures of TypeToken and its subclasses with R8 version 3.0 and higher.
-keep,allowobfuscation,allowshrinking class com.google.gson.reflect.TypeToken
-keep,allowobfuscation,allowshrinking class * extends com.google.gson.reflect.TypeToken
##---------------End: proguard configuration for Gson ----------
-keepattributes EnclosingMethod
#--------融云
-keepattributes Exceptions,InnerClasses
-keepattributes Signature
-keep class io.rong.** {*;}
-keep class cn.rongcloud.** {*;}
-keep class * implements io.rong.imlib.model.MessageContent {*;}
-dontwarn io.rong.push.**
-dontnote com.xiaomi.**
-dontnote com.google.android.gms.gcm.**
-dontnote io.rong.**
# 下方混淆使用了融云 IMKit 提供的 locationKit 位置插件时才需要配置,可参考高德官网的混淆方式:https://lbs.amap.com/api/android-sdk/guide/create-project/dev-attention
-keep class com.amap.api.maps.**{*;}
-keep class com.autonavi.**{*;}
-keep class com.amap.api.trace.**{*;}
-keep class com.amap.api.location.**{*;}
-keep class com.amap.api.fence.**{*;}
-keep class com.loc.**{*;}
-keep class com.autonavi.aps.amapapi.model.**{*;}
-keep class com.amap.api.services.**{*;}
-ignorewarnings
#--------科大讯飞
-keep class com.iflytek.**{*;}
-keepattributes Signature
#EvenBus
-keepattributes *Annotation*
-keepclassmembers class * {
@org.greenrobot.eventbus.Subscribe <methods>;
}
-keep enum org.greenrobot.eventbus.ThreadMode { *; }
# If using AsyncExecutord, keep required constructor of default event used.
# Adjust the class name if a custom failure event type is used.
-keepclassmembers class org.greenrobot.eventbus.util.ThrowableFailureEvent {
<init>(java.lang.Throwable);
}
# Accessed via reflection, avoid renaming or removal
-keep class org.greenrobot.eventbus.android.AndroidComponentsImpl*
#--------ARouter
-keep public class com.alibaba.android.arouter.routes.**{*;}
-keep public class com.alibaba.android.arouter.facade.**{*;}
-keep class * implements com.alibaba.android.arouter.facade.template.ISyringe{*;}
# If you use the byType method to obtain Service, add the following rules to protect the interface:
-keep interface * implements com.alibaba.android.arouter.facade.template.IProvider
# If single-type injection is used, that is, no interface is defined to implement IProvider, the following rules need to be added to protect the implementation
# -keep class * implements com.alibaba.android.arouter.facade.template.IProvider
#----retrofit2
-keepattributes Signature, InnerClasses, EnclosingMethod
-keepattributes RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations
-keepattributes AnnotationDefault
-keepclassmembers,allowshrinking,allowobfuscation interface * {
@retrofit2.http.* <methods>;
}
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement*
-dontwarn javax.annotation.**
-dontwarn kotlin.Unit
-dontwarn retrofit2.KotlinExtensions*
-dontwarn retrofit2.KotlinExtensions$*
-if interface * { @retrofit2.http.* <methods>; }
-keep,allowobfuscation interface <1>
-if interface * { @retrofit2.http.* <methods>; }
-keep,allowobfuscation interface * extends <1>
-keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation
-if interface * { @retrofit2.http.* public *** *(...); }
-keep,allowoptimization,allowshrinking,allowobfuscation class <3>
#-----glide
-keep public class com.bumptech.glide.** {*;}
-keep public class jp.co.cyberagent.** {*;}
-dontwarn jp.co.cyberagent.android.gpuimage.**
-printconfiguration tmp/full-r8-config.txt
#---美颜模块需要暴露出来的参数名
-keep class com.yunbao.faceunity.utils.FURenderer{
public static java.lang.String BUNDLE_AI_FACE;
}
-keep class com.yunbao.faceunity.utils.FaceUnityConfig{
public static java.lang.String BUNDLE_FACE_BEAUTIFICATION;
}
-keep class com.faceunity.wrapper.faceunity$LoadConfig*{
private static boolean sLoadedLibrary;
}
-keep class com.umeng.** {*;}
-keep class org.repackage.** {*;}
-keep class com.uyumao.** { *; }
-keepclassmembers class * {
public <init> (org.json.JSONObject);
}
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
#----svga
-keep class com.opensource.svgaplayer.**{
public <methods>;
public static <fields>;
}
# json序列化的混淆
-keep class tech.sud.mgp.hello.ui.scenes.ticket.model.** {*;}
-keep class tech.sud.mgp.hello.service.game.req.** {*;}
-keep class tech.sud.mgp.hello.service.game.resp.** {*;}
-keep class tech.sud.mgp.hello.service.login.req.** {*;}
-keep class tech.sud.mgp.hello.service.login.resp.** {*;}
-keep class tech.sud.mgp.hello.service.main.req.** {*;}
-keep class tech.sud.mgp.hello.service.main.resp.** {*;}
-keep class tech.sud.mgp.hello.service.main.config.** {*;}
-keep class tech.sud.mgp.hello.service.room.req.** {*;}
-keep class tech.sud.mgp.hello.service.room.resp.** {*;}
-keep class tech.sud.mgp.hello.service.room.model.** {*;}
-keep class tech.sud.mgp.hello.ui.main.home.model.** {*;}
-keep class tech.sud.mgp.hello.ui.scenes.base.model.** {*;}
-keep class tech.sud.mgp.hello.ui.scenes.common.cmd.** {*;}
-keep class tech.sud.mgp.hello.ui.scenes.custom.model.** {*;}
-keep class tech.sud.mgp.hello.ui.scenes.orderentertainment.model.** {*;}
-keep class tech.sud.mgp.hello.ui.main.settings.model.** {*;}
-keep class tech.sud.mgp.hello.ui.main.nft.model.** {*;}
-keep class tech.sud.mgp.hello.common.event.model.** {*;}
-keep class com.yunbao.common.sud.** {*;}
-ignorewarnings
-keepattributes *Annotation*
-keepattributes Exceptions
-keepattributes InnerClasses
-keepattributes Signature
-keepattributes SourceFile,LineNumberTable
-keep class com.huawei.hianalytics.**{*;}
-keep class com.huawei.updatesdk.**{*;}
-keep class com.huawei.hms.**{*;}
-keep class com.shayu.lib_google.**{*;}
-keep class com.shayu.lib_huawei.**{*;}

View File

@@ -0,0 +1,207 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="myname.pdlive.shayu">
<uses-permission
android:name="android.permission.CALL_PHONE"
tools:node="remove" />
<uses-permission
android:name="android.permission.CHANGE_CONFIGURATION"
tools:ignore="ProtectedPermissions" />
<uses-permission
android:name="android.permission.READ_LOGS"
tools:ignore="ProtectedPermissions"
tools:node="remove" />
<uses-permission
android:name="android.permission.READ_CALL_LOG"
tools:node="remove" />
<uses-permission
android:name="android.permission.WRITE_CALL_LOG"
tools:node="remove" />
<uses-permission
android:name="android.permission.READ_SMS"
tools:node="remove" />
<uses-permission
android:name="android.permission.SEND_SMS"
tools:node="remove" />
<uses-permission
android:name="android.permission.WRITE_SMS"
tools:node="remove" />
<uses-permission
android:name="android.permission.RECEIVE_SMS"
tools:node="remove" />
<uses-permission
android:name="android.permission.RECEIVE_WAP_PUSH"
tools:node="remove" />
<uses-permission
android:name="android.permission.RECEIVE_MMS"
tools:node="remove" />
<uses-permission
android:name="android.permission.SEND_MMS"
tools:node="remove" />
<uses-permission
android:name="android.permission.MODIFY_PHONE_STATE"
tools:ignore="ProtectedPermissions"
tools:node="remove" />
<uses-permission
android:name="android.permission.PROCESS_OUTGOING_CALLS"
tools:node="remove" />
<uses-permission
android:name="android.permission.MODIFY_AUDIO_SETTINGS"
tools:node="remove" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.NETWORK_PROVIDER" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission
android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"
tools:ignore="ProtectedPermissions" />
<uses-permission android:name="android.permission.GET_TASKS" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.REORDER_TASKS" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
<uses-permission
android:name="android.permission.WRITE_SETTINGS"
tools:ignore="ProtectedPermissions" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="com.android.vending.BILLING" />
<uses-permission android:name="com.samsung.android.iap.permission.BILLING"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<!-- Android11新增 -->
<!-- <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />-->
<!-- <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />-->
<uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY" />
<queries>
<package android:name="com.twitter.android" />
<package android:name="jp.naver.line.android" />
</queries>
<application
android:name="com.shayu.phonelive.AppContext"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:largeHeap="true"
android:preserveLegacyExternalStorage="true"
android:requestLegacyExternalStorage="true"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:replace="theme,label,icon,allowBackup">
<!-- <service-->
<!-- android:name="com.shayu.phonelive.utils.MyNotificationService">-->
<!-- <intent-filter>-->
<!-- <action android:name="com.google.firebase.MESSAGING_EVENT" />-->
<!-- </intent-filter>-->
<!-- </service>-->
<service
android:name="io.rong.push.platform.google.RongFirebaseMessagingService"
android:exported="false"
android:stopWithTask="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<activity
android:name="com.shayu.phonelive.activity.LauncherActivity"
android:exported="true"
android:screenOrientation="portrait"
tools:ignore="LockedOrientationActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="um.64e40ee55488fe7b3afa2c96" />
</intent-filter>
</activity>
<!-- 服务器地址 -->
<meta-data
android:name="SERVER_HOST"
android:value="${serverHost}" />
<meta-data
android:name="IS_GOOGLE_PLAY"
android:value="${isGooglePlay}" />
<meta-data
android:name="IS_UPLOAD_ERROR_LOG"
android:value="${isUploadLog}" />
<meta-data
android:name="IS_PLUGIN_MODEL"
android:value="${isPluginModel}" />
<meta-data
android:name="firebase_crashlytics_collection_enabled"
android:value="${isUploadLog}" />
<meta-data
android:name="com.openinstall.APP_KEY"
android:value="dnwyyj" />
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="@string/facebook_app_id" />
<meta-data
android:name="com.facebook.sdk.ClientToken"
android:value="@string/facebook_client_token" />
<meta-data
android:name="com.facebook.sdk.AutoLogAppEventsEnabled"
android:value="false" />
<meta-data
android:name="firebase_messaging_auto_init_enabled"
android:value="false" />
<meta-data
android:name="firebase_analytics_collection_enabled"
android:value="false" />
<receiver
android:name="com.shayu.phonelive.utils.CustomMessageReceiver"
android:exported="true">
<intent-filter>
<action android:name="io.rong.push.intent.MESSAGE_ARRIVED" />
<action android:name="io.rong.push.intent.MESSAGE_CLICKED" />
<action android:name="io.rong.push.intent.THIRD_PARTY_PUSH_STATE" />
</intent-filter>
</receiver>
<service
android:name="io.rong.push.platform.hms.HMSPushService"
android:exported="false">
<intent-filter>
<action android:name="com.huawei.push.action.MESSAGING_EVENT" />
</intent-filter>
</service>
<meta-data
android:name="com.huawei.hms.client.appid"
android:value="109612651" />
<meta-data
android:name="com.huawei.hms.client.cpid"
android:value="30852000032486141" />
</application>
</manifest>

View File

@@ -0,0 +1,367 @@
package com.shayu.phonelive;
import static com.yunbao.live.socket.SocketClient.mSocketHandler;
import android.app.Activity;
import android.app.ActivityManager;
import android.content.Context;
import android.net.http.HttpResponseCache;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.Process;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.alibaba.android.arouter.launcher.ARouter;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.blankj.utilcode.util.Utils;
import com.facebook.appevents.AppEventsLogger;
import com.fm.openinstall.OpenInstall;
import com.google.gson.Gson;
import com.shayu.phonelive.utils.LogUtils;
import com.tencent.imsdk.v2.V2TIMGroupMemberInfo;
import com.tencent.imsdk.v2.V2TIMManager;
import com.tencent.imsdk.v2.V2TIMSimpleMsgListener;
import com.tencent.imsdk.v2.V2TIMUserInfo;
import com.umeng.analytics.MobclickAgent;
import com.umeng.commonsdk.UMConfigure;
import com.yunbao.common.BuildConfig;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.CommonAppContext;
import com.yunbao.common.Constants;
import com.yunbao.common.bean.AnchorStartLiveBean;
import com.yunbao.common.bean.CrashSaveBean;
import com.yunbao.common.event.SudGameSocketImEvent;
import com.yunbao.common.manager.imrongcloud.InstructorSendReward;
import com.yunbao.common.manager.imrongcloud.InstructorSendRewardProvider;
import com.yunbao.common.manager.imrongcloud.MessageIMManager;
import com.yunbao.common.manager.imrongcloud.RecommendLiveRoom;
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
import com.yunbao.common.utils.AppManager;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.GoogleUtils;
import com.yunbao.common.utils.L;
import com.yunbao.common.utils.SpUtil;
import com.yunbao.live.socket.SocketReceiveBean;
import com.yunbao.live.socket.SocketRyClient;
import com.yunbao.live.utils.LiveImDeletUtil;
import com.yunbao.live.views.PortraitLiveManager;
import com.yunbao.live.views.RecommendLiveRoomProvider;
import com.yunbao.main.activity.MsgSettActivity;
import org.greenrobot.eventbus.EventBus;
import java.io.File;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import io.rong.imkit.config.RongConfigCenter;
import io.rong.imlib.RongIMClient;
import io.rong.imlib.model.Conversation;
import io.rong.imlib.model.MessageContent;
import io.rong.message.TextMessage;
//import cn.tillusory.sdk.TiSDK;
//import com.squareup.leakcanary.LeakCanary;
/**
* Created by cxf on 2017/8/3.
*/
public class AppContext extends CommonAppContext {
public static AppContext sInstance;
public LiveImDeletUtil liveImDeletUtil;
private final static List<WeakReference<Activity>> activities = new ArrayList<>();
private static final class AdjustLifecycleCallbacks implements ActivityLifecycleCallbacks {
@Override
public void onActivityResumed(Activity activity) {
}
@Override
public void onActivityPaused(Activity activity) {
}
@Override
public void onActivityStopped(@NonNull Activity activity) {
}
@Override
public void onActivitySaveInstanceState(@NonNull Activity activity, @NonNull Bundle outState) {
}
@Override
public void onActivityDestroyed(@NonNull Activity activity) {
for (WeakReference<Activity> reference : activities) {
if (reference.get() == activity) {
activities.remove(reference);
return;
}
}
AppManager.getInstance().removeActivity(activity);
}
@Override
public void onActivityCreated(@NonNull Activity activity, @Nullable Bundle savedInstanceState) {
activities.add(new WeakReference<>(activity));
CrashSaveBean.getInstance().setActivitySize(activities);
AppManager.getInstance().addActivity(activity);
}
@Override
public void onActivityStarted(@NonNull Activity activity) {
}
}
@Override
public void onCreate() {
super.onCreate();
if (!isMainProcess()) {
return;
}
CrashSaveBean.getInstance().setStartTime(System.currentTimeMillis());
//注册全局异常捕获
registerError();
registerFirebaseCrash();
LogUtils.start(this);
sInstance = this;
L.setDeBug(BuildConfig.DEBUG);
AppEventsLogger.activateApp(this);
File httpCacheDir = new File(getCacheDir(), "https");
try {
HttpResponseCache.install(httpCacheDir, 1024 * 1024 * 128);
} catch (IOException e) {
e.printStackTrace();
}
//初始化 ARouter
if (BuildConfig.DEBUG) {
ARouter.openLog();
ARouter.openDebug();
}
ARouter.init(this);
//初始化 邀请码库
if (isMainProcess()) {
OpenInstall.init(this);
}
//设置LOG开关默认为false
UMConfigure.setLogEnabled(true);
//友盟正式初始化
UMConfigure.init(getApplicationContext(), "64e40ee55488fe7b3afa2c96", "PDLive", UMConfigure.DEVICE_TYPE_PHONE, "64e40ee55488fe7b3afa2c96");
//集成umeng-crash-vx.x.x.aar则需要关闭原有统计SDK异常捕获功能
MobclickAgent.setCatchUncaughtExceptions(false);
//PushSDK初始化(如使用推送SDK必须调用此方法)
//统计SDK是否支持采集在子进程中打点的自定义事件默认不支持
UMConfigure.setProcessEvent(true);//支持多进程打点
MobclickAgent.setPageCollectionMode(MobclickAgent.PageMode.AUTO);
UMConfigure.submitPolicyGrantResult(getApplicationContext(), true);
registerActivityLifecycleCallbacks(new AdjustLifecycleCallbacks());
//初始化 AndroidUtilCode
Utils.init(this);
liveImDeletUtil = new LiveImDeletUtil();
//初始化融云
RongcloudIMManager.initRongIM(this);
ArrayList<Class<? extends MessageContent>> myMessages = new ArrayList<>();
myMessages.add(RecommendLiveRoom.class);
myMessages.add(InstructorSendReward.class);
RongIMClient.registerMessageType(myMessages);
// 注册自定义消息模板
RongConfigCenter.conversationConfig().addMessageProvider(new InstructorSendRewardProvider(getApplicationContext()));
RongConfigCenter.conversationConfig().addMessageProvider(new RecommendLiveRoomProvider(getApplicationContext()));
RongcloudIMManager.addRongcloudIMOnReceiveMessageListener(new RongIMClient.OnReceiveMessageWrapperListener() {
@Override
public boolean onReceived(io.rong.imlib.model.Message message, int i, boolean b, boolean b1) {
Log.e("wewe", message.getConversationType() + "112121");
MessageIMManager.get(sInstance).getSystemForRongcloud(message);
//融云直播间聊天
Message msg = Message.obtain();
msg.what = Constants.SOCKET_WHAT_BROADCAST;
try {
if (!"".equals(message.getContent()) && message.getContent() != null) {
TextMessage content = (TextMessage) message.getContent();
if (content.getContent().contains("_method_")) {
msg.obj = content.getContent();
//观众页面
if (SocketRyClient.mSocketHandler != null && (TextUtils.equals("__system__", message.getTargetId()) || ("g" + PortraitLiveManager.liveID).contains(message.getTargetId()))) {
SocketRyClient.mSocketHandler.sendMessage(msg);
} else if (content.getContent().contains("LivePK_anchorStartLiveNotify")) {//开播通知
SocketReceiveBean received = JSON.parseObject(content.getContent(), SocketReceiveBean.class);
JSONObject map = received.getMsg().getJSONObject(0);
sendStartAnchorLive(map);
} else if (message.getTargetId().contains("v")) {
String contentJson = ((TextMessage) message.getContent()).getContent();
Log.e("wewe", contentJson);
SudGameSocketImEvent sudGameSocketImEvent = new Gson().fromJson(contentJson, SudGameSocketImEvent.class);
Bus.get().post(sudGameSocketImEvent);
}
//主播页面
if (TextUtils.isEmpty(PortraitLiveManager.liveID) && SocketRyClient.mSocketHandler != null) {
SocketRyClient.mSocketHandler.sendMessage(msg);
}
} else if (message.getConversationType() == Conversation.ConversationType.PRIVATE) {//私聊信息
EventBus.getDefault().post(message);
}
}
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
private void sendStartAnchorLive(JSONObject map) {
AnchorStartLiveBean bean = new AnchorStartLiveBean();
bean.setAnchorName(map.getString("anchorName"));
bean.setRoomId(map.getString("roomid"));
bean.setAvatar(map.getString("avatar"));
EventBus.getDefault().post(bean);
}
});
//监听im消息
V2TIMManager.getInstance().addSimpleMsgListener(new V2TIMSimpleMsgListener() {
@Override
public void onRecvGroupTextMessage(String msgID, String groupID, V2TIMGroupMemberInfo sender, String text) {
super.onRecvGroupTextMessage(msgID, groupID, sender, text);
Log.e("asasas", text);
Message msg = Message.obtain();
msg.what = Constants.SOCKET_WHAT_BROADCAST;
msg.obj = text;
if (mSocketHandler != null && Ingroup == 1) {
mSocketHandler.sendMessage(msg);
}
}
@Override
public void onRecvC2CTextMessage(String msgID, V2TIMUserInfo sender, String text) {
super.onRecvC2CTextMessage(msgID, sender, text);
Message msg = Message.obtain();
msg.what = Constants.SOCKET_WHAT_BROADCAST;
msg.obj = text;
if (mSocketHandler != null) {
CommonAppContext.Ingroup = 1;
mSocketHandler.sendMessage(msg);
}
}
});
configSPApp();
//初始化美颜SDK
// FaceManager.initFaceUnity(this);
}
/**
* 配置SharedPreferences默认值
*/
private void configSPApp() {
if (!SpUtil.getInstance().isExists(MsgSettActivity.SWITCH_PRIVATE_CHAT_MSG)) {
SpUtil.getInstance().setBooleanValue(MsgSettActivity.SWITCH_PRIVATE_CHAT_MSG, true);
}
}
public boolean isMainProcess() {
int pid = android.os.Process.myPid();
ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
if (activityManager.getRunningAppProcesses() == null) {
return true;
}
for (ActivityManager.RunningAppProcessInfo appProcess : activityManager.getRunningAppProcesses()) {
if (appProcess.pid == pid) {
return getApplicationInfo().packageName.equals(appProcess.processName);
}
}
return false;
}
@Override
public void onTerminate() {
RongcloudIMManager.removeRongcloudIMOnReceiveMessageListener();
super.onTerminate();
}
/**
* 注册全局异常捕获有需要时可以在onCreate调用
*/
private void registerError() {
NeverCrashUtils.getInstance().setDebugMode(BuildConfig.DEBUG).setMainCrashHandler((t, e) -> {
Log.e("ApplicationError", "主线程异常");//此处log只是展示当debug为true时主类内部log会打印异常信息
e.printStackTrace();
AppManager.runDebugCode(() -> {
//闪退后finish所有Activity并且杀死进程
for (WeakReference<Activity> activity : activities) {
if (activity != null && activity.get() != null) {
activity.get().finish();
}
}
Process.killProcess(Process.myPid());
System.exit(0);
setFirebaseCrashData();
new Handler(Looper.getMainLooper()).postDelayed(() -> {
throw new RuntimeException(e);
}, 100);
});
}).setUncaughtCrashHandler((t, e) -> {
Log.e("ApplicationError", "子线程异常");//此处log只是展示当debug为true时主类内部log会打印异常信息
e.printStackTrace();
}).register(this);
}
public void registerFirebaseCrash() {
if (!CommonAppConfig.IS_UPLOAD_ERROR_LOG) {
return;
}
if (CommonAppConfig.IS_GOOGLE_PLAY != 2) {
GoogleUtils.newInstance(this).initializeApp(this);
}
}
public static void setFirebaseCrashData() {
if (!CommonAppConfig.IS_UPLOAD_ERROR_LOG) {
return;
}
String uid = CommonAppConfig.getInstance().getUid();
if (CommonAppConfig.IS_GOOGLE_PLAY != 2) {
GoogleUtils.newInstance(sInstance).setFirebaseCrashData(
uid,
SpUtil.getInstance().getStringValue(SpUtil.USER_INFO),
String.valueOf(CommonAppConfig.IS_GOOGLE_PLAY),
Arrays.toString(Build.SUPPORTED_ABIS),
String.valueOf(CrashSaveBean.getInstance().getStartTime()),
String.valueOf(CrashSaveBean.getInstance().getEnterRoom()),
String.valueOf(CrashSaveBean.getInstance().getSlidingRoom()),
String.valueOf(CrashSaveBean.getInstance().getPlaySvga()), CrashSaveBean.getInstance().getActivitySize());
}
}
}

View File

@@ -0,0 +1,160 @@
package com.shayu.phonelive;
import android.app.Application;
import android.content.Context;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import android.widget.Toast;
import com.yunbao.common.BuildConfig;
import com.yunbao.common.bean.CrashSaveBean;
import com.yunbao.common.utils.AppManager;
import com.yunbao.common.utils.FileUtil;
import com.yunbao.common.utils.SpUtil;
import com.yunbao.common.utils.ToastUtil;
import java.io.File;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Arrays;
/**
* @ClassName NeverCrashUtils
* @Description 全局捕获异常
*/
public class NeverCrashUtils {
private final static String TAG = NeverCrashUtils.class.getSimpleName();
private final static NeverCrashUtils INSTANCE = new NeverCrashUtils();
private boolean debugMode;
private MainCrashHandler mainCrashHandler;
private UncaughtCrashHandler uncaughtCrashHandler;
private NeverCrashUtils() {
}
public static NeverCrashUtils getInstance() {
return INSTANCE;
}
private synchronized MainCrashHandler getMainCrashHandler() {
if (null == mainCrashHandler) {
mainCrashHandler = (t, e) -> {
};
}
return mainCrashHandler;
}
/**
* 主线程发生异常时的回调,可用于打印日志文件
* <p>
* 注意跨线程操作的可能
*/
public NeverCrashUtils setMainCrashHandler(MainCrashHandler mainCrashHandler) {
this.mainCrashHandler = mainCrashHandler;
return this;
}
private synchronized UncaughtCrashHandler getUncaughtCrashHandler() {
if (null == uncaughtCrashHandler) {
uncaughtCrashHandler = (t, e) -> {
};
}
return uncaughtCrashHandler;
}
/**
* 子线程发生异常时的回调,可用于打印日志文件
* <p>
* 注意跨线程操作的可能
*/
public NeverCrashUtils setUncaughtCrashHandler(UncaughtCrashHandler uncaughtCrashHandler) {
this.uncaughtCrashHandler = uncaughtCrashHandler;
return this;
}
private boolean isDebugMode() {
return debugMode;
}
/**
* debug模式会打印log日志且toast提醒发生异常反之则都没有
*/
public NeverCrashUtils setDebugMode(boolean debugMode) {
this.debugMode = debugMode;
return this;
}
/**
* 完成监听异常的注册
*
* @param application application
*/
private boolean errorWhile = true;
public void register(Application application) {
//主线程异常拦截
new Handler(Looper.getMainLooper()).post(() -> {
while (errorWhile) {
try {
Looper.loop();
} catch (Throwable e) {
if (isDebugMode()) {
Log.e(TAG, "未捕获的主线程异常行为", e);
}
e.printStackTrace();
AppContext.setFirebaseCrashData();
AppManager.runDebugCode(() -> Toast.makeText(application, "发生闪退:" + e.getMessage(), Toast.LENGTH_SHORT).show());
FileUtil.saveStringToFile(new File(application.getDir("files", Context.MODE_PRIVATE).getAbsolutePath()), throwableToString(e), "error.log");
getMainCrashHandler().mainException(Looper.getMainLooper().getThread(), e);
AppManager.runDebugCode(() -> errorWhile = false);
// return;
}
}
});
/*
//子线程异常拦截
Thread.setDefaultUncaughtExceptionHandler((t, e) -> {
if (isDebugMode()) {
Log.e(TAG, "未捕获的子线程异常行为", e);
}
e.printStackTrace();
Toast.makeText(application, "发生闪退", Toast.LENGTH_SHORT).show();
FileUtil.saveStringToFile(new File(application.getDir("files", Context.MODE_PRIVATE).getAbsolutePath()),throwableToString(e),"error.log");
getMainCrashHandler().mainException(Looper.getMainLooper().getThread(), e);
getUncaughtCrashHandler().uncaughtException(t, e);
});*/
}
public interface MainCrashHandler {
void mainException(Thread t, Throwable e);
}
public interface UncaughtCrashHandler {
void uncaughtException(Thread t, Throwable e);
}
private static String throwableToString(Throwable e) {
StringWriter writer = new StringWriter();
writer.write("time=" + System.currentTimeMillis() + "\n");
writer.write("AndroidVersion=" + Build.VERSION.SDK_INT + "\n");
writer.write("AndroidName=" + Build.VERSION.RELEASE + "\n");
writer.write("PhoneName=" + Build.BRAND + "\n");
writer.write("Phone=" + Build.MODEL + "\n");
writer.write("CPU=" + Arrays.toString(Build.SUPPORTED_ABIS) + "\n");
writer.write("runTime=" + (System.currentTimeMillis() - CrashSaveBean.getInstance().getStartTime()) + "\n");
writer.write("enterRoom=" + CrashSaveBean.getInstance().getEnterRoom() + "\n");
writer.write("slidingRoom=" + CrashSaveBean.getInstance().getSlidingRoom() + "\n");
writer.write("playSvga=" + CrashSaveBean.getInstance().getPlaySvga() + "\n");
writer.write("ActivitySize=" + CrashSaveBean.getInstance().getActivitySize() + "\n");
writer.write("UserData=" + SpUtil.getInstance().getStringValue(SpUtil.USER_INFO) + "\n");
writer.write("[ERROR]");
PrintWriter printWriter = new PrintWriter(writer);
e.printStackTrace(printWriter);
return writer.toString();
}
}

View File

@@ -0,0 +1,589 @@
package com.shayu.phonelive.activity;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.FrameLayout;
import android.widget.ImageView;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.app.ActivityOptionsCompat;
import androidx.core.app.NotificationManagerCompat;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.shayu.phonelive.AppContext;
import com.tencent.rtmp.ITXLivePlayListener;
import com.tencent.rtmp.TXLiveBase;
import com.tencent.rtmp.TXLiveConstants;
import com.tencent.rtmp.TXLivePlayer;
import com.tencent.rtmp.ui.TXCloudVideoView;
import com.tencent.ugc.TXUGCBase;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants;
import com.yunbao.common.bean.AdBean;
import com.yunbao.common.bean.ConfigBean;
import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.custom.CircleProgress;
import com.yunbao.common.event.DataUserInfoEvent;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.CommonHttpConsts;
import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.interfaces.CommonCallback;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
import com.yunbao.common.utils.DownloadUtil;
import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.L;
import com.yunbao.common.utils.LogUtil;
import com.yunbao.common.utils.MD5Util;
import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.SpUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.views.LauncherAdViewHolder;
import com.yunbao.main.activity.EntryActivity;
import com.yunbao.main.activity.MainActivity;
import com.yunbao.main.http.MainHttpConsts;
import com.yunbao.main.http.MainHttpUtil;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import myname.pdlive.shayu.R;
/**
* Created by cxf on 2018/9/17.
*/
@Route(path = RouteUtil.PATH_LAUNCHER)
public class LauncherActivity extends AppCompatActivity implements View.OnClickListener {
private static final String TAG = "LauncherActivity";
private static final int WHAT_GET_CONFIG = 0;
private static final int WHAT_COUNT_DOWN = 1;
protected Context mContext;
private Handler mHandler;
private ViewGroup mRoot;
private ImageView mCover;
private ViewGroup mContainer;
private CircleProgress mCircleProgress;
private List<AdBean> mAdList;
private List<ImageView> mImageViewList;
private int mMaxProgressVal;
private int mCurProgressVal;
private int mAdIndex;
private int mInterval = 2000;
private View mBtnSkipImage;
private View mBtnSkipVideo;
private TXCloudVideoView mTXCloudVideoView;
private TXLivePlayer mPlayer;
private LauncherAdViewHolder mLauncherAdViewHolder;
private boolean mPaused;
private int mVideoLastProgress;
private boolean mForward;
@Override
public Resources getResources() {
Resources res = super.getResources();
Configuration config = new Configuration();
config.setToDefaults();
config.locale = IMLoginManager.get(this).getLocaleLanguage();
res.updateConfiguration(config, res.getDisplayMetrics());
return res;
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
getWindow().requestFeature(Window.FEATURE_ACTIVITY_TRANSITIONS);
super.onCreate(savedInstanceState);
EventBus.getDefault().register(this);
setStatusBar();
setContentView(R.layout.activity_launcher);
mContext = this;
mRoot = findViewById(R.id.root);
mCover = findViewById(R.id.cover);
mCircleProgress = findViewById(R.id.progress);
mContainer = findViewById(R.id.container);
mBtnSkipImage = findViewById(R.id.btn_skip_img);
mBtnSkipVideo = findViewById(R.id.btn_skip_video);
mBtnSkipImage.setOnClickListener(this);
mBtnSkipVideo.setOnClickListener(this);
ImgLoader.display(mContext, R.mipmap.screen, mCover);
mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case WHAT_GET_CONFIG:
getConfig();
break;
case WHAT_COUNT_DOWN:
updateCountDown();
break;
}
}
};
mHandler.sendEmptyMessageDelayed(WHAT_GET_CONFIG, 1000);
LogUtil.uploadErrorLog(AppContext.sInstance);
SpUtil.getInstance().setBooleanValue("NOTIFICATION", NotificationManagerCompat.from(this).areNotificationsEnabled());
}
/**
* 图片倒计时
*/
private void updateCountDown() {
mCurProgressVal += 100;
if (mCurProgressVal > mMaxProgressVal) {
return;
}
if (mCircleProgress != null) {
mCircleProgress.setCurProgress(mCurProgressVal);
}
int index = mCurProgressVal / mInterval;
if (index < mAdList.size() && mAdIndex != index) {
View v = mImageViewList.get(mAdIndex);
if (v != null && v.getVisibility() == View.VISIBLE) {
v.setVisibility(View.INVISIBLE);
}
mAdIndex = mCurProgressVal / mInterval;
}
if (mCurProgressVal < mMaxProgressVal) {
if (mHandler != null) {
mHandler.sendEmptyMessageDelayed(WHAT_COUNT_DOWN, 100);
}
} else if (mCurProgressVal == mMaxProgressVal) {
checkUidAndToken();
}
}
/**
* 获取Config信息
*/
private void getConfig() {
CommonHttpUtil.getConfig(mContext, new CommonCallback<ConfigBean>() {
@Override
public void callback(ConfigBean bean) {
if (bean != null) {
L.e(TAG, "----------> getPaster360Url" + bean.getBeautyKey() + " " + bean.getPaster360Url());
CommonAppConfig.getInstance().setBeautySdkType(bean.getSproutType());
//转盘开关
CommonAppConfig.getInstance().setTurnTableEnable(bean.getTurntableEnable());
CommonAppConfig.getInstance().setBeauty360TieZhiUrl(bean.getPaster360Url());
CommonAppConfig.getInstance().setAnchorPkTime(bean.getPkTime());
if (!TextUtils.isEmpty(bean.getTxVideoUgcLicenceUrl()) && !TextUtils.isEmpty(bean.getTxVideoUgcKey()))
Log.i("tvv", bean.getTxVideoUgcLicenceUrl() + "" + bean.getTxVideoUgcKey());
TXLiveBase.getInstance().setLicence(LauncherActivity.this, bean.getTxVideoUgcLicenceUrl(), bean.getTxVideoUgcKey());
TXUGCBase.getInstance().setLicence(LauncherActivity.this, bean.getTxPlayUgcLicenceUrl(), bean.getTxVideoUgcKey());
String adInfo = bean.getAdInfo();
if (!TextUtils.isEmpty(adInfo)) {
JSONObject obj = JSON.parseObject(adInfo);
Log.i(TAG, "callback: " + adInfo);
if (obj.getIntValue("switch") == 1) {
List<AdBean> list = JSON.parseArray(obj.getString("list"), AdBean.class);
if (list != null && list.size() > 0) {
mAdList = list;
mInterval = obj.getIntValue("time") * 1000;
if (mContainer != null) {
mContainer.setOnClickListener(LauncherActivity.this);
}
String[] uidAndToken = SpUtil.getInstance().getMultiStringValue(
new String[]{SpUtil.UID, SpUtil.TOKEN});
final String uid = uidAndToken[0];
final String token = uidAndToken[1];
if (!TextUtils.isEmpty(uid) && !TextUtils.isEmpty(token)) {
playAD(obj.getIntValue("type") == 0);
} else {
releaseVideo();
LauncherActivity.this.startActivity(new Intent(LauncherActivity.this, EntryActivity.class));
LauncherActivity.this.finish();
}
} else {
checkUidAndToken();
}
} else {
checkUidAndToken();
}
} else {
checkUidAndToken();
}
}else{
ToastUtil.show(getString(R.string.net_error));
}
}
});
}
/**
* 检查uid和token是否存在
*/
private void checkUidAndToken() {
if (mForward) {
return;
}
mForward = true;
if (mHandler != null) {
mHandler.removeCallbacksAndMessages(null);
mHandler = null;
}
IMLoginModel model = IMLoginManager.get(this).getUserInfo();
if (model != null) {
IMLoginManager.get(this).upDataUserInfo();
//融云连接服务器
RongcloudIMManager.connectIM(this);
forwardMainActivity();
} else {
//兼容老版本
if (IMLoginManager.get(this).checkOLd()) {
IMLoginManager.get(this).upDataUserInfo();
} else {
releaseVideo();
this.startActivity(new Intent(this, EntryActivity.class));
this.finish();
}
}
}
/**
* 跳转到首页
*/
private void forwardMainActivity() {
releaseVideo();
Intent intent = new Intent(
LauncherActivity.this, MainActivity.class);
intent.putExtra(Constants.SHOW_INVITE, false);
if (getIntent().getStringExtra("liveid") != null) {
intent.putExtra("liveid", getIntent().getStringExtra("liveid"));
}
if (getIntent().getStringExtra("type") != null) {
intent.putExtra("type", getIntent().getStringExtra("type"));
}
if (getIntent().getStringExtra("activityUrl") != null) {
intent.putExtra("activityUrl", getIntent().getStringExtra("activityUrl"));
}
if (mImageViewList != null && mImageViewList.size() > 0) {
Log.i(TAG, "forwardMainActivity: " + mImageViewList.size());
AdBean bean = mAdList.get(0);
if (bean != null && bean.getAnimation() == 1) {
intent.putExtra("ad_url", mAdList.get(0).getUrl());
Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(LauncherActivity.this, mImageViewList.get(0), "ad_img_0").toBundle();
LauncherActivity.this.startActivity(intent, bundle);
} else {
LauncherActivity.this.startActivity(intent);
}
} else {
LauncherActivity.this.startActivity(intent);
}
finish();
}
@Override
protected void onDestroy() {
EventBus.getDefault().unregister(this);
if (mHandler != null) {
mHandler.removeCallbacksAndMessages(null);
mHandler = null;
}
MainHttpUtil.cancel(MainHttpConsts.GET_BASE_INFO);
CommonHttpUtil.cancel(CommonHttpConsts.GET_CONFIG);
releaseVideo();
if (mLauncherAdViewHolder != null) {
mLauncherAdViewHolder.release();
}
mLauncherAdViewHolder = null;
super.onDestroy();
L.e(TAG, "----------> onDestroy");
}
/**
* 设置透明状态栏
*/
private void setStatusBar() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = getWindow();
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(0);
}
}
@Override
public void onClick(View v) {
int i = v.getId();
if (i == R.id.btn_skip_img || i == R.id.btn_skip_video) {
if (mBtnSkipImage != null) {
mBtnSkipImage.setClickable(false);
}
if (mBtnSkipVideo != null) {
mBtnSkipVideo.setClickable(false);
}
checkUidAndToken();
} else if (i == R.id.container) {
clickAD();
}
}
/**
* 点击广告
*/
private void clickAD() {
if (mAdList != null && mAdList.size() > mAdIndex) {
AdBean adBean = mAdList.get(mAdIndex);
if (adBean != null) {
String link = adBean.getLink();
if (!TextUtils.isEmpty(link)) {
if (mHandler != null) {
mHandler.removeCallbacksAndMessages(null);
}
if (mContainer != null) {
mContainer.setClickable(false);
}
releaseVideo();
if (mLauncherAdViewHolder == null) {
mLauncherAdViewHolder = new LauncherAdViewHolder(mContext, mRoot, link + "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken());
mLauncherAdViewHolder.addToParent();
mLauncherAdViewHolder.loadData();
mLauncherAdViewHolder.show();
mLauncherAdViewHolder.setActionListener(new LauncherAdViewHolder.ActionListener() {
@Override
public void onHideClick() {
checkUidAndToken();
}
});
}
}
}
}
}
private void releaseVideo() {
if (mPlayer != null) {
mPlayer.stopPlay(false);
mPlayer.setPlayListener(null);
}
mPlayer = null;
}
@Override
public void onBackPressed() {
if (mLauncherAdViewHolder != null) {
mLauncherAdViewHolder.release();
checkUidAndToken();
return;
}
super.onBackPressed();
}
/**
* 播放广告
*/
private void playAD(boolean isImage) {
if (mContainer == null) {
return;
}
if (isImage) {
int imgSize = mAdList.size();
if (imgSize > 0) {
mImageViewList = new ArrayList<>();
for (int i = 0; i < imgSize; i++) {
ImageView imageView = new ImageView(mContext);
imageView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
imageView.setBackgroundColor(0xffffffff);
imageView.setTransitionName("ad_img_" + i);
mImageViewList.add(imageView);
ImgLoader.display(mContext, mAdList.get(i).getUrl(), imageView);
}
for (int i = imgSize - 1; i >= 0; i--) {
mContainer.addView(mImageViewList.get(i));
}
if (mBtnSkipImage != null && mBtnSkipImage.getVisibility() != View.VISIBLE) {
mBtnSkipImage.setVisibility(View.VISIBLE);
}
mMaxProgressVal = imgSize * mInterval;
if (mCircleProgress != null) {
mCircleProgress.setMaxProgress(mMaxProgressVal);
}
if (mHandler != null) {
mHandler.sendEmptyMessageDelayed(WHAT_COUNT_DOWN, 100);
}
if (mCover != null && mCover.getVisibility() == View.VISIBLE) {
mCover.setVisibility(View.INVISIBLE);
}
} else {
checkUidAndToken();
}
} else {
if (mAdList == null || mAdList.size() == 0) {
checkUidAndToken();
return;
}
String videoUrl = mAdList.get(0).getUrl();
if (TextUtils.isEmpty(videoUrl)) {
checkUidAndToken();
return;
}
String videoFileName = MD5Util.getMD5(videoUrl);
if (TextUtils.isEmpty(videoFileName)) {
checkUidAndToken();
return;
}
File file = new File(getCacheDir(), videoFileName);
if (file.exists()) {
playAdVideo(file);
} else {
downloadAdFile(videoUrl, videoFileName);
}
}
}
@Override
protected void onPause() {
mPaused = true;
if (mPlayer != null && mPlayer.isPlaying()) {
mPlayer.setMute(true);
}
super.onPause();
}
@Override
protected void onResume() {
super.onResume();
if (mPaused) {
if (mPlayer != null && mPlayer.isPlaying()) {
mPlayer.setMute(false);
}
}
mPaused = false;
}
/**
* 下载视频
*/
private void downloadAdFile(String url, String fileName) {
DownloadUtil downloadUtil = new DownloadUtil();
downloadUtil.download("ad_video", getCacheDir(), fileName, url, new DownloadUtil.Callback() {
@Override
public void onSuccess(File file) {
playAdVideo(file);
}
@Override
public void onProgress(int progress) {
}
@Override
public void onError(Throwable e) {
checkUidAndToken();
}
});
}
/**
* 播放视频
*/
private void playAdVideo(File videoFile) {
if (mBtnSkipVideo != null && mBtnSkipVideo.getVisibility() != View.VISIBLE) {
mBtnSkipVideo.setVisibility(View.VISIBLE);
}
mTXCloudVideoView = new TXCloudVideoView(mContext);
mTXCloudVideoView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
mTXCloudVideoView.setRenderMode(TXLiveConstants.RENDER_MODE_FULL_FILL_SCREEN);
mContainer.addView(mTXCloudVideoView);
mPlayer = new TXLivePlayer(mContext);
mPlayer.setPlayerView(mTXCloudVideoView);
mPlayer.setAutoPlay(true);
mPlayer.setPlayListener(new ITXLivePlayListener() {
@Override
public void onPlayEvent(int e, Bundle bundle) {
if (e == TXLiveConstants.PLAY_EVT_PLAY_END) {//获取到视频播放完毕的回调
checkUidAndToken();
L.e(TAG, "视频播放结束------>");
} else if (e == TXLiveConstants.PLAY_EVT_CHANGE_RESOLUTION) {////获取到视频宽高回调
float videoWidth = bundle.getInt("EVT_PARAM1", 0);
float videoHeight = bundle.getInt("EVT_PARAM2", 0);
if (mTXCloudVideoView != null && videoWidth > 0 && videoHeight > 0) {
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mTXCloudVideoView.getLayoutParams();
int targetH = 0;
if (videoWidth >= videoHeight) {//横屏
params.gravity = Gravity.CENTER_VERTICAL;
targetH = (int) (mTXCloudVideoView.getWidth() / videoWidth * videoHeight);
} else {
targetH = ViewGroup.LayoutParams.MATCH_PARENT;
}
if (targetH != params.height) {
params.height = targetH;
mTXCloudVideoView.requestLayout();
}
}
} else if (e == TXLiveConstants.PLAY_EVT_RCV_FIRST_I_FRAME) {
if (mCover != null && mCover.getVisibility() == View.VISIBLE) {
mCover.setVisibility(View.INVISIBLE);
}
} else if (e == TXLiveConstants.PLAY_ERR_NET_DISCONNECT ||
e == TXLiveConstants.PLAY_ERR_FILE_NOT_FOUND) {
ToastUtil.show(mContext.getString(R.string.live_play_error));
checkUidAndToken();
} else if (e == TXLiveConstants.PLAY_EVT_PLAY_PROGRESS) {
int progress = bundle.getInt("EVT_PLAY_PROGRESS_MS");
if (mVideoLastProgress == progress) {
L.e(TAG, "视频播放结束------>");
checkUidAndToken();
} else {
mVideoLastProgress = progress;
}
}
}
@Override
public void onNetStatus(Bundle bundle) {
}
});
mPlayer.startPlay(videoFile.getAbsolutePath(), TXLivePlayer.PLAY_TYPE_LOCAL_VIDEO);
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onDataUserInfoEvent(DataUserInfoEvent event) {
if (event.isUpDataSuccess()) {
//融云连接服务器
RongcloudIMManager.connectIM(getApplication());
forwardMainActivity();
} else {
releaseVideo();
this.startActivity(new Intent(this, EntryActivity.class));
this.finish();
}
}
}

View File

@@ -0,0 +1,330 @@
package com.shayu.phonelive.utils;
import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP;
import android.Manifest;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.Dialog;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.RectF;
import android.net.Uri;
import android.os.Build;
import android.util.Log;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RemoteViews;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.app.NotificationCompat;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.target.SimpleTarget;
import com.bumptech.glide.request.target.Target;
import com.bumptech.glide.request.transition.Transition;
import com.makeramen.roundedimageview.RoundedImageView;
import com.shayu.phonelive.AppContext;
import com.shayu.phonelive.activity.LauncherActivity;
import com.yunbao.common.bean.NotificationMsgBean;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.SpUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.main.activity.MainActivity;
import org.json.JSONException;
import org.json.JSONObject;
import io.rong.imlib.ConnectChangeReceiver;
import io.rong.push.PushType;
import io.rong.push.notification.PushMessageReceiver;
import io.rong.push.notification.PushNotificationMessage;
import myname.pdlive.shayu.R;
public class CustomMessageReceiver extends PushMessageReceiver {
private String createNotificationChannel(Context context, String channelID, String channelNAME, int level) {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
NotificationManager manager = (NotificationManager) context.getSystemService(context.NOTIFICATION_SERVICE);
NotificationChannel channel = new NotificationChannel(channelID, channelNAME, level);
channel.setSound(Uri.parse("android.resource://" + context.getPackageName() + "/raw/pdlive_sound"), null);
manager.createNotificationChannel(channel);
return channelID;
} else {
return null;
}
}
@Override
public boolean onNotificationMessageClicked(
Context context, PushType pushType, PushNotificationMessage message) {
if (pushType.equals(PushType.GOOGLE_FCM)) {
Log.i("gmc", "gmc");
// TODO
} else {
Log.i("gmc", "gmc1111");
}
// 返回 true 表示拦截false 为不拦截
return true;
}
NotificationMsgBean msg = new NotificationMsgBean();
@Override
public boolean onNotificationMessageArrived(Context context, PushType pushType, PushNotificationMessage notificationMessage) {
Log.i("gmc", notificationMessage.getPushContent() + "VVV" + notificationMessage.getPushTitle() + "gmc11112222" + notificationMessage.getExtra());
if (!SpUtil.getInstance().getBooleanValue("NOTIFICATION")) {
if (AppContext.activityWeakReference != null) {
Activity activity = AppContext.activityWeakReference.get();
if (activity != null) {
DialogUitl.showSimpleDialog(activity, WordUtil.isNewZh()?"应用需要通知权限":"Application requires notification permission", new DialogUitl.SimpleCallback() {
@Override
public void onConfirmClick(Dialog dialog, String content) {
Intent intent = new Intent();
intent.setAction("android.settings.APP_NOTIFICATION_SETTINGS");
intent.putExtra("app_package", context.getPackageName());
intent.putExtra("app_uid", context.getApplicationInfo().uid);
// for Android 8 and above
intent.putExtra("android.provider.extra.APP_PACKAGE", context.getPackageName());
activity.startActivity(intent);
}
});
}
}
}
if (notificationMessage.getExtra() == null) {
msg.setImg("" + notificationMessage.getSenderPortrait());
msg.setTitle(notificationMessage.getPushTitle());
msg.setContent(notificationMessage.getPushContent());
msg.setType("-1");
sendNotification(context, msg);
} else {
try {
JSONObject obj = new JSONObject(notificationMessage.getExtra());
Log.i("gmc", "1111222");
//开播
if (obj.getString("type").equals("1") || obj.getString("type").equals("9")) {
Log.i("gmc", "1111");
msg.setImg("" + obj.getString("avatar"));
msg.setTitle(notificationMessage.getPushTitle());
msg.setContent(notificationMessage.getPushContent());
msg.setLiveuid(obj.getString("liveuid"));
msg.setType("1");
liveNotification(context, msg);
//发布动态 2
//点赞 3
//评论 4
//鼓励 5
} else if (obj.getString("type").equals("2") || obj.getString("type").equals("3") || obj.getString("type").equals("4") || obj.getString("type").equals("5")) {
msg.setImg("" + obj.getString("avatar"));
msg.setTitle(notificationMessage.getPushTitle());
msg.setContent(notificationMessage.getPushContent());
msg.setType("2");
dynamicNotification(context, msg);
} else if (obj.getString("type").equals("8") || obj.getString("type").equals("7")) {
msg.setImg("" + obj.getString("avatar"));
msg.setTitle(notificationMessage.getPushTitle());
msg.setContent(notificationMessage.getPushContent());
msg.setType(obj.getString("type"));
msg.setActivityurl(obj.getString("activityUrl"));
serviceNotification(context, msg);
}
} catch (JSONException e) {
Log.i("gmc", "1111" + e.getMessage());
e.printStackTrace();
}
}
return true;
}
public static Bitmap makeRoundCorner(Bitmap bitmap, float roundPx) {
try {
Bitmap output = Bitmap.createBitmap(bitmap.getWidth(),
bitmap.getHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(output);
final int color = 0xff424242;// 颜色值0xff---alpha
final Paint paint = new Paint();
final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
final RectF rectF = new RectF(rect);// Rect是使用int类型作为数值RectF是使用float类型作为数值
// --------抗锯齿-------//
paint.setAntiAlias(true);
canvas.drawARGB(0, 0, 0, 0);
paint.setColor(color);
canvas.drawRoundRect(rectF, roundPx, roundPx, paint);
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
final Rect src = new Rect(0, 0, bitmap.getWidth(),
bitmap.getHeight());
canvas.drawBitmap(bitmap, null, rect, paint);
return output;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
//私聊
private void sendNotification(Context context, NotificationMsgBean message) {
// 设置通知的点击行为:这里启动一个 Activity
Intent intent = new Intent(context, MainActivity.class);
intent.setFlags(FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent pendingIntent;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S) {
pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE);
} else {
pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_ONE_SHOT);
}
String channelId = createNotificationChannel(context, "my_channel_ID", "my_channel_NAME", NotificationManager.IMPORTANCE_HIGH);
// 构建 remoteView
RemoteViews remoteView = new RemoteViews(context.getPackageName(), R.layout.notification_message);
remoteView.setTextViewText(R.id.title, message.getTitle());
remoteView.setTextViewText(R.id.content, message.getContent());
Glide.with(context).asBitmap().load(message.getImg()).into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
remoteView.setImageViewBitmap(R.id.img, makeRoundCorner(resource, 50));
NotificationCompat.Builder builder = new NotificationCompat.Builder(context, channelId);
// 设置自定义 RemoteViews
builder.setContent(remoteView).setSmallIcon(R.drawable.small_icons);
// 设置通知的优先级(悬浮通知)
builder.setPriority(NotificationCompat.PRIORITY_MAX);
builder.setContentIntent(pendingIntent);
builder.setAutoCancel(true);
Notification notification = builder.build();
NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
manager.notify(0, notification);
}
});
}
int id = 1;
//动态
private void dynamicNotification(Context context, NotificationMsgBean message) {
// 设置通知的点击行为:这里启动一个 Activity
Intent intent = new Intent(context, MainActivity.class);
intent.putExtra("type", "2");
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent pendingIntent;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S) {
pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE);
} else {
pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
}
String channelId = createNotificationChannel(context, "my_channel_ID", "my_channel_NAME", NotificationManager.IMPORTANCE_HIGH);
// 构建 remoteView
RemoteViews remoteView = new RemoteViews(context.getPackageName(), R.layout.notification_message);
remoteView.setTextViewText(R.id.title, message.getTitle());
remoteView.setTextViewText(R.id.content, message.getContent());
remoteView.setImageViewResource(R.id.img, R.mipmap.ic_launcher);
NotificationCompat.Builder builder = new NotificationCompat.Builder(context, channelId);
// 设置自定义 RemoteViews
builder.setContent(remoteView).setSmallIcon(R.drawable.small_icons);
// 设置通知的优先级(悬浮通知)
builder.setPriority(NotificationCompat.PRIORITY_MAX);
builder.setContentIntent(pendingIntent);
builder.setAutoCancel(true);
Notification notification = builder.build();
NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
id = (int) (id + System.currentTimeMillis());
manager.notify(id, notification);
}
//开播
private void liveNotification(Context context, NotificationMsgBean message) {
// 设置通知的点击行为:这里启动一个 Activity
Intent intent = new Intent(context, LauncherActivity.class);
intent.setFlags(FLAG_ACTIVITY_CLEAR_TOP);
intent.putExtra("liveid", message.getLiveuid());
Log.e("gmc", message.getLiveuid() + "21121");
PendingIntent pendingIntent;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S) {
pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE);
} else {
pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
}
String channelId = createNotificationChannel(context, "my_channel_ID", "my_channel_NAME", NotificationManager.IMPORTANCE_HIGH);
// 构建 remoteView
RemoteViews remoteView = new RemoteViews(context.getPackageName(), R.layout.notification_message);
remoteView.setTextViewText(R.id.title, message.getTitle());
remoteView.setTextViewText(R.id.content, message.getContent());
Glide.with(context).asBitmap().load(message.getImg()).into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
remoteView.setImageViewBitmap(R.id.img, makeRoundCorner(resource, 50));
NotificationCompat.Builder builder = new NotificationCompat.Builder(context, channelId);
// 设置自定义 RemoteViews
builder.setContent(remoteView).setSmallIcon(R.drawable.small_icons);
// 设置通知的优先级(悬浮通知)
builder.setPriority(NotificationCompat.PRIORITY_MAX);
builder.setContentIntent(pendingIntent);
builder.setAutoCancel(true);
Notification notification = builder.build();
NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
id = (int) (id + System.currentTimeMillis());
manager.notify(id, notification);
}
});
Log.i("gmc", "11123231");
}
//后台
private void serviceNotification(Context context, NotificationMsgBean message) {
// 设置通知的点击行为:这里启动一个 Activity
Intent intent = new Intent(context, MainActivity.class);
intent.putExtra("type", message.getType());
if (message.getType().equals("8")) {
intent.putExtra("activityUrl", message.getActivityurl());
}
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent pendingIntent;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S) {
pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE);
} else {
pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
}
String channelId = createNotificationChannel(context, "my_channel_ID", "my_channel_NAME", NotificationManager.IMPORTANCE_HIGH);
// 构建 remoteView
RemoteViews remoteView = new RemoteViews(context.getPackageName(), R.layout.notification_message);
remoteView.setTextViewText(R.id.title, message.getTitle());
remoteView.setTextViewText(R.id.content, message.getContent());
remoteView.setImageViewResource(R.id.img, R.mipmap.ic_launcher);
NotificationCompat.Builder builder = new NotificationCompat.Builder(context, channelId);
// 设置自定义 RemoteViews
builder.setContent(remoteView).setSmallIcon(R.drawable.small_icons);
// 设置通知的优先级(悬浮通知)
builder.setPriority(NotificationCompat.PRIORITY_MAX);
builder.setContentIntent(pendingIntent);
builder.setAutoCancel(true);
Notification notification = builder.build();
NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
id = (int) (id + System.currentTimeMillis());
manager.notify(id, notification);
}
}

View File

@@ -0,0 +1,90 @@
package com.shayu.phonelive.utils;
import static java.text.DateFormat.DEFAULT;
import android.content.Context;
import com.yunbao.common.CommonAppConfig;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import java.util.Objects;
public class LogUtils {
/**
* 采集所有日志
*/
public static void start(Context context) {
new Thread(new Runnable() {
@Override
public void run() {
try {
String[] exec = new String[]{"logcat", "-c"};
Runtime.getRuntime().exec(exec).waitFor();
exec = new String[]{"logcat", "-v", "color", "UTC-8"};
Process process = Runtime.getRuntime().exec(exec);
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line;
PrintWriter writer = null;
String title = "[PDLIVE]" + CommonAppConfig.getInstance().getUid() + "_";
String today = title + SimpleDateFormat.getDateInstance(DEFAULT, Locale.CHINA).format(new Date());
File dir = new File(context.getDir("files", Context.MODE_PRIVATE).getAbsolutePath() + File.separator);
if (dir.listFiles() != null) {
for (File file : dir.listFiles()) {
if (file.getName().endsWith(".log") && !"error.log".equals(file.getName())) {
String fileName = file.getName().replace(".log", "").split("_")[1];
if (isDelLog(fileName)) {
file.delete();
}
}
}
}
File saveFile = new File(context.getDir("files", Context.MODE_PRIVATE).getAbsolutePath() + File.separator + today + ".log");
FileOutputStream os = new FileOutputStream(saveFile, true);
writer = new PrintWriter(os);
while ((line = bufferedReader.readLine()) != null) {
writer.append(line).write("\n");
writer.flush();
}
writer.flush();
writer.close();
exec = new String[]{"logcat", "-c"};
Runtime.getRuntime().exec(exec).waitFor();
bufferedReader.close();
start(context);
} catch (Exception e) {
e.printStackTrace();
}
}
}).start();
}
/**
* 判断是否是要删除的日志
**/
private static boolean isDelLog(String time) {
try {
Calendar timeCal = Calendar.getInstance(Locale.CHINA);
timeCal.setTime(Objects.requireNonNull(SimpleDateFormat.getDateInstance(DEFAULT, Locale.CHINA).parse(time)));
Calendar calendar = Calendar.getInstance(Locale.CHINA);
calendar.setTime(new Date());
calendar.add(Calendar.DATE, -3);
return calendar.after(timeCal);
} catch (ParseException e) {
e.printStackTrace();
}
return false;
}
}

View File

@@ -0,0 +1,112 @@
/*
package com.shayu.phonelive.utils;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.media.RingtoneManager;
import android.net.Uri;
import android.util.Log;
import android.widget.RemoteViews;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
import com.google.android.gms.common.internal.zzm;
import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.RemoteMessage;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.main.activity.MainActivity;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.Map;
import myname.pdlive.shayu.R;
public class MyNotificationService extends FirebaseMessagingService {
private String createNotificationChannel(String channelID, String channelNAME, int level) {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
NotificationChannel channel = new NotificationChannel(channelID, channelNAME, level);
manager.createNotificationChannel(channel);
return channelID;
} else {
return null;
}
}
public void onMessageReceived(RemoteMessage message) {
// do nothing
Map<String, String> params = message.getData();
JSONObject object = new JSONObject(params);
Log.e("JSON_OBJECT", object.toString());
JSONObject remoteMessage = null;
try {
remoteMessage = new JSONObject(object.getString("message"));
Log.e("gmc","remoteMessage1"+remoteMessage.toString());
Log.e("gmc","remoteMessage"+remoteMessage.getString("fromUserName"));
} catch (JSONException e) {
e.printStackTrace();
}
// if(remoteMessage!=null && remoteMessage.isNull("fcm_token")) {
// String title = remoteMessage.getData().get("title");
// String message = remoteMessage.getData().get("text");
// String username = remoteMessage.getData().get("username");
// String uid = remoteMessage.getData().get("uid");
// String fcmToken = remoteMessage.getData().get("fcm_token");
// Log.e("gmc","remoteMessage"+remoteMessage.getData().get("username"));
//
// //Muestro la notifiación
//// sendNotification(title, message, username, uid, fcmToken);
// }else {
// /// Si es de tipo inserción la muestro sino no.
// //Es una nueva notificación de que alguien ha creado algo
// if(remoteMessage.getData().get("accion")!=null &&
// remoteMessage.getData().get("accion").compareTo("insert")==0)
//// displayNotification(remoteMessage.getNotification(), remoteMessage.getData());
//// //Envío los datos al RecyclerView correspondiente para que se actualice
//// addNotificacion(remoteMessage);
// Log.e("gmc","remoteMessage"+remoteMessage.getData().get("username"));
//
// }
// sendNotification("remoteMessage");
}
// private void sendNotification(String messageBody) {
//
// // 设置通知的点击行为:这里启动一个 Activity
// Intent intent = new Intent(this, MainActivity.class);
// intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
// PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, 0);
// String channelId = createNotificationChannel("my_channel_ID", "my_channel_NAME", NotificationManager.IMPORTANCE_HIGH);
// // 构建 remoteView
//// RemoteViews remoteView = new RemoteViews(getPackageName(), R.layout.notification_message);
//
//// remoteView.setTextViewText(R.id.tvMsg, "RemoteViews");
//// remoteView.setImageViewResource(R.id.ivIcon, R.mipmap.ic_launcher_round);
// NotificationCompat.Builder builder = new NotificationCompat.Builder(this,channelId);
// // 设置自定义 RemoteViews
// builder.setContent(remoteView).setSmallIcon(R.mipmap.ic_launcher);
// // 设置通知的优先级(悬浮通知)
// builder.setPriority(NotificationCompat.PRIORITY_MAX);
// builder.setContentIntent(pendingIntent);
// builder.setAutoCancel(true);
// Notification notification = builder.build();
// NotificationManager manager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
// manager.notify(0, notification);
//
// }
}
*/

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<shape android:shape="oval" xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#80000000"/>
</shape>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="12sp"/>
<stroke android:color="@color/white" android:width="1dp"/>
<solid android:color="#80000000"/>
</shape>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000" />
<FrameLayout
android:id="@+id/btn_skip_img"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="right"
android:layout_marginTop="37dp"
android:layout_marginRight="15dp"
android:background="@drawable/bg_launcher_skip"
android:visibility="invisible">
<com.yunbao.common.custom.CircleProgress
android:id="@+id/progress"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cp_bg_color="@color/white"
app:cp_cur_progress="0"
app:cp_fg_color="#ff7200"
app:cp_stroke_width="2dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="@string/recommend_skip"
android:textColor="@color/white"
android:textSize="11sp" />
</FrameLayout>
<TextView
android:id="@+id/btn_skip_video"
android:layout_width="44dp"
android:layout_height="26dp"
android:layout_gravity="right"
android:layout_marginTop="37dp"
android:layout_marginRight="15dp"
android:background="@drawable/bg_launcher_skip_2"
android:gravity="center"
android:text="@string/recommend_skip"
android:textColor="@color/white"
android:textSize="11sp"
android:visibility="invisible" />
<ImageView
android:id="@+id/cover"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
android:scaleType="centerCrop" />
</FrameLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">PandoraLive</string>
<string name="leak_canary_test_class_name">assertk.Assert</string>
</resources>

2589
app/tmp/full-r8-config.txt Normal file

File diff suppressed because it is too large Load Diff