.class public Lcom/zcw/togglebutton/ToggleButton; .super Landroid/view/View; .source "ToggleButton.java" # annotations .annotation system Ldalvik/annotation/MemberClasses; value = { Lcom/zcw/togglebutton/ToggleButton$OnToggleChanged; } .end annotation # instance fields .field private borderColor:I .field private borderWidth:I .field private centerY:F .field private defaultAnimate:Z .field private endX:F .field private isDefaultOn:Z .field private listener:Lcom/zcw/togglebutton/ToggleButton$OnToggleChanged; .field private offBorderColor:I .field private offColor:I .field private offLineWidth:F .field private onColor:I .field private paint:Landroid/graphics/Paint; .field private radius:F .field private rect:Landroid/graphics/RectF; .field private spotColor:I .field private spotMaxX:F .field private spotMinX:F .field private spotSize:I .field private spotX:F .field private spring:Lcom/facebook/rebound/Spring; .field springListener:Lcom/facebook/rebound/SimpleSpringListener; .field private springSystem:Lcom/facebook/rebound/SpringSystem; .field private startX:F .field private toggleOn:Z # direct methods .method private constructor (Landroid/content/Context;)V .locals 2 .prologue const/4 v1, 0x0 .line 70 invoke-direct {p0, p1}, Landroid/view/View;->(Landroid/content/Context;)V .line 32 const-string v0, "#4ebb7f" invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I move-result v0 iput v0, p0, Lcom/zcw/togglebutton/ToggleButton;->onColor:I .line 34 const-string v0, "#dadbda" invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I move-result v0 iput v0, p0, Lcom/zcw/togglebutton/ToggleButton;->offBorderColor:I .line 36 const-string v0, "#ffffff" invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I move-result v0 iput v0, p0, Lcom/zcw/togglebutton/ToggleButton;->offColor:I .line 38 const-string v0, "#ffffff" invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I move-result v0 iput v0, p0, Lcom/zcw/togglebutton/ToggleButton;->spotColor:I .line 40 iget v0, p0, Lcom/zcw/togglebutton/ToggleButton;->offBorderColor:I iput v0, p0, Lcom/zcw/togglebutton/ToggleButton;->borderColor:I .line 44 iput-boolean v1, p0, Lcom/zcw/togglebutton/ToggleButton;->toggleOn:Z .line 46 const/4 v0, 0x2 iput v0, p0, Lcom/zcw/togglebutton/ToggleButton;->borderWidth:I .line 60 new-instance v0, Landroid/graphics/RectF; invoke-direct {v0}, Landroid/graphics/RectF;->()V iput-object v0, p0, Lcom/zcw/togglebutton/ToggleButton;->rect:Landroid/graphics/RectF; .line 62 const/4 v0, 0x1 iput-boolean v0, p0, Lcom/zcw/togglebutton/ToggleButton;->defaultAnimate:Z .line 65 iput-boolean v1, p0, Lcom/zcw/togglebutton/ToggleButton;->isDefaultOn:Z .line 235 new-instance v0, Lcom/zcw/togglebutton/ToggleButton$2; invoke-direct {v0, p0}, Lcom/zcw/togglebutton/ToggleButton$2;->(Lcom/zcw/togglebutton/ToggleButton;)V iput-object v0, p0, Lcom/zcw/togglebutton/ToggleButton;->springListener:Lcom/facebook/rebound/SimpleSpringListener; .line 71 return-void .end method .method public constructor (Landroid/content/Context;Landroid/util/AttributeSet;)V .locals 2 .prologue const/4 v1, 0x0 .line 77 invoke-direct {p0, p1, p2}, Landroid/view/View;->(Landroid/content/Context;Landroid/util/AttributeSet;)V .line 32 const-string v0, "#4ebb7f" invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I move-result v0 iput v0, p0, Lcom/zcw/togglebutton/ToggleButton;->onColor:I .line 34 const-string v0, "#dadbda" invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I move-result v0 iput v0, p0, Lcom/zcw/togglebutton/ToggleButton;->offBorderColor:I .line 36 const-string v0, "#ffffff" invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I move-result v0 iput v0, p0, Lcom/zcw/togglebutton/ToggleButton;->offColor:I .line 38 const-string v0, "#ffffff" invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I move-result v0 iput v0, p0, Lcom/zcw/togglebutton/ToggleButton;->spotColor:I .line 40 iget v0, p0, Lcom/zcw/togglebutton/ToggleButton;->offBorderColor:I iput v0, p0, Lcom/zcw/togglebutton/ToggleButton;->borderColor:I .line 44 iput-boolean v1, p0, Lcom/zcw/togglebutton/ToggleButton;->toggleOn:Z .line 46 const/4 v0, 0x2 iput v0, p0, Lcom/zcw/togglebutton/ToggleButton;->borderWidth:I .line 60 new-instance v0, Landroid/graphics/RectF; invoke-direct {v0}, Landroid/graphics/RectF;->()V iput-object v0, p0, Lcom/zcw/togglebutton/ToggleButton;->rect:Landroid/graphics/RectF; .line 62 const/4 v0, 0x1 iput-boolean v0, p0, Lcom/zcw/togglebutton/ToggleButton;->defaultAnimate:Z .line 65 iput-boolean v1, p0, Lcom/zcw/togglebutton/ToggleButton;->isDefaultOn:Z .line 235 new-instance v0, Lcom/zcw/togglebutton/ToggleButton$2; invoke-direct {v0, p0}, Lcom/zcw/togglebutton/ToggleButton$2;->(Lcom/zcw/togglebutton/ToggleButton;)V iput-object v0, p0, Lcom/zcw/togglebutton/ToggleButton;->springListener:Lcom/facebook/rebound/SimpleSpringListener; .line 78 invoke-virtual {p0, p2}, Lcom/zcw/togglebutton/ToggleButton;->setup(Landroid/util/AttributeSet;)V .line 79 return-void .end method .method public constructor (Landroid/content/Context;Landroid/util/AttributeSet;I)V .locals 2 .prologue const/4 v1, 0x0 .line 73 invoke-direct {p0, p1, p2, p3}, Landroid/view/View;->(Landroid/content/Context;Landroid/util/AttributeSet;I)V .line 32 const-string v0, "#4ebb7f" invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I move-result v0 iput v0, p0, Lcom/zcw/togglebutton/ToggleButton;->onColor:I .line 34 const-string v0, "#dadbda" invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I move-result v0 iput v0, p0, Lcom/zcw/togglebutton/ToggleButton;->offBorderColor:I .line 36 const-string v0, "#ffffff" invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I move-result v0 iput v0, p0, Lcom/zcw/togglebutton/ToggleButton;->offColor:I .line 38 const-string v0, "#ffffff" invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I move-result v0 iput v0, p0, Lcom/zcw/togglebutton/ToggleButton;->spotColor:I .line 40 iget v0, p0, Lcom/zcw/togglebutton/ToggleButton;->offBorderColor:I iput v0, p0, Lcom/zcw/togglebutton/ToggleButton;->borderColor:I .line 44 iput-boolean v1, p0, Lcom/zcw/togglebutton/ToggleButton;->toggleOn:Z .line 46 const/4 v0, 0x2 iput v0, p0, Lcom/zcw/togglebutton/ToggleButton;->borderWidth:I .line 60 new-instance v0, Landroid/graphics/RectF; invoke-direct {v0}, Landroid/graphics/RectF;->()V iput-object v0, p0, Lcom/zcw/togglebutton/ToggleButton;->rect:Landroid/graphics/RectF; .line 62 const/4 v0, 0x1 iput-boolean v0, p0, Lcom/zcw/togglebutton/ToggleButton;->defaultAnimate:Z .line 65 iput-boolean v1, p0, Lcom/zcw/togglebutton/ToggleButton;->isDefaultOn:Z .line 235 new-instance v0, Lcom/zcw/togglebutton/ToggleButton$2; invoke-direct {v0, p0}, Lcom/zcw/togglebutton/ToggleButton$2;->(Lcom/zcw/togglebutton/ToggleButton;)V iput-object v0, p0, Lcom/zcw/togglebutton/ToggleButton;->springListener:Lcom/facebook/rebound/SimpleSpringListener; .line 74 invoke-virtual {p0, p2}, Lcom/zcw/togglebutton/ToggleButton;->setup(Landroid/util/AttributeSet;)V .line 75 return-void .end method .method static synthetic access$000(Lcom/zcw/togglebutton/ToggleButton;)Z .locals 1 .prologue .line 26 iget-boolean v0, p0, Lcom/zcw/togglebutton/ToggleButton;->defaultAnimate:Z return v0 .end method .method static synthetic access$100(Lcom/zcw/togglebutton/ToggleButton;D)V .locals 1 .prologue .line 26 invoke-direct {p0, p1, p2}, Lcom/zcw/togglebutton/ToggleButton;->calculateEffect(D)V return-void .end method .method private calculateEffect(D)V .locals 15 .prologue .line 277 const-wide/16 v2, 0x0 const-wide/high16 v4, 0x3ff0000000000000L # 1.0 iget v0, p0, Lcom/zcw/togglebutton/ToggleButton;->spotMinX:F float-to-double v6, v0 iget v0, p0, Lcom/zcw/togglebutton/ToggleButton;->spotMaxX:F float-to-double v8, v0 move-wide/from16 v0, p1 invoke-static/range {v0 .. v9}, Lcom/facebook/rebound/SpringUtil;->mapValueFromRangeToRange(DDDDD)D move-result-wide v0 double-to-float v0, v0 .line 278 iput v0, p0, Lcom/zcw/togglebutton/ToggleButton;->spotX:F .line 280 const-wide/high16 v0, 0x3ff0000000000000L # 1.0 sub-double v0, v0, p1 const-wide/16 v2, 0x0 const-wide/high16 v4, 0x3ff0000000000000L # 1.0 const-wide/high16 v6, 0x4024000000000000L # 10.0 iget v8, p0, Lcom/zcw/togglebutton/ToggleButton;->spotSize:I int-to-double v8, v8 invoke-static/range {v0 .. v9}, Lcom/facebook/rebound/SpringUtil;->mapValueFromRangeToRange(DDDDD)D move-result-wide v0 double-to-float v0, v0 .line 282 iput v0, p0, Lcom/zcw/togglebutton/ToggleButton;->offLineWidth:F .line 284 iget v0, p0, Lcom/zcw/togglebutton/ToggleButton;->onColor:I invoke-static {v0}, Landroid/graphics/Color;->blue(I)I move-result v6 .line 285 iget v0, p0, Lcom/zcw/togglebutton/ToggleButton;->onColor:I invoke-static {v0}, Landroid/graphics/Color;->red(I)I move-result v10 .line 286 iget v0, p0, Lcom/zcw/togglebutton/ToggleButton;->onColor:I invoke-static {v0}, Landroid/graphics/Color;->green(I)I move-result v11 .line 288 iget v0, p0, Lcom/zcw/togglebutton/ToggleButton;->offBorderColor:I invoke-static {v0}, Landroid/graphics/Color;->blue(I)I move-result v8 .line 289 iget v0, p0, Lcom/zcw/togglebutton/ToggleButton;->offBorderColor:I invoke-static {v0}, Landroid/graphics/Color;->red(I)I move-result v12 .line 290 iget v0, p0, Lcom/zcw/togglebutton/ToggleButton;->offBorderColor:I invoke-static {v0}, Landroid/graphics/Color;->green(I)I move-result v13 .line 292 const-wide/high16 v0, 0x3ff0000000000000L # 1.0 sub-double v0, v0, p1 const-wide/16 v2, 0x0 const-wide/high16 v4, 0x3ff0000000000000L # 1.0 int-to-double v6, v6 int-to-double v8, v8 invoke-static/range {v0 .. v9}, Lcom/facebook/rebound/SpringUtil;->mapValueFromRangeToRange(DDDDD)D move-result-wide v0 double-to-int v14, v0 .line 293 const-wide/high16 v0, 0x3ff0000000000000L # 1.0 sub-double v0, v0, p1 const-wide/16 v2, 0x0 const-wide/high16 v4, 0x3ff0000000000000L # 1.0 int-to-double v6, v10 int-to-double v8, v12 invoke-static/range {v0 .. v9}, Lcom/facebook/rebound/SpringUtil;->mapValueFromRangeToRange(DDDDD)D move-result-wide v0 double-to-int v10, v0 .line 294 const-wide/high16 v0, 0x3ff0000000000000L # 1.0 sub-double v0, v0, p1 const-wide/16 v2, 0x0 const-wide/high16 v4, 0x3ff0000000000000L # 1.0 int-to-double v6, v11 int-to-double v8, v13 invoke-static/range {v0 .. v9}, Lcom/facebook/rebound/SpringUtil;->mapValueFromRangeToRange(DDDDD)D move-result-wide v0 double-to-int v0, v0 .line 296 const/4 v1, 0x0 const/16 v2, 0xff invoke-direct {p0, v14, v1, v2}, Lcom/zcw/togglebutton/ToggleButton;->clamp(III)I move-result v1 .line 297 const/4 v2, 0x0 const/16 v3, 0xff invoke-direct {p0, v10, v2, v3}, Lcom/zcw/togglebutton/ToggleButton;->clamp(III)I move-result v2 .line 298 const/4 v3, 0x0 const/16 v4, 0xff invoke-direct {p0, v0, v3, v4}, Lcom/zcw/togglebutton/ToggleButton;->clamp(III)I move-result v0 .line 300 invoke-static {v2, v0, v1}, Landroid/graphics/Color;->rgb(III)I move-result v0 iput v0, p0, Lcom/zcw/togglebutton/ToggleButton;->borderColor:I .line 302 invoke-virtual {p0}, Lcom/zcw/togglebutton/ToggleButton;->postInvalidate()V .line 303 return-void .end method .method private clamp(III)I .locals 1 .prologue .line 244 invoke-static {p1, p2}, Ljava/lang/Math;->max(II)I move-result v0 invoke-static {v0, p3}, Ljava/lang/Math;->min(II)I move-result v0 return v0 .end method .method private takeEffect(Z)V .locals 7 .prologue const-wide/high16 v0, 0x3ff0000000000000L # 1.0 const-wide/16 v2, 0x0 .line 180 if-eqz p1, :cond_1 .line 181 iget-object v4, p0, Lcom/zcw/togglebutton/ToggleButton;->spring:Lcom/facebook/rebound/Spring; iget-boolean v5, p0, Lcom/zcw/togglebutton/ToggleButton;->toggleOn:Z if-eqz v5, :cond_0 :goto_0 invoke-virtual {v4, v0, v1}, Lcom/facebook/rebound/Spring;->setEndValue(D)Lcom/facebook/rebound/Spring; .line 187 :goto_1 return-void :cond_0 move-wide v0, v2 .line 181 goto :goto_0 .line 184 :cond_1 iget-object v6, p0, Lcom/zcw/togglebutton/ToggleButton;->spring:Lcom/facebook/rebound/Spring; iget-boolean v4, p0, Lcom/zcw/togglebutton/ToggleButton;->toggleOn:Z if-eqz v4, :cond_2 move-wide v4, v0 :goto_2 invoke-virtual {v6, v4, v5}, Lcom/facebook/rebound/Spring;->setCurrentValue(D)Lcom/facebook/rebound/Spring; .line 185 iget-boolean v4, p0, Lcom/zcw/togglebutton/ToggleButton;->toggleOn:Z if-eqz v4, :cond_3 :goto_3 invoke-direct {p0, v0, v1}, Lcom/zcw/togglebutton/ToggleButton;->calculateEffect(D)V goto :goto_1 :cond_2 move-wide v4, v2 .line 184 goto :goto_2 :cond_3 move-wide v0, v2 .line 185 goto :goto_3 .end method # virtual methods .method public draw(Landroid/graphics/Canvas;)V .locals 7 .prologue const/high16 v6, 0x3f000000 # 0.5f const/4 v4, 0x0 .line 251 iget-object v0, p0, Lcom/zcw/togglebutton/ToggleButton;->rect:Landroid/graphics/RectF; invoke-virtual {p0}, Lcom/zcw/togglebutton/ToggleButton;->getWidth()I move-result v1 int-to-float v1, v1 invoke-virtual {p0}, Lcom/zcw/togglebutton/ToggleButton;->getHeight()I move-result v2 int-to-float v2, v2 invoke-virtual {v0, v4, v4, v1, v2}, Landroid/graphics/RectF;->set(FFFF)V .line 252 iget-object v0, p0, Lcom/zcw/togglebutton/ToggleButton;->paint:Landroid/graphics/Paint; iget v1, p0, Lcom/zcw/togglebutton/ToggleButton;->borderColor:I invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setColor(I)V .line 253 iget-object v0, p0, Lcom/zcw/togglebutton/ToggleButton;->rect:Landroid/graphics/RectF; iget v1, p0, Lcom/zcw/togglebutton/ToggleButton;->radius:F iget v2, p0, Lcom/zcw/togglebutton/ToggleButton;->radius:F iget-object v3, p0, Lcom/zcw/togglebutton/ToggleButton;->paint:Landroid/graphics/Paint; invoke-virtual {p1, v0, v1, v2, v3}, Landroid/graphics/Canvas;->drawRoundRect(Landroid/graphics/RectF;FFLandroid/graphics/Paint;)V .line 255 iget v0, p0, Lcom/zcw/togglebutton/ToggleButton;->offLineWidth:F cmpl-float v0, v0, v4 if-lez v0, :cond_0 .line 256 iget v0, p0, Lcom/zcw/togglebutton/ToggleButton;->offLineWidth:F mul-float/2addr v0, v6 .line 257 iget-object v1, p0, Lcom/zcw/togglebutton/ToggleButton;->rect:Landroid/graphics/RectF; iget v2, p0, Lcom/zcw/togglebutton/ToggleButton;->spotX:F sub-float/2addr v2, v0 iget v3, p0, Lcom/zcw/togglebutton/ToggleButton;->centerY:F sub-float/2addr v3, v0 iget v4, p0, Lcom/zcw/togglebutton/ToggleButton;->endX:F add-float/2addr v4, v0 iget v5, p0, Lcom/zcw/togglebutton/ToggleButton;->centerY:F add-float/2addr v5, v0 invoke-virtual {v1, v2, v3, v4, v5}, Landroid/graphics/RectF;->set(FFFF)V .line 258 iget-object v1, p0, Lcom/zcw/togglebutton/ToggleButton;->paint:Landroid/graphics/Paint; iget v2, p0, Lcom/zcw/togglebutton/ToggleButton;->offColor:I invoke-virtual {v1, v2}, Landroid/graphics/Paint;->setColor(I)V .line 259 iget-object v1, p0, Lcom/zcw/togglebutton/ToggleButton;->rect:Landroid/graphics/RectF; iget-object v2, p0, Lcom/zcw/togglebutton/ToggleButton;->paint:Landroid/graphics/Paint; invoke-virtual {p1, v1, v0, v0, v2}, Landroid/graphics/Canvas;->drawRoundRect(Landroid/graphics/RectF;FFLandroid/graphics/Paint;)V .line 262 :cond_0 iget-object v0, p0, Lcom/zcw/togglebutton/ToggleButton;->rect:Landroid/graphics/RectF; iget v1, p0, Lcom/zcw/togglebutton/ToggleButton;->spotX:F const/high16 v2, 0x3f800000 # 1.0f sub-float/2addr v1, v2 iget v2, p0, Lcom/zcw/togglebutton/ToggleButton;->radius:F sub-float/2addr v1, v2 iget v2, p0, Lcom/zcw/togglebutton/ToggleButton;->centerY:F iget v3, p0, Lcom/zcw/togglebutton/ToggleButton;->radius:F sub-float/2addr v2, v3 iget v3, p0, Lcom/zcw/togglebutton/ToggleButton;->spotX:F const v4, 0x3f8ccccd # 1.1f add-float/2addr v3, v4 iget v4, p0, Lcom/zcw/togglebutton/ToggleButton;->radius:F add-float/2addr v3, v4 iget v4, p0, Lcom/zcw/togglebutton/ToggleButton;->centerY:F iget v5, p0, Lcom/zcw/togglebutton/ToggleButton;->radius:F add-float/2addr v4, v5 invoke-virtual {v0, v1, v2, v3, v4}, Landroid/graphics/RectF;->set(FFFF)V .line 263 iget-object v0, p0, Lcom/zcw/togglebutton/ToggleButton;->paint:Landroid/graphics/Paint; iget v1, p0, Lcom/zcw/togglebutton/ToggleButton;->borderColor:I invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setColor(I)V .line 264 iget-object v0, p0, Lcom/zcw/togglebutton/ToggleButton;->rect:Landroid/graphics/RectF; iget v1, p0, Lcom/zcw/togglebutton/ToggleButton;->radius:F iget v2, p0, Lcom/zcw/togglebutton/ToggleButton;->radius:F iget-object v3, p0, Lcom/zcw/togglebutton/ToggleButton;->paint:Landroid/graphics/Paint; invoke-virtual {p1, v0, v1, v2, v3}, Landroid/graphics/Canvas;->drawRoundRect(Landroid/graphics/RectF;FFLandroid/graphics/Paint;)V .line 266 iget v0, p0, Lcom/zcw/togglebutton/ToggleButton;->spotSize:I int-to-float v0, v0 mul-float/2addr v0, v6 .line 267 iget-object v1, p0, Lcom/zcw/togglebutton/ToggleButton;->rect:Landroid/graphics/RectF; iget v2, p0, Lcom/zcw/togglebutton/ToggleButton;->spotX:F sub-float/2addr v2, v0 iget v3, p0, Lcom/zcw/togglebutton/ToggleButton;->centerY:F sub-float/2addr v3, v0 iget v4, p0, Lcom/zcw/togglebutton/ToggleButton;->spotX:F add-float/2addr v4, v0 iget v5, p0, Lcom/zcw/togglebutton/ToggleButton;->centerY:F add-float/2addr v5, v0 invoke-virtual {v1, v2, v3, v4, v5}, Landroid/graphics/RectF;->set(FFFF)V .line 268 iget-object v1, p0, Lcom/zcw/togglebutton/ToggleButton;->paint:Landroid/graphics/Paint; iget v2, p0, Lcom/zcw/togglebutton/ToggleButton;->spotColor:I invoke-virtual {v1, v2}, Landroid/graphics/Paint;->setColor(I)V .line 269 iget-object v1, p0, Lcom/zcw/togglebutton/ToggleButton;->rect:Landroid/graphics/RectF; iget-object v2, p0, Lcom/zcw/togglebutton/ToggleButton;->paint:Landroid/graphics/Paint; invoke-virtual {p1, v1, v0, v0, v2}, Landroid/graphics/Canvas;->drawRoundRect(Landroid/graphics/RectF;FFLandroid/graphics/Paint;)V .line 271 return-void .end method .method public isAnimate()Z .locals 1 .prologue .line 322 iget-boolean v0, p0, Lcom/zcw/togglebutton/ToggleButton;->defaultAnimate:Z return v0 .end method .method public onAttachedToWindow()V .locals 2 .prologue .line 88 invoke-super {p0}, Landroid/view/View;->onAttachedToWindow()V .line 89 iget-object v0, p0, Lcom/zcw/togglebutton/ToggleButton;->spring:Lcom/facebook/rebound/Spring; iget-object v1, p0, Lcom/zcw/togglebutton/ToggleButton;->springListener:Lcom/facebook/rebound/SimpleSpringListener; invoke-virtual {v0, v1}, Lcom/facebook/rebound/Spring;->addListener(Lcom/facebook/rebound/SpringListener;)Lcom/facebook/rebound/Spring; .line 90 return-void .end method .method protected onDetachedFromWindow()V .locals 2 .prologue .line 83 invoke-super {p0}, Landroid/view/View;->onDetachedFromWindow()V .line 84 iget-object v0, p0, Lcom/zcw/togglebutton/ToggleButton;->spring:Lcom/facebook/rebound/Spring; iget-object v1, p0, Lcom/zcw/togglebutton/ToggleButton;->springListener:Lcom/facebook/rebound/SimpleSpringListener; invoke-virtual {v0, v1}, Lcom/facebook/rebound/Spring;->removeListener(Lcom/facebook/rebound/SpringListener;)Lcom/facebook/rebound/Spring; .line 85 return-void .end method .method protected onLayout(ZIIII)V .locals 4 .prologue .line 218 invoke-super/range {p0 .. p5}, Landroid/view/View;->onLayout(ZIIII)V .line 220 invoke-virtual {p0}, Lcom/zcw/togglebutton/ToggleButton;->getWidth()I move-result v0 .line 221 invoke-virtual {p0}, Lcom/zcw/togglebutton/ToggleButton;->getHeight()I move-result v1 .line 223 invoke-static {v0, v1}, Ljava/lang/Math;->min(II)I move-result v2 int-to-float v2, v2 const/high16 v3, 0x3f000000 # 0.5f mul-float/2addr v2, v3 iput v2, p0, Lcom/zcw/togglebutton/ToggleButton;->radius:F .line 224 iget v2, p0, Lcom/zcw/togglebutton/ToggleButton;->radius:F iput v2, p0, Lcom/zcw/togglebutton/ToggleButton;->centerY:F .line 225 iget v2, p0, Lcom/zcw/togglebutton/ToggleButton;->radius:F iput v2, p0, Lcom/zcw/togglebutton/ToggleButton;->startX:F .line 226 int-to-float v0, v0 iget v2, p0, Lcom/zcw/togglebutton/ToggleButton;->radius:F sub-float/2addr v0, v2 iput v0, p0, Lcom/zcw/togglebutton/ToggleButton;->endX:F .line 227 iget v0, p0, Lcom/zcw/togglebutton/ToggleButton;->startX:F iget v2, p0, Lcom/zcw/togglebutton/ToggleButton;->borderWidth:I int-to-float v2, v2 add-float/2addr v0, v2 iput v0, p0, Lcom/zcw/togglebutton/ToggleButton;->spotMinX:F .line 228 iget v0, p0, Lcom/zcw/togglebutton/ToggleButton;->endX:F iget v2, p0, Lcom/zcw/togglebutton/ToggleButton;->borderWidth:I int-to-float v2, v2 sub-float/2addr v0, v2 iput v0, p0, Lcom/zcw/togglebutton/ToggleButton;->spotMaxX:F .line 229 iget v0, p0, Lcom/zcw/togglebutton/ToggleButton;->borderWidth:I mul-int/lit8 v0, v0, 0x4 sub-int v0, v1, v0 iput v0, p0, Lcom/zcw/togglebutton/ToggleButton;->spotSize:I .line 230 iget-boolean v0, p0, Lcom/zcw/togglebutton/ToggleButton;->toggleOn:Z if-eqz v0, :cond_0 iget v0, p0, Lcom/zcw/togglebutton/ToggleButton;->spotMaxX:F :goto_0 iput v0, p0, Lcom/zcw/togglebutton/ToggleButton;->spotX:F .line 231 const/4 v0, 0x0 iput v0, p0, Lcom/zcw/togglebutton/ToggleButton;->offLineWidth:F .line 232 return-void .line 230 :cond_0 iget v0, p0, Lcom/zcw/togglebutton/ToggleButton;->spotMinX:F goto :goto_0 .end method .method protected onMeasure(II)V .locals 8 .prologue const/high16 v7, 0x40000000 # 2.0f const/4 v6, 0x1 const/high16 v5, -0x80000000 .line 193 invoke-static {p1}, Landroid/view/View$MeasureSpec;->getMode(I)I move-result v0 .line 194 invoke-static {p2}, Landroid/view/View$MeasureSpec;->getMode(I)I move-result v1 .line 196 invoke-static {p1}, Landroid/view/View$MeasureSpec;->getSize(I)I .line 197 invoke-static {p2}, Landroid/view/View$MeasureSpec;->getSize(I)I move-result v2 .line 199 invoke-static {}, Landroid/content/res/Resources;->getSystem()Landroid/content/res/Resources; move-result-object v3 .line 200 if-eqz v0, :cond_0 if-ne v0, v5, :cond_1 .line 201 :cond_0 const/high16 v0, 0x42480000 # 50.0f invoke-virtual {v3}, Landroid/content/res/Resources;->getDisplayMetrics()Landroid/util/DisplayMetrics; move-result-object v4 invoke-static {v6, v0, v4}, Landroid/util/TypedValue;->applyDimension(IFLandroid/util/DisplayMetrics;)F move-result v0 float-to-int v0, v0 .line 202 invoke-static {v0, v7}, Landroid/view/View$MeasureSpec;->makeMeasureSpec(II)I move-result p1 .line 205 :cond_1 if-eqz v1, :cond_2 if-ne v2, v5, :cond_3 .line 206 :cond_2 const/high16 v0, 0x41f00000 # 30.0f invoke-virtual {v3}, Landroid/content/res/Resources;->getDisplayMetrics()Landroid/util/DisplayMetrics; move-result-object v1 invoke-static {v6, v0, v1}, Landroid/util/TypedValue;->applyDimension(IFLandroid/util/DisplayMetrics;)F move-result v0 float-to-int v0, v0 .line 207 invoke-static {v0, v7}, Landroid/view/View$MeasureSpec;->makeMeasureSpec(II)I move-result p2 .line 211 :cond_3 invoke-super {p0, p1, p2}, Landroid/view/View;->onMeasure(II)V .line 212 return-void .end method .method public setAnimate(Z)V .locals 0 .prologue .line 325 iput-boolean p1, p0, Lcom/zcw/togglebutton/ToggleButton;->defaultAnimate:Z .line 326 return-void .end method .method public setOnToggleChanged(Lcom/zcw/togglebutton/ToggleButton$OnToggleChanged;)V .locals 0 .prologue .line 318 iput-object p1, p0, Lcom/zcw/togglebutton/ToggleButton;->listener:Lcom/zcw/togglebutton/ToggleButton$OnToggleChanged; .line 319 return-void .end method .method public setToggleOff()V .locals 1 .prologue .line 171 const/4 v0, 0x1 invoke-virtual {p0, v0}, Lcom/zcw/togglebutton/ToggleButton;->setToggleOff(Z)V .line 172 return-void .end method .method public setToggleOff(Z)V .locals 1 .prologue .line 175 const/4 v0, 0x0 iput-boolean v0, p0, Lcom/zcw/togglebutton/ToggleButton;->toggleOn:Z .line 176 invoke-direct {p0, p1}, Lcom/zcw/togglebutton/ToggleButton;->takeEffect(Z)V .line 177 return-void .end method .method public setToggleOn()V .locals 1 .prologue .line 156 const/4 v0, 0x1 invoke-virtual {p0, v0}, Lcom/zcw/togglebutton/ToggleButton;->setToggleOn(Z)V .line 157 return-void .end method .method public setToggleOn(Z)V .locals 1 .prologue .line 163 const/4 v0, 0x1 iput-boolean v0, p0, Lcom/zcw/togglebutton/ToggleButton;->toggleOn:Z .line 164 invoke-direct {p0, p1}, Lcom/zcw/togglebutton/ToggleButton;->takeEffect(Z)V .line 165 return-void .end method .method public setup(Landroid/util/AttributeSet;)V .locals 6 .prologue .line 93 new-instance v0, Landroid/graphics/Paint; const/4 v1, 0x1 invoke-direct {v0, v1}, Landroid/graphics/Paint;->(I)V iput-object v0, p0, Lcom/zcw/togglebutton/ToggleButton;->paint:Landroid/graphics/Paint; .line 94 iget-object v0, p0, Lcom/zcw/togglebutton/ToggleButton;->paint:Landroid/graphics/Paint; sget-object v1, Landroid/graphics/Paint$Style;->FILL:Landroid/graphics/Paint$Style; invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setStyle(Landroid/graphics/Paint$Style;)V .line 95 iget-object v0, p0, Lcom/zcw/togglebutton/ToggleButton;->paint:Landroid/graphics/Paint; sget-object v1, Landroid/graphics/Paint$Cap;->ROUND:Landroid/graphics/Paint$Cap; invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setStrokeCap(Landroid/graphics/Paint$Cap;)V .line 97 invoke-static {}, Lcom/facebook/rebound/SpringSystem;->create()Lcom/facebook/rebound/SpringSystem; move-result-object v0 iput-object v0, p0, Lcom/zcw/togglebutton/ToggleButton;->springSystem:Lcom/facebook/rebound/SpringSystem; .line 98 iget-object v0, p0, Lcom/zcw/togglebutton/ToggleButton;->springSystem:Lcom/facebook/rebound/SpringSystem; invoke-virtual {v0}, Lcom/facebook/rebound/SpringSystem;->createSpring()Lcom/facebook/rebound/Spring; move-result-object v0 iput-object v0, p0, Lcom/zcw/togglebutton/ToggleButton;->spring:Lcom/facebook/rebound/Spring; .line 99 iget-object v0, p0, Lcom/zcw/togglebutton/ToggleButton;->spring:Lcom/facebook/rebound/Spring; const-wide/high16 v2, 0x4049000000000000L # 50.0 const-wide/high16 v4, 0x401c000000000000L # 7.0 invoke-static {v2, v3, v4, v5}, Lcom/facebook/rebound/SpringConfig;->fromOrigamiTensionAndFriction(DD)Lcom/facebook/rebound/SpringConfig; move-result-object v1 invoke-virtual {v0, v1}, Lcom/facebook/rebound/Spring;->setSpringConfig(Lcom/facebook/rebound/SpringConfig;)Lcom/facebook/rebound/Spring; .line 101 new-instance v0, Lcom/zcw/togglebutton/ToggleButton$1; invoke-direct {v0, p0}, Lcom/zcw/togglebutton/ToggleButton$1;->(Lcom/zcw/togglebutton/ToggleButton;)V invoke-virtual {p0, v0}, Lcom/zcw/togglebutton/ToggleButton;->setOnClickListener(Landroid/view/View$OnClickListener;)V .line 108 invoke-virtual {p0}, Lcom/zcw/togglebutton/ToggleButton;->getContext()Landroid/content/Context; move-result-object v0 sget-object v1, Lcom/zcw/togglebutton/R$styleable;->ToggleButton:[I invoke-virtual {v0, p1, v1}, Landroid/content/Context;->obtainStyledAttributes(Landroid/util/AttributeSet;[I)Landroid/content/res/TypedArray; move-result-object v0 .line 109 sget v1, Lcom/zcw/togglebutton/R$styleable;->ToggleButton_tbOffBorderColor:I iget v2, p0, Lcom/zcw/togglebutton/ToggleButton;->offBorderColor:I invoke-virtual {v0, v1, v2}, Landroid/content/res/TypedArray;->getColor(II)I move-result v1 iput v1, p0, Lcom/zcw/togglebutton/ToggleButton;->offBorderColor:I .line 110 sget v1, Lcom/zcw/togglebutton/R$styleable;->ToggleButton_tbOnColor:I iget v2, p0, Lcom/zcw/togglebutton/ToggleButton;->onColor:I invoke-virtual {v0, v1, v2}, Landroid/content/res/TypedArray;->getColor(II)I move-result v1 iput v1, p0, Lcom/zcw/togglebutton/ToggleButton;->onColor:I .line 111 sget v1, Lcom/zcw/togglebutton/R$styleable;->ToggleButton_tbSpotColor:I iget v2, p0, Lcom/zcw/togglebutton/ToggleButton;->spotColor:I invoke-virtual {v0, v1, v2}, Landroid/content/res/TypedArray;->getColor(II)I move-result v1 iput v1, p0, Lcom/zcw/togglebutton/ToggleButton;->spotColor:I .line 112 sget v1, Lcom/zcw/togglebutton/R$styleable;->ToggleButton_tbOffColor:I iget v2, p0, Lcom/zcw/togglebutton/ToggleButton;->offColor:I invoke-virtual {v0, v1, v2}, Landroid/content/res/TypedArray;->getColor(II)I move-result v1 iput v1, p0, Lcom/zcw/togglebutton/ToggleButton;->offColor:I .line 113 sget v1, Lcom/zcw/togglebutton/R$styleable;->ToggleButton_tbBorderWidth:I iget v2, p0, Lcom/zcw/togglebutton/ToggleButton;->borderWidth:I invoke-virtual {v0, v1, v2}, Landroid/content/res/TypedArray;->getDimensionPixelSize(II)I move-result v1 iput v1, p0, Lcom/zcw/togglebutton/ToggleButton;->borderWidth:I .line 114 sget v1, Lcom/zcw/togglebutton/R$styleable;->ToggleButton_tbAnimate:I iget-boolean v2, p0, Lcom/zcw/togglebutton/ToggleButton;->defaultAnimate:Z invoke-virtual {v0, v1, v2}, Landroid/content/res/TypedArray;->getBoolean(IZ)Z move-result v1 iput-boolean v1, p0, Lcom/zcw/togglebutton/ToggleButton;->defaultAnimate:Z .line 115 sget v1, Lcom/zcw/togglebutton/R$styleable;->ToggleButton_tbAsDefaultOn:I iget-boolean v2, p0, Lcom/zcw/togglebutton/ToggleButton;->isDefaultOn:Z invoke-virtual {v0, v1, v2}, Landroid/content/res/TypedArray;->getBoolean(IZ)Z move-result v1 iput-boolean v1, p0, Lcom/zcw/togglebutton/ToggleButton;->isDefaultOn:Z .line 116 invoke-virtual {v0}, Landroid/content/res/TypedArray;->recycle()V .line 118 iget v0, p0, Lcom/zcw/togglebutton/ToggleButton;->offBorderColor:I iput v0, p0, Lcom/zcw/togglebutton/ToggleButton;->borderColor:I .line 120 iget-boolean v0, p0, Lcom/zcw/togglebutton/ToggleButton;->isDefaultOn:Z if-eqz v0, :cond_0 .line 121 invoke-virtual {p0}, Lcom/zcw/togglebutton/ToggleButton;->toggleOn()V .line 123 :cond_0 return-void .end method .method public toggle()V .locals 1 .prologue .line 126 const/4 v0, 0x1 invoke-virtual {p0, v0}, Lcom/zcw/togglebutton/ToggleButton;->toggle(Z)V .line 127 return-void .end method .method public toggle(Z)V .locals 2 .prologue .line 130 iget-boolean v0, p0, Lcom/zcw/togglebutton/ToggleButton;->toggleOn:Z if-nez v0, :cond_1 const/4 v0, 0x1 :goto_0 iput-boolean v0, p0, Lcom/zcw/togglebutton/ToggleButton;->toggleOn:Z .line 131 invoke-direct {p0, p1}, Lcom/zcw/togglebutton/ToggleButton;->takeEffect(Z)V .line 133 iget-object v0, p0, Lcom/zcw/togglebutton/ToggleButton;->listener:Lcom/zcw/togglebutton/ToggleButton$OnToggleChanged; if-eqz v0, :cond_0 .line 134 iget-object v0, p0, Lcom/zcw/togglebutton/ToggleButton;->listener:Lcom/zcw/togglebutton/ToggleButton$OnToggleChanged; iget-boolean v1, p0, Lcom/zcw/togglebutton/ToggleButton;->toggleOn:Z invoke-interface {v0, v1}, Lcom/zcw/togglebutton/ToggleButton$OnToggleChanged;->onToggle(Z)V .line 136 :cond_0 return-void .line 130 :cond_1 const/4 v0, 0x0 goto :goto_0 .end method .method public toggleOff()V .locals 2 .prologue .line 146 invoke-virtual {p0}, Lcom/zcw/togglebutton/ToggleButton;->setToggleOff()V .line 147 iget-object v0, p0, Lcom/zcw/togglebutton/ToggleButton;->listener:Lcom/zcw/togglebutton/ToggleButton$OnToggleChanged; if-eqz v0, :cond_0 .line 148 iget-object v0, p0, Lcom/zcw/togglebutton/ToggleButton;->listener:Lcom/zcw/togglebutton/ToggleButton$OnToggleChanged; iget-boolean v1, p0, Lcom/zcw/togglebutton/ToggleButton;->toggleOn:Z invoke-interface {v0, v1}, Lcom/zcw/togglebutton/ToggleButton$OnToggleChanged;->onToggle(Z)V .line 150 :cond_0 return-void .end method .method public toggleOn()V .locals 2 .prologue .line 139 invoke-virtual {p0}, Lcom/zcw/togglebutton/ToggleButton;->setToggleOn()V .line 140 iget-object v0, p0, Lcom/zcw/togglebutton/ToggleButton;->listener:Lcom/zcw/togglebutton/ToggleButton$OnToggleChanged; if-eqz v0, :cond_0 .line 141 iget-object v0, p0, Lcom/zcw/togglebutton/ToggleButton;->listener:Lcom/zcw/togglebutton/ToggleButton$OnToggleChanged; iget-boolean v1, p0, Lcom/zcw/togglebutton/ToggleButton;->toggleOn:Z invoke-interface {v0, v1}, Lcom/zcw/togglebutton/ToggleButton$OnToggleChanged;->onToggle(Z)V .line 143 :cond_0 return-void .end method