|
10 | 10 | import android.graphics.Paint; |
11 | 11 | import android.graphics.Path; |
12 | 12 | import android.graphics.PixelFormat; |
| 13 | +import android.graphics.PorterDuff; |
13 | 14 | import android.graphics.Rect; |
14 | 15 | import android.graphics.drawable.Drawable; |
15 | | -import android.util.Log; |
16 | 16 | import android.util.TypedValue; |
17 | 17 | import android.view.View; |
18 | 18 |
|
@@ -65,9 +65,9 @@ public SmartSpinnerBackgroundDrawable(Context context) { |
65 | 65 | paddingTop=paddingBottom; |
66 | 66 |
|
67 | 67 | TypedValue typedValue=new TypedValue(); |
68 | | - context.getTheme().resolveAttribute(R.attr.colorControlActivated,typedValue,true); |
| 68 | + context.getTheme().resolveAttribute(androidx.appcompat.R.attr.colorControlActivated,typedValue,true); |
69 | 69 | int defaultPressColor = typedValue.data; |
70 | | - context.getTheme().resolveAttribute(R.attr.colorControlHighlight,typedValue,true); |
| 70 | + context.getTheme().resolveAttribute(androidx.appcompat.R.attr.colorControlHighlight,typedValue,true); |
71 | 71 | int rippleColor = typedValue.data; |
72 | 72 |
|
73 | 73 | //<editor-fold desc="triangle"> |
@@ -238,21 +238,27 @@ public boolean getPadding(@NonNull Rect padding) { |
238 | 238 | public ConstantState getConstantState() { |
239 | 239 | return super.getConstantState(); |
240 | 240 | } |
241 | | - |
| 241 | + private float cTriangleY; |
| 242 | +// private float cTriangleX; |
| 243 | + private float startTriangleY; |
| 244 | + private float startTriangleX; |
| 245 | + private float cx; |
242 | 246 | @Override |
243 | 247 | public void draw(@NonNull Canvas canvas) { |
| 248 | +// canvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.MULTIPLY); |
| 249 | + trianglePath.reset(); |
244 | 250 | Rect rect=getBounds(); |
245 | 251 | // Log.v("TTT",rect.toString()); |
246 | | - float cTriangleY=((rect.bottom)/2f); |
247 | | - float cTriangleX=(triangleWith/2)+triangleMarginHorizontal; |
248 | | - float startTriangleY=cTriangleY-triangleHeight/2; |
249 | | - float startTriangleX=triangleMarginHorizontal; |
| 252 | + cTriangleY=((rect.bottom)/2f); |
| 253 | +// cTriangleX=(triangleWith/2)+triangleMarginHorizontal; |
| 254 | + startTriangleY=cTriangleY-triangleHeight/2; |
| 255 | + startTriangleX=triangleMarginHorizontal; |
250 | 256 | /*if direction is ltr draw triangle from right side*/ |
251 | 257 | if (mDirection !=View.LAYOUT_DIRECTION_RTL){ |
252 | 258 | startTriangleX=rect.right - triangleMarginHorizontal - triangleWith; |
253 | 259 |
|
254 | 260 | } |
255 | | - float cx=startTriangleX+triangleWith/2; |
| 261 | + cx=startTriangleX+triangleWith/2; |
256 | 262 | canvas.drawCircle(cx, cTriangleY,rippleRadius,ripplePaint); |
257 | 263 |
|
258 | 264 | trianglePath.moveTo(startTriangleX,startTriangleY); |
|
0 commit comments