diff --git a/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/ui/BusBorderShadowLayout.java b/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/ui/BusBorderShadowLayout.java
deleted file mode 100644
index 6bde93ce05..0000000000
--- a/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/ui/BusBorderShadowLayout.java
+++ /dev/null
@@ -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();
- }
- }
-
-
-}
diff --git a/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/ui/IShadow.kt b/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/ui/IShadow.kt
deleted file mode 100644
index ef5d8fd4eb..0000000000
--- a/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/ui/IShadow.kt
+++ /dev/null
@@ -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();
-}
\ No newline at end of file
diff --git a/OCH/mogo-och-bus-passenger/src/main/res/layout/bus_p_route_fragment.xml b/OCH/mogo-och-bus-passenger/src/main/res/layout/bus_p_route_fragment.xml
index badb81fb9e..01bff7f219 100644
--- a/OCH/mogo-och-bus-passenger/src/main/res/layout/bus_p_route_fragment.xml
+++ b/OCH/mogo-och-bus-passenger/src/main/res/layout/bus_p_route_fragment.xml
@@ -5,7 +5,7 @@
android:layout_height="match_parent"
android:background="@android:color/transparent">
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/ui/BusTrafficLightView.java b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/ui/BusTrafficLightView.java
index 561ba5e3ee..c8cee1dff0 100644
--- a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/ui/BusTrafficLightView.java
+++ b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/ui/BusTrafficLightView.java
@@ -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) {
diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/ui/GradientTextView.java b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/ui/GradientTextView.java
deleted file mode 100644
index c93f1c1475..0000000000
--- a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/ui/GradientTextView.java
+++ /dev/null
@@ -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;
- }
-}
diff --git a/OCH/mogo-och-bus/src/main/res/layout/bus_traffic_light_view.xml b/OCH/mogo-och-bus/src/main/res/layout/bus_traffic_light_view.xml
index 05f2d9c38b..2fb7084349 100644
--- a/OCH/mogo-och-bus/src/main/res/layout/bus_traffic_light_view.xml
+++ b/OCH/mogo-och-bus/src/main/res/layout/bus_traffic_light_view.xml
@@ -22,7 +22,7 @@
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
-
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/GradientTextView.java b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/GradientTextView.java
deleted file mode 100644
index 163d8a9d88..0000000000
--- a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/GradientTextView.java
+++ /dev/null
@@ -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;
- }
-}
diff --git a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/TaxiPassengerRadiuImageView.java b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/TaxiPassengerRadiuImageView.java
deleted file mode 100644
index f110b9f5c3..0000000000
--- a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/TaxiPassengerRadiuImageView.java
+++ /dev/null
@@ -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);
- }
-
-}
diff --git a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/TaxiPassengerServingOrderFragment.java b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/TaxiPassengerServingOrderFragment.java
index 7cb5543f28..29662add0f 100644
--- a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/TaxiPassengerServingOrderFragment.java
+++ b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/TaxiPassengerServingOrderFragment.java
@@ -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;// 返回的道路限速值
diff --git a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/TaxiPassengerTrafficLightView.java b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/TaxiPassengerTrafficLightView.java
index 000c05ad24..5004f08bb7 100644
--- a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/TaxiPassengerTrafficLightView.java
+++ b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/TaxiPassengerTrafficLightView.java
@@ -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) {
diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/layout/taxi_p_activity_serving_order_view.xml b/OCH/mogo-och-taxi-passenger/src/main/res/layout/taxi_p_activity_serving_order_view.xml
index 51ce312479..f59ae55046 100644
--- a/OCH/mogo-och-taxi-passenger/src/main/res/layout/taxi_p_activity_serving_order_view.xml
+++ b/OCH/mogo-och-taxi-passenger/src/main/res/layout/taxi_p_activity_serving_order_view.xml
@@ -23,7 +23,7 @@
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent">
-
+ app:och_image_left_top_radius="@dimen/dp_48"
+ app:och_image_right_top_radius="@dimen/dp_48" />
-
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/layout/taxi_p_traffic_light_view.xml b/OCH/mogo-och-taxi-passenger/src/main/res/layout/taxi_p_traffic_light_view.xml
index 5055eaa928..7bd77d1200 100644
--- a/OCH/mogo-och-taxi-passenger/src/main/res/layout/taxi_p_traffic_light_view.xml
+++ b/OCH/mogo-och-taxi-passenger/src/main/res/layout/taxi_p_traffic_light_view.xml
@@ -22,7 +22,7 @@
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/callback/IShadow.kt b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/callback/IShadow.kt
deleted file mode 100644
index 1bf997c223..0000000000
--- a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/callback/IShadow.kt
+++ /dev/null
@@ -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();
-}
\ No newline at end of file
diff --git a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/BorderShadowLayout.java b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/BorderShadowLayout.java
deleted file mode 100644
index 7be3b46212..0000000000
--- a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/BorderShadowLayout.java
+++ /dev/null
@@ -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();
- }
- }
-
-
-}
diff --git a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/GradientTextView.java b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/GradientTextView.java
deleted file mode 100644
index 2532c83983..0000000000
--- a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/GradientTextView.java
+++ /dev/null
@@ -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;
- }
-}
-
diff --git a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/TaxiRadiusImageView.java b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/TaxiRadiusImageView.java
deleted file mode 100644
index 9f61645c94..0000000000
--- a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/TaxiRadiusImageView.java
+++ /dev/null
@@ -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);
- }
-
-}
diff --git a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/TaxiTrafficLightView.java b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/TaxiTrafficLightView.java
index 1567404022..cc5b0a3ffb 100644
--- a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/TaxiTrafficLightView.java
+++ b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/TaxiTrafficLightView.java
@@ -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) {
diff --git a/OCH/mogo-och-taxi/src/main/res/layout/taxi_order_grab_view.xml b/OCH/mogo-och-taxi/src/main/res/layout/taxi_order_grab_view.xml
index 3f9ca0f376..5b35b9dfbf 100644
--- a/OCH/mogo-och-taxi/src/main/res/layout/taxi_order_grab_view.xml
+++ b/OCH/mogo-och-taxi/src/main/res/layout/taxi_order_grab_view.xml
@@ -155,13 +155,13 @@
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
-
+ app:och_image_right_bottom_radius="60px"/>
\ No newline at end of file
diff --git a/OCH/mogo-och-taxi/src/main/res/layout/taxi_panel.xml b/OCH/mogo-och-taxi/src/main/res/layout/taxi_panel.xml
index 8329f6e770..333782635a 100644
--- a/OCH/mogo-och-taxi/src/main/res/layout/taxi_panel.xml
+++ b/OCH/mogo-och-taxi/src/main/res/layout/taxi_panel.xml
@@ -1,5 +1,5 @@
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/OCH/mogo-och-taxi/src/main/res/layout/taxi_traffic_light_view.xml b/OCH/mogo-och-taxi/src/main/res/layout/taxi_traffic_light_view.xml
index badf0a393e..5156e30f3c 100644
--- a/OCH/mogo-och-taxi/src/main/res/layout/taxi_traffic_light_view.xml
+++ b/OCH/mogo-och-taxi/src/main/res/layout/taxi_traffic_light_view.xml
@@ -22,7 +22,7 @@
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file