52 lines
1.7 KiB
Java
52 lines
1.7 KiB
Java
package com.squareup.leakcanary.internal;
|
|
|
|
import android.content.Context;
|
|
import android.content.res.Resources;
|
|
import android.content.res.TypedArray;
|
|
import android.graphics.Canvas;
|
|
import android.graphics.Paint;
|
|
import android.util.AttributeSet;
|
|
import android.view.View;
|
|
import com.squareup.leakcanary.R;
|
|
|
|
/* loaded from: classes.dex */
|
|
public final class MoreDetailsView extends View {
|
|
private final Paint iconPaint;
|
|
private boolean opened;
|
|
|
|
public MoreDetailsView(Context context, AttributeSet attributeSet) {
|
|
super(context, attributeSet);
|
|
Resources resources = getResources();
|
|
this.iconPaint = new Paint(1);
|
|
this.iconPaint.setStrokeWidth(resources.getDimensionPixelSize(R.dimen.leak_canary_more_stroke_width));
|
|
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R.styleable.leak_canary_MoreDetailsView);
|
|
int color = obtainStyledAttributes.getColor(R.styleable.leak_canary_MoreDetailsView_leak_canary_plus_color, -16777216);
|
|
obtainStyledAttributes.recycle();
|
|
this.iconPaint.setColor(color);
|
|
}
|
|
|
|
@Override // android.view.View
|
|
protected void onDraw(Canvas canvas) {
|
|
int width = getWidth();
|
|
int height = getHeight();
|
|
int i = height / 2;
|
|
int i2 = width / 2;
|
|
if (this.opened) {
|
|
float f = i;
|
|
canvas.drawLine(0.0f, f, width, f, this.iconPaint);
|
|
} else {
|
|
float f2 = i;
|
|
canvas.drawLine(0.0f, f2, width, f2, this.iconPaint);
|
|
float f3 = i2;
|
|
canvas.drawLine(f3, 0.0f, f3, height, this.iconPaint);
|
|
}
|
|
}
|
|
|
|
public void setOpened(boolean z) {
|
|
if (z != this.opened) {
|
|
this.opened = z;
|
|
invalidate();
|
|
}
|
|
}
|
|
}
|