[通用模块整理] 通用wiget整理完成
This commit is contained in:
@@ -1,359 +0,0 @@
|
||||
package com.mogo.och.bus.passenger.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.BlurMaskFilter;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.RectF;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.TypedValue;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import com.mogo.och.bus.passenger.R;
|
||||
import com.mogo.och.bus.passenger.utils.DimenUtil;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/1/21
|
||||
* 边框阴影
|
||||
*/
|
||||
public class BusBorderShadowLayout extends LinearLayout {
|
||||
|
||||
|
||||
private static final String TAG = "ShadowLayout";
|
||||
|
||||
//默认阴影半径
|
||||
public static final float SHADOW_DEFAULT_RADIUS = DimenUtil.INSTANCE.dp2px(5);
|
||||
|
||||
//阴影最大偏移量
|
||||
public static final float SHADOW_MAX_OFFSET = DimenUtil.INSTANCE.dp2px(20);
|
||||
|
||||
//阴影最大模糊半径
|
||||
public static final float SHADOW_MAX_BLUR = DimenUtil.INSTANCE.dp2px(20);
|
||||
|
||||
|
||||
|
||||
//默认模糊半径
|
||||
public static final float SHADOW_DEFAULT_BLUR_RADIUS = DimenUtil.INSTANCE.dp2px(5);
|
||||
|
||||
|
||||
//阴影颜色
|
||||
private int shadowColor = Color.parseColor("#333333");
|
||||
|
||||
//阴影类型,0:默认为单边 1:单边 2:邻边 3:四边所有
|
||||
private int shadowType;
|
||||
|
||||
//阴影半径
|
||||
private float shadowRadius = 0f;
|
||||
|
||||
//模糊度半径
|
||||
private float blurRadius = SHADOW_DEFAULT_BLUR_RADIUS ;
|
||||
|
||||
//水平位移
|
||||
private float xOffset = DimenUtil.INSTANCE.dp2px(10);
|
||||
|
||||
|
||||
//竖直方向位移
|
||||
private float yOffset = DimenUtil.INSTANCE.dp2px(0);
|
||||
|
||||
//背景色
|
||||
private int bgColor = Color.WHITE;
|
||||
|
||||
//是否有点击效果
|
||||
private boolean hasEffect = false ;
|
||||
|
||||
|
||||
int left =0 ,right =0,top = 0,bottom = 0 ;
|
||||
|
||||
//代理方式
|
||||
private IShadow shadow = new BusBorderShadowLayout.ShadowConfig(this);
|
||||
|
||||
private float mWidthMode;
|
||||
private float mHeightMode;
|
||||
private Paint mPaint = new Paint();
|
||||
private Paint locationPaint = new Paint();
|
||||
|
||||
public BusBorderShadowLayout(Context context) {
|
||||
super(context,null);
|
||||
}
|
||||
|
||||
public BusBorderShadowLayout(Context context, AttributeSet attrs) {
|
||||
this(context, attrs,0);
|
||||
}
|
||||
|
||||
public BusBorderShadowLayout(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
this.setLayerType(LAYER_TYPE_SOFTWARE, null);//取消硬件加速
|
||||
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.ShadowLayout);
|
||||
shadowColor = typedArray.getColor(R.styleable.ShadowLayout_shadowColor, Color.BLUE);
|
||||
blurRadius = typedArray.getDimension(R.styleable.ShadowLayout_blurRadius, SHADOW_DEFAULT_BLUR_RADIUS);
|
||||
shadowRadius = typedArray.getDimension(R.styleable.ShadowLayout_shadowRadius,0);
|
||||
hasEffect = typedArray.getBoolean(R.styleable.ShadowLayout_hasEffect, false);
|
||||
xOffset = typedArray.getDimension(R.styleable.ShadowLayout_xOffset,DimenUtil.INSTANCE.dp2px(10));
|
||||
yOffset = typedArray.getDimension(R.styleable.ShadowLayout_yOffset,DimenUtil.INSTANCE.dp2px(10));
|
||||
bgColor = typedArray.getColor(R.styleable.ShadowLayout_bgColor,Color.WHITE);
|
||||
typedArray.recycle();
|
||||
|
||||
if (shadowRadius<0){
|
||||
shadowRadius = -shadowRadius;
|
||||
}
|
||||
if (blurRadius < 0) {
|
||||
blurRadius = -blurRadius;
|
||||
}
|
||||
|
||||
blurRadius = Math.min(SHADOW_MAX_BLUR,blurRadius);
|
||||
|
||||
if (Math.abs(xOffset)> SHADOW_MAX_OFFSET){
|
||||
xOffset = xOffset/Math.abs(xOffset) * SHADOW_MAX_OFFSET;
|
||||
}
|
||||
|
||||
if (Math.abs(yOffset) > SHADOW_MAX_OFFSET){
|
||||
yOffset = yOffset/Math.abs(yOffset) * SHADOW_MAX_OFFSET;
|
||||
}
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
private void init(){
|
||||
setBackgroundColor(Color.parseColor("#00ffffff"));
|
||||
if (xOffset>0){
|
||||
//水平偏移量为正数,右侧有阴影,阴影长度为blurRadius+|xOffset|
|
||||
right = (int)(blurRadius + Math.abs(xOffset));
|
||||
}else if (xOffset==0){
|
||||
//水平偏移为0,水平间距为blurRadius
|
||||
left = (int)blurRadius;
|
||||
right = (int)blurRadius;
|
||||
}else {
|
||||
//水平偏移为负数,左侧有阴影,阴影长度为blurRadius+|xOffset|
|
||||
left = (int)(blurRadius + Math.abs(xOffset));
|
||||
}
|
||||
if (yOffset>0){
|
||||
//竖直偏移量为正数,底部有阴影,阴影长度为blurRadius+|yOffset|
|
||||
bottom = (int)(blurRadius + Math.abs(yOffset));
|
||||
}else if (yOffset==0){
|
||||
//竖直偏移量为0,竖直间距为blurRadius
|
||||
top = (int)blurRadius;
|
||||
bottom = (int)blurRadius;
|
||||
}else {
|
||||
//竖直偏移量为负数,顶部有阴影,阴影长度为blurRadius+|yOffset|
|
||||
top = (int)(blurRadius + Math.abs(yOffset));
|
||||
}
|
||||
setPadding(left,top,right,bottom);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取阴影设置
|
||||
* @return 返回阴影设置配置
|
||||
*/
|
||||
public IShadow getShadowConfig(){
|
||||
return shadow;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
||||
super.onLayout(changed,l,t,r,b);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void dispatchDraw(Canvas canvas) {
|
||||
super.dispatchDraw(canvas);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
drawBackground(canvas);//放在super前是后景,相反是前景,前景会覆盖子布局
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//绘制背景色(在子view底部)
|
||||
private void drawBackground(Canvas canvas){
|
||||
|
||||
mWidthMode = getMeasuredWidth();
|
||||
mHeightMode = getMeasuredHeight();
|
||||
float startX = 0;
|
||||
float startY = 0;
|
||||
float endX = 0;
|
||||
float endY = 0;
|
||||
|
||||
if (xOffset==0){
|
||||
startX = right;
|
||||
endX = mWidthMode-blurRadius;
|
||||
}else {
|
||||
startX = right+blurRadius;
|
||||
endX = mWidthMode-left-blurRadius;
|
||||
}
|
||||
|
||||
if (yOffset==0){
|
||||
startY = bottom;
|
||||
endY = mHeightMode-blurRadius;
|
||||
}else {
|
||||
startY = bottom+blurRadius;
|
||||
endY = mHeightMode-top-blurRadius;
|
||||
}
|
||||
// mPaint.setShadowLayer(blurRadius,0,0,shadowColor);
|
||||
if (blurRadius>0){
|
||||
mPaint.setMaskFilter(new BlurMaskFilter(blurRadius,BlurMaskFilter.Blur.NORMAL));
|
||||
}
|
||||
mPaint.setColor(shadowColor);
|
||||
mPaint.setAntiAlias(true);
|
||||
|
||||
RectF shadowRect = new RectF(startX,startY,endX,endY);
|
||||
|
||||
RectF locationRectF = new RectF(left,top,mWidthMode-right,mHeightMode-bottom);
|
||||
if (shadowRadius==0){
|
||||
//不是圆角
|
||||
canvas.drawRect(shadowRect,mPaint);
|
||||
}else {
|
||||
//圆角,角度为shadowRadius
|
||||
canvas.drawRoundRect(shadowRect,shadowRadius,shadowRadius,mPaint);
|
||||
}
|
||||
|
||||
locationPaint.setColor(bgColor);
|
||||
locationPaint.setAntiAlias(true);
|
||||
|
||||
if (shadowRadius==0){
|
||||
//不是圆角
|
||||
canvas.drawRect(locationRectF,locationPaint);
|
||||
}else {
|
||||
//圆角,角度为shadowRadius
|
||||
canvas.drawRoundRect(locationRectF,shadowRadius,shadowRadius,locationPaint);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 阴影配置
|
||||
*/
|
||||
class ShadowConfig implements IShadow {
|
||||
|
||||
//代理
|
||||
private BusBorderShadowLayout shadow;
|
||||
|
||||
private ShadowConfig(BusBorderShadowLayout shadow) {
|
||||
this.shadow = shadow;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IShadow setShadowRadius(float radius) {
|
||||
return setShadowRadius(TypedValue.COMPLEX_UNIT_DIP,radius);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IShadow setShadowRadius(int unit, float radius) {
|
||||
Context c = getContext();
|
||||
Resources r;
|
||||
|
||||
if (c == null) {
|
||||
r = Resources.getSystem();
|
||||
} else {
|
||||
r = c.getResources();
|
||||
}
|
||||
shadow.shadowRadius = Math.abs(TypedValue.applyDimension(unit,radius,r.getDisplayMetrics()));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IShadow setShadowColor(int color) {
|
||||
shadow.shadowColor = color;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IShadow setShadowColorRes(int colorRes) {
|
||||
shadow.shadowColor = shadow.getResources().getColor(colorRes);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IShadow setBlurRadius(float radius) {
|
||||
return setBlurRadius(TypedValue.COMPLEX_UNIT_DIP,radius);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IShadow setBlurRadius(int unit, float radius) {
|
||||
Context c = getContext();
|
||||
Resources r;
|
||||
if (c == null) {
|
||||
r = Resources.getSystem();
|
||||
} else {
|
||||
r = c.getResources();
|
||||
}
|
||||
shadow.blurRadius = Math.min(SHADOW_MAX_BLUR,Math.abs(TypedValue.applyDimension(unit,radius,r.getDisplayMetrics())));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IShadow setXOffset(float offset) {
|
||||
return setXOffset(TypedValue.COMPLEX_UNIT_DIP,offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IShadow setXOffset(int unit, float offset) {
|
||||
Context c = getContext();
|
||||
Resources r;
|
||||
if (c == null) {
|
||||
r = Resources.getSystem();
|
||||
} else {
|
||||
r = c.getResources();
|
||||
}
|
||||
|
||||
float x = TypedValue.applyDimension(unit,offset,r.getDisplayMetrics());
|
||||
if (Math.abs(x)> SHADOW_MAX_OFFSET){
|
||||
x = x/Math.abs(x) * SHADOW_MAX_OFFSET;
|
||||
}
|
||||
shadow.xOffset = x;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IShadow setYOffset(float offset) {
|
||||
return setYOffset(TypedValue.COMPLEX_UNIT_DIP,offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IShadow setYOffset(int unit, float offset) {
|
||||
Context c = getContext();
|
||||
Resources r;
|
||||
if (c == null) {
|
||||
r = Resources.getSystem();
|
||||
} else {
|
||||
r = c.getResources();
|
||||
}
|
||||
|
||||
float y = TypedValue.applyDimension(unit,offset,r.getDisplayMetrics());
|
||||
if (Math.abs(y)> SHADOW_MAX_OFFSET){
|
||||
y = y/Math.abs(y) * SHADOW_MAX_OFFSET;
|
||||
}
|
||||
shadow.yOffset = y;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void commit() {
|
||||
shadow.init();
|
||||
shadow.requestLayout();
|
||||
shadow.postInvalidate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
package com.mogo.och.bus.passenger.ui
|
||||
|
||||
import androidx.annotation.ColorRes
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/1/21
|
||||
*/
|
||||
interface IShadow {
|
||||
//设置阴影半径
|
||||
fun setShadowRadius(radius:Float):IShadow
|
||||
|
||||
//添加单位设置
|
||||
fun setShadowRadius(unit:Int,radius: Float):IShadow
|
||||
|
||||
//设置应用颜色
|
||||
fun setShadowColor(color:Int):IShadow
|
||||
|
||||
//设置阴影颜色资源文件id
|
||||
fun setShadowColorRes(@ColorRes color: Int):IShadow
|
||||
/**
|
||||
* 设置模糊半径
|
||||
* @param radius
|
||||
*/
|
||||
fun setBlurRadius(radius:Float):IShadow
|
||||
|
||||
/**
|
||||
*
|
||||
* @param unit @{@link android.util.TypedValue#TYPE_DIMENSION}
|
||||
* @param radius 模糊半径
|
||||
*/
|
||||
fun setBlurRadius(unit:Int,radius:Float):IShadow
|
||||
|
||||
/**
|
||||
* 设置水平方向的偏移量
|
||||
* @param offset x轴偏移
|
||||
*/
|
||||
fun setXOffset(offset:Float):IShadow
|
||||
|
||||
|
||||
/**
|
||||
* 设置x方向的偏移量,设置单位
|
||||
* @param unit @{@link android.util.TypedValue#TYPE_DIMENSION}
|
||||
* @param offset x轴偏移
|
||||
*/
|
||||
fun setXOffset(unit:Int,offset:Float):IShadow
|
||||
|
||||
/**
|
||||
* 设置竖直方向的偏移量
|
||||
* @param offset y轴偏移
|
||||
*/
|
||||
fun setYOffset(offset:Float):IShadow
|
||||
|
||||
/**
|
||||
* 设置竖直方向的偏移量,带单位
|
||||
* @param unit @{@link android.util.TypedValue#TYPE_DIMENSION}
|
||||
* @param offset y轴偏移
|
||||
*/
|
||||
fun setYOffset(unit:Int,offset:Float):IShadow
|
||||
|
||||
/**
|
||||
* 更新绘制
|
||||
*/
|
||||
fun commit();
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
android:layout_height="match_parent"
|
||||
android:background="@android:color/transparent">
|
||||
|
||||
<com.mogo.och.bus.passenger.ui.BusBorderShadowLayout
|
||||
<com.mogo.och.common.module.wigets.OCHBorderShadowLayout
|
||||
android:id="@+id/edge_view"
|
||||
android:layout_width="716px"
|
||||
android:layout_height="match_parent"
|
||||
@@ -19,7 +19,7 @@
|
||||
android:layout_width="@dimen/bus_p_route_info_panel_width"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@android:color/transparent" />
|
||||
</com.mogo.och.bus.passenger.ui.BusBorderShadowLayout>
|
||||
</com.mogo.och.common.module.wigets.OCHBorderShadowLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="@dimen/bus_p_route_info_panel_width"
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!--阴影布局 -->
|
||||
<declare-styleable name="ShadowLayout">
|
||||
<!-- 阴影颜色-->
|
||||
<attr name="shadowColor" format="color"/>
|
||||
<!-- 圆角大小,默认无圆角0-->
|
||||
<attr name="shadowRadius" format="dimension"/>
|
||||
<!-- 模糊半径 -->
|
||||
<attr name="blurRadius" format="dimension" />
|
||||
<!-- 是否有点击效果-->
|
||||
<attr name="hasEffect" format="boolean"/>
|
||||
<attr name="bgColor" format="color"/>
|
||||
<!-- 水平位移-->
|
||||
<attr name="xOffset" format="dimension"/>
|
||||
<!--竖直位移 -->
|
||||
<attr name="yOffset" format="dimension"/>
|
||||
|
||||
</declare-styleable>
|
||||
</resources>
|
||||
@@ -8,6 +8,7 @@ import android.widget.ImageView;
|
||||
import com.mogo.eagle.core.function.api.hmi.view.IViewTrafficLight;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.bus.R;
|
||||
import com.mogo.och.common.module.wigets.OCHGradientTextView;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -19,7 +20,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
public class BusTrafficLightView extends IViewTrafficLight {
|
||||
|
||||
private ImageView mLightIconIV;
|
||||
private GradientTextView mLightTimeTV;
|
||||
private OCHGradientTextView mLightTimeTV;
|
||||
private int mCurrentLightId;
|
||||
|
||||
public BusTrafficLightView(@Nullable Context context) {
|
||||
|
||||
@@ -1,113 +0,0 @@
|
||||
package com.mogo.och.bus.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.LinearGradient;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.Shader;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import androidx.appcompat.widget.AppCompatTextView;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/3/22
|
||||
*/
|
||||
public class GradientTextView extends AppCompatTextView {
|
||||
|
||||
private LinearGradient mLinearGradient;
|
||||
private Paint mPaint;
|
||||
private int mViewWidth = 0;//文字的宽度
|
||||
private int mViewHeight = 0;//文字的高度
|
||||
private Rect mTextBound = new Rect();
|
||||
private int[] mColorList;//存放颜色的数组
|
||||
private boolean isVertrial;//默认是横向
|
||||
|
||||
private float mRadius;
|
||||
private float mdx;
|
||||
private float mdy;
|
||||
private int mColor;
|
||||
|
||||
public GradientTextView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public GradientTextView(Context context,
|
||||
AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
//设置默认的颜色
|
||||
mColorList = new int[]{0xFFFFFFFF, 0xFFFFFFF};
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
|
||||
if (isVertrial) {
|
||||
mViewHeight = getMeasuredHeight();
|
||||
} else {
|
||||
mViewWidth = getMeasuredWidth();
|
||||
}
|
||||
mPaint = getPaint();
|
||||
String mTipText = getText().toString();
|
||||
|
||||
setStyle();
|
||||
|
||||
mPaint.getTextBounds(mTipText, 0, mTipText.length(), mTextBound);
|
||||
|
||||
mPaint.setShadowLayer(mRadius, mdx, mdy, mColor);
|
||||
|
||||
//画出文字
|
||||
canvas.drawText(mTipText, getMeasuredWidth() / 2 - mTextBound.width() / 2, getMeasuredHeight() / 2 + mTextBound.height() / 2, mPaint);
|
||||
}
|
||||
|
||||
/**
|
||||
* true表示纵向渐变,false变身横向渐变
|
||||
*
|
||||
* @param vertrial
|
||||
*/
|
||||
public void setVertrial(boolean vertrial) {
|
||||
isVertrial = vertrial;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置渐变的颜色
|
||||
*
|
||||
* @param mColorList
|
||||
*/
|
||||
public void setmColorList(int[] mColorList) {
|
||||
if (mColorList != null && mColorList.length < 2) {
|
||||
throw new RuntimeException("ClorList's length must be > 2");
|
||||
} else {
|
||||
|
||||
this.mColorList = mColorList;
|
||||
}
|
||||
}
|
||||
|
||||
public void setStyle() {
|
||||
mPaint.setAntiAlias(true);
|
||||
mPaint.setDither(true);
|
||||
mPaint.setFilterBitmap(true);
|
||||
//前面4个参数分别表示渐变的开始x轴,开始y轴,结束的x轴,结束的y轴,mcolorList表示渐变的颜色数组
|
||||
mLinearGradient = new LinearGradient(0, 0, mViewWidth, mViewHeight, mColorList, null, Shader.TileMode.CLAMP);
|
||||
mPaint.setShader(mLinearGradient);
|
||||
mPaint.setStrokeJoin(Paint.Join.ROUND);
|
||||
mPaint.setStrokeCap(Paint.Cap.ROUND);
|
||||
mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置投影层
|
||||
* @param radius
|
||||
* @param dx
|
||||
* @param dy
|
||||
* @param color
|
||||
*/
|
||||
public void setShadowLayerCustom(float radius, float dx, float dy, int color) {
|
||||
this.mRadius = radius;
|
||||
this.mdx = dx;
|
||||
this.mdy = dy;
|
||||
this.mColor = color;
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,7 @@
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<com.mogo.och.bus.ui.GradientTextView
|
||||
<com.mogo.och.common.module.wigets.OCHGradientTextView
|
||||
android:id="@+id/bus_traffic_light_time_tv"
|
||||
android:layout_width="@dimen/bus_traffic_light_time_view_width"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
@@ -29,6 +29,7 @@ dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
implementation 'androidx.core:core-ktx:1.1.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0'
|
||||
implementation 'com.google.android.material:material:1.2.1'
|
||||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
package com.mogo.och.common.module
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/4/27
|
||||
*/
|
||||
interface CommonUtilsInterface {
|
||||
|
||||
}
|
||||
@@ -44,9 +44,6 @@ public class OCHBorderShadowLayout extends LinearLayout {
|
||||
//阴影颜色
|
||||
private int shadowColor = Color.parseColor("#333333");
|
||||
|
||||
//阴影类型,0:默认为单边 1:单边 2:邻边 3:四边所有
|
||||
private int shadowType;
|
||||
|
||||
//阴影半径
|
||||
private float shadowRadius = 0f;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.och.taxi.passenger.ui;
|
||||
package com.mogo.och.common.module.wigets;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
@@ -12,36 +12,36 @@ import android.util.AttributeSet;
|
||||
|
||||
import androidx.cardview.widget.CardView;
|
||||
|
||||
import com.mogo.och.taxi.passenger.R;
|
||||
import com.mogo.och.common.module.R;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/9/29
|
||||
* @date: 2022/5/7
|
||||
*/
|
||||
public class TaxiPassengerCardView extends CardView {
|
||||
public class OCHCornerCustomCardView extends CardView {
|
||||
|
||||
private int defaultRadius = 0;
|
||||
private float tlRadiu;
|
||||
private float trRadiu;
|
||||
private float brRadiu;
|
||||
private float blRadiu;
|
||||
public TaxiPassengerCardView(Context context) {
|
||||
public OCHCornerCustomCardView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public TaxiPassengerCardView(Context context, AttributeSet attrs) {
|
||||
public OCHCornerCustomCardView(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, R.attr.materialCardViewStyle);
|
||||
}
|
||||
|
||||
public TaxiPassengerCardView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
public OCHCornerCustomCardView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
setRadius(0);
|
||||
TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.TaxiPassengerRoundCorner);
|
||||
TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.OCHCardViewCorner);
|
||||
|
||||
tlRadiu = array.getDimension(R.styleable.TaxiPassengerRoundCorner_taxi_left_top_radius, defaultRadius);
|
||||
trRadiu = array.getDimension(R.styleable.TaxiPassengerRoundCorner_taxi_right_top_radius, defaultRadius);
|
||||
brRadiu = array.getDimension(R.styleable.TaxiPassengerRoundCorner_taxi_right_bottom_radius, defaultRadius);
|
||||
blRadiu = array.getDimension(R.styleable.TaxiPassengerRoundCorner_taxi_left_bottom_radius, defaultRadius);
|
||||
tlRadiu = array.getDimension(R.styleable.OCHCardViewCorner_och_card_left_top_radius, defaultRadius);
|
||||
trRadiu = array.getDimension(R.styleable.OCHCardViewCorner_och_card_right_top_radius, defaultRadius);
|
||||
brRadiu = array.getDimension(R.styleable.OCHCardViewCorner_och_card_right_bottom_radius, defaultRadius);
|
||||
blRadiu = array.getDimension(R.styleable.OCHCardViewCorner_och_card_left_bottom_radius, defaultRadius);
|
||||
setBackground(new ColorDrawable());
|
||||
}
|
||||
|
||||
@@ -26,4 +26,12 @@
|
||||
<attr name="yOffset" format="dimension"/>
|
||||
|
||||
</declare-styleable>
|
||||
|
||||
<!--CardView -->
|
||||
<declare-styleable name="OCHCardViewCorner">
|
||||
<attr name="och_card_left_top_radius" format="dimension" />
|
||||
<attr name="och_card_right_top_radius" format="dimension" />
|
||||
<attr name="och_card_right_bottom_radius" format="dimension" />
|
||||
<attr name="och_card_left_bottom_radius" format="dimension" />
|
||||
</declare-styleable>
|
||||
</resources>
|
||||
@@ -1,112 +0,0 @@
|
||||
package com.mogo.och.taxi.passenger.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.LinearGradient;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.Shader;
|
||||
import android.util.AttributeSet;
|
||||
import androidx.appcompat.widget.AppCompatTextView;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/3/22
|
||||
*/
|
||||
public class GradientTextView extends AppCompatTextView {
|
||||
|
||||
private LinearGradient mLinearGradient;
|
||||
private Paint mPaint;
|
||||
private int mViewWidth = 0;//文字的宽度
|
||||
private int mViewHeight = 0;//文字的高度
|
||||
private Rect mTextBound = new Rect();
|
||||
private int[] mColorList;//存放颜色的数组
|
||||
private boolean isVertrial;//默认是横向
|
||||
|
||||
private float mRadius;
|
||||
private float mdx;
|
||||
private float mdy;
|
||||
private int mColor;
|
||||
|
||||
public GradientTextView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public GradientTextView(Context context,
|
||||
AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
//设置默认的颜色
|
||||
mColorList = new int[]{0xFFFFFFFF, 0xFFFFFFF};
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
|
||||
if (isVertrial) {
|
||||
mViewHeight = getMeasuredHeight();
|
||||
} else {
|
||||
mViewWidth = getMeasuredWidth();
|
||||
}
|
||||
mPaint = getPaint();
|
||||
String mTipText = getText().toString();
|
||||
|
||||
setStyle();
|
||||
|
||||
mPaint.getTextBounds(mTipText, 0, mTipText.length(), mTextBound);
|
||||
|
||||
mPaint.setShadowLayer(mRadius, mdx, mdy, mColor);
|
||||
|
||||
//画出文字
|
||||
canvas.drawText(mTipText, getMeasuredWidth() / 2 - mTextBound.width() / 2, getMeasuredHeight() / 2 + mTextBound.height() / 2, mPaint);
|
||||
}
|
||||
|
||||
/**
|
||||
* true表示纵向渐变,false变身横向渐变
|
||||
*
|
||||
* @param vertrial
|
||||
*/
|
||||
public void setVertrial(boolean vertrial) {
|
||||
isVertrial = vertrial;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置渐变的颜色
|
||||
*
|
||||
* @param mColorList
|
||||
*/
|
||||
public void setmColorList(int[] mColorList) {
|
||||
if (mColorList != null && mColorList.length < 2) {
|
||||
throw new RuntimeException("ClorList's length must be > 2");
|
||||
} else {
|
||||
|
||||
this.mColorList = mColorList;
|
||||
}
|
||||
}
|
||||
|
||||
public void setStyle() {
|
||||
mPaint.setAntiAlias(true);
|
||||
mPaint.setDither(true);
|
||||
mPaint.setFilterBitmap(true);
|
||||
//前面4个参数分别表示渐变的开始x轴,开始y轴,结束的x轴,结束的y轴,mcolorList表示渐变的颜色数组
|
||||
mLinearGradient = new LinearGradient(0, 0, mViewWidth, mViewHeight, mColorList, null, Shader.TileMode.CLAMP);
|
||||
mPaint.setShader(mLinearGradient);
|
||||
mPaint.setStrokeJoin(Paint.Join.ROUND);
|
||||
mPaint.setStrokeCap(Paint.Cap.ROUND);
|
||||
mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置投影层
|
||||
* @param radius
|
||||
* @param dx
|
||||
* @param dy
|
||||
* @param color
|
||||
*/
|
||||
public void setShadowLayerCustom(float radius, float dx, float dy, int color) {
|
||||
this.mRadius = radius;
|
||||
this.mdx = dx;
|
||||
this.mdy = dy;
|
||||
this.mColor = color;
|
||||
}
|
||||
}
|
||||
@@ -1,110 +0,0 @@
|
||||
package com.mogo.och.taxi.passenger.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Path;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.appcompat.widget.AppCompatImageView;
|
||||
|
||||
import com.mogo.och.taxi.passenger.R;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/9/29
|
||||
*/
|
||||
public class TaxiPassengerRadiuImageView extends AppCompatImageView {
|
||||
private float width, height;
|
||||
private int defaultRadius = 0;
|
||||
private int radius;
|
||||
private int leftTopRadius;
|
||||
private int rightTopRadius;
|
||||
private int rightBottomRadius;
|
||||
private int leftBottomRadius;
|
||||
|
||||
|
||||
public TaxiPassengerRadiuImageView(Context context) {
|
||||
this(context, null);
|
||||
init(context, null);
|
||||
}
|
||||
|
||||
public TaxiPassengerRadiuImageView(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
init(context, attrs);
|
||||
}
|
||||
|
||||
public TaxiPassengerRadiuImageView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
init(context, attrs);
|
||||
}
|
||||
|
||||
private void init(Context context, AttributeSet attrs) {
|
||||
if (Build.VERSION.SDK_INT < 18) {
|
||||
setLayerType(View.LAYER_TYPE_SOFTWARE, null);
|
||||
}
|
||||
// 读取配置
|
||||
TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.RoundCornerImageView);
|
||||
radius = array.getDimensionPixelOffset(R.styleable.RoundCornerImageView_taxi_passenger_radius, defaultRadius);
|
||||
leftTopRadius = array.getDimensionPixelOffset(R.styleable.RoundCornerImageView_taxi_passenger_left_top_radius, defaultRadius);
|
||||
rightTopRadius = array.getDimensionPixelOffset(R.styleable.RoundCornerImageView_taxi_passenger_right_top_radius, defaultRadius);
|
||||
rightBottomRadius = array.getDimensionPixelOffset(R.styleable.RoundCornerImageView_taxi_passenger_right_bottom_radius, defaultRadius);
|
||||
leftBottomRadius = array.getDimensionPixelOffset(R.styleable.RoundCornerImageView_taxi_passenger_left_bottom_radius, defaultRadius);
|
||||
|
||||
|
||||
if (defaultRadius == leftTopRadius) {
|
||||
leftTopRadius = radius;
|
||||
}
|
||||
if (defaultRadius == rightTopRadius) {
|
||||
rightTopRadius = radius;
|
||||
}
|
||||
if (defaultRadius == rightBottomRadius) {
|
||||
rightBottomRadius = radius;
|
||||
}
|
||||
if (defaultRadius == leftBottomRadius) {
|
||||
leftBottomRadius = radius;
|
||||
}
|
||||
array.recycle();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
||||
super.onLayout(changed, left, top, right, bottom);
|
||||
width = getWidth();
|
||||
height = getHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
//这里做下判断,只有图片的宽高大于设置的圆角距离的时候才进行裁剪
|
||||
int maxLeft = Math.max(leftTopRadius, leftBottomRadius);
|
||||
int maxRight = Math.max(rightTopRadius, rightBottomRadius);
|
||||
int minWidth = maxLeft + maxRight;
|
||||
int maxTop = Math.max(leftTopRadius, rightTopRadius);
|
||||
int maxBottom = Math.max(leftBottomRadius, rightBottomRadius);
|
||||
int minHeight = maxTop + maxBottom;
|
||||
if (width >= minWidth && height > minHeight) {
|
||||
Path path = new Path();
|
||||
//右上,右下,左下,左上
|
||||
path.moveTo(leftTopRadius, 0);
|
||||
path.lineTo(width - rightTopRadius, 0);
|
||||
path.quadTo(width, 0, width, rightTopRadius);
|
||||
|
||||
path.lineTo(width, height - rightBottomRadius);
|
||||
path.quadTo(width, height, width - rightBottomRadius, height);
|
||||
|
||||
path.lineTo(leftBottomRadius, height);
|
||||
path.quadTo(0, height, 0, height - leftBottomRadius);
|
||||
|
||||
path.lineTo(0, leftTopRadius);
|
||||
path.quadTo(0, 0, leftTopRadius, 0);
|
||||
|
||||
canvas.clipPath(path);
|
||||
}
|
||||
super.onDraw(canvas);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,6 +24,8 @@ import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil;
|
||||
import com.mogo.och.common.module.utils.NumberFormatUtil;
|
||||
import com.mogo.och.common.module.wigets.OCHGradientTextView;
|
||||
import com.mogo.och.common.module.wigets.OCHRadiusImageView;
|
||||
import com.mogo.och.taxi.passenger.R;
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerOrderQueryRespBean;
|
||||
import com.mogo.och.taxi.passenger.callback.ITaxiPassengerMapViewCallback;
|
||||
@@ -46,7 +48,7 @@ public class TaxiPassengerServingOrderFragment extends
|
||||
|
||||
private final String TAG = TaxiPassengerServingOrderFragment.class.getSimpleName();
|
||||
|
||||
private GradientTextView mTPSpeedTv;
|
||||
private OCHGradientTextView mTPSpeedTv;
|
||||
private TextView mTPSpeedTvShadowBg;
|
||||
|
||||
private TextView mTPOrderStatus;
|
||||
@@ -65,7 +67,7 @@ public class TaxiPassengerServingOrderFragment extends
|
||||
private AppCompatSeekBar mProgressSeekBar;
|
||||
private TextView mProgessDes;
|
||||
|
||||
private TaxiPassengerRadiuImageView mSpeedLayoutBg;
|
||||
private OCHRadiusImageView mSpeedLayoutBg;
|
||||
|
||||
private int mLimitingVelocity = 0;// 返回的道路限速值
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import android.widget.TextView;
|
||||
|
||||
import com.mogo.eagle.core.function.api.hmi.view.IViewTrafficLight;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.common.module.wigets.OCHGradientTextView;
|
||||
import com.mogo.och.taxi.passenger.R;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -22,7 +23,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
public class TaxiPassengerTrafficLightView extends IViewTrafficLight {
|
||||
|
||||
private ImageView mLightIconIV;
|
||||
private GradientTextView mLightTimeTV;
|
||||
private OCHGradientTextView mLightTimeTV;
|
||||
private int mCurrentLightId;
|
||||
|
||||
public TaxiPassengerTrafficLightView(@Nullable Context context) {
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<com.mogo.och.taxi.passenger.ui.TaxiPassengerRadiuImageView
|
||||
<com.mogo.och.common.module.wigets.OCHRadiusImageView
|
||||
android:id="@+id/taxi_p_speed_bg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -33,8 +33,8 @@
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:taxi_passenger_left_top_radius="@dimen/dp_48"
|
||||
app:taxi_passenger_right_top_radius="@dimen/dp_48" />
|
||||
app:och_image_left_top_radius="@dimen/dp_48"
|
||||
app:och_image_right_top_radius="@dimen/dp_48" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/taxi_p_order_stations"
|
||||
@@ -341,7 +341,7 @@
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/taxi_p_speed_shadow_color"
|
||||
android:textSize="@dimen/taxi_p_speed_size"/>
|
||||
<com.mogo.och.taxi.passenger.ui.GradientTextView
|
||||
<com.mogo.och.common.module.wigets.OCHGradientTextView
|
||||
android:id="@+id/taxi_p_speed_tv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.mogo.och.taxi.passenger.ui.TaxiPassengerCardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<com.mogo.och.common.module.wigets.OCHCornerCustomCardView 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"
|
||||
app:taxi_right_bottom_radius="@dimen/dp_40"
|
||||
app:taxi_left_bottom_radius="@dimen/dp_40"
|
||||
app:och_card_right_bottom_radius="@dimen/dp_40"
|
||||
app:och_card_left_bottom_radius="@dimen/dp_40"
|
||||
android:background="@color/taxi_p_map_bg">
|
||||
|
||||
<com.amap.api.maps.TextureMapView
|
||||
@@ -14,4 +14,4 @@
|
||||
android:background="@color/taxi_p_map_bg"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
</com.mogo.och.taxi.passenger.ui.TaxiPassengerCardView>
|
||||
</com.mogo.och.common.module.wigets.OCHCornerCustomCardView>
|
||||
@@ -22,7 +22,7 @@
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<com.mogo.och.taxi.passenger.ui.GradientTextView
|
||||
<com.mogo.och.common.module.wigets.OCHGradientTextView
|
||||
android:id="@+id/taxi_p_traffic_light_time_tv"
|
||||
android:layout_width="@dimen/taxi_p_traffic_light_time_view_width"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<declare-styleable name="TaxiPassengerRoundCorner">
|
||||
<attr name="taxi_left_top_radius" format="dimension" />
|
||||
<attr name="taxi_right_top_radius" format="dimension" />
|
||||
<attr name="taxi_right_bottom_radius" format="dimension" />
|
||||
<attr name="taxi_left_bottom_radius" format="dimension" />
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="RoundCornerImageView">
|
||||
<attr name="taxi_passenger_radius" format="dimension" />
|
||||
<attr name="taxi_passenger_left_top_radius" format="dimension" />
|
||||
<attr name="taxi_passenger_right_top_radius" format="dimension" />
|
||||
<attr name="taxi_passenger_right_bottom_radius" format="dimension" />
|
||||
<attr name="taxi_passenger_left_bottom_radius" format="dimension" />
|
||||
</declare-styleable>
|
||||
|
||||
</resources>
|
||||
@@ -1,65 +0,0 @@
|
||||
package com.mogo.och.taxi.callback
|
||||
|
||||
import androidx.annotation.ColorRes
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/1/21
|
||||
*/
|
||||
interface IShadow {
|
||||
//设置阴影半径
|
||||
fun setShadowRadius(radius:Float):IShadow
|
||||
|
||||
//添加单位设置
|
||||
fun setShadowRadius(unit:Int,radius: Float):IShadow
|
||||
|
||||
//设置应用颜色
|
||||
fun setShadowColor(color:Int):IShadow
|
||||
|
||||
//设置阴影颜色资源文件id
|
||||
fun setShadowColorRes(@ColorRes color: Int):IShadow
|
||||
/**
|
||||
* 设置模糊半径
|
||||
* @param radius
|
||||
*/
|
||||
fun setBlurRadius(radius:Float):IShadow
|
||||
|
||||
/**
|
||||
*
|
||||
* @param unit @{@link android.util.TypedValue#TYPE_DIMENSION}
|
||||
* @param radius 模糊半径
|
||||
*/
|
||||
fun setBlurRadius(unit:Int,radius:Float):IShadow
|
||||
|
||||
/**
|
||||
* 设置水平方向的偏移量
|
||||
* @param offset x轴偏移
|
||||
*/
|
||||
fun setXOffset(offset:Float):IShadow
|
||||
|
||||
|
||||
/**
|
||||
* 设置x方向的偏移量,设置单位
|
||||
* @param unit @{@link android.util.TypedValue#TYPE_DIMENSION}
|
||||
* @param offset x轴偏移
|
||||
*/
|
||||
fun setXOffset(unit:Int,offset:Float):IShadow
|
||||
|
||||
/**
|
||||
* 设置竖直方向的偏移量
|
||||
* @param offset y轴偏移
|
||||
*/
|
||||
fun setYOffset(offset:Float):IShadow
|
||||
|
||||
/**
|
||||
* 设置竖直方向的偏移量,带单位
|
||||
* @param unit @{@link android.util.TypedValue#TYPE_DIMENSION}
|
||||
* @param offset y轴偏移
|
||||
*/
|
||||
fun setYOffset(unit:Int,offset:Float):IShadow
|
||||
|
||||
/**
|
||||
* 更新绘制
|
||||
*/
|
||||
fun commit();
|
||||
}
|
||||
@@ -1,360 +0,0 @@
|
||||
package com.mogo.och.taxi.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.BlurMaskFilter;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.RectF;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.TypedValue;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import com.mogo.och.taxi.R;
|
||||
import com.mogo.och.taxi.callback.IShadow;
|
||||
import com.mogo.och.taxi.utils.DimenUtil;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/1/21
|
||||
* 边框阴影
|
||||
*/
|
||||
public class BorderShadowLayout extends LinearLayout {
|
||||
|
||||
|
||||
private static final String TAG = "ShadowLayout";
|
||||
|
||||
//默认阴影半径
|
||||
public static final float SHADOW_DEFAULT_RADIUS = DimenUtil.INSTANCE.dp2px(5);
|
||||
|
||||
//阴影最大偏移量
|
||||
public static final float SHADOW_MAX_OFFSET = DimenUtil.INSTANCE.dp2px(20);
|
||||
|
||||
//阴影最大模糊半径
|
||||
public static final float SHADOW_MAX_BLUR = DimenUtil.INSTANCE.dp2px(20);
|
||||
|
||||
|
||||
|
||||
//默认模糊半径
|
||||
public static final float SHADOW_DEFAULT_BLUR_RADIUS = DimenUtil.INSTANCE.dp2px(5);
|
||||
|
||||
|
||||
//阴影颜色
|
||||
private int shadowColor = Color.parseColor("#333333");
|
||||
|
||||
//阴影类型,0:默认为单边 1:单边 2:邻边 3:四边所有
|
||||
private int shadowType;
|
||||
|
||||
//阴影半径
|
||||
private float shadowRadius = 0f;
|
||||
|
||||
//模糊度半径
|
||||
private float blurRadius = SHADOW_DEFAULT_BLUR_RADIUS ;
|
||||
|
||||
//水平位移
|
||||
private float xOffset = DimenUtil.INSTANCE.dp2px(10);
|
||||
|
||||
|
||||
//竖直方向位移
|
||||
private float yOffset = DimenUtil.INSTANCE.dp2px(10);
|
||||
|
||||
//背景色
|
||||
private int bgColor = Color.WHITE;
|
||||
|
||||
//是否有点击效果
|
||||
private boolean hasEffect = false ;
|
||||
|
||||
|
||||
int left =0 ,right =0,top = 0,bottom = 0 ;
|
||||
|
||||
//代理方式
|
||||
private IShadow shadow = new BorderShadowLayout.ShadowConfig(this);
|
||||
|
||||
private float mWidthMode;
|
||||
private float mHeightMode;
|
||||
private Paint mPaint = new Paint();
|
||||
private Paint locationPaint = new Paint();
|
||||
|
||||
public BorderShadowLayout(Context context) {
|
||||
super(context,null);
|
||||
}
|
||||
|
||||
public BorderShadowLayout(Context context, AttributeSet attrs) {
|
||||
this(context, attrs,0);
|
||||
}
|
||||
|
||||
public BorderShadowLayout(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
this.setLayerType(LAYER_TYPE_SOFTWARE, null);//取消硬件加速
|
||||
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.ShadowLayout);
|
||||
shadowColor = typedArray.getColor(R.styleable.ShadowLayout_shadowColor, Color.BLUE);
|
||||
blurRadius = typedArray.getDimension(R.styleable.ShadowLayout_blurRadius, SHADOW_DEFAULT_BLUR_RADIUS);
|
||||
shadowRadius = typedArray.getDimension(R.styleable.ShadowLayout_shadowRadius,0);
|
||||
hasEffect = typedArray.getBoolean(R.styleable.ShadowLayout_hasEffect, false);
|
||||
xOffset = typedArray.getDimension(R.styleable.ShadowLayout_xOffset,DimenUtil.INSTANCE.dp2px(10));
|
||||
yOffset = typedArray.getDimension(R.styleable.ShadowLayout_yOffset,DimenUtil.INSTANCE.dp2px(10));
|
||||
bgColor = typedArray.getColor(R.styleable.ShadowLayout_bgColor,Color.WHITE);
|
||||
typedArray.recycle();
|
||||
|
||||
if (shadowRadius<0){
|
||||
shadowRadius = -shadowRadius;
|
||||
}
|
||||
if (blurRadius < 0) {
|
||||
blurRadius = -blurRadius;
|
||||
}
|
||||
|
||||
blurRadius = Math.min(SHADOW_MAX_BLUR,blurRadius);
|
||||
|
||||
if (Math.abs(xOffset)> SHADOW_MAX_OFFSET){
|
||||
xOffset = xOffset/Math.abs(xOffset) * SHADOW_MAX_OFFSET;
|
||||
}
|
||||
|
||||
if (Math.abs(yOffset) > SHADOW_MAX_OFFSET){
|
||||
yOffset = yOffset/Math.abs(yOffset) * SHADOW_MAX_OFFSET;
|
||||
}
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
private void init(){
|
||||
setBackgroundColor(Color.parseColor("#00ffffff"));
|
||||
if (xOffset>0){
|
||||
//水平偏移量为正数,右侧有阴影,阴影长度为blurRadius+|xOffset|
|
||||
right = (int)(blurRadius + Math.abs(xOffset));
|
||||
}else if (xOffset==0){
|
||||
//水平偏移为0,水平间距为blurRadius
|
||||
left = (int)blurRadius;
|
||||
right = (int)blurRadius;
|
||||
}else {
|
||||
//水平偏移为负数,左侧有阴影,阴影长度为blurRadius+|xOffset|
|
||||
left = (int)(blurRadius + Math.abs(xOffset));
|
||||
}
|
||||
if (yOffset>0){
|
||||
//竖直偏移量为正数,底部有阴影,阴影长度为blurRadius+|yOffset|
|
||||
bottom = (int)(blurRadius + Math.abs(yOffset));
|
||||
}else if (yOffset==0){
|
||||
//竖直偏移量为0,竖直间距为blurRadius
|
||||
top = (int)blurRadius;
|
||||
bottom = (int)blurRadius;
|
||||
}else {
|
||||
//竖直偏移量为负数,顶部有阴影,阴影长度为blurRadius+|yOffset|
|
||||
top = (int)(blurRadius + Math.abs(yOffset));
|
||||
}
|
||||
setPadding(left,top,right,bottom);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取阴影设置
|
||||
* @return 返回阴影设置配置
|
||||
*/
|
||||
public IShadow getShadowConfig(){
|
||||
return shadow;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
||||
super.onLayout(changed,l,t,r,b);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void dispatchDraw(Canvas canvas) {
|
||||
super.dispatchDraw(canvas);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
drawBackground(canvas);//放在super前是后景,相反是前景,前景会覆盖子布局
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//绘制背景色(在子view底部)
|
||||
private void drawBackground(Canvas canvas){
|
||||
|
||||
mWidthMode = getMeasuredWidth();
|
||||
mHeightMode = getMeasuredHeight();
|
||||
float startX = 0;
|
||||
float startY = 0;
|
||||
float endX = 0;
|
||||
float endY = 0;
|
||||
|
||||
if (xOffset==0){
|
||||
startX = right;
|
||||
endX = mWidthMode-blurRadius;
|
||||
}else {
|
||||
startX = right+blurRadius;
|
||||
endX = mWidthMode-left-blurRadius;
|
||||
}
|
||||
|
||||
if (yOffset==0){
|
||||
startY = bottom;
|
||||
endY = mHeightMode-blurRadius;
|
||||
}else {
|
||||
startY = bottom+blurRadius;
|
||||
endY = mHeightMode-top-blurRadius;
|
||||
}
|
||||
// mPaint.setShadowLayer(blurRadius,0,0,shadowColor);
|
||||
if (blurRadius>0){
|
||||
mPaint.setMaskFilter(new BlurMaskFilter(blurRadius,BlurMaskFilter.Blur.NORMAL));
|
||||
}
|
||||
mPaint.setColor(shadowColor);
|
||||
mPaint.setAntiAlias(true);
|
||||
|
||||
RectF shadowRect = new RectF(startX,startY,endX,endY);
|
||||
|
||||
RectF locationRectF = new RectF(left,top,mWidthMode-right,mHeightMode-bottom);
|
||||
if (shadowRadius==0){
|
||||
//不是圆角
|
||||
canvas.drawRect(shadowRect,mPaint);
|
||||
}else {
|
||||
//圆角,角度为shadowRadius
|
||||
canvas.drawRoundRect(shadowRect,shadowRadius,shadowRadius,mPaint);
|
||||
}
|
||||
|
||||
locationPaint.setColor(bgColor);
|
||||
locationPaint.setAntiAlias(true);
|
||||
|
||||
if (shadowRadius==0){
|
||||
//不是圆角
|
||||
canvas.drawRect(locationRectF,locationPaint);
|
||||
}else {
|
||||
//圆角,角度为shadowRadius
|
||||
canvas.drawRoundRect(locationRectF,shadowRadius,shadowRadius,locationPaint);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 阴影配置
|
||||
*/
|
||||
class ShadowConfig implements IShadow {
|
||||
|
||||
//代理
|
||||
private BorderShadowLayout shadow;
|
||||
|
||||
private ShadowConfig(BorderShadowLayout shadow) {
|
||||
this.shadow = shadow;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IShadow setShadowRadius(float radius) {
|
||||
return setShadowRadius(TypedValue.COMPLEX_UNIT_DIP,radius);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IShadow setShadowRadius(int unit, float radius) {
|
||||
Context c = getContext();
|
||||
Resources r;
|
||||
|
||||
if (c == null) {
|
||||
r = Resources.getSystem();
|
||||
} else {
|
||||
r = c.getResources();
|
||||
}
|
||||
shadow.shadowRadius = Math.abs(TypedValue.applyDimension(unit,radius,r.getDisplayMetrics()));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IShadow setShadowColor(int color) {
|
||||
shadow.shadowColor = color;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IShadow setShadowColorRes(int colorRes) {
|
||||
shadow.shadowColor = shadow.getResources().getColor(colorRes);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IShadow setBlurRadius(float radius) {
|
||||
return setBlurRadius(TypedValue.COMPLEX_UNIT_DIP,radius);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IShadow setBlurRadius(int unit, float radius) {
|
||||
Context c = getContext();
|
||||
Resources r;
|
||||
if (c == null) {
|
||||
r = Resources.getSystem();
|
||||
} else {
|
||||
r = c.getResources();
|
||||
}
|
||||
shadow.blurRadius = Math.min(SHADOW_MAX_BLUR,Math.abs(TypedValue.applyDimension(unit,radius,r.getDisplayMetrics())));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IShadow setXOffset(float offset) {
|
||||
return setXOffset(TypedValue.COMPLEX_UNIT_DIP,offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IShadow setXOffset(int unit, float offset) {
|
||||
Context c = getContext();
|
||||
Resources r;
|
||||
if (c == null) {
|
||||
r = Resources.getSystem();
|
||||
} else {
|
||||
r = c.getResources();
|
||||
}
|
||||
|
||||
float x = TypedValue.applyDimension(unit,offset,r.getDisplayMetrics());
|
||||
if (Math.abs(x)> SHADOW_MAX_OFFSET){
|
||||
x = x/Math.abs(x) * SHADOW_MAX_OFFSET;
|
||||
}
|
||||
shadow.xOffset = x;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IShadow setYOffset(float offset) {
|
||||
return setYOffset(TypedValue.COMPLEX_UNIT_DIP,offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IShadow setYOffset(int unit, float offset) {
|
||||
Context c = getContext();
|
||||
Resources r;
|
||||
if (c == null) {
|
||||
r = Resources.getSystem();
|
||||
} else {
|
||||
r = c.getResources();
|
||||
}
|
||||
|
||||
float y = TypedValue.applyDimension(unit,offset,r.getDisplayMetrics());
|
||||
if (Math.abs(y)> SHADOW_MAX_OFFSET){
|
||||
y = y/Math.abs(y) * SHADOW_MAX_OFFSET;
|
||||
}
|
||||
shadow.yOffset = y;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void commit() {
|
||||
shadow.init();
|
||||
shadow.requestLayout();
|
||||
shadow.postInvalidate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,114 +0,0 @@
|
||||
package com.mogo.och.taxi.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.LinearGradient;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.Shader;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import androidx.appcompat.widget.AppCompatTextView;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/3/22
|
||||
*/
|
||||
public class GradientTextView extends AppCompatTextView {
|
||||
|
||||
private LinearGradient mLinearGradient;
|
||||
private Paint mPaint;
|
||||
private int mViewWidth = 0;//文字的宽度
|
||||
private int mViewHeight = 0;//文字的高度
|
||||
private Rect mTextBound = new Rect();
|
||||
private int[] mColorList;//存放颜色的数组
|
||||
private boolean isVertrial;//默认是横向
|
||||
|
||||
private float mRadius;
|
||||
private float mdx;
|
||||
private float mdy;
|
||||
private int mColor;
|
||||
|
||||
public GradientTextView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public GradientTextView(Context context,
|
||||
AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
//设置默认的颜色
|
||||
mColorList = new int[]{0xFFFFFFFF, 0xFFFFFFF};
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
|
||||
if (isVertrial) {
|
||||
mViewHeight = getMeasuredHeight();
|
||||
} else {
|
||||
mViewWidth = getMeasuredWidth();
|
||||
}
|
||||
mPaint = getPaint();
|
||||
String mTipText = getText().toString();
|
||||
|
||||
setStyle();
|
||||
|
||||
mPaint.getTextBounds(mTipText, 0, mTipText.length(), mTextBound);
|
||||
|
||||
mPaint.setShadowLayer(mRadius, mdx, mdy, mColor);
|
||||
|
||||
//画出文字
|
||||
canvas.drawText(mTipText, getMeasuredWidth() / 2 - mTextBound.width() / 2, getMeasuredHeight() / 2 + mTextBound.height() / 2, mPaint);
|
||||
}
|
||||
|
||||
/**
|
||||
* true表示纵向渐变,false变身横向渐变
|
||||
*
|
||||
* @param vertrial
|
||||
*/
|
||||
public void setVertrial(boolean vertrial) {
|
||||
isVertrial = vertrial;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置渐变的颜色
|
||||
*
|
||||
* @param mColorList
|
||||
*/
|
||||
public void setmColorList(int[] mColorList) {
|
||||
if (mColorList != null && mColorList.length < 2) {
|
||||
throw new RuntimeException("ClorList's length must be > 2");
|
||||
} else {
|
||||
|
||||
this.mColorList = mColorList;
|
||||
}
|
||||
}
|
||||
|
||||
public void setStyle() {
|
||||
mPaint.setAntiAlias(true);
|
||||
mPaint.setDither(true);
|
||||
mPaint.setFilterBitmap(true);
|
||||
//前面4个参数分别表示渐变的开始x轴,开始y轴,结束的x轴,结束的y轴,mcolorList表示渐变的颜色数组
|
||||
mLinearGradient = new LinearGradient(0, 0, mViewWidth, mViewHeight, mColorList, null, Shader.TileMode.CLAMP);
|
||||
mPaint.setShader(mLinearGradient);
|
||||
mPaint.setStrokeJoin(Paint.Join.ROUND);
|
||||
mPaint.setStrokeCap(Paint.Cap.ROUND);
|
||||
mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置投影层
|
||||
* @param radius
|
||||
* @param dx
|
||||
* @param dy
|
||||
* @param color
|
||||
*/
|
||||
public void setShadowLayerCustom(float radius, float dx, float dy, int color) {
|
||||
this.mRadius = radius;
|
||||
this.mdx = dx;
|
||||
this.mdy = dy;
|
||||
this.mColor = color;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,110 +0,0 @@
|
||||
package com.mogo.och.taxi.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Path;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.appcompat.widget.AppCompatImageView;
|
||||
|
||||
import com.mogo.och.taxi.R;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/9/29
|
||||
*/
|
||||
public class TaxiRadiusImageView extends AppCompatImageView {
|
||||
private float width, height;
|
||||
private int defaultRadius = 0;
|
||||
private int radius;
|
||||
private int leftTopRadius;
|
||||
private int rightTopRadius;
|
||||
private int rightBottomRadius;
|
||||
private int leftBottomRadius;
|
||||
|
||||
|
||||
public TaxiRadiusImageView(Context context) {
|
||||
this(context, null);
|
||||
init(context, null);
|
||||
}
|
||||
|
||||
public TaxiRadiusImageView(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
init(context, attrs);
|
||||
}
|
||||
|
||||
public TaxiRadiusImageView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
init(context, attrs);
|
||||
}
|
||||
|
||||
private void init(Context context, AttributeSet attrs) {
|
||||
if (Build.VERSION.SDK_INT < 18) {
|
||||
setLayerType(View.LAYER_TYPE_SOFTWARE, null);
|
||||
}
|
||||
// 读取配置
|
||||
TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.RoundCornerImageView);
|
||||
radius = array.getDimensionPixelOffset(R.styleable.RoundCornerImageView_taxi_radius, defaultRadius);
|
||||
leftTopRadius = array.getDimensionPixelOffset(R.styleable.RoundCornerImageView_taxi_left_top_radius, defaultRadius);
|
||||
rightTopRadius = array.getDimensionPixelOffset(R.styleable.RoundCornerImageView_taxi_right_top_radius, defaultRadius);
|
||||
rightBottomRadius = array.getDimensionPixelOffset(R.styleable.RoundCornerImageView_taxi_right_bottom_radius, defaultRadius);
|
||||
leftBottomRadius = array.getDimensionPixelOffset(R.styleable.RoundCornerImageView_taxi_left_bottom_radius, defaultRadius);
|
||||
|
||||
|
||||
if (defaultRadius == leftTopRadius) {
|
||||
leftTopRadius = radius;
|
||||
}
|
||||
if (defaultRadius == rightTopRadius) {
|
||||
rightTopRadius = radius;
|
||||
}
|
||||
if (defaultRadius == rightBottomRadius) {
|
||||
rightBottomRadius = radius;
|
||||
}
|
||||
if (defaultRadius == leftBottomRadius) {
|
||||
leftBottomRadius = radius;
|
||||
}
|
||||
array.recycle();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
||||
super.onLayout(changed, left, top, right, bottom);
|
||||
width = getWidth();
|
||||
height = getHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
//这里做下判断,只有图片的宽高大于设置的圆角距离的时候才进行裁剪
|
||||
int maxLeft = Math.max(leftTopRadius, leftBottomRadius);
|
||||
int maxRight = Math.max(rightTopRadius, rightBottomRadius);
|
||||
int minWidth = maxLeft + maxRight;
|
||||
int maxTop = Math.max(leftTopRadius, rightTopRadius);
|
||||
int maxBottom = Math.max(leftBottomRadius, rightBottomRadius);
|
||||
int minHeight = maxTop + maxBottom;
|
||||
if (width >= minWidth && height > minHeight) {
|
||||
Path path = new Path();
|
||||
//右上,右下,左下,左上
|
||||
path.moveTo(leftTopRadius, 0);
|
||||
path.lineTo(width - rightTopRadius, 0);
|
||||
path.quadTo(width, 0, width, rightTopRadius);
|
||||
|
||||
path.lineTo(width, height - rightBottomRadius);
|
||||
path.quadTo(width, height, width - rightBottomRadius, height);
|
||||
|
||||
path.lineTo(leftBottomRadius, height);
|
||||
path.quadTo(0, height, 0, height - leftBottomRadius);
|
||||
|
||||
path.lineTo(0, leftTopRadius);
|
||||
path.quadTo(0, 0, leftTopRadius, 0);
|
||||
|
||||
canvas.clipPath(path);
|
||||
}
|
||||
super.onDraw(canvas);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import android.widget.ImageView;
|
||||
|
||||
import com.mogo.eagle.core.function.api.hmi.view.IViewTrafficLight;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.common.module.wigets.OCHGradientTextView;
|
||||
import com.mogo.och.taxi.R;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -19,7 +20,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
public class TaxiTrafficLightView extends IViewTrafficLight {
|
||||
|
||||
private ImageView mLightIconIV;
|
||||
private GradientTextView mLightTimeTV;
|
||||
private OCHGradientTextView mLightTimeTV;
|
||||
private int mCurrentLightId;
|
||||
|
||||
public TaxiTrafficLightView(@Nullable Context context) {
|
||||
|
||||
@@ -155,13 +155,13 @@
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
|
||||
<com.mogo.och.taxi.ui.TaxiRadiusImageView
|
||||
<com.mogo.och.common.module.wigets.OCHRadiusImageView
|
||||
android:id="@+id/grab_result_anim"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/grab_failure_anmi_flow"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:taxi_right_bottom_radius="60px"/>
|
||||
app:och_image_right_bottom_radius="60px"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.mogo.och.taxi.ui.BorderShadowLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<com.mogo.och.common.module.wigets.OCHBorderShadowLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -64,4 +64,4 @@
|
||||
android:textSize="12sp" />
|
||||
|
||||
</LinearLayout>
|
||||
</com.mogo.och.taxi.ui.BorderShadowLayout>
|
||||
</com.mogo.och.common.module.wigets.OCHBorderShadowLayout>
|
||||
@@ -22,7 +22,7 @@
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<com.mogo.och.taxi.ui.GradientTextView
|
||||
<com.mogo.och.common.module.wigets.OCHGradientTextView
|
||||
android:id="@+id/taxi_traffic_light_time_tv"
|
||||
android:layout_width="@dimen/taxi_traffic_light_time_view_width"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<declare-styleable name="RoundCornerImageView">
|
||||
<attr name="taxi_radius" format="dimension" />
|
||||
<attr name="taxi_left_top_radius" format="dimension" />
|
||||
<attr name="taxi_right_top_radius" format="dimension" />
|
||||
<attr name="taxi_right_bottom_radius" format="dimension" />
|
||||
<attr name="taxi_left_bottom_radius" format="dimension" />
|
||||
</declare-styleable>
|
||||
<!--阴影布局 -->
|
||||
<declare-styleable name="ShadowLayout">
|
||||
<!-- 阴影颜色-->
|
||||
<attr name="shadowColor" format="color"/>
|
||||
<!-- 圆角大小,默认无圆角0-->
|
||||
<attr name="shadowRadius" format="dimension"/>
|
||||
<!-- 模糊半径 -->
|
||||
<attr name="blurRadius" format="dimension" />
|
||||
<!-- 是否有点击效果-->
|
||||
<attr name="hasEffect" format="boolean"/>
|
||||
<attr name="bgColor" format="color"/>
|
||||
<!-- 水平位移-->
|
||||
<attr name="xOffset" format="dimension"/>
|
||||
<!--竖直位移 -->
|
||||
<attr name="yOffset" format="dimension"/>
|
||||
|
||||
</declare-styleable>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user