Files
rr3-apk/decompiled/sources/com/mbridge/msdk/dycreator/baseview/MBRoundRectImageViewC.java
Daniel Elliott f9d20bb3fc Add decompiled APK source code (JADX)
- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-18 14:52:23 -08:00

87 lines
3.1 KiB
Java

package com.mbridge.msdk.dycreator.baseview;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Shader;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import com.mbridge.msdk.foundation.tools.af;
/* loaded from: classes4.dex */
public class MBRoundRectImageViewC extends MBImageView {
private Paint a;
public MBRoundRectImageViewC(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
this.a = new Paint();
}
@Override // android.widget.ImageView, android.view.View
public void onDraw(Canvas canvas) {
try {
Drawable drawable = getDrawable();
if (drawable == null) {
super.onDraw(canvas);
return;
}
Bitmap a = a(((BitmapDrawable) drawable).getBitmap());
if (a != null && !a.isRecycled()) {
Bitmap a2 = a(a, 30);
if (a2 != null && !a2.isRecycled()) {
Rect rect = new Rect(0, 0, a2.getWidth(), a2.getHeight());
this.a.reset();
canvas.drawBitmap(a2, rect, rect, this.a);
return;
}
super.onDraw(canvas);
return;
}
super.onDraw(canvas);
} catch (Exception e) {
af.b("MBRoundRectImageViewC", e.getMessage());
}
}
private Bitmap a(Bitmap bitmap) {
if (bitmap != null && !bitmap.isRecycled()) {
try {
int width = getWidth();
float height = getHeight() / bitmap.getHeight();
Matrix matrix = new Matrix();
matrix.postScale(width / bitmap.getWidth(), height);
return Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
} catch (Exception e) {
af.b("MBRoundRectImageViewC", e.getMessage());
}
}
return bitmap;
}
private Bitmap a(Bitmap bitmap, int i) {
if (bitmap != null && !bitmap.isRecycled()) {
try {
Shader.TileMode tileMode = Shader.TileMode.CLAMP;
BitmapShader bitmapShader = new BitmapShader(bitmap, tileMode, tileMode);
Bitmap createBitmap = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Bitmap.Config.ARGB_4444);
Canvas canvas = new Canvas(createBitmap);
Paint paint = new Paint();
paint.setAntiAlias(true);
paint.setShader(bitmapShader);
float f = i;
canvas.drawRoundRect(new RectF(0.0f, 0.0f, bitmap.getWidth(), bitmap.getHeight()), f, f, paint);
return createBitmap;
} catch (Exception e) {
af.b("MBRoundRectImageViewC", e.getMessage());
}
}
return bitmap;
}
}