2019-07-31 00:08:31 +00:00
|
|
|
.class public final Landroidx/core/view/OneShotPreDrawListener;
|
|
|
|
.super Ljava/lang/Object;
|
|
|
|
.source "OneShotPreDrawListener.java"
|
|
|
|
|
|
|
|
# interfaces
|
|
|
|
.implements Landroid/view/ViewTreeObserver$OnPreDrawListener;
|
2019-12-06 03:29:40 +00:00
|
|
|
.implements Landroid/view/View$OnAttachStateChangeListener;
|
2019-07-31 00:08:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
# instance fields
|
2019-12-06 03:29:40 +00:00
|
|
|
.field public final mRunnable:Ljava/lang/Runnable;
|
2019-07-31 00:08:31 +00:00
|
|
|
|
2019-12-06 03:29:40 +00:00
|
|
|
.field public final mView:Landroid/view/View;
|
2019-07-31 00:08:31 +00:00
|
|
|
|
2019-12-06 03:29:40 +00:00
|
|
|
.field public mViewTreeObserver:Landroid/view/ViewTreeObserver;
|
2019-07-31 00:08:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
# direct methods
|
2019-12-06 03:29:40 +00:00
|
|
|
.method public constructor <init>(Landroid/view/View;Ljava/lang/Runnable;)V
|
2019-07-31 00:08:31 +00:00
|
|
|
.locals 0
|
|
|
|
|
|
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
|
|
|
|
iput-object p1, p0, Landroidx/core/view/OneShotPreDrawListener;->mView:Landroid/view/View;
|
|
|
|
|
|
|
|
invoke-virtual {p1}, Landroid/view/View;->getViewTreeObserver()Landroid/view/ViewTreeObserver;
|
|
|
|
|
|
|
|
move-result-object p1
|
|
|
|
|
|
|
|
iput-object p1, p0, Landroidx/core/view/OneShotPreDrawListener;->mViewTreeObserver:Landroid/view/ViewTreeObserver;
|
|
|
|
|
|
|
|
iput-object p2, p0, Landroidx/core/view/OneShotPreDrawListener;->mRunnable:Ljava/lang/Runnable;
|
|
|
|
|
|
|
|
return-void
|
|
|
|
.end method
|
|
|
|
|
|
|
|
.method public static add(Landroid/view/View;Ljava/lang/Runnable;)Landroidx/core/view/OneShotPreDrawListener;
|
|
|
|
.locals 1
|
2019-12-06 03:29:40 +00:00
|
|
|
.param p0 # Landroid/view/View;
|
|
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
|
|
.end annotation
|
|
|
|
.end param
|
|
|
|
.param p1 # Ljava/lang/Runnable;
|
|
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
|
|
.end annotation
|
|
|
|
.end param
|
|
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
|
|
.end annotation
|
2019-07-31 00:08:31 +00:00
|
|
|
|
|
|
|
if-eqz p0, :cond_1
|
|
|
|
|
|
|
|
if-eqz p1, :cond_0
|
|
|
|
|
|
|
|
new-instance v0, Landroidx/core/view/OneShotPreDrawListener;
|
|
|
|
|
|
|
|
invoke-direct {v0, p0, p1}, Landroidx/core/view/OneShotPreDrawListener;-><init>(Landroid/view/View;Ljava/lang/Runnable;)V
|
|
|
|
|
|
|
|
invoke-virtual {p0}, Landroid/view/View;->getViewTreeObserver()Landroid/view/ViewTreeObserver;
|
|
|
|
|
|
|
|
move-result-object p1
|
|
|
|
|
|
|
|
invoke-virtual {p1, v0}, Landroid/view/ViewTreeObserver;->addOnPreDrawListener(Landroid/view/ViewTreeObserver$OnPreDrawListener;)V
|
|
|
|
|
|
|
|
invoke-virtual {p0, v0}, Landroid/view/View;->addOnAttachStateChangeListener(Landroid/view/View$OnAttachStateChangeListener;)V
|
|
|
|
|
|
|
|
return-object v0
|
|
|
|
|
|
|
|
:cond_0
|
|
|
|
new-instance p0, Ljava/lang/NullPointerException;
|
|
|
|
|
|
|
|
const-string p1, "runnable == null"
|
|
|
|
|
|
|
|
invoke-direct {p0, p1}, Ljava/lang/NullPointerException;-><init>(Ljava/lang/String;)V
|
|
|
|
|
|
|
|
throw p0
|
|
|
|
|
|
|
|
:cond_1
|
|
|
|
new-instance p0, Ljava/lang/NullPointerException;
|
|
|
|
|
|
|
|
const-string p1, "view == null"
|
|
|
|
|
|
|
|
invoke-direct {p0, p1}, Ljava/lang/NullPointerException;-><init>(Ljava/lang/String;)V
|
|
|
|
|
|
|
|
throw p0
|
|
|
|
.end method
|
|
|
|
|
|
|
|
|
|
|
|
# virtual methods
|
2019-12-06 03:29:40 +00:00
|
|
|
.method public onPreDraw()Z
|
2019-07-31 00:08:31 +00:00
|
|
|
.locals 1
|
|
|
|
|
|
|
|
invoke-virtual {p0}, Landroidx/core/view/OneShotPreDrawListener;->removeListener()V
|
|
|
|
|
|
|
|
iget-object v0, p0, Landroidx/core/view/OneShotPreDrawListener;->mRunnable:Ljava/lang/Runnable;
|
|
|
|
|
|
|
|
invoke-interface {v0}, Ljava/lang/Runnable;->run()V
|
|
|
|
|
|
|
|
const/4 v0, 0x1
|
|
|
|
|
|
|
|
return v0
|
|
|
|
.end method
|
|
|
|
|
2019-12-06 03:29:40 +00:00
|
|
|
.method public onViewAttachedToWindow(Landroid/view/View;)V
|
2019-07-31 00:08:31 +00:00
|
|
|
.locals 0
|
|
|
|
|
|
|
|
invoke-virtual {p1}, Landroid/view/View;->getViewTreeObserver()Landroid/view/ViewTreeObserver;
|
|
|
|
|
|
|
|
move-result-object p1
|
|
|
|
|
|
|
|
iput-object p1, p0, Landroidx/core/view/OneShotPreDrawListener;->mViewTreeObserver:Landroid/view/ViewTreeObserver;
|
|
|
|
|
|
|
|
return-void
|
|
|
|
.end method
|
|
|
|
|
2019-12-06 03:29:40 +00:00
|
|
|
.method public onViewDetachedFromWindow(Landroid/view/View;)V
|
2019-07-31 00:08:31 +00:00
|
|
|
.locals 0
|
|
|
|
|
|
|
|
invoke-virtual {p0}, Landroidx/core/view/OneShotPreDrawListener;->removeListener()V
|
|
|
|
|
|
|
|
return-void
|
|
|
|
.end method
|
|
|
|
|
2019-12-06 03:29:40 +00:00
|
|
|
.method public removeListener()V
|
2019-07-31 00:08:31 +00:00
|
|
|
.locals 1
|
|
|
|
|
|
|
|
iget-object v0, p0, Landroidx/core/view/OneShotPreDrawListener;->mViewTreeObserver:Landroid/view/ViewTreeObserver;
|
|
|
|
|
|
|
|
invoke-virtual {v0}, Landroid/view/ViewTreeObserver;->isAlive()Z
|
|
|
|
|
|
|
|
move-result v0
|
|
|
|
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
|
|
|
|
iget-object v0, p0, Landroidx/core/view/OneShotPreDrawListener;->mViewTreeObserver:Landroid/view/ViewTreeObserver;
|
|
|
|
|
|
|
|
invoke-virtual {v0, p0}, Landroid/view/ViewTreeObserver;->removeOnPreDrawListener(Landroid/view/ViewTreeObserver$OnPreDrawListener;)V
|
|
|
|
|
|
|
|
goto :goto_0
|
|
|
|
|
|
|
|
:cond_0
|
|
|
|
iget-object v0, p0, Landroidx/core/view/OneShotPreDrawListener;->mView:Landroid/view/View;
|
|
|
|
|
|
|
|
invoke-virtual {v0}, Landroid/view/View;->getViewTreeObserver()Landroid/view/ViewTreeObserver;
|
|
|
|
|
|
|
|
move-result-object v0
|
|
|
|
|
|
|
|
invoke-virtual {v0, p0}, Landroid/view/ViewTreeObserver;->removeOnPreDrawListener(Landroid/view/ViewTreeObserver$OnPreDrawListener;)V
|
|
|
|
|
|
|
|
:goto_0
|
|
|
|
iget-object v0, p0, Landroidx/core/view/OneShotPreDrawListener;->mView:Landroid/view/View;
|
|
|
|
|
|
|
|
invoke-virtual {v0, p0}, Landroid/view/View;->removeOnAttachStateChangeListener(Landroid/view/View$OnAttachStateChangeListener;)V
|
|
|
|
|
|
|
|
return-void
|
|
|
|
.end method
|