579 lines
15 KiB
Smali
579 lines
15 KiB
Smali
.class public final Lcom/angarron/colorpicker/a;
|
|
.super Landroid/widget/FrameLayout;
|
|
.source "ColorItem.java"
|
|
|
|
# interfaces
|
|
.implements Landroid/view/View$OnClickListener;
|
|
|
|
|
|
# annotations
|
|
.annotation system Ldalvik/annotation/MemberClasses;
|
|
value = {
|
|
Lcom/angarron/colorpicker/a$a;
|
|
}
|
|
.end annotation
|
|
|
|
|
|
# instance fields
|
|
.field private mColor:I
|
|
.annotation build Landroidx/annotation/ColorInt;
|
|
.end annotation
|
|
.end field
|
|
|
|
.field private nc:Landroid/widget/ImageView;
|
|
|
|
.field private nd:I
|
|
|
|
.field private ne:Z
|
|
|
|
.field private nf:Lcom/angarron/colorpicker/a$a;
|
|
|
|
|
|
# direct methods
|
|
.method public constructor <init>(Landroid/content/Context;IZ)V
|
|
.locals 0
|
|
.param p2 # I
|
|
.annotation build Landroidx/annotation/ColorInt;
|
|
.end annotation
|
|
.end param
|
|
|
|
invoke-direct {p0, p1}, Landroid/widget/FrameLayout;-><init>(Landroid/content/Context;)V
|
|
|
|
const/4 p1, 0x0
|
|
|
|
iput p1, p0, Lcom/angarron/colorpicker/a;->nd:I
|
|
|
|
iput-boolean p1, p0, Lcom/angarron/colorpicker/a;->ne:Z
|
|
|
|
iput p2, p0, Lcom/angarron/colorpicker/a;->mColor:I
|
|
|
|
iput-boolean p3, p0, Lcom/angarron/colorpicker/a;->ne:Z
|
|
|
|
invoke-direct {p0}, Lcom/angarron/colorpicker/a;->bE()V
|
|
|
|
invoke-virtual {p0, p0}, Lcom/angarron/colorpicker/a;->setOnClickListener(Landroid/view/View$OnClickListener;)V
|
|
|
|
invoke-virtual {p0}, Lcom/angarron/colorpicker/a;->getContext()Landroid/content/Context;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-static {p1}, Landroid/view/LayoutInflater;->from(Landroid/content/Context;)Landroid/view/LayoutInflater;
|
|
|
|
move-result-object p1
|
|
|
|
sget p2, Lcom/angarron/colorpicker/R$b;->color_item:I
|
|
|
|
const/4 p3, 0x1
|
|
|
|
invoke-virtual {p1, p2, p0, p3}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;Z)Landroid/view/View;
|
|
|
|
sget p1, Lcom/angarron/colorpicker/R$a;->selected_checkmark:I
|
|
|
|
invoke-virtual {p0, p1}, Lcom/angarron/colorpicker/a;->findViewById(I)Landroid/view/View;
|
|
|
|
move-result-object p1
|
|
|
|
check-cast p1, Landroid/widget/ImageView;
|
|
|
|
iput-object p1, p0, Lcom/angarron/colorpicker/a;->nc:Landroid/widget/ImageView;
|
|
|
|
iget-object p1, p0, Lcom/angarron/colorpicker/a;->nc:Landroid/widget/ImageView;
|
|
|
|
iget p2, p0, Lcom/angarron/colorpicker/a;->mColor:I
|
|
|
|
invoke-static {p2}, Lcom/angarron/colorpicker/a;->isColorDark(I)Z
|
|
|
|
move-result p2
|
|
|
|
if-eqz p2, :cond_0
|
|
|
|
const/4 p2, -0x1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
const/high16 p2, -0x1000000
|
|
|
|
:goto_0
|
|
invoke-virtual {p1, p2}, Landroid/widget/ImageView;->setColorFilter(I)V
|
|
|
|
iget-boolean p1, p0, Lcom/angarron/colorpicker/a;->ne:Z
|
|
|
|
invoke-virtual {p0, p1}, Lcom/angarron/colorpicker/a;->setChecked(Z)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method static synthetic a(Lcom/angarron/colorpicker/a;F)V
|
|
.locals 0
|
|
|
|
invoke-direct {p0, p1}, Lcom/angarron/colorpicker/a;->setItemCheckmarkAttributes(F)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method static synthetic a(Lcom/angarron/colorpicker/a;)Z
|
|
.locals 0
|
|
|
|
iget-boolean p0, p0, Lcom/angarron/colorpicker/a;->ne:Z
|
|
|
|
return p0
|
|
.end method
|
|
|
|
.method static synthetic b(Lcom/angarron/colorpicker/a;)Landroid/widget/ImageView;
|
|
.locals 0
|
|
|
|
iget-object p0, p0, Lcom/angarron/colorpicker/a;->nc:Landroid/widget/ImageView;
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method private bE()V
|
|
.locals 2
|
|
|
|
invoke-direct {p0}, Lcom/angarron/colorpicker/a;->bG()Landroid/graphics/drawable/Drawable;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {p0, v0}, Lcom/angarron/colorpicker/a;->setForeground(Landroid/graphics/drawable/Drawable;)V
|
|
|
|
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
|
|
|
|
const/16 v1, 0x10
|
|
|
|
if-ge v0, v1, :cond_0
|
|
|
|
invoke-direct {p0}, Lcom/angarron/colorpicker/a;->bF()Landroid/graphics/drawable/Drawable;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {p0, v0}, Lcom/angarron/colorpicker/a;->setBackgroundDrawable(Landroid/graphics/drawable/Drawable;)V
|
|
|
|
return-void
|
|
|
|
:cond_0
|
|
invoke-direct {p0}, Lcom/angarron/colorpicker/a;->bF()Landroid/graphics/drawable/Drawable;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {p0, v0}, Lcom/angarron/colorpicker/a;->setBackground(Landroid/graphics/drawable/Drawable;)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method private bF()Landroid/graphics/drawable/Drawable;
|
|
.locals 3
|
|
|
|
new-instance v0, Landroid/graphics/drawable/GradientDrawable;
|
|
|
|
invoke-direct {v0}, Landroid/graphics/drawable/GradientDrawable;-><init>()V
|
|
|
|
const/4 v1, 0x1
|
|
|
|
invoke-virtual {v0, v1}, Landroid/graphics/drawable/GradientDrawable;->setShape(I)V
|
|
|
|
iget v1, p0, Lcom/angarron/colorpicker/a;->nd:I
|
|
|
|
if-eqz v1, :cond_1
|
|
|
|
iget v2, p0, Lcom/angarron/colorpicker/a;->mColor:I
|
|
|
|
invoke-static {v2}, Lcom/angarron/colorpicker/a;->isColorDark(I)Z
|
|
|
|
move-result v2
|
|
|
|
if-eqz v2, :cond_0
|
|
|
|
const/4 v2, -0x1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
const/high16 v2, -0x1000000
|
|
|
|
:goto_0
|
|
invoke-virtual {v0, v1, v2}, Landroid/graphics/drawable/GradientDrawable;->setStroke(II)V
|
|
|
|
:cond_1
|
|
iget v1, p0, Lcom/angarron/colorpicker/a;->mColor:I
|
|
|
|
invoke-virtual {v0, v1}, Landroid/graphics/drawable/GradientDrawable;->setColor(I)V
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method private bG()Landroid/graphics/drawable/Drawable;
|
|
.locals 5
|
|
|
|
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
|
|
|
|
const/4 v1, 0x1
|
|
|
|
const/16 v2, 0x15
|
|
|
|
if-lt v0, v2, :cond_0
|
|
|
|
new-instance v0, Landroid/graphics/drawable/GradientDrawable;
|
|
|
|
invoke-direct {v0}, Landroid/graphics/drawable/GradientDrawable;-><init>()V
|
|
|
|
invoke-virtual {v0, v1}, Landroid/graphics/drawable/GradientDrawable;->setShape(I)V
|
|
|
|
const/high16 v1, -0x1000000
|
|
|
|
invoke-virtual {v0, v1}, Landroid/graphics/drawable/GradientDrawable;->setColor(I)V
|
|
|
|
new-instance v1, Landroid/graphics/drawable/RippleDrawable;
|
|
|
|
iget v2, p0, Lcom/angarron/colorpicker/a;->mColor:I
|
|
|
|
invoke-static {v2}, Lcom/angarron/colorpicker/a;->m(I)I
|
|
|
|
move-result v2
|
|
|
|
invoke-static {v2}, Landroid/content/res/ColorStateList;->valueOf(I)Landroid/content/res/ColorStateList;
|
|
|
|
move-result-object v2
|
|
|
|
const/4 v3, 0x0
|
|
|
|
invoke-direct {v1, v2, v3, v0}, Landroid/graphics/drawable/RippleDrawable;-><init>(Landroid/content/res/ColorStateList;Landroid/graphics/drawable/Drawable;Landroid/graphics/drawable/Drawable;)V
|
|
|
|
return-object v1
|
|
|
|
:cond_0
|
|
new-instance v0, Landroid/graphics/drawable/StateListDrawable;
|
|
|
|
invoke-direct {v0}, Landroid/graphics/drawable/StateListDrawable;-><init>()V
|
|
|
|
const/16 v2, 0x50
|
|
|
|
invoke-virtual {v0, v2}, Landroid/graphics/drawable/StateListDrawable;->setAlpha(I)V
|
|
|
|
const/16 v2, 0xfa
|
|
|
|
invoke-virtual {v0, v2}, Landroid/graphics/drawable/StateListDrawable;->setEnterFadeDuration(I)V
|
|
|
|
invoke-virtual {v0, v2}, Landroid/graphics/drawable/StateListDrawable;->setExitFadeDuration(I)V
|
|
|
|
new-instance v2, Landroid/graphics/drawable/GradientDrawable;
|
|
|
|
invoke-direct {v2}, Landroid/graphics/drawable/GradientDrawable;-><init>()V
|
|
|
|
invoke-virtual {v2, v1}, Landroid/graphics/drawable/GradientDrawable;->setShape(I)V
|
|
|
|
iget v3, p0, Lcom/angarron/colorpicker/a;->mColor:I
|
|
|
|
invoke-static {v3}, Lcom/angarron/colorpicker/a;->m(I)I
|
|
|
|
move-result v3
|
|
|
|
invoke-virtual {v2, v3}, Landroid/graphics/drawable/GradientDrawable;->setColor(I)V
|
|
|
|
new-array v1, v1, [I
|
|
|
|
const v3, 0x10100a7
|
|
|
|
const/4 v4, 0x0
|
|
|
|
aput v3, v1, v4
|
|
|
|
invoke-virtual {v0, v1, v2}, Landroid/graphics/drawable/StateListDrawable;->addState([ILandroid/graphics/drawable/Drawable;)V
|
|
|
|
new-array v1, v4, [I
|
|
|
|
new-instance v2, Landroid/graphics/drawable/ColorDrawable;
|
|
|
|
invoke-direct {v2, v4}, Landroid/graphics/drawable/ColorDrawable;-><init>(I)V
|
|
|
|
invoke-virtual {v0, v1, v2}, Landroid/graphics/drawable/StateListDrawable;->addState([ILandroid/graphics/drawable/Drawable;)V
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method private static isColorDark(I)Z
|
|
.locals 6
|
|
|
|
invoke-static {p0}, Landroid/graphics/Color;->red(I)I
|
|
|
|
move-result v0
|
|
|
|
int-to-double v0, v0
|
|
|
|
const-wide v2, 0x3fd322d0e5604189L # 0.299
|
|
|
|
invoke-static {v0, v1}, Ljava/lang/Double;->isNaN(D)Z
|
|
|
|
mul-double v0, v0, v2
|
|
|
|
invoke-static {p0}, Landroid/graphics/Color;->green(I)I
|
|
|
|
move-result v2
|
|
|
|
int-to-double v2, v2
|
|
|
|
const-wide v4, 0x3fe2c8b439581062L # 0.587
|
|
|
|
invoke-static {v2, v3}, Ljava/lang/Double;->isNaN(D)Z
|
|
|
|
mul-double v2, v2, v4
|
|
|
|
add-double/2addr v0, v2
|
|
|
|
invoke-static {p0}, Landroid/graphics/Color;->blue(I)I
|
|
|
|
move-result p0
|
|
|
|
int-to-double v2, p0
|
|
|
|
const-wide v4, 0x3fbd2f1a9fbe76c9L # 0.114
|
|
|
|
invoke-static {v2, v3}, Ljava/lang/Double;->isNaN(D)Z
|
|
|
|
mul-double v2, v2, v4
|
|
|
|
add-double/2addr v0, v2
|
|
|
|
const-wide/high16 v2, 0x4064000000000000L # 160.0
|
|
|
|
cmpg-double p0, v0, v2
|
|
|
|
if-gez p0, :cond_0
|
|
|
|
const/4 p0, 0x1
|
|
|
|
return p0
|
|
|
|
:cond_0
|
|
const/4 p0, 0x0
|
|
|
|
return p0
|
|
.end method
|
|
|
|
.method private static m(I)I
|
|
.locals 3
|
|
.annotation build Landroidx/annotation/ColorInt;
|
|
.end annotation
|
|
|
|
const/4 v0, 0x3
|
|
|
|
new-array v0, v0, [F
|
|
|
|
invoke-static {p0, v0}, Landroid/graphics/Color;->colorToHSV(I[F)V
|
|
|
|
const/4 p0, 0x2
|
|
|
|
aget v1, v0, p0
|
|
|
|
const/high16 v2, 0x3f000000 # 0.5f
|
|
|
|
mul-float v1, v1, v2
|
|
|
|
aput v1, v0, p0
|
|
|
|
invoke-static {v0}, Landroid/graphics/Color;->HSVToColor([F)I
|
|
|
|
move-result p0
|
|
|
|
return p0
|
|
.end method
|
|
|
|
.method private setItemCheckmarkAttributes(F)V
|
|
.locals 1
|
|
|
|
iget-object v0, p0, Lcom/angarron/colorpicker/a;->nc:Landroid/widget/ImageView;
|
|
|
|
invoke-virtual {v0, p1}, Landroid/widget/ImageView;->setAlpha(F)V
|
|
|
|
iget-object v0, p0, Lcom/angarron/colorpicker/a;->nc:Landroid/widget/ImageView;
|
|
|
|
invoke-virtual {v0, p1}, Landroid/widget/ImageView;->setScaleX(F)V
|
|
|
|
iget-object v0, p0, Lcom/angarron/colorpicker/a;->nc:Landroid/widget/ImageView;
|
|
|
|
invoke-virtual {v0, p1}, Landroid/widget/ImageView;->setScaleY(F)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public final getColor()I
|
|
.locals 1
|
|
|
|
iget v0, p0, Lcom/angarron/colorpicker/a;->mColor:I
|
|
|
|
return v0
|
|
.end method
|
|
|
|
.method public final onClick(Landroid/view/View;)V
|
|
.locals 0
|
|
|
|
iget-boolean p1, p0, Lcom/angarron/colorpicker/a;->ne:Z
|
|
|
|
if-nez p1, :cond_0
|
|
|
|
const/4 p1, 0x1
|
|
|
|
invoke-virtual {p0, p1}, Lcom/angarron/colorpicker/a;->setChecked(Z)V
|
|
|
|
iget-boolean p1, p0, Lcom/angarron/colorpicker/a;->ne:Z
|
|
|
|
if-eqz p1, :cond_0
|
|
|
|
iget-object p1, p0, Lcom/angarron/colorpicker/a;->nf:Lcom/angarron/colorpicker/a$a;
|
|
|
|
if-eqz p1, :cond_0
|
|
|
|
invoke-interface {p1, p0}, Lcom/angarron/colorpicker/a$a;->c(Lcom/angarron/colorpicker/a;)V
|
|
|
|
:cond_0
|
|
return-void
|
|
.end method
|
|
|
|
.method public final setChecked(Z)V
|
|
.locals 6
|
|
|
|
iget-boolean v0, p0, Lcom/angarron/colorpicker/a;->ne:Z
|
|
|
|
iput-boolean p1, p0, Lcom/angarron/colorpicker/a;->ne:Z
|
|
|
|
const-wide/16 v1, 0xfa
|
|
|
|
const/4 p1, 0x0
|
|
|
|
const/4 v3, 0x0
|
|
|
|
const/high16 v4, 0x3f800000 # 1.0f
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
iget-boolean v5, p0, Lcom/angarron/colorpicker/a;->ne:Z
|
|
|
|
if-eqz v5, :cond_0
|
|
|
|
invoke-direct {p0, v3}, Lcom/angarron/colorpicker/a;->setItemCheckmarkAttributes(F)V
|
|
|
|
iget-object v0, p0, Lcom/angarron/colorpicker/a;->nc:Landroid/widget/ImageView;
|
|
|
|
invoke-virtual {v0, p1}, Landroid/widget/ImageView;->setVisibility(I)V
|
|
|
|
iget-object p1, p0, Lcom/angarron/colorpicker/a;->nc:Landroid/widget/ImageView;
|
|
|
|
invoke-virtual {p1}, Landroid/widget/ImageView;->animate()Landroid/view/ViewPropertyAnimator;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-virtual {p1, v4}, Landroid/view/ViewPropertyAnimator;->alpha(F)Landroid/view/ViewPropertyAnimator;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-virtual {p1, v4}, Landroid/view/ViewPropertyAnimator;->scaleX(F)Landroid/view/ViewPropertyAnimator;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-virtual {p1, v4}, Landroid/view/ViewPropertyAnimator;->scaleY(F)Landroid/view/ViewPropertyAnimator;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-virtual {p1, v1, v2}, Landroid/view/ViewPropertyAnimator;->setDuration(J)Landroid/view/ViewPropertyAnimator;
|
|
|
|
move-result-object p1
|
|
|
|
new-instance v0, Lcom/angarron/colorpicker/a$1;
|
|
|
|
invoke-direct {v0, p0}, Lcom/angarron/colorpicker/a$1;-><init>(Lcom/angarron/colorpicker/a;)V
|
|
|
|
invoke-virtual {p1, v0}, Landroid/view/ViewPropertyAnimator;->setListener(Landroid/animation/Animator$AnimatorListener;)Landroid/view/ViewPropertyAnimator;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-virtual {p1}, Landroid/view/ViewPropertyAnimator;->start()V
|
|
|
|
return-void
|
|
|
|
:cond_0
|
|
if-eqz v0, :cond_1
|
|
|
|
iget-boolean v0, p0, Lcom/angarron/colorpicker/a;->ne:Z
|
|
|
|
if-nez v0, :cond_1
|
|
|
|
iget-object v0, p0, Lcom/angarron/colorpicker/a;->nc:Landroid/widget/ImageView;
|
|
|
|
invoke-virtual {v0, p1}, Landroid/widget/ImageView;->setVisibility(I)V
|
|
|
|
invoke-direct {p0, v4}, Lcom/angarron/colorpicker/a;->setItemCheckmarkAttributes(F)V
|
|
|
|
iget-object p1, p0, Lcom/angarron/colorpicker/a;->nc:Landroid/widget/ImageView;
|
|
|
|
invoke-virtual {p1}, Landroid/widget/ImageView;->animate()Landroid/view/ViewPropertyAnimator;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-virtual {p1, v3}, Landroid/view/ViewPropertyAnimator;->alpha(F)Landroid/view/ViewPropertyAnimator;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-virtual {p1, v3}, Landroid/view/ViewPropertyAnimator;->scaleX(F)Landroid/view/ViewPropertyAnimator;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-virtual {p1, v3}, Landroid/view/ViewPropertyAnimator;->scaleY(F)Landroid/view/ViewPropertyAnimator;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-virtual {p1, v1, v2}, Landroid/view/ViewPropertyAnimator;->setDuration(J)Landroid/view/ViewPropertyAnimator;
|
|
|
|
move-result-object p1
|
|
|
|
new-instance v0, Lcom/angarron/colorpicker/a$2;
|
|
|
|
invoke-direct {v0, p0}, Lcom/angarron/colorpicker/a$2;-><init>(Lcom/angarron/colorpicker/a;)V
|
|
|
|
invoke-virtual {p1, v0}, Landroid/view/ViewPropertyAnimator;->setListener(Landroid/animation/Animator$AnimatorListener;)Landroid/view/ViewPropertyAnimator;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-virtual {p1}, Landroid/view/ViewPropertyAnimator;->start()V
|
|
|
|
return-void
|
|
|
|
:cond_1
|
|
iget-object v0, p0, Lcom/angarron/colorpicker/a;->nc:Landroid/widget/ImageView;
|
|
|
|
iget-boolean v1, p0, Lcom/angarron/colorpicker/a;->ne:Z
|
|
|
|
if-eqz v1, :cond_2
|
|
|
|
goto :goto_0
|
|
|
|
:cond_2
|
|
const/4 p1, 0x4
|
|
|
|
:goto_0
|
|
invoke-virtual {v0, p1}, Landroid/widget/ImageView;->setVisibility(I)V
|
|
|
|
invoke-direct {p0, v4}, Lcom/angarron/colorpicker/a;->setItemCheckmarkAttributes(F)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public final setOnSelectedListener(Lcom/angarron/colorpicker/a$a;)V
|
|
.locals 0
|
|
|
|
iput-object p1, p0, Lcom/angarron/colorpicker/a;->nf:Lcom/angarron/colorpicker/a$a;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public final setOutlineWidth(I)V
|
|
.locals 0
|
|
|
|
iput p1, p0, Lcom/angarron/colorpicker/a;->nd:I
|
|
|
|
invoke-direct {p0}, Lcom/angarron/colorpicker/a;->bE()V
|
|
|
|
return-void
|
|
.end method
|