androidx版本首次提交

This commit is contained in:
18401019693 2022-07-18 15:31:45 +08:00
commit 1791a114e3
2932 changed files with 218954 additions and 0 deletions

16
.gitignore vendored Normal file
View File

@ -0,0 +1,16 @@
*.iml
local.properties
/baidu/build/
/app/build/
/.idea/
/.gradle/
/beauty/build/
/billing/build/
/build/
/common/build/
/lib_beauty360/build/
/lib_country_code/build/
/live/build/
/main/build/
/video/build/

113
app/build.gradle Normal file
View File

@ -0,0 +1,113 @@
apply plugin: 'com.android.application'
apply plugin: 'img-optimizer'
apply plugin: 'com.google.gms.google-services'
//
android {
dexOptions {
jumboMode = true
}
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"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
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.0V2
v1SigningEnabled true
}
}
aaptOptions {
cruncherEnabled = false
useNewCruncher = false
}
packagingOptions {// mob兼容性androidx
pickFirst 'META-INF/*'
}
defaultConfig {
// applicationId "myname.pdlive.shayu"
applicationId "com.pdlive.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 false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
debug {
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'])
//
api project(':main')
//
api project(':video')
annotationProcessor rootProject.ext.dependencies["arouter-compiler"]
}

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.pdlive.shayu"
}
},
"oauth_client": [
{
"client_id": "292494634914-8nuhhoeo061ki1jevbcsrl7dfdl6dlm0.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.pdlive.shayu",
"certificate_hash": "38cc19306c9facee36a9224e9a4070bc0be15c7d"
}
},
{
"client_id": "292494634914-ctr3fptp5mkv2qqr4gkgjo9uluq2joqb.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.pdlive.shayu",
"certificate_hash": "15fc5e70cf238323bf7111c8c627803985478e87"
}
},
{
"client_id": "292494634914-ejtqvaj86a2lldv0di2pr3d5gngprahd.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.pdlive.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.
----------------------------------------

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

@ -0,0 +1,37 @@
# 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.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.**{ *; }

View File

@ -0,0 +1,173 @@
<?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.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.QUERY_ALL_PACKAGES"/>
<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_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="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>
<!-- Android11新增 -->
<!-- <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />-->
<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:theme="@style/AppTheme"
android:usesCleartextTraffic="true"
tools:replace="theme,label,icon,allowBackup">
<activity
android:name="com.shayu.phonelive.activity.LauncherActivity"
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="smvslm" />
</intent-filter>
</activity> <!-- keytool -exportcert -alias androiddebugkey -keystore feixiong.jks | openssl sha1 -binary | openssl base64 -->
<meta-data
android:name="TencentMapSDK"
android:value="${txMapAppKey}" />
<!-- <meta-data-->
<!-- android:name="TencentMapAppSecret"-->
<!-- android:value="${txMapAppSecret}" /> &lt;!&ndash; 腾讯bugly &ndash;&gt;-->
<!-- <meta-data-->
<!-- android:name="BUGLY_APPID"-->
<!-- android:value="${buglyAppId}" />-->
<!-- <meta-data-->
<!-- android:name="BUGLY_APP_CHANNEL"-->
<!-- android:value="com.chihu.phonelive" />-->
<!-- <meta-data-->
<!-- android:name="BUGLY_ENABLE_DEBUG"-->
<!-- android:value="true" /> &lt;!&ndash; 腾讯bugly end &ndash;&gt;-->
<!-- 百度语音识别 -->
<meta-data
android:name="com.baidu.speech.APP_ID"
android:value="${baiduAppId}" />
<meta-data
android:name="com.baidu.speech.API_KEY"
android:value="${baiduAppKey}" />
<meta-data
android:name="com.baidu.speech.SECRET_KEY"
android:value="${baiduAppSecretKey}" />
<!-- <service-->
<!-- android:name="com.baidu.speech.VoiceRecognitionService"-->
<!-- android:exported="false" /> &lt;!&ndash; 百度语音识别end &ndash;&gt;-->
<!-- 友盟统计 -->
<!-- <meta-data-->
<!-- android:name="UMENG_APPKEY"-->
<!-- android:value="${umengAppKey}" />-->
<!-- <meta-data-->
<!-- android:name="UMENG_CHANNEL"-->
<!-- android:value="com.chihu.phonelive" /> &lt;!&ndash; 友盟统计 end &ndash;&gt;-->
<!-- 服务器地址 -->
<meta-data
android:name="SERVER_HOST"
android:value="${serverHost}" />
<meta-data
android:name="IS_GOOGLE_PLAY"
android:value="${isGooglePlay}" />
<meta-data
android:name="com.openinstall.APP_KEY"
android:value="smvslm" />
<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"/>
</application>
</manifest>

View File

@ -0,0 +1,269 @@
package com.shayu.phonelive;
import android.app.Activity;
import android.app.ActivityManager;
import android.content.Context;
import android.net.http.HttpResponseCache;
import android.os.Bundle;
import android.os.Message;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.adjust.sdk.Adjust;
import com.adjust.sdk.AdjustConfig;
import com.adjust.sdk.AdjustEvent;
import com.adjust.sdk.LogLevel;
import com.alibaba.android.arouter.launcher.ARouter;
import com.blankj.utilcode.util.Utils;
import com.facebook.appevents.AppEventsLogger;
import com.fm.openinstall.OpenInstall;
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.yunbao.common.BuildConfig;
import com.yunbao.common.CommonAppContext;
import com.yunbao.common.Constants;
import com.yunbao.common.utils.L;
import com.yunbao.live.socket.SocketRyClient;
import com.yunbao.live.utils.LiveImDeletUtil;
import java.io.File;
import java.io.IOException;
import io.rong.imlib.RongIMClient;
import io.rong.imlib.model.Conversation;
import io.rong.message.TextMessage;
import static com.adjust.sdk.AdjustConfig.ENVIRONMENT_PRODUCTION;
import static com.yunbao.live.socket.SocketClient.mSocketHandler;
//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 static final class AdjustLifecycleCallbacks implements ActivityLifecycleCallbacks {
@Override
public void onActivityResumed(Activity activity) {
Adjust.onResume();
}
@Override
public void onActivityPaused(Activity activity) {
Adjust.onPause();
}
@Override
public void onActivityStopped(@NonNull Activity activity) {
}
@Override
public void onActivitySaveInstanceState(@NonNull Activity activity, @NonNull Bundle outState) {
}
@Override
public void onActivityDestroyed(@NonNull Activity activity) {
}
@Override
public void onActivityCreated(@NonNull Activity activity, @Nullable Bundle savedInstanceState) {
}
@Override
public void onActivityStarted(@NonNull Activity activity) {
}
}
@Override
public void onCreate() {
super.onCreate();
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);
}
String environment = AdjustConfig.ENVIRONMENT_PRODUCTION;
AdjustConfig config = new AdjustConfig(this, "3om5fbglyqdc", environment);
Adjust.onCreate(config);
registerActivityLifecycleCallbacks(new AdjustLifecycleCallbacks());
config.setLogLevel(LogLevel.WARN);
//激活操作记录
AdjustEvent adjustEvent = new AdjustEvent("m7wk0c");
Adjust.trackEvent(adjustEvent);
//谷歌激活
mFirebaseAnalytics.logEvent("FS_activation", null);
//FB激活
logger.logEvent("FB_activation");
AdjustEvent adjustEvent2 = new AdjustEvent("p7igfz");
Adjust.trackEvent(adjustEvent2);
//谷歌激活
mFirebaseAnalytics.logEvent("FS_complete_1st_loading", null);
//FB激活
logger.logEvent("FB_complete_1st_loading");
//初始化 AndroidUtilCode
Utils.init(this);
liveImDeletUtil = new LiveImDeletUtil();
// 融云
RongIMClient.getInstance().setOnReceiveMessageListener(new RongIMClient.OnReceiveMessageWrapperListener() {
/**
* 接收实时或者离线消息
* 注意:
* 1. 针对接收离线消息时服务端会将 200 条消息打成一个包发到客户端客户端对这包数据进行解析
* 2. hasPackage 标识是否还有剩余的消息包left 标识这包消息解析完逐条抛送给 App 层后剩余多少条
* 如何判断离线消息收完
* 1. hasPackage left 都为 0
* 2. hasPackage 0 标识当前正在接收最后一包200条消息left 0 标识最后一包的最后一条消息也已接收完毕
*
* @param message 接收到的消息对象
* @param left 每个数据包数据逐条上抛后还剩余的条数
* @param hasPackage 是否在服务端还存在未下发的消息包
* @param offline 消息是否离线消息
* @return 是否处理消息 如果 App 处理了此消息返回 true; 否则返回 false SDK 处理
*/
@Override
public boolean onReceived(io.rong.imlib.model.Message message, int left, boolean hasPackage, boolean offline) {
Log.e("rytest", message.getContent() + "");
if (message.getConversationType() == Conversation.ConversationType.CHATROOM) {
//群聊
Message msg = Message.obtain();
msg.what = Constants.SOCKET_WHAT_BROADCAST;
if (!"".equals(message.getContent()) && message.getContent() != null) {
if (message.getObjectName().equals("RC:TxtMsg")) {
TextMessage content = (TextMessage) message.getContent();
msg.obj = content.getContent();
if (SocketRyClient.mSocketHandler != null && Ingroup == 1) {
SocketRyClient.mSocketHandler.sendMessage(msg);
}
TextMessage rongMsg = (TextMessage) message.getContent();
String firstIndexRM = "";
if (rongMsg.getContent().length() > 4) {
firstIndexRM = rongMsg.getContent().substring(0, 5);
}
String firstIndexRM2 = "";
if (rongMsg.getContent().length() > 9) {
firstIndexRM2 = rongMsg.getContent().substring(0, 10);
}
if ("{\"msg".equals(firstIndexRM) || "{\"retcode\"".equals(firstIndexRM2)) {
liveImDeletUtil.deleteMessages(message.getTargetId(), message.getMessageId());
}
}
}
} else {
//私聊
Message msg = Message.obtain();
msg.what = Constants.SOCKET_WHAT_BROADCAST;
if (!"".equals(message.getContent()) && message.getContent() != null) {
if (message.getObjectName().equals("RC:TxtMsg")) {
TextMessage content = (TextMessage) message.getContent();
msg.obj = content.getContent();
if (content.getContent().contains("_method_")) {
if (SocketRyClient.mSocketHandler != null) {
CommonAppContext.Ingroup = 1;
SocketRyClient.mSocketHandler.sendMessage(msg);
}
}
TextMessage rongMsg = (TextMessage) message.getContent();
String firstIndexRM = "";
if (rongMsg.getContent().length() > 4) {
firstIndexRM = rongMsg.getContent().substring(0, 5);
}
String firstIndexRM2 = "";
if (rongMsg.getContent().length() > 9) {
firstIndexRM2 = rongMsg.getContent().substring(0, 10);
}
if ("{\"msg".equals(firstIndexRM) || "{\"retcode\"".equals(firstIndexRM2)) {
liveImDeletUtil.deleteMessages(message.getTargetId(), message.getMessageId());
}
}
}
}
return false;
}
});
//监听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);
}
}
});
}
public boolean isMainProcess() {
int pid = android.os.Process.myPid();
ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
for (ActivityManager.RunningAppProcessInfo appProcess : activityManager.getRunningAppProcesses()) {
if (appProcess.pid == pid) {
return getApplicationInfo().packageName.equals(appProcess.processName);
}
}
return false;
}
}

View File

@ -0,0 +1,524 @@
package com.shayu.phonelive.activity;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
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 com.adjust.sdk.Adjust;
import com.adjust.sdk.AdjustEvent;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
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.bean.AdBean;
import com.yunbao.common.bean.ConfigBean;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.custom.CircleProgress;
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.utils.DownloadUtil;
import com.yunbao.common.utils.L;
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 java.io.File;
import java.util.ArrayList;
import java.util.List;
import myname.pdlive.shayu.R;
import static com.yunbao.common.CommonAppContext.logger;
import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics;
/**
* 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;
private Handler mHandler;
protected Context mContext;
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
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setStatusBar();
// if ((getIntent().getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != 0) {
// finish();
// return;
// }
setContentView(R.layout.activity_launcher);
//开屏
AdjustEvent adjustEvent = new AdjustEvent("vjqk8g");
Adjust.trackEvent(adjustEvent);
//谷歌激活
mFirebaseAnalytics.logEvent("FS_screen", null);
//FB激活
logger.logEvent("FB_screen");
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);
}
/**
* 图片倒计时
*/
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);
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();
}
}
}
});
}
/**
* 检查uid和token是否存在
*/
private void checkUidAndToken() {
if (mForward) {
return;
}
mForward = true;
if (mHandler != null) {
mHandler.removeCallbacksAndMessages(null);
mHandler = null;
}
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)) {
MainHttpUtil.getBaseInfo(uid, token, new CommonCallback<UserBean>() {
@Override
public void callback(UserBean bean) {
if (bean != null) {
CommonAppConfig.getInstance().setLoginInfo(uid, token, false);
forwardMainActivity();
}
}
});
} else {
releaseVideo();
this.startActivity(new Intent(this, EntryActivity.class));
this.finish();
}
}
/**
* 跳转到首页
*/
private void forwardMainActivity() {
releaseVideo();
MainActivity.forward(mContext);
// this.startActivity(new Intent(this, TestActivity.class));
finish();
}
@Override
protected void onDestroy() {
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;
}
/**
* 播放广告
*/
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);
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(WordUtil.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);
}
}

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>

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: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 586 KiB

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">PDLIVE</string>
</resources>

59
baidu/build.gradle Normal file
View File

@ -0,0 +1,59 @@
apply plugin: 'com.android.library'
apply plugin: 'img-optimizer'
android {
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"
}
defaultConfig {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
versionCode rootProject.ext.android.versionCode
versionName rootProject.ext.android.versionName
manifestPlaceholders = rootProject.ext.manifestPlaceholders
ndk {
abiFilters "armeabi-v7a","arm64-v8a"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
repositories {
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
api rootProject.ext.dependencies["appcompat-androidx"]
//fastJson解析json
implementation rootProject.ext.dependencies["fastjson"]
//
// compile files('libs/bdasr_3.0.8.2.jar')
}

Binary file not shown.

25
baidu/proguard-rules.pro vendored Normal file
View File

@ -0,0 +1,25 @@
# 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 line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@ -0,0 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.yunbao.baidu"
/>

View File

@ -0,0 +1,120 @@
package com.yunbao.baidu.utils;
import android.content.Context;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
//import com.baidu.speech.EventListener;
//import com.baidu.speech.EventManager;
//import com.baidu.speech.EventManagerFactory;
//import com.baidu.speech.asr.SpeechConstant;
/**
* Created by cxf on 2018/7/28.
* 聊天时候语音识别
*/
public class ImAsrUtil {
//
// private EventManager mManager;
// private EventListener mEventListener;
// private String mJsonString;
// private AsrCallback mCallback;
public ImAsrUtil(Context context) {
// mManager = EventManagerFactory.create(context, "asr");
// mEventListener = new EventListener() {
// @Override
// public void onEvent(String name, String params, byte[] bytes, int offset, int length) {
// switch (name) {
// case SpeechConstant.CALLBACK_EVENT_ASR_READY://引擎准备就绪可以开始说话
// //L.e(TAG, "引擎准备就绪,可以开始说话------>"+params);
// break;
// case SpeechConstant.CALLBACK_EVENT_ASR_BEGIN://检测到说话开始
// //L.e(TAG, "检测到说话开始------>" + params);
//// if(mCallback!=null){
//// mCallback.onSpeakStart();
//// }
// break;
// case SpeechConstant.CALLBACK_EVENT_ASR_END://检测到说话结束
// //L.e(TAG, "检测到说话结束------>" + params);
//// if (mCallback != null) {
//// mCallback.onSpeakEnd();
//// }
// break;
// case SpeechConstant.CALLBACK_EVENT_ASR_PARTIAL://识别结果类型json
// JSONObject obj = JSON.parseObject(params);
// String result = obj.getJSONArray("results_recognition").getString(0);
// //L.e(TAG, "识别结果------>" + result);
// if (mCallback != null) {
// mCallback.onResult(result);
// }
// break;
// case SpeechConstant.CALLBACK_EVENT_ASR_FINISH://识别结束可能含有错误信息
// //L.e(TAG, "识别结束------>" + params);
// break;
// case SpeechConstant.CALLBACK_EVENT_ASR_LONG_SPEECH://长语音额外的回调表示长语音识别结束
// //L.e(TAG, "长语音识别结束------>" + params);
// break;
//
// }
// }
// };
// mManager.registerListener(mEventListener);
// JSONObject params = new JSONObject();
// //DECODER = 0 表示禁用离线功能只使用在线功能DECODER = 2 表示启用离线功能但是SDK强制在线优先
// params.put(SpeechConstant.DECODER, 0);
// //开启长语音
// params.put(SpeechConstant.VAD_ENDPOINT_TIMEOUT, 0);
// //关闭自动断句
// params.put(SpeechConstant.VAD, SpeechConstant.VAD_TOUCH);
// //在选择PID为长句输入法模式的时候是否禁用标点符号
// params.put(SpeechConstant.DISABLE_PUNCTUATION, true);
// //是否需要语音音量数据回调开启后有CALLBACK_EVENT_ASR_VOLUME事件回调
// params.put(SpeechConstant.ACCEPT_AUDIO_VOLUME, false);
// //是否需要语音音频数据回调开启后有CALLBACK_EVENT_ASR_AUDIO事件
// params.put(SpeechConstant.ACCEPT_AUDIO_DATA, false);
// mJsonString = params.toJSONString();
// }
//
// /**
// * 开始录音
// */
// public void start() {
// if (mManager != null) {
// mManager.send(SpeechConstant.ASR_START, mJsonString, null, 0, 0);
// }
// }
//
// /**
// * 停止录音
// */
// public void stop() {
// if (mManager != null) {
// mManager.send(SpeechConstant.ASR_STOP, null, null, 0, 0);
// mManager.send(SpeechConstant.ASR_CANCEL, "{}", null, 0, 0);
// }
// }
//
//
// public void release() {
// if (mManager != null) {
// mManager.send(SpeechConstant.ASR_CANCEL, "{}", null, 0, 0);
// mManager.unregisterListener(mEventListener);
// }
// mManager=null;
// mCallback=null;
// }
// public interface AsrCallback {
// //void onSpeakStart();
//
// void onResult(String result);
//
// //void onSpeakEnd();
// }
//
// public void setAsrCallback(AsrCallback callback){
// mCallback=callback;
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

64
beauty/build.gradle Normal file
View File

@ -0,0 +1,64 @@
apply plugin: 'com.android.library'
apply plugin: 'img-optimizer'
android {
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"
}
defaultConfig {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
versionCode rootProject.ext.android.versionCode
versionName rootProject.ext.android.versionName
manifestPlaceholders = rootProject.ext.manifestPlaceholders
ndk {
abiFilters "armeabi-v7a","arm64-v8a"
}
}
aaptOptions {
cruncherEnabled = false
useNewCruncher = false
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
repositories {
flatDir {
dirs 'libs','../libs'
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//sdk内部解析json用
api(name: 'ti-sdk', ext: 'aar')
//common
implementation project(':common')
implementation project(path: ':lib_beauty360')
}

58
beauty/img_optimizer.log Normal file
View File

@ -0,0 +1,58 @@
2019-11-01 13:58:52 info: Task optimizeBeautyRelease begin:
----------------------------------------
2019-11-01 13:58:52 info: 25 images need to be optimized.
----------------------------------------
2019-11-01 13:58:52 info: Succeed! 55954B-->19421B, 65.29113% saved! /Users/yaling/Documents/bayue/denglong_release4/beauty/src/main/res/mipmap-mdpi/icon_filter_qingxin.png
----------------------------------------
2019-11-01 13:58:52 warn: Skipped! /Users/yaling/Documents/bayue/denglong_release4/beauty/src/main/res/mipmap-mdpi/icon_none.png
----------------------------------------
2019-11-01 13:58:52 info: Succeed! 3913B-->2602B, 33.503704% saved! /Users/yaling/Documents/bayue/denglong_release4/beauty/src/main/res/mipmap-mdpi/icon_record_haha_1.png
----------------------------------------
2019-11-01 13:58:52 info: Succeed! 59473B-->19330B, 67.497856% saved! /Users/yaling/Documents/bayue/denglong_release4/beauty/src/main/res/mipmap-mdpi/icon_filter_qingliang.png
----------------------------------------
2019-11-01 13:58:52 info: Succeed! 4192B-->2683B, 35.99714% saved! /Users/yaling/Documents/bayue/denglong_release4/beauty/src/main/res/mipmap-mdpi/icon_record_haha_2.png
----------------------------------------
2019-11-01 13:58:53 info: Succeed! 4094B-->2681B, 34.513924% saved! /Users/yaling/Documents/bayue/denglong_release4/beauty/src/main/res/mipmap-mdpi/icon_record_haha_3.png
----------------------------------------
2019-11-01 13:58:53 info: Succeed! 3340B-->2496B, 25.26946% saved! /Users/yaling/Documents/bayue/denglong_release4/beauty/src/main/res/mipmap-mdpi/icon_record_haha_4.png
----------------------------------------
2019-11-01 13:58:53 info: Succeed! 58992B-->19385B, 67.13961% saved! /Users/yaling/Documents/bayue/denglong_release4/beauty/src/main/res/mipmap-mdpi/icon_filter_langman.png
----------------------------------------
2019-11-01 13:58:53 info: Succeed! 54709B-->20351B, 62.80137% saved! /Users/yaling/Documents/bayue/denglong_release4/beauty/src/main/res/mipmap-mdpi/icon_filter_huaijiu.png
----------------------------------------
2019-11-01 13:58:53 info: Succeed! 57811B-->19404B, 66.435455% saved! /Users/yaling/Documents/bayue/denglong_release4/beauty/src/main/res/mipmap-mdpi/icon_filter_weimei.png
----------------------------------------
2019-11-01 13:58:53 info: Succeed! 2484B-->1931B, 22.26248% saved! /Users/yaling/Documents/bayue/denglong_release4/beauty/src/main/res/mipmap-mdpi/icon_tiezhi_none.png
----------------------------------------
2019-11-01 13:58:53 info: Succeed! 57630B-->19658B, 65.8893% saved! /Users/yaling/Documents/bayue/denglong_release4/beauty/src/main/res/mipmap-mdpi/icon_filter_landiao.png
----------------------------------------
2019-11-01 13:58:53 info: Succeed! 4201B-->1800B, 57.153057% saved! /Users/yaling/Documents/bayue/denglong_release4/beauty/src/main/res/mipmap-mdpi/icon_filter_selected.png
----------------------------------------
2019-11-01 13:58:54 info: Succeed! 57238B-->19354B, 66.1868% saved! /Users/yaling/Documents/bayue/denglong_release4/beauty/src/main/res/mipmap-mdpi/icon_filter_orginal.png
----------------------------------------
2019-11-01 13:58:54 info: Succeed! 57400B-->19610B, 65.836235% saved! /Users/yaling/Documents/bayue/denglong_release4/beauty/src/main/res/mipmap-mdpi/icon_filter_fennen.png
----------------------------------------
2019-11-01 13:58:54 info: Succeed! 55963B-->19519B, 65.1216% saved! /Users/yaling/Documents/bayue/denglong_release4/beauty/src/main/res/mipmap-mdpi/icon_filter_rixi.png
----------------------------------------
2019-11-01 13:58:54 info: Succeed! 914B-->698B, 23.632385% saved! /Users/yaling/Documents/bayue/denglong_release4/beauty/src/main/res/mipmap-mdpi/icon_tiezhi_download.png
----------------------------------------
2019-11-01 13:58:57 warn: Skipped! /Users/yaling/Documents/bayue/denglong_release4/beauty/src/main/res/mipmap-xxxhdpi/filter_rixi.png
----------------------------------------
2019-11-01 13:58:59 warn: Skipped! /Users/yaling/Documents/bayue/denglong_release4/beauty/src/main/res/mipmap-xxxhdpi/filter_qingliang.png
----------------------------------------
2019-11-01 13:59:00 warn: Skipped! /Users/yaling/Documents/bayue/denglong_release4/beauty/src/main/res/mipmap-xxxhdpi/filter_huaijiu.png
----------------------------------------
2019-11-01 13:59:03 warn: Skipped! /Users/yaling/Documents/bayue/denglong_release4/beauty/src/main/res/mipmap-xxxhdpi/filter_langman.png
----------------------------------------
2019-11-01 13:59:06 warn: Skipped! /Users/yaling/Documents/bayue/denglong_release4/beauty/src/main/res/mipmap-xxxhdpi/filter_qingxin.png
----------------------------------------
2019-11-01 13:59:09 warn: Skipped! /Users/yaling/Documents/bayue/denglong_release4/beauty/src/main/res/mipmap-xxxhdpi/filter_fennen.png
----------------------------------------
2019-11-01 13:59:11 warn: Skipped! /Users/yaling/Documents/bayue/denglong_release4/beauty/src/main/res/mipmap-xxxhdpi/filter_landiao.png
----------------------------------------
2019-11-01 13:59:13 warn: Skipped! /Users/yaling/Documents/bayue/denglong_release4/beauty/src/main/res/mipmap-xxxhdpi/filter_weimei.png
----------------------------------------
2019-11-01 13:59:13 info: Total: 25, Succeed: 16, Skipped: 9, Failed: 0, Saved: 339.2431640625KB
----------------------------------------
2019-11-01 13:59:13 info: Task optimizeBeautyRelease executed successfully.
----------------------------------------

25
beauty/proguard-rules.pro vendored Normal file
View File

@ -0,0 +1,25 @@
# 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 line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@ -0,0 +1,2 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.yunbao.beauty"/>

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 486 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 299 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 KiB

View File

@ -0,0 +1,68 @@
{
"gifts": [
{
"name": "aixin",
"dir": "aixin",
"category": "default",
"thumb": "aixin_icon.png",
"voiced": false,
"downloaded": false
},
{
"name": "kaixinle",
"dir": "kaixinle",
"category": "default",
"thumb": "kaixinle_icon.png",
"voiced": false,
"downloaded": false
},
{
"name": "meihua",
"dir": "meihua",
"category": "default",
"thumb": "meihua_icon.png",
"voiced": false,
"downloaded": false
},
{
"name": "chengbao",
"dir": "chengbao",
"category": "default",
"thumb": "chengbao_icon.png",
"voiced": false,
"downloaded": false
},
{
"name": "yuanbao",
"dir": "yuanbao",
"category": "default",
"thumb": "yuanbao_icon.png",
"voiced": false,
"downloaded": false
},
{
"name": "kuaiting",
"dir": "kuaiting",
"category": "default",
"thumb": "kuaiting_icon.png",
"voiced": false,
"downloaded": false
},
{
"name": "qiubite",
"dir": "qiubite",
"category": "default",
"thumb": "qiubite_icon.png",
"voiced": false,
"downloaded": false
},
{
"name": "semimi",
"dir": "semimi",
"category": "default",
"thumb": "semimi_icon.png",
"voiced": false,
"downloaded": false
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 KiB

View File

@ -0,0 +1,29 @@
{
"masks": [
{
"name": "panda",
"thumb": "panda_icon.png",
"downloaded": true
},
{
"name": "leopard",
"thumb": "leopard_icon.png",
"downloaded": true
},
{
"name": "fox",
"thumb": "fox_icon.png",
"downloaded": true
},
{
"name": "pig",
"thumb": "pig_icon.png",
"downloaded": true
},
{
"name": "spirit",
"thumb": "spirit_icon.png",
"downloaded": true
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -0,0 +1,188 @@
{
"stickers": [
{
"name": "maoer",
"dir": "maoer",
"category": "default",
"thumb": "maoerduo_icon.png",
"voiced": false,
"downloaded": false
},
{
"name": "cloud",
"dir": "cloud",
"category": "default",
"thumb": "cloud_icon.png",
"voiced": false,
"downloaded": false
},
{
"name": "glass",
"dir": "glass",
"category": "default",
"thumb": "glass_icon.png",
"voiced": false,
"downloaded": false
},
{
"name": "stars_twinkle",
"dir": "stars_twinkle",
"category": "default",
"thumb": "stars_twinkle_icon.png",
"voiced": false,
"downloaded": false
},
{
"name": "wife",
"dir": "wife",
"category": "default",
"thumb": "wife_icon.png",
"voiced": false,
"downloaded": false
},
{
"name": "cat",
"dir": "cat",
"category": "default",
"thumb": "cat_icon.png",
"voiced": false,
"downloaded": false
},
{
"name": "halloweeneve",
"dir": "halloweeneve",
"category": "default",
"thumb": "halloweeneve_icon.png",
"voiced": false,
"downloaded": false
},
{
"name": "black_cat",
"dir": "black_cat",
"category": "default",
"thumb": "black_cat_icon.png",
"voiced": false,
"downloaded": false
},
{
"name": "black_cloud",
"dir": "black_cloud",
"category": "default",
"thumb": "black_cloud_icon.png",
"voiced": false,
"downloaded": false
},
{
"name": "eyemask",
"dir": "eyemask",
"category": "default",
"thumb": "eyemask_icon.png",
"voiced": false,
"downloaded": false
},
{
"name": "tears",
"dir": "tears",
"category": "default",
"thumb": "tears_icon.png",
"voiced": false,
"downloaded": false
},
{
"name": "moustache",
"dir": "moustache",
"category": "default",
"thumb": "moustache_icon.png",
"voiced": false,
"downloaded": false
},
{
"name": "bride",
"dir": "bride",
"category": "default",
"thumb": "bride_icon.png",
"voiced": false,
"downloaded": false
},
{
"name": "flowerrabbit",
"dir": "flowerrabbit",
"category": "default",
"thumb": "flowerrabbit_icon.png",
"voiced": false,
"downloaded": false
},
{
"name": "cigar",
"dir": "cigar",
"category": "default",
"thumb": "cigar_icon.png",
"voiced": false,
"downloaded": false
},
{
"name": "devil",
"dir": "devil",
"category": "default",
"thumb": "devil_icon.png",
"voiced": false,
"downloaded": false
},
{
"name": "doggy",
"dir": "doggy",
"category": "default",
"thumb": "doggy_icon.png",
"voiced": false,
"downloaded": false
},
{
"name": "dog",
"dir": "dog",
"category": "default",
"thumb": "dog_icon.png",
"voiced": false,
"downloaded": false
},
{
"name": "winterhat",
"dir": "winterhat",
"category": "default",
"thumb": "winterhat_icon.png",
"voiced": false,
"downloaded": false
},
{
"name": "wangguan",
"dir": "wangguan",
"category": "default",
"thumb": "wangguan_icon.png",
"voiced": false,
"downloaded": false
},
{
"name": "wuyun",
"dir": "wuyun",
"category": "default",
"thumb": "wuyun_icon.png",
"voiced": false,
"downloaded": false
},
{
"name": "eyestar",
"dir": "eyestar",
"category": "default",
"thumb": "star_icon.png",
"voiced": false,
"downloaded": false
},
{
"name": "kisses",
"dir": "kisses",
"category": "default",
"thumb": "kiss_icon.png",
"voiced": false,
"downloaded": false
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

View File

@ -0,0 +1,36 @@
{
"watermarks": [
{
"x": 0,
"y": 0,
"ratio": 20,
"name": "watermark.png",
"thumb": "watermark.png",
"downloaded": true
},
{
"x": 80,
"y": 0,
"ratio": 20,
"name": "watermark1.png",
"thumb": "watermark1_icon.png",
"downloaded": true
},
{
"x": 0,
"y": 80,
"ratio": 20,
"name": "watermark2.png",
"thumb": "watermark2_icon.png",
"downloaded": true
},
{
"x": 80,
"y": 80,
"ratio": 20,
"name": "watermark3.png",
"thumb": "watermark3_icon.png",
"downloaded": true
}
]
}

View File

@ -0,0 +1,123 @@
package com.yunbao.beauty.adapter;
import android.content.Context;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import com.yunbao.beauty.bean.FilterBean;
import com.yunbao.common.Constants;
import com.yunbao.beauty.R;
import com.yunbao.common.interfaces.OnItemClickListener;
import java.util.ArrayList;
import java.util.List;
import cn.tillusory.sdk.bean.TiFilterEnum;
/**
* Created by cxf on 2018/6/22.
*/
public class FilterAdapter extends RecyclerView.Adapter<FilterAdapter.Vh> {
private List<FilterBean> mList;
private LayoutInflater mInflater;
private View.OnClickListener mOnClickListener;
private OnItemClickListener<FilterBean> mOnItemClickListener;
private int mCheckedPosition;
public FilterAdapter(Context context) {
mList = new ArrayList<>();
mList.add(new FilterBean(R.mipmap.icon_filter_orginal, 0, TiFilterEnum.NO_FILTER, 0, true));
mList.add(new FilterBean(R.mipmap.icon_filter_langman, R.mipmap.filter_langman, TiFilterEnum.CHOCOLATE_FILTER));
mList.add(new FilterBean(R.mipmap.icon_filter_qingxin, R.mipmap.filter_qingxin, TiFilterEnum.COCO_FILTER));
mList.add(new FilterBean(R.mipmap.icon_filter_weimei, R.mipmap.filter_weimei, TiFilterEnum.COFFEE_FILTER));
mList.add(new FilterBean(R.mipmap.icon_filter_fennen, R.mipmap.filter_fennen, TiFilterEnum.DELICIOUS_FILTER));
mList.add(new FilterBean(R.mipmap.icon_filter_huaijiu, R.mipmap.filter_huaijiu, TiFilterEnum.FIRSTLOVE_FILTER));
mList.add(new FilterBean(R.mipmap.icon_filter_qingliang, R.mipmap.filter_qingliang, TiFilterEnum.FOREST_FILTER));
mList.add(new FilterBean(R.mipmap.icon_filter_landiao, R.mipmap.filter_landiao, TiFilterEnum.GLOSSY_FILTER));
mList.add(new FilterBean(R.mipmap.icon_filter_rixi, R.mipmap.filter_rixi, TiFilterEnum.GRASS_FILTER));
mInflater = LayoutInflater.from(context);
mOnClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
Object tag = v.getTag();
if (tag != null) {
int position = (int) tag;
if (mCheckedPosition == position) {
return;
}
if (mCheckedPosition >= 0 && mCheckedPosition < mList.size()) {
mList.get(mCheckedPosition).setChecked(false);
notifyItemChanged(mCheckedPosition, Constants.PAYLOAD);
}
mList.get(position).setChecked(true);
notifyItemChanged(position, Constants.PAYLOAD);
mCheckedPosition = position;
if (mOnItemClickListener != null) {
mOnItemClickListener.onItemClick(mList.get(position), position);
}
}
}
};
}
public void setOnItemClickListener(OnItemClickListener<FilterBean> onItemClickListener) {
mOnItemClickListener = onItemClickListener;
}
@Override
public Vh onCreateViewHolder(ViewGroup parent, int viewType) {
return new Vh(mInflater.inflate(R.layout.item_list_filter, parent, false));
}
@Override
public void onBindViewHolder(Vh holder, int position) {
}
@Override
public void onBindViewHolder(Vh vh, int position, List<Object> payloads) {
Object payload = payloads.size() > 0 ? payloads.get(0) : null;
vh.setData(mList.get(position), position, payload);
}
@Override
public int getItemCount() {
return mList.size();
}
class Vh extends RecyclerView.ViewHolder {
ImageView mImg;
ImageView mCheckImg;
public Vh(View itemView) {
super(itemView);
mImg = (ImageView) itemView.findViewById(R.id.img);
mCheckImg = (ImageView) itemView.findViewById(R.id.check_img);
itemView.setOnClickListener(mOnClickListener);
}
void setData(FilterBean bean, int position, Object payload) {
itemView.setTag(position);
if (payload == null) {
mImg.setImageResource(bean.getImgSrc());
}
if (bean.isChecked()) {
if (mCheckImg.getVisibility() != View.VISIBLE) {
mCheckImg.setVisibility(View.VISIBLE);
}
} else {
if (mCheckImg.getVisibility() == View.VISIBLE) {
mCheckImg.setVisibility(View.INVISIBLE);
}
}
}
}
}

View File

@ -0,0 +1,120 @@
package com.yunbao.beauty.adapter;
import android.content.Context;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.yunbao.beauty.bean.RockBean;
import com.yunbao.common.Constants;
import com.yunbao.beauty.R;
import java.util.ArrayList;
import java.util.List;
import cn.tillusory.sdk.bean.TiRockEnum;
/**
* Created by cxf on 2018/8/3.
*/
public class RockAdapter extends RecyclerView.Adapter<RockAdapter.Vh> {
private Context mContext;
private List<RockBean> mList;
private LayoutInflater mInflater;
private ActionListener mActionListener;
private int mCheckedPosition;
private int mCheckedColor;
private int mUnCheckedColor;
private View.OnClickListener mOnClickListener;
public RockAdapter(Context context) {
mContext = context;
mInflater = LayoutInflater.from(context);
mList = new ArrayList<>();
TiRockEnum[] values = TiRockEnum.values();
for (int i = 0, size = values.length; i < size; i++) {
RockBean bean = new RockBean(values[i]);
if (i == 0) {
bean.setChecked(true);
}
mList.add(bean);
}
mCheckedColor = ContextCompat.getColor(context, R.color.global);
mUnCheckedColor = 0xffffffff;
mOnClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
Object tag = v.getTag();
if (tag != null) {
int position = (int) tag;
if (mCheckedPosition != position) {
mList.get(mCheckedPosition).setChecked(false);
mList.get(position).setChecked(true);
notifyItemChanged(mCheckedPosition, Constants.PAYLOAD);
notifyItemChanged(position, Constants.PAYLOAD);
mCheckedPosition = position;
if (mActionListener != null) {
mActionListener.onItemClick(mList.get(position).getTiRockEnum());
}
}
}
}
};
}
public void setActionListener(ActionListener listener) {
mActionListener = listener;
}
@Override
public Vh onCreateViewHolder(ViewGroup parent, int viewType) {
return new Vh(mInflater.inflate(R.layout.view_item_list_beauty_filter, parent, false));
}
@Override
public void onBindViewHolder(Vh vh, int position) {
}
@Override
public void onBindViewHolder(Vh vh, int position, List<Object> payloads) {
Object payload = payloads.size() > 0 ? payloads.get(0) : null;
vh.setData(mList.get(position), position, payload);
}
@Override
public int getItemCount() {
return mList.size();
}
class Vh extends RecyclerView.ViewHolder {
TextView mTextView;
public Vh(View itemView) {
super(itemView);
mTextView = (TextView) itemView;
itemView.setOnClickListener(mOnClickListener);
}
void setData(RockBean bean, int position, Object payload) {
itemView.setTag(position);
if (payload == null) {
mTextView.setText(bean.getTiRockEnum().getString(mContext));
}
if (mCheckedPosition == position) {
mTextView.setTextColor(mCheckedColor);
} else {
mTextView.setTextColor(mUnCheckedColor);
}
}
}
public interface ActionListener {
void onItemClick(TiRockEnum tiRockEnum);
}
}

View File

@ -0,0 +1,215 @@
package com.yunbao.beauty.adapter;
import android.content.Context;
import android.graphics.drawable.Drawable;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.RecyclerView;
import android.util.SparseArray;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import com.yunbao.beauty.bean.TieZhiBean;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants;
import com.yunbao.beauty.R;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.utils.DownloadUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import java.io.File;
import java.util.List;
import cn.tillusory.sdk.TiSDK;
import cn.tillusory.sdk.common.TiUtils;
/**
* Created by cxf on 2018/6/23.
* 萌颜 贴纸
*/
public class TieZhiAdapter extends RecyclerView.Adapter<TieZhiAdapter.Vh> {
private Context mContext;
private List<TieZhiBean> mList;
private LayoutInflater mInflater;
private Drawable mCheckDrawable;
private int mCheckedPosition;
private OnItemClickListener<TieZhiBean> mOnItemClickListener;
private static final int MAX_DOWNLOAD_TASK = 3;
private SparseArray<String> mLoadingTaskMap;
private DownloadUtil mDownloadUtil;
private View.OnClickListener mOnClickListener;
public TieZhiAdapter(Context context) {
mContext = context;
mList = TieZhiBean.getTieZhiList(context);
mInflater = LayoutInflater.from(context);
mCheckDrawable = ContextCompat.getDrawable(context, R.drawable.bg_item_tiezhi);
mLoadingTaskMap = new SparseArray<>();
mDownloadUtil = new DownloadUtil();
mOnClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
Object tag = v.getTag();
if (tag == null) {
return;
}
final int position = (int) tag;
if (position < 0 || position >= mList.size()) {
return;
}
final TieZhiBean bean = mList.get(position);
if (bean == null) {
return;
}
if (!bean.isDownloaded()) {
if (mDownloadUtil != null && mLoadingTaskMap.size() < MAX_DOWNLOAD_TASK &&
mLoadingTaskMap.indexOfKey(position) < 0) {//不存在这个key
String name = bean.getName();
mLoadingTaskMap.put(position, name);
bean.setDownloading(true);
notifyItemChanged(position, Constants.PAYLOAD);
mDownloadUtil.download(name, CommonAppConfig.VIDEO_TIE_ZHI_PATH, name, bean.getUrl(), new DownloadUtil.Callback() {
@Override
public void onSuccess(File file) {
if (file != null) {
File targetDir = new File(TiSDK.getStickerPath(mContext));
try {
//解压到贴纸目录
TiUtils.unzip(file, targetDir);
bean.setDownloadSuccess(mContext);
} catch (Exception e) {
ToastUtil.show(WordUtil.getString(R.string.tiezhi_download_failed));
bean.setDownloading(false);
} finally {
file.delete();
notifyItemChanged(position, Constants.PAYLOAD);
mLoadingTaskMap.remove(position);
}
}
}
@Override
public void onProgress(int progress) {
}
@Override
public void onError(Throwable e) {
ToastUtil.show(WordUtil.getString(R.string.tiezhi_download_failed));
bean.setDownloading(false);
notifyItemChanged(position, Constants.PAYLOAD);
mLoadingTaskMap.remove(position);
}
});
}
} else {
if (mCheckedPosition != position) {
if (mCheckedPosition >= 0 && mCheckedPosition < mList.size()) {
mList.get(mCheckedPosition).setChecked(false);
}
mList.get(position).setChecked(true);
notifyItemChanged(mCheckedPosition, Constants.PAYLOAD);
notifyItemChanged(position, Constants.PAYLOAD);
mCheckedPosition = position;
if (mOnItemClickListener != null) {
mOnItemClickListener.onItemClick(bean, position);
}
}
}
}
};
}
public void setOnItemClickListener(OnItemClickListener<TieZhiBean> onItemClickListener) {
mOnItemClickListener = onItemClickListener;
}
@Override
public Vh onCreateViewHolder(ViewGroup parent, int viewType) {
return new Vh(mInflater.inflate(R.layout.item_list_tiezhi, parent, false));
}
@Override
public void onBindViewHolder(Vh holder, int position) {
}
@Override
public void onBindViewHolder(Vh vh, int position, List<Object> payloads) {
Object payload = payloads.size() > 0 ? payloads.get(0) : null;
vh.setData(mList.get(position), position, payload);
}
@Override
public int getItemCount() {
return mList.size();
}
class Vh extends RecyclerView.ViewHolder {
ImageView mImg;
View mLoading;
View mDownLoad;
public Vh(View itemView) {
super(itemView);
mImg = (ImageView) itemView.findViewById(R.id.img);
mLoading = itemView.findViewById(R.id.loading);
mDownLoad = itemView.findViewById(R.id.download);
itemView.setOnClickListener(mOnClickListener);
}
void setData(TieZhiBean bean, int position, Object payload) {
itemView.setTag(position);
if (payload == null) {
if (position == 0) {
mImg.setImageResource(R.mipmap.icon_tiezhi_none);
} else {
ImgLoader.display(mContext,bean.getThumb(), mImg);
}
}
if (bean.isDownloading()) {
if (mLoading.getVisibility() != View.VISIBLE) {
mLoading.setVisibility(View.VISIBLE);
}
} else {
if (mLoading.getVisibility() == View.VISIBLE) {
mLoading.setVisibility(View.INVISIBLE);
}
}
if (bean.isDownloaded()) {
if (mDownLoad.getVisibility() == View.VISIBLE) {
mDownLoad.setVisibility(View.INVISIBLE);
}
} else {
if (mDownLoad.getVisibility() != View.VISIBLE) {
mDownLoad.setVisibility(View.VISIBLE);
}
}
if (bean.isChecked()) {
itemView.setBackground(mCheckDrawable);
} else {
itemView.setBackground(null);
}
}
}
public void clear() {
if (mLoadingTaskMap != null) {
for (int i = 0, size = mLoadingTaskMap.size(); i < size; i++) {
String tag = mLoadingTaskMap.valueAt(i);
CommonHttpUtil.cancel(tag);
}
}
}
}

View File

@ -0,0 +1,77 @@
package com.yunbao.beauty.bean;
import cn.tillusory.sdk.bean.TiFilterEnum;
/**
* Created by cxf on 2018/8/4.
*/
public class FilterBean {
private int mImgSrc;
private int mFilterSrc;
private TiFilterEnum mTiFilterEnum;
private boolean mChecked;
private int mKsyFilterType;//金山自带滤镜类型
public FilterBean() {
}
public FilterBean(TiFilterEnum tiFilterEnum) {
mTiFilterEnum = tiFilterEnum;
}
public FilterBean(int imgSrc, int filterSrc, TiFilterEnum tiFilterEnum) {
mImgSrc = imgSrc;
mFilterSrc = filterSrc;
mTiFilterEnum = tiFilterEnum;
}
public FilterBean(int imgSrc, int filterSrc, TiFilterEnum tiFilterEnum, int ksyFilterType) {
this(imgSrc, filterSrc, tiFilterEnum);
mKsyFilterType = ksyFilterType;
}
public FilterBean(int imgSrc, int filterSrc, TiFilterEnum tiFilterEnum, int ksyFilterType, boolean checked) {
this(imgSrc, filterSrc, tiFilterEnum, ksyFilterType);
mChecked = checked;
}
public int getImgSrc() {
return mImgSrc;
}
public void setImgSrc(int imgSrc) {
this.mImgSrc = imgSrc;
}
public int getFilterSrc() {
return mFilterSrc;
}
public void setFilterSrc(int filterSrc) {
mFilterSrc = filterSrc;
}
public TiFilterEnum getTiFilterEnum() {
return mTiFilterEnum;
}
public boolean isChecked() {
return mChecked;
}
public void setChecked(boolean checked) {
mChecked = checked;
}
public int getKsyFilterType() {
return mKsyFilterType;
}
public void setKsyFilterType(int ksyFilterType) {
mKsyFilterType = ksyFilterType;
}
}

View File

@ -0,0 +1,29 @@
package com.yunbao.beauty.bean;
import cn.tillusory.sdk.bean.TiRockEnum;
/**
* Created by cxf on 2018/8/4.
*/
public class RockBean {
private TiRockEnum mTiRockEnum;
private boolean mChecked;
public RockBean(TiRockEnum tiRockEnum) {
mTiRockEnum = tiRockEnum;
}
public boolean isChecked() {
return mChecked;
}
public void setChecked(boolean checked) {
mChecked = checked;
}
public TiRockEnum getTiRockEnum() {
return mTiRockEnum;
}
}

View File

@ -0,0 +1,94 @@
package com.yunbao.beauty.bean;
import android.content.Context;
import java.util.ArrayList;
import java.util.List;
import cn.tillusory.sdk.bean.TiSticker;
/**
* Created by cxf on 2018/6/23.
*/
public class TieZhiBean {
private TiSticker tiSticker;
private boolean checked;
private boolean downloading;
public TieZhiBean(TiSticker tiSticker) {
this.tiSticker = tiSticker;
}
public TieZhiBean(TiSticker tiSticker, boolean checked) {
this.tiSticker = tiSticker;
this.checked = checked;
}
public String getUrl() {
if (this.tiSticker != null) {
return this.tiSticker.getUrl();
}
return null;
}
public String getName() {
if (this.tiSticker != null) {
return this.tiSticker.getName();
}
return null;
}
public String getThumb() {
if (this.tiSticker != null) {
return this.tiSticker.getThumb();
}
return null;
}
public boolean isDownloaded() {
if (this.tiSticker != null) {
return this.tiSticker.isDownloaded();
}
return false;
}
public void setDownloadSuccess(Context context) {
if (this.tiSticker != null) {
this.tiSticker.setDownloaded(true);
this.tiSticker.stickerDownload(context);
}
downloading=false;
}
public boolean isChecked() {
return checked;
}
public void setChecked(boolean checked) {
this.checked = checked;
}
public boolean isDownloading() {
return downloading;
}
public void setDownloading(boolean downloading) {
this.downloading = downloading;
}
/**
* 获取贴纸列表
*/
public static List<TieZhiBean> getTieZhiList(Context context) {
List<TieZhiBean> result = new ArrayList<>();
result.add(new TieZhiBean(TiSticker.NO_STICKER, true));
List<TiSticker> list = TiSticker.getAllStickers(context);
for (TiSticker tiSticker : list) {
result.add(new TieZhiBean(tiSticker));
}
return result;
}
}

View File

@ -0,0 +1,596 @@
package com.yunbao.beauty.custom;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import androidx.annotation.ColorInt;
import androidx.annotation.Dimension;
import androidx.annotation.DrawableRes;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
import android.util.TypedValue;
import android.view.View;
/**
* RecyclerView分割线
* 来自github https://github.com/binbinqq86/DividerItemDecoration
*/
public class ItemDecoration2 extends RecyclerView.ItemDecoration {
private static final String TAG = "ItemDecoration";
private Drawable mDivider;
private int dividerHeight;
private int dividerWidth;
private int dividerColor;
private static final int[] ATTRS = new int[]{android.R.attr.listDivider};
private static final int HORIZONTAL_LIST = LinearLayoutManager.HORIZONTAL;
private static final int VERTICAL_LIST = LinearLayoutManager.VERTICAL;
/**
* 设置是否显示左右边界线
*/
private boolean drawBorderLeftAndRight = false;
/**
* 设置是否显示上下边界线
*/
private boolean drawBorderTopAndBottom = false;
/**
* 是否只留空白不画分割线
*/
private boolean onlySetItemOffsetsButNoDraw=false;
/**
* 是否是线性布局
*/
private boolean isLinearLayoutManager=true;
/**
* 布局方向
*/
private int orientation=VERTICAL_LIST;
public ItemDecoration2(Context context) {
final TypedArray a = context.obtainStyledAttributes(ATTRS);
mDivider = a.getDrawable(0);
a.recycle();
this.dividerHeight=mDivider.getIntrinsicHeight();
this.dividerWidth=mDivider.getIntrinsicWidth();
}
/**
* 自定义分割线
*
* @param context
* @param drawableId 分割线图片
*/
public ItemDecoration2(Context context, @DrawableRes int drawableId) {
mDivider = ContextCompat.getDrawable(context, drawableId);
this.dividerHeight=mDivider.getIntrinsicHeight();
this.dividerWidth=mDivider.getIntrinsicWidth();
}
/**
* 自定义分割线
* 也可以使用{@link Canvas#drawRect(float, float, float, float, Paint)}或者{@link Canvas#drawText(String, float, float, Paint)}等等
* 结合{@link Paint}去绘制各式各样的分割线
* @param context
* @param color 整型颜色值非资源id
* @param dividerWidth 单位为dp
* @param dividerHeight 单位为dp
*/
public ItemDecoration2(Context context, @ColorInt int color, @Dimension float dividerWidth, @Dimension float dividerHeight) {
mDivider = new ColorDrawable(color);
this.dividerWidth= (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,dividerWidth,context.getResources().getDisplayMetrics());
this.dividerHeight= (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,dividerHeight,context.getResources().getDisplayMetrics());
}
/**
* 垂直滚动item宽度充满高度自适应
* 水平滚动,item高度充满宽度自适应
* 在itemView绘制完成之前调用也就是说此方法draw出来的效果将会在itemView的下面
* onDrawOver方法draw出来的效果将叠加在itemView的上面
* @param c
* @param parent
* @param state
*/
@Override
public void onDrawOver(Canvas c, RecyclerView parent, RecyclerView.State state) {
if(onlySetItemOffsetsButNoDraw){
return;
}
if(isLinearLayoutManager){
drawLinearItemDivider(c,parent);
}else{
drawHorizontalLine(c, parent);
drawVerticalLine(c, parent);
}
}
private void drawLinearItemDivider(Canvas c, RecyclerView parent){
int spanCount = getSpanCount(parent);
int allChildCount = parent.getAdapter().getItemCount();
int top=0,bottom=0,left=0,right=0;
for (int i = 0; i < parent.getChildCount(); i++) {
final View child = parent.getChildAt(i);
final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
if(orientation==VERTICAL_LIST){//画横线
left = child.getLeft() - params.leftMargin;
right = child.getRight() + params.rightMargin;
if(drawBorderTopAndBottom){
//加上第一条
if(isFirstRaw(parent,params.getViewLayoutPosition(),spanCount)){
top=child.getTop()-params.topMargin-dividerHeight;
bottom = top + dividerHeight;
mDivider.setBounds(left, top, right, bottom);
mDivider.draw(c);
}
}else{
if(isLastRaw(parent,params.getViewLayoutPosition(),spanCount,allChildCount)){
continue;
}
}
top = child.getBottom() + params.bottomMargin;
bottom = top + dividerHeight;
mDivider.setBounds(left, top, right, bottom);
mDivider.draw(c);
}else{//画竖线
top=child.getTop()-params.topMargin;
bottom=child.getBottom()+params.bottomMargin;
if(drawBorderLeftAndRight){
//加上第一条
if(isFirstColumn(parent,params.getViewLayoutPosition(),spanCount)){
left=child.getLeft()-params.leftMargin-dividerWidth;
right = left + dividerWidth;
mDivider.setBounds(left, top, right, bottom);
mDivider.draw(c);
}
}else{
if(isLastColum(parent,params.getViewLayoutPosition(),spanCount,allChildCount)){
continue;
}
}
left = child.getRight() + params.rightMargin;
right = left + dividerWidth;
mDivider.setBounds(left, top, right, bottom);
mDivider.draw(c);
}
}
if(orientation==VERTICAL_LIST){
if(drawBorderLeftAndRight){
top = parent.getPaddingTop();
bottom = parent.getHeight() - parent.getPaddingBottom();
left=parent.getPaddingLeft();
right=left+dividerWidth;
//画左边界
mDivider.setBounds(left,top,right,bottom);
mDivider.draw(c);
left=parent.getWidth()-parent.getPaddingRight()-dividerWidth;
right=left+dividerWidth;
// Log.e(TAG, "drawLinearItemDivider: "+parent.getWidth()+"#"+parent.getPaddingLeft()+"#"+mDivider.getIntrinsicWidth() );
//画右边界
mDivider.setBounds(left,top,right,bottom);
mDivider.draw(c);
}
}else if(orientation==HORIZONTAL_LIST){
if(drawBorderTopAndBottom){
left=parent.getPaddingLeft();
right=parent.getWidth()-parent.getPaddingRight();
top=parent.getPaddingTop();
bottom=top+dividerHeight;
//画上边界
mDivider.setBounds(left,top,right,bottom);
mDivider.draw(c);
top=parent.getHeight()-parent.getPaddingBottom()-dividerHeight;
bottom=top+dividerHeight;
//画下边界
mDivider.setBounds(left,top,right,bottom);
mDivider.draw(c);
}
}
}
/**
* 画水平分割线
* @param c
* @param parent
*/
private void drawHorizontalLine(Canvas c, RecyclerView parent) {
int spanCount = getSpanCount(parent);
for (int i = 0; i < parent.getChildCount(); i++) {
final View child = parent.getChildAt(i);
final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
int top=0,bottom=0,left=0,right=0;
left = child.getLeft() - params.leftMargin;
//因为getItemOffsets中为竖线留了空隙所以要加上分割线的宽度在此处处理下面不用处理
right = child.getRight() + params.rightMargin+ dividerWidth;
if(i==parent.getChildCount()-1 && !drawBorderLeftAndRight){
right-=dividerWidth;//防止最后一个越界
}
if(isFirstColumn(parent,params.getViewLayoutPosition(),spanCount) && drawBorderLeftAndRight){
left-=dividerWidth;//下面不用处理
}
if(drawBorderTopAndBottom){
//加上第一条
if(isFirstRaw(parent,params.getViewLayoutPosition(),spanCount)){
top=child.getTop()-params.topMargin-dividerHeight;
bottom = top + dividerHeight;
mDivider.setBounds(left, top, right, bottom);
mDivider.draw(c);
}
}else{
int allChildCount = parent.getAdapter().getItemCount();
if(isLastRaw(parent,params.getViewLayoutPosition(),spanCount,allChildCount)){
continue;
}
}
// Log.e(TAG, "drawVertical: "+params.getViewLayoutPosition()+"@@"+mDivider.getIntrinsicWidth()+"#"+parent.getLayoutManager().getLeftDecorationWidth(child) );
top = child.getBottom() + params.bottomMargin;
bottom = top + dividerHeight;
mDivider.setBounds(left, top, right, bottom);
mDivider.draw(c);
}
}
/**
* 画垂直分割线
* @param c
* @param parent
*/
private void drawVerticalLine(Canvas c, RecyclerView parent) {
int spanCount = getSpanCount(parent);
for (int i = 0; i < parent.getChildCount(); i++) {
final View child = parent.getChildAt(i);
final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child .getLayoutParams();
int left=0,right=0,top=0,bottom=0;
top=child.getTop()-params.topMargin;
//因为getItemOffsets中为横线留了空隙所以要加上分割线的高度(上下加一处即可)
bottom=child.getBottom()+params.bottomMargin/**+mDivider.getIntrinsicHeight()*/;
// if(isFirstRaw(parent,params.getViewLayoutPosition(),spanCount) && drawBorderTopAndBottom){
// top-=mDivider.getIntrinsicHeight();
// }
if(drawBorderLeftAndRight){
//加上第一条
if(isFirstColumn(parent,params.getViewLayoutPosition(),spanCount)){
left=child.getLeft()-params.leftMargin-dividerWidth;
right = left + dividerWidth;
mDivider.setBounds(left, top, right, bottom);
mDivider.draw(c);
}
}else{
int allChildCount = parent.getAdapter().getItemCount();
if(isLastColum(parent,params.getViewLayoutPosition(),spanCount,allChildCount)){
continue;
}
}
left = child.getRight() + params.rightMargin;
right = left + dividerWidth;
mDivider.setBounds(left, top, right, bottom);
mDivider.draw(c);
}
}
/**
* item的偏移如果不设置也能画线但是画在了item后面(被item挡住了可以通过设置item背景透明度证实)
* @param outRect
* @param view
* @param parent
* @param state
*/
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
RecyclerView.LayoutManager layoutManager = parent.getLayoutManager();
if(!(layoutManager instanceof LinearLayoutManager)){
throw new IllegalStateException("The LayoutManager must be LinearLayoutManager or it's subclass!!!");
}
isLinearLayoutManager=(layoutManager instanceof LinearLayoutManager) && !(layoutManager instanceof GridLayoutManager);
if(isLinearLayoutManager){
orientation=((LinearLayoutManager) layoutManager).getOrientation();
}else{
orientation=(layoutManager instanceof GridLayoutManager)?((GridLayoutManager) layoutManager).getOrientation():((StaggeredGridLayoutManager)layoutManager).getOrientation();
}
int spanCount = getSpanCount(parent);
int childCount = parent.getAdapter().getItemCount();
int itemPosition=((RecyclerView.LayoutParams) view.getLayoutParams()).getViewLayoutPosition();
// Log.e(TAG, "getItemOffsets: "+childCount+"$"+spanCount+"$"+itemPosition );
boolean isLastRaw=isLastRaw(parent, itemPosition, spanCount, childCount);
boolean isLastColum=isLastColum(parent, itemPosition, spanCount, childCount);
boolean isFirstRaw=isFirstRaw(parent,itemPosition,spanCount);
boolean isFirstColumn=isFirstColumn(parent,itemPosition,spanCount);
int left=0,top=0,right=0,bottom=0;
if(isLinearLayoutManager){
if(orientation==VERTICAL_LIST){
//垂直滚动线性布局
bottom=dividerHeight;
if(isLastRaw && !drawBorderTopAndBottom){
bottom=0;
}
if(isFirstRaw && drawBorderTopAndBottom){
top=dividerHeight;
}
if(drawBorderLeftAndRight){
left=dividerWidth;
right=dividerWidth;
}
}else if(orientation==HORIZONTAL_LIST){
right=dividerWidth;
if(isLastColum && !drawBorderLeftAndRight){
right=0;
}
if(isFirstColumn && drawBorderLeftAndRight){
left=dividerWidth;
}
if(drawBorderTopAndBottom){
top=dividerHeight;
bottom=dividerHeight;
}
}
}else{
GridLayoutManager.SpanSizeLookup spanSizeLookup = ((GridLayoutManager)layoutManager).getSpanSizeLookup();
int spanIndexLeft = spanSizeLookup.getSpanIndex(itemPosition, spanCount);//左边的跨度索引值[0,spanCount)之间
int spanIndexRight = spanIndexLeft - 1 + spanSizeLookup.getSpanSize(itemPosition);//右边的跨度索引值[0,spanCount)之间
// Log.e(TAG, "getItemOffsets: "+spanIndexLeft +"#"+spanIndexRight+"#"+itemPosition+"$$$"+spanSizeLookup.getSpanGroupIndex(itemPosition, spanCount));
if(orientation==VERTICAL_LIST){
if(drawBorderLeftAndRight){
//如果此处不能整除会造成divider的宽或高不统一的bug下同因为Rect不支持float所以暂无法解决
left=dividerWidth * (spanCount - spanIndexLeft) / spanCount;
right=dividerWidth * (spanIndexRight + 1) / spanCount;
}else{
left = dividerWidth * spanIndexLeft / spanCount;
right = dividerWidth * (spanCount - spanIndexRight - 1) / spanCount;
}
if(drawBorderTopAndBottom){
if (spanSizeLookup.getSpanGroupIndex(itemPosition, spanCount) == 0) {
top = dividerHeight;
} else {
top = 0;
}
bottom = dividerHeight;
}else{
if (isLastRaw) {
bottom=0;
} else {
bottom = dividerHeight;
}
top=0;
}
}else if(orientation==HORIZONTAL_LIST){
if(drawBorderTopAndBottom){
top=dividerHeight * (spanCount - spanIndexLeft) / spanCount;
bottom=dividerHeight * (spanIndexRight + 1) / spanCount;
}else{
top = dividerHeight * spanIndexLeft / spanCount;
bottom = dividerHeight * (spanCount - spanIndexRight - 1) / spanCount;
}
if(drawBorderLeftAndRight){
if(isFirstColumn){
left=dividerWidth;
}else{
left=0;
}
right=dividerWidth;
}else{
if(isLastColum){
right=0;
}else{
right=dividerWidth;
}
left=0;
}
}
}
//Log.e(TAG, "getItemOffsets: "+left+"@"+top+"#"+right+"$"+bottom+"%"+itemPosition );
outRect.set(left,top,right,bottom);
}
private boolean isFirstRaw(RecyclerView parent, int pos, int spanCount){
if (!isLinearLayoutManager) {
GridLayoutManager.SpanSizeLookup spanSizeLookup = ((GridLayoutManager)parent.getLayoutManager()).getSpanSizeLookup();
int spanIndexLeft = spanSizeLookup.getSpanIndex(pos, spanCount);
if (orientation == GridLayoutManager.VERTICAL) {
// if(pos<spanCount){
// return true;
// }
//=========================另一种方案兼容每个item的spanSize不同的情况==============================
if(spanSizeLookup.getSpanGroupIndex(pos,spanCount)==0){
return true;
}
}else{
// if(pos%spanCount==0){
// return true;
// }
//=========================另一种方案兼容每个item的spanSize不同的情况==============================
if(spanIndexLeft==0){
return true;
}
}
}else{
if (orientation == LinearLayoutManager.VERTICAL) {
if(pos==0){
return true;
}
}else{
//每一个都是第一行也是最后一行
return true;
}
}
return false;
}
private boolean isFirstColumn(RecyclerView parent, int pos, int spanCount){
if (!isLinearLayoutManager) {
GridLayoutManager.SpanSizeLookup spanSizeLookup = ((GridLayoutManager)parent.getLayoutManager()).getSpanSizeLookup();
int spanIndexLeft = spanSizeLookup.getSpanIndex(pos, spanCount);
if (orientation == GridLayoutManager.VERTICAL) {
// if(pos%spanCount==0){
// return true;
// }
//=========================另一种方案兼容每个item的spanSize不同的情况==============================
if(spanIndexLeft==0){
return true;
}
}else{
// if(pos<spanCount){
// return true;
// }
//=========================另一种方案兼容每个item的spanSize不同的情况==============================
if(spanSizeLookup.getSpanGroupIndex(pos,spanCount)==0){
return true;
}
}
}else{
if (orientation == LinearLayoutManager.VERTICAL) {
//每一个都是第一列也是最后一列
return true;
}else{
if(pos==0){
return true;
}
}
}
return false;
}
private boolean isLastColum(RecyclerView parent, int pos, int spanCount, int childCount) {
if (!isLinearLayoutManager) {
GridLayoutManager.SpanSizeLookup spanSizeLookup = ((GridLayoutManager)parent.getLayoutManager()).getSpanSizeLookup();
int spanIndexLeft = spanSizeLookup.getSpanIndex(pos, spanCount);
if (orientation == GridLayoutManager.VERTICAL) {
//最后一列或者不能整除的情况下最后一个
// if ((pos + 1) % spanCount == 0 /**|| pos==childCount-1*/){// 如果是最后一列
// return true;
// }
//=========================另一种方案兼容每个item的spanSize不同的情况==============================
if(spanIndexLeft==spanCount-1 || spanCount==spanSizeLookup.getSpanSize(pos) || pos==childCount-1){
return true;
}
}else{
// if(pos>=childCount-spanCount && childCount%spanCount==0){
// //整除的情况判断最后一整列
// return true;
// }else if(childCount%spanCount!=0 && pos>=spanCount*(childCount/spanCount)){
// //不能整除的情况只判断最后几个
// return true;
// }
//=========================另一种方案==============================
// if(pos>=childCount-spanCount){
// return true;
// }
//=========================另一种方案兼容每个item的spanSize不同的情况==============================
int lastItemSpanGroupIndex=spanSizeLookup.getSpanGroupIndex(childCount-1,spanCount);
if(spanSizeLookup.getSpanGroupIndex(pos,spanCount)==lastItemSpanGroupIndex){
return true;//如果与最后一个元素同组则判定为最后一行
}
}
}else{
if (orientation == LinearLayoutManager.VERTICAL) {
//每一个都是第一列也是最后一列
return true;
}else{
if(pos==childCount-1){
return true;
}
}
}
return false;
}
private boolean isLastRaw(RecyclerView parent, int pos, int spanCount, int childCount) {
if (!isLinearLayoutManager) {
GridLayoutManager.SpanSizeLookup spanSizeLookup = ((GridLayoutManager)parent.getLayoutManager()).getSpanSizeLookup();
int spanIndexLeft = spanSizeLookup.getSpanIndex(pos, spanCount);
if (orientation == GridLayoutManager.VERTICAL) {
// if(pos>=childCount-spanCount && childCount%spanCount==0){
// //整除的情况判断最后一整行
// return true;
// }else if(childCount%spanCount!=0 && pos>=spanCount*(childCount/spanCount)){
// //不能整除的情况只判断最后几个
// return true;
// }
//=======================另一种方案===============================
// if(pos>=childCount-spanCount){
// return true;
// }
//=========================另一种方案兼容每个item的spanSize不同的情况==============================
//判断最后一行是否充满整行
boolean flag=spanSizeLookup.getSpanIndex(childCount-1, spanCount)==spanCount-1 || spanCount==spanSizeLookup.getSpanSize(childCount-1);
int lastItemSpanGroupIndex=spanSizeLookup.getSpanGroupIndex(childCount-1,spanCount);
if(spanSizeLookup.getSpanGroupIndex(pos,spanCount)==lastItemSpanGroupIndex){
return true;//如果与最后一个元素同组则判定为最后一行
}
// if(flag){
// }else{
// //没有充满则前一行跟最后一行都判定为最后一行
// if(spanSizeLookup.getSpanGroupIndex(pos,spanCount)==lastItemSpanGroupIndex || spanSizeLookup.getSpanGroupIndex(pos,spanCount)==lastItemSpanGroupIndex-1){
// return true;
// }
// }
}else{
//最后一行或者不能整除的情况下最后一个
// if ((pos + 1) % spanCount == 0 /**|| pos==childCount-1*/){// 如果是最后一行
// return true;
// }
//=========================另一种方案兼容每个item的spanSize不同的情况==============================
if(spanIndexLeft==spanCount-1 || spanCount==spanSizeLookup.getSpanSize(pos) || pos==childCount-1){
return true;
}
}
}else{
if (orientation == LinearLayoutManager.VERTICAL) {
if(pos==childCount-1){
return true;
}
}else{
//每一个都是第一行也是最后一行
return true;
}
}
return false;
}
private int getSpanCount(RecyclerView parent) {
// 列数
int spanCount = -1;
RecyclerView.LayoutManager layoutManager = parent.getLayoutManager();
if (layoutManager instanceof GridLayoutManager) {
spanCount = ((GridLayoutManager) layoutManager).getSpanCount();
} else if (layoutManager instanceof StaggeredGridLayoutManager) {
spanCount = ((StaggeredGridLayoutManager) layoutManager).getSpanCount();
}
return spanCount;
}
public boolean isDrawBorderTopAndBottom() {
return drawBorderTopAndBottom;
}
public void setDrawBorderTopAndBottom(boolean drawBorderTopAndBottom) {
this.drawBorderTopAndBottom = drawBorderTopAndBottom;
}
public boolean isDrawBorderLeftAndRight() {
return drawBorderLeftAndRight;
}
public void setDrawBorderLeftAndRight(boolean drawBorderLeftAndRight) {
this.drawBorderLeftAndRight = drawBorderLeftAndRight;
}
public boolean isOnlySetItemOffsetsButNoDraw() {
return onlySetItemOffsetsButNoDraw;
}
public void setOnlySetItemOffsetsButNoDraw(boolean onlySetItemOffsetsButNoDraw) {
this.onlySetItemOffsetsButNoDraw = onlySetItemOffsetsButNoDraw;
}
}

View File

@ -0,0 +1,100 @@
package com.yunbao.beauty.custom;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.widget.RadioButton;
import com.yunbao.beauty.R;
/**
* Created by cxf on 2017/7/19.
* 可以调节drawable大小的RadioButton
*/
public class MyRadioButton extends RadioButton {
private int mDrawableSize;
private int mTopDrawableSize;
private int mLeftDrawableSize;
private int mRightDrawableSize;
private int mBottomDrawableSize;
private Drawable mTopDrawable;
private Drawable mLeftDrawable;
private Drawable mRightDrawable;
private Drawable mBottomDrawable;
private float mScale;
public MyRadioButton(Context context) {
this(context, null);
}
public MyRadioButton(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public MyRadioButton(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
mScale = context.getResources().getDisplayMetrics().density;
TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.MyRadioButton);
mDrawableSize = (int) ta.getDimension(R.styleable.MyRadioButton_mr_drawableSize1, dp2px(20));
mTopDrawableSize = (int) ta.getDimension(R.styleable.MyRadioButton_mr_top_drawableSize1, mDrawableSize);
mLeftDrawableSize = (int) ta.getDimension(R.styleable.MyRadioButton_mr_left_drawableSize1, mDrawableSize);
mRightDrawableSize = (int) ta.getDimension(R.styleable.MyRadioButton_mr_right_drawableSize1, mDrawableSize);
mBottomDrawableSize = (int) ta.getDimension(R.styleable.MyRadioButton_mr_bottom_drawableSize1, mDrawableSize);
mTopDrawable = ta.getDrawable(R.styleable.MyRadioButton_mr_top_drawable1);
mLeftDrawable = ta.getDrawable(R.styleable.MyRadioButton_mr_left_drawable1);
mRightDrawable = ta.getDrawable(R.styleable.MyRadioButton_mr_right_drawable1);
mBottomDrawable = ta.getDrawable(R.styleable.MyRadioButton_mr_bottom_drawable1);
ta.recycle();
}
public void setTopDrawable(Drawable topDrawable) {
mTopDrawable = topDrawable;
}
public void setBottomDrawable(Drawable bottomDrawable) {
mBottomDrawable = bottomDrawable;
}
public void setLeftDrawable(Drawable leftDrawable) {
mLeftDrawable = leftDrawable;
}
public void setRightDrawable(Drawable rightDrawable) {
mRightDrawable = rightDrawable;
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
setCompoundDrawablesWithIntrinsicBounds(mLeftDrawable, mTopDrawable, mRightDrawable, mBottomDrawable);
}
@Override
public void setCompoundDrawablesWithIntrinsicBounds(Drawable left, Drawable top, Drawable right, Drawable bottom) {
if (left != null) {
left.setBounds(0, 0, mLeftDrawableSize, mLeftDrawableSize);
}
if (top != null) {
top.setBounds(0, 0, mTopDrawableSize, mTopDrawableSize);
}
if (right != null) {
right.setBounds(0, 0, mRightDrawableSize, mRightDrawableSize);
}
if (bottom != null) {
bottom.setBounds(0, 0, mBottomDrawableSize, mBottomDrawableSize);
}
setCompoundDrawables(left, top, right, bottom);
}
private int dp2px(int dpVal) {
return (int) (dpVal * mScale + 0.5f);
}
}

View File

@ -0,0 +1,31 @@
package com.yunbao.beauty.custom;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.ImageView;
/**
* Created by cxf on 2018/6/7.
*/
public class SquareImageView2 extends ImageView {
public SquareImageView2(Context context) {
super(context);
}
public SquareImageView2(Context context, AttributeSet attrs) {
super(context, attrs);
}
public SquareImageView2(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int widthSize = MeasureSpec.getSize(widthMeasureSpec);
heightMeasureSpec = MeasureSpec.makeMeasureSpec(widthSize, MeasureSpec.EXACTLY);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
}

View File

@ -0,0 +1,113 @@
package com.yunbao.beauty.custom;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.SeekBar;
import android.widget.TextView;
import com.yunbao.beauty.R;
/**
* Created by cxf on 2018/6/22.
*/
public class TextSeekBar extends FrameLayout implements SeekBar.OnSeekBarChangeListener {
private SeekBar mSeekBar;
private TextView mTextView;
private TextView mProgressVal;
private Context mContext;
private String mText;
private int mProgress;
private OnSeekChangeListener mOnSeekChangeListener;
public TextSeekBar(Context context) {
this(context, null);
}
public TextSeekBar(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public TextSeekBar(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
mContext = context;
TypedArray ta = context.getResources().obtainAttributes(attrs, R.styleable.TextSeekBar);
mText = ta.getString(R.styleable.TextSeekBar_text2);
mProgress = ta.getInteger(R.styleable.TextSeekBar_progressVal, 0);
ta.recycle();
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
View v = LayoutInflater.from(mContext).inflate(R.layout.view_seek_group, this, false);
mSeekBar = (SeekBar) v.findViewById(R.id.seekBar);
mTextView = (TextView) v.findViewById(R.id.text);
mProgressVal = (TextView) v.findViewById(R.id.progressVal);
mSeekBar.setProgress(mProgress);
mSeekBar.setOnSeekBarChangeListener(this);
mTextView.setText(mText);
mProgressVal.setText(String.valueOf(mProgress));
addView(v);
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
mProgress = progress;
mProgressVal.setText(String.valueOf(progress));
if (mOnSeekChangeListener != null) {
mOnSeekChangeListener.onProgressChanged(TextSeekBar.this, progress);
}
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
public int getProgress() {
return mProgress;
}
public void setProgress(int progress) {
mProgress = progress;
if (mSeekBar != null) {
mSeekBar.setProgress(progress);
}
}
public float getFloatProgress() {
return mProgress / 100f;
}
public void setOnSeekChangeListener(OnSeekChangeListener listener) {
mOnSeekChangeListener = listener;
}
public interface OnSeekChangeListener {
void onProgressChanged(View view, int progress);
}
@Override
public void setEnabled(boolean enabled) {
super.setEnabled(enabled);
if (mSeekBar != null) {
mSeekBar.setEnabled(enabled);
}
if (enabled) {
setAlpha(1f);
} else {
setAlpha(0.5f);
}
}
}

View File

@ -0,0 +1,43 @@
package com.yunbao.beauty.interfaces;
import cn.tillusory.sdk.bean.TiDistortionEnum;
import cn.tillusory.sdk.bean.TiFilterEnum;
import cn.tillusory.sdk.bean.TiRockEnum;
/**
* Created by cxf on 2018/10/8.
* 360美颜回调
*/
public interface Beauty360EffectListener extends BeautyEffectListener {
//滤镜类型
void onFilterChanged(String filtertype);
//滤镜强度
void onFilterStrength(int filterValue);
//白皙
void onMeiBaiChanged(int progress);
//美颜强度
void onSkinsoftStrengthChanged(int progress);
//红润
void onHongRunChanged(int progress);
//粉嫩
void onFengNenChanged(int progress);
void onBigEyeChanged(int progress);
void onFaceChanged(int progress);
void onTieZhiChanged(String tieZhiName);
void onHaHaChanged(TiDistortionEnum tiDistortionEnum);
void onRockChanged(TiRockEnum tiRockEnum);
void onFaceNarrowing(int progress);
}

View File

@ -0,0 +1,8 @@
package com.yunbao.beauty.interfaces;
/**
* Created by cxf on 2018/12/13.
*/
public interface BeautyEffectListener {
}

View File

@ -0,0 +1,24 @@
package com.yunbao.beauty.interfaces;
/**
* Created by cxf on 2018/12/13.
*/
public interface BeautyViewHolder {
void setEffectListener(BeautyEffectListener effectListener);
void show();
void hide();
boolean isShowed();
void release();
void setVisibleListener(VisibleListener visibleListener);
interface VisibleListener {
void onVisibleChanged(boolean visible);
}
}

View File

@ -0,0 +1,20 @@
package com.yunbao.beauty.interfaces;
import com.yunbao.beauty.bean.FilterBean;
/**
* Created by cxf on 2018/10/8.
* 基础美颜回调
*/
public interface DefaultBeautyEffectListener extends BeautyEffectListener {
void onFilterChanged(FilterBean filterBean);
void onMeiBaiChanged(int progress);
void onMoPiChanged(int progress);
void onHongRunChanged(int progress);
}

Some files were not shown because too many files have changed in this diff Show More