package com.solocredit.finance.weight.shadow;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.DashPathEffect;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.RectF;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.RippleDrawable;
import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.shapes.RoundRectShape;
import android.os.Build;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import com.solocredit.finance.R;
/**
* Created by leo
* on 2019/7/9.
* 阴影控件
*/
public class ShadowLayout extends FrameLayout {
/***
* Shadow
*/
private Paint shadowPaint;//阴影画笔
private int mShadowColor;//阴影颜色
private float mShadowLimit;//阴影扩散区域大小
//阴影x,y偏移量
private float mDx;
private float mDy;
//阴影圆角属性,也是shape的圆角属性
private float mCornerRadius;//圆角大小,如四角没有单独设置,则为大小为mCornerRadius
private float mCornerRadius_leftTop;//单独设置左上角圆角大小。(同理以下)
private float mCornerRadius_rightTop;
private float mCornerRadius_leftBottom;
private float mCornerRadius_rightBottom;
//阴影四边可见属性
private boolean leftShow;//false表示左边不可见
private boolean rightShow;
private boolean topShow;
private boolean bottomShow;
//子布局与父布局的padding(即通过padding来实现mShadowLimit的大小和阴影展示)
private int leftPadding;
private int topPadding;
private int rightPadding;
private int bottomPadding;
private RectF rectf = new RectF();//阴影布局子空间区域
private View firstView;//如有子View则为子View,否则为ShadowLayout本身
//
private boolean isSym;//控件区域是否对称,如不对称则区域跟随阴影走
private boolean isShowShadow = true;//是否使用阴影,可能存在不使用阴影只使用shape
/**
* Shape
*/
private static final int MODE_PRESSED = 1;
private static final int MODE_SELECTED = 2;
private static final int MODE_RIPPLE = 3;
private static final int MODE_DASHLINE = 4;
//
private int shapeModeType;//ShadowLayout的shapeMode,默认是pressed.
GradientDrawable gradientDrawable;//shape功能最终用系统类GradientDrawable代替
private Drawable layoutBackground;//正常情况下的drawable(与mBackGroundColor不可共存)
private Drawable layoutBackground_true;
private int mBackGroundColor;//正常情况下的color(默认为白色,与layoutBackground不可共存)
private int mBackGroundColor_true = -101;
//填充渐变色
private int startColor;
private int centerColor;
private int endColor;
private int angle;
//边框画笔
private int current_stroke_color;
private float stroke_with;
private int stroke_color;
private int stroke_color_true;
private float stroke_dashWidth = -1;
private float stroke_dashGap = -1;
/**
* ClickAble
*/
private boolean isClickable;//是否可点击
private Drawable clickAbleFalseDrawable;//不可点击状态下的drawable(与clickAbleFalseColor不可共存)
private int clickAbleFalseColor = -101;//不可点击状态下的填充color(与clickAbleFalseDrawable不可共存)
/**
* ShadowLayout绑定的textView
*/
private int mTextViewResId = -1;
private TextView mTextView;
private int textColor;
private int textColor_true;
private String text;
private String text_true;
/**
* 虚线
*/
private Paint mPaintDash;
private Path dashPath;
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
public ShadowLayout(Context context) {
this(context, null);
}
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
public ShadowLayout(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
public ShadowLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
initView(context, attrs);
}
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
private void initView(Context context, AttributeSet attrs) {
initAttributes(attrs);
if (isDashLine()) {
return;
}
shadowPaint = new Paint();
shadowPaint.setAntiAlias(true);
shadowPaint.setStyle(Paint.Style.FILL);
gradientDrawable = new GradientDrawable();
gradientDrawable.setColors(new int[]{mBackGroundColor, mBackGroundColor});
if (stroke_color != -101) {
current_stroke_color = stroke_color;
}
setPadding();
}
//是否为线性模式
private boolean isDashLine() {
return shapeModeType == ShadowLayout.MODE_DASHLINE;
}
private void initDashLine() {
mPaintDash = new Paint();
mPaintDash.setAntiAlias(true);
mPaintDash.setColor(stroke_color);
mPaintDash.setStyle(Paint.Style.STROKE);
mPaintDash.setPathEffect(new DashPathEffect(new float[]{stroke_dashWidth, stroke_dashGap}, 0));
dashPath = new Path();
}
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
private void initAttributes(AttributeSet attrs) {
TypedArray attr = getContext().obtainStyledAttributes(attrs, R.styleable.ShadowLayout);
shapeModeType = attr.getInt(R.styleable.ShadowLayout_hl_shapeMode, ShadowLayout.MODE_PRESSED);
//如果为线性模式,只用到以下属性
if (isDashLine()) {
stroke_color = attr.getColor(R.styleable.ShadowLayout_hl_strokeColor, -101);
stroke_dashWidth = attr.getDimension(R.styleable.ShadowLayout_hl_stroke_dashWidth, -1);
stroke_dashGap = attr.getDimension(R.styleable.ShadowLayout_hl_stroke_dashGap, -1);
if (stroke_color == -101) {
throw new UnsupportedOperationException("shapeMode为MODE_DASHLINE,need set: stroke_color");
}
if (stroke_dashWidth == -1) {
throw new UnsupportedOperationException("shapeMode为MODE_DASHLINE,need set: stroke_dashWidth");
}
if ((stroke_dashWidth == -1 && stroke_dashGap != -1) || (stroke_dashWidth != -1 && stroke_dashGap == -1)) {
throw new UnsupportedOperationException("must set: ShadowLayout_hl_stroke_dashWidth,ShadowLayout_hl_stroke_dashGap");
}
initDashLine();
attr.recycle();
return;
}
isShowShadow = !attr.getBoolean(R.styleable.ShadowLayout_hl_shadowHidden, false);
leftShow = !attr.getBoolean(R.styleable.ShadowLayout_hl_shadowHiddenLeft, false);
rightShow = !attr.getBoolean(R.styleable.ShadowLayout_hl_shadowHiddenRight, false);
bottomShow = !attr.getBoolean(R.styleable.ShadowLayout_hl_shadowHiddenBottom, false);
topShow = !attr.getBoolean(R.styleable.ShadowLayout_hl_shadowHiddenTop, false);
mCornerRadius = attr.getDimension(R.styleable.ShadowLayout_hl_cornerRadius, getResources().getDimension(com.lib.base.R.dimen.qb_px_0));
mCornerRadius_leftTop = attr.getDimension(R.styleable.ShadowLayout_hl_cornerRadius_leftTop, -1);
mCornerRadius_leftBottom = attr.getDimension(R.styleabl
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
本项目是一款基于Java与Kotlin的贷超-贷款包8-2模板设计源码,总计包含1004个文件,涵盖307个Java源文件、271个XML配置文件、194个Kotlin源文件、200个PNG图片文件、10个webp图片文件、5个Gradle构建文件、4个Git忽略文件、3个属性文件以及其他少量文件。该模板适用于贷超和贷款包的设计与开发,为金融领域提供专业化的解决方案。
资源推荐
资源详情
资源评论
收起资源包目录
基于Java与Kotlin的贷超-贷款包8-2模板设计源码 (1007个子文件)
gradlew.bat 3KB
mulla_user_lucky_draw_anim.gif 178KB
loading.gif 26KB
.gitignore 231B
.gitignore 6B
.gitignore 6B
.gitignore 6B
build.gradle 4KB
build.gradle 932B
build.gradle 850B
settings.gradle 553B
build.gradle 299B
gradlew 6KB
gradle-wrapper.jar 58KB
ShadowLayout.java 55KB
RangeSeekBar.java 45KB
XBanner.java 44KB
PermissionChecker.java 43KB
WheelTime.java 35KB
WheelView.java 33KB
BasePopup.java 28KB
TitleBarUtil.java 25KB
SeekBar.java 24KB
Permission.java 22KB
PermissionUtils.java 22KB
MullaDivider.java 21KB
RoundedDrawable.java 20KB
PermissionFragment.java 19KB
CustomImageView.java 18KB
XXPermissions.java 18KB
IOUtils.java 18KB
IOUtils.java 18KB
LunarCalendar.java 18KB
LocaleContract.java 18KB
WheelOptions.java 16KB
MullaRecyclerViewAdapter.java 16KB
BaseDao.java 14KB
BaseDao.java 14KB
MullaViewHolderHelper.java 14KB
PermissionDelegateImplV23.java 14KB
PermissionIntentManager.java 14KB
GlideRoundUtils.java 13KB
MullaBindingRecyclerViewAdapter.java 13KB
TimePickerView.java 12KB
Request.java 12KB
Request.java 12KB
ChinaDate.java 12KB
PhoneRomUtils.java 12KB
BasePickerView.java 10KB
HttpHeaders.java 10KB
HttpHeaders.java 10KB
Progress.java 10KB
VerticalRangeSeekBar.java 10KB
Progress.java 10KB
OkHttp.java 9KB
TimePickerBuilder.java 9KB
OkHttp.java 9KB
HttpsUtils.java 9KB
HttpParams.java 9KB
HttpsUtils.java 9KB
HttpParams.java 9KB
HttpUtils.java 9KB
HttpUtils.java 9KB
MultiLanguages.java 9KB
OptionsPickerBuilder.java 8KB
HttpLoggingInterceptor.java 8KB
HttpLoggingInterceptor.java 8KB
BodyRequest.java 8KB
BodyRequest.java 8KB
BaseCachePolicy.java 8KB
SerializableCookie.java 8KB
SerializableCookie.java 8KB
MullaAdapterViewAdapter.java 8KB
SPCookieStore.java 8KB
SPCookieStore.java 8KB
BaseCachePolicy.java 8KB
MullaHeaderAndFooterAdapter.java 8KB
MullaRVVerticalScrollHelper.java 7KB
RatingBar.java 7KB
HeaderParser.java 7KB
HeaderParser.java 7KB
OptionsPickerView.java 7KB
VerticalSeekBar.java 7KB
XBannerViewPager.java 7KB
GetInstalledAppsPermissionCompat.java 7KB
PermissionApi.java 6KB
AndroidManifestParser.java 6KB
DBHelper.java 6KB
SPUtils.java 6KB
DBHelper.java 6KB
MullaEmptyView.java 6KB
DBCookieStore.java 6KB
DBCookieStore.java 6KB
Utils.java 6KB
PermissionPageFragment.java 5KB
GlideRoundTransform.java 5KB
BitmapConvert.java 5KB
BitmapConvert.java 5KB
StartActivityManager.java 5KB
PermissionDelegateImplV33.java 5KB
共 1007 条
- 1
- 2
- 3
- 4
- 5
- 6
- 11
资源评论
xyq2024
- 粉丝: 2421
- 资源: 5454
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- LitJson(0.19.0版本,适用于.NetStandard2.0)
- LitJson(0.19.0版本,适用于.NetStandard1.5)
- (源码)基于ROS的咖啡机器人控制系统.zip
- (源码)基于Qt和OpenCV的图像拼接系统.zip
- 《信号与系统》编程作业.zip
- (源码)基于C#的二级文件系统模拟.zip
- (源码)基于C++的巡飞弹三自由度弹道仿真系统.zip
- (源码)基于SpringBoot和Redis的短链接生成系统.zip
- (源码)基于Qt和GStreamer的条形码扫描系统.zip
- Apache Dubbo 是一个高性能的、基于 Java 的开源 RPC 框架 dubbo源码
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功