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

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);
}

View File

@@ -0,0 +1,35 @@
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.
* 萌颜美颜回调
*/
public interface TiBeautyEffectListener extends BeautyEffectListener {
void onFilterChanged(TiFilterEnum tiFilterEnum);
void onMeiBaiChanged(int progress);
void onMoPiChanged(int progress);
void onBaoHeChanged(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,440 @@
package com.yunbao.beauty.views;
import android.app.Activity;
import android.content.Context;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.text.TextUtils;
import android.util.SparseArray;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import com.by.lib_beauty360.AppConfig;
import com.by.lib_beauty360.ItemData4LvJing;
import com.by.lib_beauty360.ItemData4TieZhi;
import com.by.lib_beauty360.RecycleView.HomeItemCell4LvJing;
import com.by.lib_beauty360.RecycleView.HomeItemCell4Tiezhi;
import com.by.lib_beauty360.RecycleView.IRecycleCell;
import com.by.lib_beauty360.RecycleView.MyItemClickListener;
import com.by.lib_beauty360.RecycleView.MyItemClickListener4Tiezhi;
import com.by.lib_beauty360.RecycleView.MyRecycleAdapter4LvJing;
import com.by.lib_beauty360.RecycleView.MyRecycleAdapter4Tiezhi;
import com.yunbao.beauty.R;
import com.yunbao.beauty.adapter.RockAdapter;
import com.yunbao.beauty.custom.ItemDecoration2;
import com.yunbao.beauty.custom.TextSeekBar;
import com.yunbao.beauty.interfaces.Beauty360EffectListener;
import com.yunbao.beauty.interfaces.BeautyEffectListener;
import com.yunbao.beauty.interfaces.BeautyViewHolder;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.bean.ConfigBean;
import com.yunbao.common.views.AbsViewHolder;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import cn.tillusory.sdk.bean.TiDistortionEnum;
import cn.tillusory.sdk.bean.TiRockEnum;
/**
* Created by cxf on 2018/6/22.
* Camera360美颜UI相关
*/
public class Beauty360ViewHolder extends AbsViewHolder implements
View.OnClickListener, BeautyViewHolder, MyItemClickListener , MyItemClickListener4Tiezhi {
private SparseArray<View> mSparseArray;
private int mCurKey;
// private TieZhiAdapter mTieZhiAdapter;
private Beauty360EffectListener mEffectListener;
private VisibleListener mVisibleListener;
private boolean mShowed;
private List<IRecycleCell> mListData4LvJing;
private List<IRecycleCell> mListData4TieZhi;
private String mCurFilterStrength;
private String mCurTiezhiName;
private int mFilterValue = 100;
private MyRecycleAdapter4LvJing mAdapter4LvJing;
private MyRecycleAdapter4Tiezhi mAdapter4Tiezhi;
Activity mActivity;
public Beauty360ViewHolder(Context context, ViewGroup parentView) {
super(context, parentView);
}
public Beauty360ViewHolder(Activity activity, ViewGroup parentView) {
super(activity, parentView);
mActivity= activity;
}
@Override
protected int getLayoutId() {
return R.layout.view_beauty360;
}
@Override
public void init() {
findViewById(R.id.btn_beauty).setOnClickListener(this);
findViewById(R.id.btn_beauty_shape).setOnClickListener(this);
findViewById(R.id.btn_meng).setOnClickListener(this);
findViewById(R.id.btn_filter).setOnClickListener(this);
findViewById(R.id.btn_hide).setOnClickListener(this);
findViewById(R.id.btn_rock).setOnClickListener(this);
findViewById(R.id.btn_haha).setOnClickListener(this);
findViewById(R.id.btn_haha_0).setOnClickListener(this);
findViewById(R.id.btn_haha_1).setOnClickListener(this);
findViewById(R.id.btn_haha_2).setOnClickListener(this);
findViewById(R.id.btn_haha_3).setOnClickListener(this);
findViewById(R.id.btn_haha_4).setOnClickListener(this);
mSparseArray = new SparseArray<>();
mSparseArray.put(R.id.btn_beauty, findViewById(R.id.group_beauty));
mSparseArray.put(R.id.btn_beauty_shape, findViewById(R.id.group_beauty_shape));
mSparseArray.put(R.id.btn_meng, findViewById(R.id.group_meng));
mSparseArray.put(R.id.btn_filter, findViewById(R.id.group_filter));
mSparseArray.put(R.id.btn_rock, findViewById(R.id.group_rock));
mSparseArray.put(R.id.btn_haha, findViewById(R.id.group_haha));
mCurKey = R.id.btn_beauty;
TextSeekBar.OnSeekChangeListener onSeekChangeListener = new TextSeekBar.OnSeekChangeListener() {
@Override
public void onProgressChanged(View view, int progress) {
if (mEffectListener != null) {
int i = view.getId();
if (i == R.id.seek_baixi) {
mEffectListener.onMeiBaiChanged(progress);
} else if (i == R.id.seek_skin_strength) {
mEffectListener.onSkinsoftStrengthChanged(progress);
} else if (i == R.id.seek_hongrun) {
mEffectListener.onHongRunChanged(progress);
} else if (i == R.id.seek_fengnen) {
mEffectListener.onFengNenChanged(progress);
} else if (i == R.id.seek_big_eye) {
mEffectListener.onBigEyeChanged(progress);
}
else if (i == R.id.seek_filter_strength) {
//滤镜强度
mEffectListener.onFilterStrength(progress);
}else if (i == R.id.seek_face) {
mEffectListener.onFaceChanged(progress);
}
else if (i == R.id.seek_face_strength) {
mEffectListener.onFaceNarrowing(progress);
}
}
}
};
TextSeekBar seekMeiBai = ((TextSeekBar) findViewById(R.id.seek_baixi));
TextSeekBar seekMoPi = ((TextSeekBar) findViewById(R.id.seek_skin_strength));
TextSeekBar seekBaoHe = ((TextSeekBar) findViewById(R.id.seek_hongrun));
TextSeekBar seekFenNen = ((TextSeekBar) findViewById(R.id.seek_fengnen));
TextSeekBar seekBigEye = ((TextSeekBar) findViewById(R.id.seek_big_eye));
TextSeekBar seekFilterStrength = ((TextSeekBar) findViewById(R.id.seek_filter_strength));
TextSeekBar seekFace = ((TextSeekBar) findViewById(R.id.seek_face));
TextSeekBar seekFaceNarrowing = ((TextSeekBar) findViewById(R.id.seek_face_strength));
seekMeiBai.setOnSeekChangeListener(onSeekChangeListener);
seekMoPi.setOnSeekChangeListener(onSeekChangeListener);
seekBaoHe.setOnSeekChangeListener(onSeekChangeListener);
seekFenNen.setOnSeekChangeListener(onSeekChangeListener);
seekBigEye.setOnSeekChangeListener(onSeekChangeListener);
seekFilterStrength.setOnSeekChangeListener(onSeekChangeListener);
seekFace.setOnSeekChangeListener(onSeekChangeListener);
seekFaceNarrowing.setOnSeekChangeListener(onSeekChangeListener);
ConfigBean configBean = CommonAppConfig.getInstance().getConfig();
if (configBean != null) {
seekMeiBai.setProgress(configBean.getBeautyMeiBai());
seekMoPi.setProgress(configBean.getBeautyMoPi());
seekBaoHe.setProgress(configBean.getBeautyBaoHe());
seekFenNen.setProgress(configBean.getBeautyFenNen());
seekBigEye.setProgress(configBean.getBeautyBigEye());
seekFilterStrength.setProgress(50);
seekFace.setProgress(configBean.getBeautyFace());
//seekFaceNarrowing.setProgress(configBean.seekFaceNarrowing());
}
//贴纸
// RecyclerView tieZhiRecyclerView = (RecyclerView) findViewById(R.id.tiezhi_recyclerView);
// tieZhiRecyclerView.setHasFixedSize(true);
// tieZhiRecyclerView.setLayoutManager(new GridLayoutManager(mContext, 6, GridLayoutManager.VERTICAL, false));
// ItemDecoration2 decoration1 = new ItemDecoration2(mContext, 0x00000000, 8, 8);
// decoration1.setOnlySetItemOffsetsButNoDraw(true);
// tieZhiRecyclerView.addItemDecoration(decoration1);
// mTieZhiAdapter = new TieZhiAdapter(mContext);
// mTieZhiAdapter.setOnItemClickListener(new OnItemClickListener<TieZhiBean>() {
// @Override
// public void onItemClick(TieZhiBean bean, int position) {
// if (mEffectListener != null) {
// mEffectListener.onTieZhiChanged(bean.getName());
// }
// }
// });
// tieZhiRecyclerView.setAdapter(mTieZhiAdapter);
RecyclerView tieZhiRecyclerView = (RecyclerView) findViewById(R.id.tiezhi_recyclerView);
tieZhiRecyclerView.setHasFixedSize(true);
tieZhiRecyclerView.setLayoutManager(new GridLayoutManager(mContext, 6, GridLayoutManager.VERTICAL, false));
ItemDecoration2 decoration1 = new ItemDecoration2(mContext, 0x00000000, 8, 8);
decoration1.setOnlySetItemOffsetsButNoDraw(true);
tieZhiRecyclerView.addItemDecoration(decoration1);
ConstructList4TieZhi();
mAdapter4Tiezhi = new MyRecycleAdapter4Tiezhi(mActivity, mListData4TieZhi);
tieZhiRecyclerView.setAdapter(mAdapter4Tiezhi);
tieZhiRecyclerView.setItemAnimator(new DefaultItemAnimator());
//滤镜
// RecyclerView filterRecyclerView = (RecyclerView) findViewById(R.id.filter_recyclerView);
// filterRecyclerView.setHasFixedSize(true);
// filterRecyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false));
// FilterAdapter filterAdapter = new FilterAdapter(mContext);
// filterAdapter.setOnItemClickListener(new OnItemClickListener<FilterBean>() {
// @Override
// public void onItemClick(FilterBean bean, int position) {
// if (mEffectListener != null) {
// mEffectListener.onFilterChanged(bean.getTiFilterEnum());
// }
// }
// });
// filterRecyclerView.setAdapter(filterAdapter);
//滤镜
RecyclerView mFilterRecycleView = (RecyclerView) findViewById(R.id.filter_recyclerView);
LinearLayoutManager mLayoutManager = new LinearLayoutManager(mFilterRecycleView.getContext(), LinearLayoutManager.HORIZONTAL, false);
mFilterRecycleView.setLayoutManager(mLayoutManager);
ConstructList4LvJing();
mAdapter4LvJing = new MyRecycleAdapter4LvJing(mActivity, mListData4LvJing);
mFilterRecycleView.setAdapter(mAdapter4LvJing);
mFilterRecycleView.setItemAnimator(new DefaultItemAnimator());
//抖动
RecyclerView rockRecyclerView = (RecyclerView) findViewById(R.id.rock_recyclerView);
rockRecyclerView.setHasFixedSize(true);
rockRecyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false));
RockAdapter rockAdapter = new RockAdapter(mContext);
rockAdapter.setActionListener(new RockAdapter.ActionListener() {
@Override
public void onItemClick(TiRockEnum tiRockEnum) {
if (mEffectListener != null) {
mEffectListener.onRockChanged(tiRockEnum);
}
}
});
rockRecyclerView.setAdapter(rockAdapter);
}
private void ConstructList4LvJing() {
mListData4LvJing = new ArrayList<>();
for (int i = 0; i < AppConfig.mFilterName.length; ++i) {
ItemData4LvJing itemData = new ItemData4LvJing();
itemData.filterName = AppConfig.mFilterNameAll[i];
itemData.filterType = AppConfig.mFilterTypeAll[i];
itemData.filterPictrue=AppConfig.mFilterPictrueAll[i];
mListData4LvJing.add(new HomeItemCell4LvJing(mActivity, itemData, this));
}
}
private void ConstructList4TieZhi() {
mListData4TieZhi = new ArrayList<>();
//遍历解压缩后的文件夹,获取所有贴纸列表
String path= CommonAppConfig.VIDEO_TIE_ZHI_PATH+CommonAppConfig.TIEZHI_360_NAME
+ File.separator + "StickerResource_20170502";
File file=new File(path);
if (file.exists()){
File[] fileList= file.listFiles();
int len=fileList.length;
String [] tiezhiArray=new String[len];
for (int i=0;i<len;i++){
tiezhiArray[i] = fileList[i].getName();
}
//单独添加第一个取消图片
ItemData4TieZhi itemData0 = new ItemData4TieZhi();
itemData0.tieZhiName="";
mListData4TieZhi.add(new HomeItemCell4Tiezhi(mActivity, itemData0, this));
//如果压缩包来自Mac电脑需要去掉.DS_Store文件
for (int i = 0; i < len; ++i) {
if (!tiezhiArray[i].contains("DS_Store")){
ItemData4TieZhi itemData = new ItemData4TieZhi();
itemData.tieZhiName=tiezhiArray[i];
mListData4TieZhi.add(new HomeItemCell4Tiezhi(mActivity, itemData, this));
}
}
}else {
}
}
@Override
public void setEffectListener(BeautyEffectListener effectListener) {
if (effectListener != null && effectListener instanceof Beauty360EffectListener) {
mEffectListener = (Beauty360EffectListener) effectListener;
}
}
@Override
public void show() {
if (mVisibleListener != null) {
mVisibleListener.onVisibleChanged(true);
}
if (mParentView != null && mContentView != null) {
ViewParent parent = mContentView.getParent();
if (parent != null) {
((ViewGroup) parent).removeView(mContentView);
}
mParentView.addView(mContentView);
}
mShowed = true;
}
@Override
public void hide() {
removeFromParent();
if (mVisibleListener != null) {
mVisibleListener.onVisibleChanged(false);
}
mShowed = false;
}
@Override
public void onClick(View v) {
int id = v.getId();
if (id == R.id.btn_beauty || id == R.id.btn_beauty_shape || id == R.id.btn_meng || id == R.id.btn_filter || id == R.id.btn_rock || id == R.id.btn_haha) {
toggle(id);
} else if (id == R.id.btn_hide) {
hide();
} else if (id == R.id.btn_haha_0) {
if (mEffectListener != null) {
mEffectListener.onHaHaChanged(TiDistortionEnum.NO_DISTORTION);
}
} else if (id == R.id.btn_haha_1) {
if (mEffectListener != null) {
mEffectListener.onHaHaChanged(TiDistortionEnum.ET_DISTORTION);
}
} else if (id == R.id.btn_haha_2) {
if (mEffectListener != null) {
mEffectListener.onHaHaChanged(TiDistortionEnum.PEAR_FACE_DISTORTION);
}
} else if (id == R.id.btn_haha_3) {
if (mEffectListener != null) {
mEffectListener.onHaHaChanged(TiDistortionEnum.SLIM_FACE_DISTORTION);
}
} else if (id == R.id.btn_haha_4) {
if (mEffectListener != null) {
mEffectListener.onHaHaChanged(TiDistortionEnum.SQUARE_FACE_DISTORTION);
}
}
}
private void toggle(int key) {
if (mCurKey == key) {
return;
}
mCurKey = key;
for (int i = 0, size = mSparseArray.size(); i < size; i++) {
View v = mSparseArray.valueAt(i);
if (mSparseArray.keyAt(i) == key) {
if (v.getVisibility() != View.VISIBLE) {
v.setVisibility(View.VISIBLE);
}
} else {
if (v.getVisibility() == View.VISIBLE) {
v.setVisibility(View.INVISIBLE);
}
}
}
}
@Override
public boolean isShowed() {
return mShowed;
}
@Override
public void release() {
mVisibleListener = null;
mEffectListener = null;
// if (mTieZhiAdapter != null) {
// mTieZhiAdapter.clear();
// }
}
@Override
public void setVisibleListener(VisibleListener visibleListener) {
mVisibleListener = visibleListener;
}
@Override
public void onItemClick(String filtertype) {
//点击某个滤镜
if (TextUtils.isEmpty(filtertype))
return;
if (filtertype.equals(mCurFilterStrength)) {
return;
}
mCurFilterStrength = filtertype;
if (mEffectListener != null) {
mEffectListener.onFilterChanged(filtertype);
}
mAdapter4LvJing.notifyDataSetChanged();
}
@Override
public String getCurFilterType() {
return mCurFilterStrength;
}
@Override
public void onTiezhiItemClick(String name) {
//点击某个贴纸
if (TextUtils.isEmpty(name))
return;
if (name.equals(mCurTiezhiName)) {
return;
}
mCurTiezhiName=name;
if (mEffectListener != null) {
mEffectListener.onTieZhiChanged(name);
}
mAdapter4Tiezhi.notifyDataSetChanged();
}
@Override
public String getCurTiezhiName() {
return mCurTiezhiName;
}
}

View File

@@ -0,0 +1,169 @@
package com.yunbao.beauty.views;
import android.content.Context;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.util.SparseArray;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import com.yunbao.beauty.R;
import com.yunbao.beauty.adapter.FilterAdapter;
import com.yunbao.beauty.bean.FilterBean;
import com.yunbao.beauty.custom.TextSeekBar;
import com.yunbao.beauty.interfaces.BeautyEffectListener;
import com.yunbao.beauty.interfaces.BeautyViewHolder;
import com.yunbao.beauty.interfaces.DefaultBeautyEffectListener;
import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.views.AbsViewHolder;
/**
* Created by cxf on 2018/6/22.
* 默认美颜
*/
public class DefaultBeautyViewHolder extends AbsViewHolder implements View.OnClickListener, BeautyViewHolder {
private SparseArray<View> mSparseArray;
private int mCurKey;
private FilterAdapter mFilterAdapter;
private DefaultBeautyEffectListener mEffectListener;
private VisibleListener mVisibleListener;
private boolean mShowed;
public DefaultBeautyViewHolder(Context context, ViewGroup parentView) {
super(context, parentView);
}
@Override
protected int getLayoutId() {
return R.layout.view_beauty_default;
}
@Override
public void init() {
findViewById(R.id.btn_beauty).setOnClickListener(this);
findViewById(R.id.btn_filter).setOnClickListener(this);
findViewById(R.id.btn_hide).setOnClickListener(this);
mSparseArray = new SparseArray<>();
mSparseArray.put(R.id.btn_beauty, findViewById(R.id.group_beauty));
mSparseArray.put(R.id.btn_filter, findViewById(R.id.group_filter));
mCurKey = R.id.btn_beauty;
TextSeekBar.OnSeekChangeListener onSeekChangeListener = new TextSeekBar.OnSeekChangeListener() {
@Override
public void onProgressChanged(View view, int progress) {
if (mEffectListener != null) {
int i = view.getId();
if (i == R.id.seek_baixi) {
mEffectListener.onMeiBaiChanged(progress);
} else if (i == R.id.seek_skin_strength) {
mEffectListener.onMoPiChanged(progress);
} else if (i == R.id.seek_hongrun) {
mEffectListener.onHongRunChanged(progress);
}
}
}
};
TextSeekBar seekMeiBai = ((TextSeekBar) findViewById(R.id.seek_baixi));
TextSeekBar seekMoPi = ((TextSeekBar) findViewById(R.id.seek_skin_strength));
TextSeekBar seekHongRun = ((TextSeekBar) findViewById(R.id.seek_hongrun));
seekMeiBai.setOnSeekChangeListener(onSeekChangeListener);
seekMoPi.setOnSeekChangeListener(onSeekChangeListener);
seekHongRun.setOnSeekChangeListener(onSeekChangeListener);
//滤镜
RecyclerView filterRecyclerView = (RecyclerView) findViewById(R.id.filter_recyclerView);
filterRecyclerView.setHasFixedSize(true);
filterRecyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false));
mFilterAdapter = new FilterAdapter(mContext);
mFilterAdapter.setOnItemClickListener(new OnItemClickListener<FilterBean>() {
@Override
public void onItemClick(FilterBean bean, int position) {
if (mEffectListener != null) {
mEffectListener.onFilterChanged(bean);
}
}
});
filterRecyclerView.setAdapter(mFilterAdapter);
}
@Override
public void setEffectListener(BeautyEffectListener effectListener) {
if (effectListener != null && effectListener instanceof DefaultBeautyEffectListener) {
mEffectListener = (DefaultBeautyEffectListener) effectListener;
}
}
@Override
public void show() {
if (mVisibleListener != null) {
mVisibleListener.onVisibleChanged(true);
}
if (mParentView != null && mContentView != null) {
ViewParent parent = mContentView.getParent();
if (parent != null) {
((ViewGroup) parent).removeView(mContentView);
}
mParentView.addView(mContentView);
}
mShowed = true;
}
@Override
public void hide() {
removeFromParent();
if (mVisibleListener != null) {
mVisibleListener.onVisibleChanged(false);
}
mShowed = false;
}
@Override
public void onClick(View v) {
int id = v.getId();
if (id == R.id.btn_beauty || id == R.id.btn_filter) {
toggle(id);
} else if (id == R.id.btn_hide) {
hide();
}
}
private void toggle(int key) {
if (mCurKey == key) {
return;
}
mCurKey = key;
for (int i = 0, size = mSparseArray.size(); i < size; i++) {
View v = mSparseArray.valueAt(i);
if (mSparseArray.keyAt(i) == key) {
if (v.getVisibility() != View.VISIBLE) {
v.setVisibility(View.VISIBLE);
}
} else {
if (v.getVisibility() == View.VISIBLE) {
v.setVisibility(View.INVISIBLE);
}
}
}
}
@Override
public boolean isShowed() {
return mShowed;
}
@Override
public void release() {
mVisibleListener = null;
mEffectListener = null;
}
@Override
public void setVisibleListener(VisibleListener visibleListener) {
mVisibleListener = visibleListener;
}
}

View File

@@ -0,0 +1,284 @@
package com.yunbao.beauty.views;
import android.content.Context;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.util.SparseArray;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import com.yunbao.beauty.adapter.FilterAdapter;
import com.yunbao.beauty.adapter.RockAdapter;
import com.yunbao.beauty.adapter.TieZhiAdapter;
import com.yunbao.beauty.bean.FilterBean;
import com.yunbao.beauty.bean.TieZhiBean;
import com.yunbao.beauty.custom.ItemDecoration2;
import com.yunbao.beauty.custom.TextSeekBar;
import com.yunbao.beauty.interfaces.BeautyViewHolder;
import com.yunbao.beauty.interfaces.BeautyEffectListener;
import com.yunbao.beauty.interfaces.TiBeautyEffectListener;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.beauty.R;
import com.yunbao.common.bean.ConfigBean;
import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.views.AbsViewHolder;
import cn.tillusory.sdk.bean.TiDistortionEnum;
import cn.tillusory.sdk.bean.TiRockEnum;
/**
* Created by cxf on 2018/6/22.
* 萌颜UI相关
*/
public class TiBeautyViewHolder extends AbsViewHolder implements View.OnClickListener, BeautyViewHolder {
private SparseArray<View> mSparseArray;
private int mCurKey;
private TieZhiAdapter mTieZhiAdapter;
private TiBeautyEffectListener mEffectListener;
private VisibleListener mVisibleListener;
private boolean mShowed;
public TiBeautyViewHolder(Context context, ViewGroup parentView) {
super(context, parentView);
}
@Override
protected int getLayoutId() {
return R.layout.view_beauty;
}
@Override
public void init() {
findViewById(R.id.btn_beauty).setOnClickListener(this);
findViewById(R.id.btn_beauty_shape).setOnClickListener(this);
findViewById(R.id.btn_meng).setOnClickListener(this);
findViewById(R.id.btn_filter).setOnClickListener(this);
findViewById(R.id.btn_hide).setOnClickListener(this);
findViewById(R.id.btn_rock).setOnClickListener(this);
findViewById(R.id.btn_haha).setOnClickListener(this);
findViewById(R.id.btn_haha_0).setOnClickListener(this);
findViewById(R.id.btn_haha_1).setOnClickListener(this);
findViewById(R.id.btn_haha_2).setOnClickListener(this);
findViewById(R.id.btn_haha_3).setOnClickListener(this);
findViewById(R.id.btn_haha_4).setOnClickListener(this);
mSparseArray = new SparseArray<>();
mSparseArray.put(R.id.btn_beauty, findViewById(R.id.group_beauty));
mSparseArray.put(R.id.btn_beauty_shape, findViewById(R.id.group_beauty_shape));
mSparseArray.put(R.id.btn_meng, findViewById(R.id.group_meng));
mSparseArray.put(R.id.btn_filter, findViewById(R.id.group_filter));
mSparseArray.put(R.id.btn_rock, findViewById(R.id.group_rock));
mSparseArray.put(R.id.btn_haha, findViewById(R.id.group_haha));
mCurKey = R.id.btn_beauty;
TextSeekBar.OnSeekChangeListener onSeekChangeListener = new TextSeekBar.OnSeekChangeListener() {
@Override
public void onProgressChanged(View view, int progress) {
if (mEffectListener != null) {
int i = view.getId();
if (i == R.id.seek_baixi) {
mEffectListener.onMeiBaiChanged(progress);
} else if (i == R.id.seek_skin_strength) {
mEffectListener.onMoPiChanged(progress);
} else if (i == R.id.seek_hongrun) {
mEffectListener.onBaoHeChanged(progress);
} else if (i == R.id.seek_fengnen) {
mEffectListener.onFengNenChanged(progress);
} else if (i == R.id.seek_big_eye) {
mEffectListener.onBigEyeChanged(progress);
} else if (i == R.id.seek_face) {
mEffectListener.onFaceChanged(progress);
}
else if (i == R.id.seek_face_strength) {
mEffectListener.onFaceNarrowing(progress);
}
}
}
};
TextSeekBar seekMeiBai = ((TextSeekBar) findViewById(R.id.seek_baixi));
TextSeekBar seekMoPi = ((TextSeekBar) findViewById(R.id.seek_skin_strength));
TextSeekBar seekBaoHe = ((TextSeekBar) findViewById(R.id.seek_hongrun));
TextSeekBar seekFenNen = ((TextSeekBar) findViewById(R.id.seek_fengnen));
TextSeekBar seekBigEye = ((TextSeekBar) findViewById(R.id.seek_big_eye));
TextSeekBar seekFace = ((TextSeekBar) findViewById(R.id.seek_face));
TextSeekBar seekFaceNarrowing = ((TextSeekBar) findViewById(R.id.seek_face_strength));
seekMeiBai.setOnSeekChangeListener(onSeekChangeListener);
seekMoPi.setOnSeekChangeListener(onSeekChangeListener);
seekBaoHe.setOnSeekChangeListener(onSeekChangeListener);
seekFenNen.setOnSeekChangeListener(onSeekChangeListener);
seekBigEye.setOnSeekChangeListener(onSeekChangeListener);
seekFace.setOnSeekChangeListener(onSeekChangeListener);
seekFaceNarrowing.setOnSeekChangeListener(onSeekChangeListener);
ConfigBean configBean = CommonAppConfig.getInstance().getConfig();
if (configBean != null) {
seekMeiBai.setProgress(configBean.getBeautyMeiBai());
seekMoPi.setProgress(configBean.getBeautyMoPi());
seekBaoHe.setProgress(configBean.getBeautyBaoHe());
seekFenNen.setProgress(configBean.getBeautyFenNen());
seekBigEye.setProgress(configBean.getBeautyBigEye());
seekFace.setProgress(configBean.getBeautyFace());
//seekFaceNarrowing.setProgress(configBean.seekFaceNarrowing());
}
//贴纸
RecyclerView tieZhiRecyclerView = (RecyclerView) findViewById(R.id.tiezhi_recyclerView);
tieZhiRecyclerView.setHasFixedSize(true);
tieZhiRecyclerView.setLayoutManager(new GridLayoutManager(mContext, 6, GridLayoutManager.VERTICAL, false));
ItemDecoration2 decoration1 = new ItemDecoration2(mContext, 0x00000000, 8, 8);
decoration1.setOnlySetItemOffsetsButNoDraw(true);
tieZhiRecyclerView.addItemDecoration(decoration1);
mTieZhiAdapter = new TieZhiAdapter(mContext);
mTieZhiAdapter.setOnItemClickListener(new OnItemClickListener<TieZhiBean>() {
@Override
public void onItemClick(TieZhiBean bean, int position) {
if (mEffectListener != null) {
mEffectListener.onTieZhiChanged(bean.getName());
}
}
});
tieZhiRecyclerView.setAdapter(mTieZhiAdapter);
//滤镜
RecyclerView filterRecyclerView = (RecyclerView) findViewById(R.id.filter_recyclerView);
filterRecyclerView.setHasFixedSize(true);
filterRecyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false));
FilterAdapter filterAdapter = new FilterAdapter(mContext);
filterAdapter.setOnItemClickListener(new OnItemClickListener<FilterBean>() {
@Override
public void onItemClick(FilterBean bean, int position) {
if (mEffectListener != null) {
mEffectListener.onFilterChanged(bean.getTiFilterEnum());
}
}
});
filterRecyclerView.setAdapter(filterAdapter);
//抖动
RecyclerView rockRecyclerView = (RecyclerView) findViewById(R.id.rock_recyclerView);
rockRecyclerView.setHasFixedSize(true);
rockRecyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false));
RockAdapter rockAdapter = new RockAdapter(mContext);
rockAdapter.setActionListener(new RockAdapter.ActionListener() {
@Override
public void onItemClick(TiRockEnum tiRockEnum) {
if (mEffectListener != null) {
mEffectListener.onRockChanged(tiRockEnum);
}
}
});
rockRecyclerView.setAdapter(rockAdapter);
}
@Override
public void setEffectListener(BeautyEffectListener effectListener) {
if (effectListener != null && effectListener instanceof TiBeautyEffectListener) {
mEffectListener = (TiBeautyEffectListener) effectListener;
}
}
@Override
public void show() {
if (mVisibleListener != null) {
mVisibleListener.onVisibleChanged(true);
}
if (mParentView != null && mContentView != null) {
ViewParent parent = mContentView.getParent();
if (parent != null) {
((ViewGroup) parent).removeView(mContentView);
}
mParentView.addView(mContentView);
}
mShowed = true;
}
@Override
public void hide() {
removeFromParent();
if (mVisibleListener != null) {
mVisibleListener.onVisibleChanged(false);
}
mShowed = false;
}
@Override
public void onClick(View v) {
int id = v.getId();
if (id == R.id.btn_beauty || id == R.id.btn_beauty_shape || id == R.id.btn_meng || id == R.id.btn_filter || id == R.id.btn_rock || id == R.id.btn_haha) {
toggle(id);
} else if (id == R.id.btn_hide) {
hide();
} else if (id == R.id.btn_haha_0) {
if (mEffectListener != null) {
mEffectListener.onHaHaChanged(TiDistortionEnum.NO_DISTORTION);
}
} else if (id == R.id.btn_haha_1) {
if (mEffectListener != null) {
mEffectListener.onHaHaChanged(TiDistortionEnum.ET_DISTORTION);
}
} else if (id == R.id.btn_haha_2) {
if (mEffectListener != null) {
mEffectListener.onHaHaChanged(TiDistortionEnum.PEAR_FACE_DISTORTION);
}
} else if (id == R.id.btn_haha_3) {
if (mEffectListener != null) {
mEffectListener.onHaHaChanged(TiDistortionEnum.SLIM_FACE_DISTORTION);
}
} else if (id == R.id.btn_haha_4) {
if (mEffectListener != null) {
mEffectListener.onHaHaChanged(TiDistortionEnum.SQUARE_FACE_DISTORTION);
}
}
}
private void toggle(int key) {
if (mCurKey == key) {
return;
}
mCurKey = key;
for (int i = 0, size = mSparseArray.size(); i < size; i++) {
View v = mSparseArray.valueAt(i);
if (mSparseArray.keyAt(i) == key) {
if (v.getVisibility() != View.VISIBLE) {
v.setVisibility(View.VISIBLE);
}
} else {
if (v.getVisibility() == View.VISIBLE) {
v.setVisibility(View.INVISIBLE);
}
}
}
}
@Override
public boolean isShowed() {
return mShowed;
}
@Override
public void release() {
mVisibleListener = null;
mEffectListener = null;
if (mTieZhiAdapter != null) {
mTieZhiAdapter.clear();
}
}
@Override
public void setVisibleListener(VisibleListener visibleListener) {
mVisibleListener = visibleListener;
}
}

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/global" android:state_checked="true"/>
<item android:color="#fff" android:state_checked="false"/>
</selector>

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true">
<layer-list>
<item
android:bottom="5dp"
android:top="33dp"
android:left="20dp"
android:right="20dp"
>
<shape>
<solid android:color="@color/global"/>
</shape>
</item>
</layer-list>
</item>
</selector>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true">
<shape>
<corners android:radius="4dp"/>
<stroke android:color="@color/global" android:width="1dp"/>
</shape>
</item>
<item android:state_checked="false">
<shape/>
</item>
</selector>

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke android:color="@color/global" android:width="1dp"/>
</shape>

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="55dp"
android:layout_height="80dp"
>
<ImageView
android:id="@+id/img"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
/>
<ImageView
android:id="@+id/check_img"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:src="@mipmap/icon_filter_selected"
android:visibility="invisible"
/>
</RelativeLayout>

View File

@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="1dp"
>
<com.yunbao.beauty.custom.SquareImageView2
android:id="@+id/img"
android:layout_width="match_parent"
android:layout_height="0dp"
android:padding="5dp"
android:scaleType="fitCenter"
/>
<ImageView
android:id="@+id/download"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_alignBottom="@id/img"
android:layout_alignParentRight="true"
android:src="@mipmap/icon_tiezhi_download"
android:visibility="invisible"
/>
<RelativeLayout
android:id="@+id/loading"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_alignBottom="@id/img"
android:layout_alignTop="@id/img"
android:background="#80000000"
android:visibility="invisible"
>
<ProgressBar
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_centerInParent="true"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="8dp"
android:layout_marginTop="14dp"
android:indeterminateBehavior="repeat"
android:indeterminateDrawable="@drawable/anim_loading"
android:indeterminateOnly="true"
/>
</RelativeLayout>
</RelativeLayout>

View File

@@ -0,0 +1,398 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<RadioGroup
android:id="@+id/bottom"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:background="@color/bg_black"
android:orientation="horizontal"
>
<RadioButton
android:id="@+id/btn_beauty"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/bg_btn_beauty"
android:button="@null"
android:checked="true"
android:gravity="center"
android:text="@string/beauty"
android:textColor="@color/fg_btn_beauty"
android:textSize="14sp"
/>
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:background="#969696"
/>
<RadioButton
android:id="@+id/btn_beauty_shape"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/bg_btn_beauty"
android:button="@null"
android:gravity="center"
android:text="@string/beauty_shape"
android:textColor="@color/fg_btn_beauty"
android:textSize="14sp"
/>
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:background="#969696"
/>
<RadioButton
android:id="@+id/btn_meng"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/bg_btn_beauty"
android:button="@null"
android:gravity="center"
android:text="@string/meng"
android:textColor="@color/fg_btn_beauty"
android:textSize="14sp"
/>
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:background="#969696"
/>
<RadioButton
android:id="@+id/btn_filter"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/bg_btn_beauty"
android:button="@null"
android:gravity="center"
android:text="@string/filter"
android:textColor="@color/fg_btn_beauty"
android:textSize="14sp"
/>
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:background="#969696"
/>
<RadioButton
android:id="@+id/btn_rock"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/bg_btn_beauty"
android:button="@null"
android:gravity="center"
android:text="@string/shake"
android:textColor="@color/fg_btn_beauty"
android:textSize="14sp"
/>
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:background="#969696"
/>
<RadioButton
android:id="@+id/btn_haha"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/bg_btn_beauty"
android:button="@null"
android:gravity="center"
android:text="@string/haha"
android:textColor="@color/fg_btn_beauty"
android:textSize="14sp"
/>
</RadioGroup>
<View
android:id="@+id/btn_hide"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/bottom"/>
<LinearLayout
android:id="@+id/group_beauty"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@id/bottom"
android:background="@color/bg_black"
android:clickable="true"
android:orientation="vertical"
android:paddingBottom="15dp"
android:paddingTop="15dp"
android:visibility="visible"
>
<com.yunbao.beauty.custom.TextSeekBar
android:id="@+id/seek_baixi"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
app:progressVal="0"
app:text2="@string/beauty_meibai"
/>
<com.yunbao.beauty.custom.TextSeekBar
android:id="@+id/seek_skin_strength"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
app:progressVal="0"
app:text2="@string/beauty_mopi"
/>
<com.yunbao.beauty.custom.TextSeekBar
android:id="@+id/seek_hongrun"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
app:progressVal="0"
app:text2="@string/beauty_baohe"
/>
<com.yunbao.beauty.custom.TextSeekBar
android:id="@+id/seek_fengnen"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:progressVal="0"
app:text2="@string/beauty_fengnen"
/>
</LinearLayout>
<LinearLayout
android:id="@+id/group_beauty_shape"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@id/bottom"
android:background="@color/bg_black"
android:clickable="true"
android:orientation="vertical"
android:paddingBottom="15dp"
android:paddingTop="15dp"
android:visibility="invisible"
>
<com.yunbao.beauty.custom.TextSeekBar
android:id="@+id/seek_big_eye"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
app:progressVal="0"
app:text2="@string/beauty_big_eye"
/>
<com.yunbao.beauty.custom.TextSeekBar
android:id="@+id/seek_face"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
app:progressVal="0"
app:text2="@string/beauty_face"
/>
<com.yunbao.beauty.custom.TextSeekBar
android:id="@+id/seek_face_strength"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
app:progressVal="0"
app:text2="@string/face_narrowing"
/>
</LinearLayout>
<LinearLayout
android:id="@+id/group_meng"
android:layout_width="match_parent"
android:layout_height="180dp"
android:layout_above="@id/bottom"
android:background="@color/bg_black"
android:clickable="true"
android:orientation="vertical"
android:paddingBottom="15dp"
android:paddingTop="15dp"
android:visibility="invisible"
>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/tiezhi_recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
<FrameLayout
android:id="@+id/group_filter"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@id/bottom"
android:background="@color/bg_black"
android:clickable="true"
android:paddingBottom="15dp"
android:paddingTop="15dp"
android:visibility="invisible"
>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/filter_recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</FrameLayout>
<FrameLayout
android:id="@+id/group_rock"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_above="@id/bottom"
android:background="@color/bg_black"
android:clickable="true"
android:visibility="invisible"
>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rock_recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</FrameLayout>
<RadioGroup
android:id="@+id/group_haha"
android:layout_width="match_parent"
android:layout_height="90dp"
android:layout_above="@id/bottom"
android:background="@color/bg_black"
android:clickable="true"
android:orientation="horizontal"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:visibility="invisible"
>
<com.yunbao.beauty.custom.MyRadioButton
android:id="@+id/btn_haha_0"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:background="@drawable/bg_haha"
android:button="@null"
android:checked="true"
android:paddingTop="20dp"
app:mr_top_drawable1="@mipmap/icon_none"
app:mr_top_drawableSize1="40dp"
/>
<com.yunbao.beauty.custom.MyRadioButton
android:id="@+id/btn_haha_1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:background="@drawable/bg_haha"
android:button="@null"
android:drawablePadding="8dp"
android:gravity="center_horizontal"
android:paddingTop="8dp"
android:text="@string/haha_1"
android:textColor="#fff"
android:textSize="14sp"
app:mr_top_drawable1="@mipmap/icon_record_haha_1"
app:mr_top_drawableSize1="40dp"
/>
<com.yunbao.beauty.custom.MyRadioButton
android:id="@+id/btn_haha_2"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:background="@drawable/bg_haha"
android:button="@null"
android:drawablePadding="8dp"
android:gravity="center_horizontal"
android:paddingTop="8dp"
android:text="@string/haha_2"
android:textColor="#fff"
android:textSize="14sp"
app:mr_top_drawable1="@mipmap/icon_record_haha_2"
app:mr_top_drawableSize1="40dp"
/>
<com.yunbao.beauty.custom.MyRadioButton
android:id="@+id/btn_haha_3"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:background="@drawable/bg_haha"
android:button="@null"
android:drawablePadding="8dp"
android:gravity="center_horizontal"
android:paddingTop="8dp"
android:text="@string/haha_3"
android:textColor="#fff"
android:textSize="14sp"
app:mr_top_drawable1="@mipmap/icon_record_haha_3"
app:mr_top_drawableSize1="40dp"
/>
<com.yunbao.beauty.custom.MyRadioButton
android:id="@+id/btn_haha_4"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:background="@drawable/bg_haha"
android:button="@null"
android:drawablePadding="8dp"
android:gravity="center_horizontal"
android:paddingTop="8dp"
android:text="@string/haha_4"
android:textColor="#fff"
android:textSize="14sp"
app:mr_top_drawable1="@mipmap/icon_record_haha_4"
app:mr_top_drawableSize1="40dp"
/>
</RadioGroup>
</RelativeLayout>

View File

@@ -0,0 +1,413 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<RadioGroup
android:id="@+id/bottom"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:background="@color/bg_black"
android:orientation="horizontal"
>
<RadioButton
android:id="@+id/btn_beauty"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/bg_btn_beauty"
android:button="@null"
android:checked="true"
android:gravity="center"
android:text="@string/beauty"
android:textColor="@color/fg_btn_beauty"
android:textSize="14sp"
/>
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:background="#969696"
/>
<RadioButton
android:id="@+id/btn_beauty_shape"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/bg_btn_beauty"
android:button="@null"
android:gravity="center"
android:text="@string/beauty_shape"
android:textColor="@color/fg_btn_beauty"
android:textSize="14sp"
/>
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:background="#969696"
/>
<RadioButton
android:id="@+id/btn_meng"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/bg_btn_beauty"
android:button="@null"
android:gravity="center"
android:text="@string/tiezhi"
android:textColor="@color/fg_btn_beauty"
android:textSize="14sp"
/>
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:background="#969696"
/>
<RadioButton
android:id="@+id/btn_filter"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/bg_btn_beauty"
android:button="@null"
android:gravity="center"
android:text="@string/filter"
android:textColor="@color/fg_btn_beauty"
android:textSize="14sp"
/>
<View
android:visibility="gone"
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:background="#969696"
/>
<RadioButton
android:visibility="gone"
android:id="@+id/btn_rock"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/bg_btn_beauty"
android:button="@null"
android:gravity="center"
android:text="@string/shake"
android:textColor="@color/fg_btn_beauty"
android:textSize="14sp"
/>
<View
android:visibility="gone"
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:background="#969696"
/>
<RadioButton
android:visibility="gone"
android:id="@+id/btn_haha"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/bg_btn_beauty"
android:button="@null"
android:gravity="center"
android:text="@string/haha"
android:textColor="@color/fg_btn_beauty"
android:textSize="14sp"
/>
</RadioGroup>
<View
android:id="@+id/btn_hide"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/bottom"/>
<LinearLayout
android:id="@+id/group_beauty"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@id/bottom"
android:background="@color/bg_black"
android:clickable="true"
android:orientation="vertical"
android:paddingBottom="15dp"
android:paddingTop="15dp"
>
<com.yunbao.beauty.custom.TextSeekBar
android:id="@+id/seek_baixi"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
app:progressVal="0"
app:text2="@string/beauty_meibai2"
/>
<com.yunbao.beauty.custom.TextSeekBar
android:id="@+id/seek_hongrun"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
app:progressVal="0"
app:text2="@string/beauty_hongrun"
/>
<com.yunbao.beauty.custom.TextSeekBar
android:id="@+id/seek_fengnen"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:progressVal="0"
app:text2="@string/beauty_fengnen"
/>
<com.yunbao.beauty.custom.TextSeekBar
android:id="@+id/seek_skin_strength"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
app:progressVal="0"
app:text2="@string/beauty_strength"
/>
</LinearLayout>
<LinearLayout
android:id="@+id/group_beauty_shape"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@id/bottom"
android:background="@color/bg_black"
android:clickable="true"
android:orientation="vertical"
android:paddingBottom="15dp"
android:paddingTop="15dp"
android:visibility="gone"
>
<com.yunbao.beauty.custom.TextSeekBar
android:id="@+id/seek_big_eye"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
app:progressVal="0"
app:text2="@string/beauty_big_eye"
/>
<com.yunbao.beauty.custom.TextSeekBar
android:id="@+id/seek_face"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
app:progressVal="0"
app:text2="@string/beauty_face"
/>
<com.yunbao.beauty.custom.TextSeekBar
android:id="@+id/seek_face_strength"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
app:progressVal="0"
android:visibility="gone"
app:text2="@string/beauty_face_strength"
/>
</LinearLayout>
<LinearLayout
android:id="@+id/group_meng"
android:layout_width="match_parent"
android:layout_height="180dp"
android:layout_above="@id/bottom"
android:background="@color/bg_black"
android:clickable="true"
android:orientation="vertical"
android:paddingBottom="15dp"
android:paddingTop="15dp"
android:visibility="gone"
>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/tiezhi_recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:id="@+id/group_filter"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@id/bottom"
android:background="@color/bg_black"
android:clickable="true"
android:paddingBottom="15dp"
android:paddingTop="15dp"
android:visibility="gone"
>
<com.yunbao.beauty.custom.TextSeekBar
android:paddingTop="10dp"
android:paddingBottom="20dp"
android:id="@+id/seek_filter_strength"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:progressVal="0"
app:text2="@string/beauty_face_strength"
/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/filter_recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
<FrameLayout
android:id="@+id/group_rock"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_above="@id/bottom"
android:background="@color/bg_black"
android:clickable="true"
android:visibility="gone"
>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rock_recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</FrameLayout>
<RadioGroup
android:id="@+id/group_haha"
android:layout_width="match_parent"
android:layout_height="90dp"
android:layout_above="@id/bottom"
android:background="@color/bg_black"
android:clickable="true"
android:orientation="horizontal"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:visibility="gone"
>
<com.yunbao.beauty.custom.MyRadioButton
android:id="@+id/btn_haha_0"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:background="@drawable/bg_haha"
android:button="@null"
android:checked="true"
android:paddingTop="20dp"
app:mr_top_drawable1="@mipmap/icon_none"
app:mr_top_drawableSize1="40dp"
/>
<com.yunbao.beauty.custom.MyRadioButton
android:id="@+id/btn_haha_1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:background="@drawable/bg_haha"
android:button="@null"
android:drawablePadding="8dp"
android:gravity="center_horizontal"
android:paddingTop="8dp"
android:text="@string/haha_1"
android:textColor="#fff"
android:textSize="14sp"
app:mr_top_drawable1="@mipmap/icon_record_haha_1"
app:mr_top_drawableSize1="40dp"
/>
<com.yunbao.beauty.custom.MyRadioButton
android:id="@+id/btn_haha_2"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:background="@drawable/bg_haha"
android:button="@null"
android:drawablePadding="8dp"
android:gravity="center_horizontal"
android:paddingTop="8dp"
android:text="@string/haha_2"
android:textColor="#fff"
android:textSize="14sp"
app:mr_top_drawable1="@mipmap/icon_record_haha_2"
app:mr_top_drawableSize1="40dp"
/>
<com.yunbao.beauty.custom.MyRadioButton
android:id="@+id/btn_haha_3"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:background="@drawable/bg_haha"
android:button="@null"
android:drawablePadding="8dp"
android:gravity="center_horizontal"
android:paddingTop="8dp"
android:text="@string/haha_3"
android:textColor="#fff"
android:textSize="14sp"
app:mr_top_drawable1="@mipmap/icon_record_haha_3"
app:mr_top_drawableSize1="40dp"
/>
<com.yunbao.beauty.custom.MyRadioButton
android:id="@+id/btn_haha_4"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:background="@drawable/bg_haha"
android:button="@null"
android:drawablePadding="8dp"
android:gravity="center_horizontal"
android:paddingTop="8dp"
android:text="@string/haha_4"
android:textColor="#fff"
android:textSize="14sp"
app:mr_top_drawable1="@mipmap/icon_record_haha_4"
app:mr_top_drawableSize1="40dp"
/>
</RadioGroup>
</RelativeLayout>

View File

@@ -0,0 +1,147 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<RadioGroup
android:id="@+id/bottom"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:background="@color/bg_black"
android:orientation="horizontal"
>
<Space
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="0.7"
/>
<RadioButton
android:id="@+id/btn_beauty"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/bg_btn_beauty"
android:button="@null"
android:checked="true"
android:gravity="center"
android:text="@string/beauty"
android:textColor="@color/fg_btn_beauty"
android:textSize="14sp"
/>
<Space
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="0.7"
/>
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:background="#969696"
/>
<Space
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="0.7"
/>
<RadioButton
android:id="@+id/btn_filter"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/bg_btn_beauty"
android:button="@null"
android:gravity="center"
android:text="@string/filter"
android:textColor="@color/fg_btn_beauty"
android:textSize="14sp"
/>
<Space
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="0.7"
/>
</RadioGroup>
<View
android:id="@+id/btn_hide"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/bottom"/>
<LinearLayout
android:id="@+id/group_beauty"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@id/bottom"
android:background="@color/bg_black"
android:clickable="true"
android:orientation="vertical"
android:paddingBottom="15dp"
android:paddingTop="15dp"
android:visibility="visible"
>
<com.yunbao.beauty.custom.TextSeekBar
android:id="@+id/seek_baixi"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
app:progressVal="0"
app:text2="@string/beauty_meibai"
/>
<com.yunbao.beauty.custom.TextSeekBar
android:id="@+id/seek_skin_strength"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
app:progressVal="0"
app:text2="@string/beauty_mopi"
/>
<com.yunbao.beauty.custom.TextSeekBar
android:id="@+id/seek_hongrun"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:progressVal="0"
app:text2="@string/beauty_hongrun"
/>
</LinearLayout>
<FrameLayout
android:id="@+id/group_filter"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@id/bottom"
android:background="@color/bg_black"
android:clickable="true"
android:paddingBottom="15dp"
android:paddingTop="15dp"
android:visibility="invisible"
>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/filter_recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</FrameLayout>
</RelativeLayout>

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:textColor="#fff"
android:textSize="14sp"
android:paddingLeft="15dp"
android:paddingRight="15dp"
/>

View File

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="30dp"
android:orientation="horizontal"
>
<TextView
android:id="@+id/text"
android:layout_width="40dp"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:gravity="center"
android:textColor="#fff"
android:textSize="14sp"
/>
<SeekBar
android:id="@+id/seekBar"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:max="100"
/>
<TextView
android:id="@+id/progressVal"
android:layout_width="40dp"
android:layout_height="match_parent"
android:layout_marginRight="10dp"
android:gravity="center"
android:textColor="#fff"
android:textSize="14sp"
/>
</LinearLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

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