KeyboardPatch.smali
.class public Lcom/gyf/barlibrary/KeyboardPatch;
.super Ljava/lang/Object;
.source "KeyboardPatch.java"
# instance fields
.field private actionBarHeight:I
.field private keyboardHeightPrevious:I
.field private mActivity:Landroid/app/Activity;
.field private mBarParams:Lcom/gyf/barlibrary/BarParams;
.field private mChildView:Landroid/view/View;
.field private mContentView:Landroid/view/View;
.field private mDecorView:Landroid/view/View;
.field private mWindow:Landroid/view/Window;
.field private navigationAtBottom:Z
.field private navigationBarHeight:I
.field private onGlobalLayoutListener:Landroid/view/ViewTreeObserver$OnGlobalLayoutListener;
.field private paddingBottom:I
.field private paddingLeft:I
.field private paddingRight:I
.field private paddingTop:I
.field private statusBarHeight:I
# direct methods
.method static constructor <clinit>()V
.registers 1
return-void
.end method
.method private constructor <init>(Landroid/app/Activity;)V
.registers 4
.param p1, "activity" # Landroid/app/Activity;
.line 39
invoke-virtual {p1}, Landroid/app/Activity;->getWindow()Landroid/view/Window;
move-result-object v0
invoke-virtual {v0}, Landroid/view/Window;->getDecorView()Landroid/view/View;
move-result-object v0
const v1, 0x1020002
invoke-virtual {v0, v1}, Landroid/view/View;->findViewById(I)Landroid/view/View;
move-result-object v0
check-cast v0, Landroid/widget/FrameLayout;
const/4 v1, 0x0
invoke-virtual {v0, v1}, Landroid/widget/FrameLayout;->getChildAt(I)Landroid/view/View;
move-result-object v0
invoke-direct {p0, p1, v0}, Lcom/gyf/barlibrary/KeyboardPatch;-><init>(Landroid/app/Activity;Landroid/view/View;)V
.line 40
return-void
.end method
.method private constructor <init>(Landroid/app/Activity;Landroid/app/Dialog;Ljava/lang/String;)V
.registers 6
.param p1, "activity" # Landroid/app/Activity;
.param p2, "dialog" # Landroid/app/Dialog;
.param p3, "tag" # Ljava/lang/String;
.line 47
invoke-virtual {p2}, Landroid/app/Dialog;->getWindow()Landroid/view/Window;
move-result-object v0
const v1, 0x1020002
invoke-virtual {v0, v1}, Landroid/view/Window;->findViewById(I)Landroid/view/View;
move-result-object v0
invoke-direct {p0, p1, p2, p3, v0}, Lcom/gyf/barlibrary/KeyboardPatch;-><init>(Landroid/app/Activity;Landroid/app/Dialog;Ljava/lang/String;Landroid/view/View;)V
.line 48
return-void
.end method
.method private constructor <init>(Landroid/app/Activity;Landroid/app/Dialog;Ljava/lang/String;Landroid/view/View;)V
.registers 7
.param p1, "activity" # Landroid/app/Activity;
.param p2, "dialog" # Landroid/app/Dialog;
.param p3, "tag" # Ljava/lang/String;
.param p4, "contentView" # Landroid/view/View;
.line 50
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 137
new-instance v0, Lcom/gyf/barlibrary/KeyboardPatch$1;
invoke-direct {v0, p0}, Lcom/gyf/barlibrary/KeyboardPatch$1;-><init>(Lcom/gyf/barlibrary/KeyboardPatch;)V
iput-object v0, p0, Lcom/gyf/barlibrary/KeyboardPatch;->onGlobalLayoutListener:Landroid/view/ViewTreeObserver$OnGlobalLayoutListener;
.line 51
iput-object p1, p0, Lcom/gyf/barlibrary/KeyboardPatch;->mActivity:Landroid/app/Activity;
.line 52
if-eqz p2, :cond_13
invoke-virtual {p2}, Landroid/app/Dialog;->getWindow()Landroid/view/Window;
move-result-object v0
goto :goto_17
:cond_13
invoke-virtual {p1}, Landroid/app/Activity;->getWindow()Landroid/view/Window;
move-result-object v0
:goto_17
iput-object v0, p0, Lcom/gyf/barlibrary/KeyboardPatch;->mWindow:Landroid/view/Window;
.line 53
invoke-virtual {v0}, Landroid/view/Window;->getDecorView()Landroid/view/View;
move-result-object v0
iput-object v0, p0, Lcom/gyf/barlibrary/KeyboardPatch;->mDecorView:Landroid/view/View;
.line 54
if-eqz p4, :cond_23
move-object v0, p4
goto :goto_30
:cond_23
iget-object v0, p0, Lcom/gyf/barlibrary/KeyboardPatch;->mWindow:Landroid/view/Window;
.line 55
invoke-virtual {v0}, Landroid/view/Window;->getDecorView()Landroid/view/View;
move-result-object v0
const v1, 0x1020002
invoke-virtual {v0, v1}, Landroid/view/View;->findViewById(I)Landroid/view/View;
move-result-object v0
:goto_30
iput-object v0, p0, Lcom/gyf/barlibrary/KeyboardPatch;->mContentView:Landroid/view/View;
.line 56
if-eqz p2, :cond_3d
invoke-static {p1, p2, p3}, Lcom/gyf/barlibrary/ImmersionBar;->with(Landroid/app/Activity;Landroid/app/Dialog;Ljava/lang/String;)Lcom/gyf/barlibrary/ImmersionBar;
move-result-object v0
invoke-virtual {v0}, Lcom/gyf/barlibrary/ImmersionBar;->getBarParams()Lcom/gyf/barlibrary/BarParams;
move-result-object v0
goto :goto_45
.line 57
:cond_3d
invoke-static {p1}, Lcom/gyf/barlibrary/ImmersionBar;->with(Landroid/app/Activity;)Lcom/gyf/barlibrary/ImmersionBar;
move-result-object v0
invoke-virtual {v0}, Lcom/gyf/barlibrary/ImmersionBar;->getBarParams()Lcom/gyf/barlibrary/BarParams;
move-result-object v0
:goto_45
iput-object v0, p0, Lcom/gyf/barlibrary/KeyboardPatch;->mBarParams:Lcom/gyf/barlibrary/BarParams;
.line 58
if-eqz v0, :cond_4a
.line 60
return-void
.line 59
:cond_4a
new-instance v0, Ljava/lang/IllegalArgumentException;
const-string/jumbo v1, "\u5148\u4f7f\u7528ImmersionBar\u521d\u59cb\u5316"
invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw v0
.end method
.method private constructor <init>(Landroid/app/Activity;Landroid/view/View;)V
.registers 5
.param p1, "activity" # Landroid/app/Activity;
.param p2, "contentView" # Landroid/view/View;
.line 43
const/4 v0, 0x0
const-string v1, ""
invoke-direct {p0, p1, v0, v1, p2}, Lcom/gyf/barlibrary/KeyboardPatch;-><init>(Landroid/app/Activity;Landroid/app/Dialog;Ljava/lang/String;Landroid/view/View;)V
.line 44
return-void
.end method
.method private constructor <init>(Landroid/app/Activity;Landroid/view/Window;)V
.registers 6
.param p1, "activity" # Landroid/app/Activity;
.param p2, "window" # Landroid/view/Window;
.line 62
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 137
new-instance v0, Lcom/gyf/barlibrary/KeyboardPatch$1;
invoke-direct {v0, p0}, Lcom/gyf/barlibrary/KeyboardPatch$1;-><init>(Lcom/gyf/barlibrary/KeyboardPatch;)V
iput-object v0, p0, Lcom/gyf/barlibrary/KeyboardPatch;->onGlobalLayoutListener:Landroid/view/ViewTreeObserver$OnGlobalLayoutListener;
.line 63
iput-object p1, p0, Lcom/gyf/barlibrary/KeyboardPatch;->mActivity:Landroid/app/Activity;
.line 64
iput-object p2, p0, Lcom/gyf/barlibrary/KeyboardPatch;->mWindow:Landroid/view/Window;
.line 65
invoke-virtual {p2}, Landroid/view/Window;->getDecorView()Landroid/view/View;
move-result-object v0
iput-object v0, p0, Lcom/gyf/barlibrary/KeyboardPatch;->mDecorView:Landroid/view/View;
.line 66
const v1, 0x1020002
invoke-virtual {v0, v1}, Landroid/view/View;->findViewById(I)Landroid/view/View;
move-result-object v0
check-cast v0, Landroid/widget/FrameLayout;
.line 67
.local v0, "frameLayout":Landroid/widget/FrameLayout;
const/4 v1, 0x0
invoke-virtual {v0, v1}, Landroid/widget/FrameLayout;->getChildAt(I)Landroid/view/View;
move-result-object v1
iput-object v1, p0, Lcom/gyf/barlibrary/KeyboardPatch;->mChildView:Landroid/view/View;
.line 68
if-eqz v1, :cond_27
goto :goto_28
:cond_27
move-object v1, v0
:goto_28
iput-object v1, p0, Lcom/gyf/barlibrary/KeyboardPatch;->mContentView:Landroid/view/View;
.line 70
invoke-virtual {v1}, Landroid/view/View;->getPaddingLeft()I
move-result v1
iput v1, p0, Lcom/gyf/barlibrary/KeyboardPatch;->paddingLeft:I
.line 71
iget-object v1, p0, Lcom/gyf/barlibrary/KeyboardPatch;->mContentView:Landroid/view/View;
invoke-virtual {v1}, Landroid/view/View;->getPaddingTop()I
move-result v1
iput v1, p0, Lcom/gyf/barlibrary/KeyboardPatch;->paddingTop:I
.line 72
iget-object v1, p0, Lcom/gyf/barlibrary/KeyboardPatch;->mContentView:Landroid/view/View;
invoke-virtual {v1}, Landroid/view/View;->getPaddingRight()I
move-result v1
iput v1, p0, Lcom/gyf/barlibrary/KeyboardPatch;->paddingRight:I
.line 73
iget-object v1, p0, Lcom/gyf/barlibrary/KeyboardPatch;->mContentView:Landroid/view/View;
invoke-virtual {v1}, Landroid/view/View;->getPaddingBottom()I
move-result v1
iput v1, p0, Lcom/gyf/barlibrary/KeyboardPatch;->paddingBottom:I
.line 75
new-instance v1, Lcom/gyf/barlibrary/BarConfig;
iget-object v2, p0, Lcom/gyf/barlibrary/KeyboardPatch;->mActivity:Landroid/app/Activity;
invoke-direct {v1, v2}, Lcom/gyf/barlibrary/BarConfig;-><init>(Landroid/app/Activity;)V
.line 76
.local v1, "barConfig":Lcom/gyf/barlibrary/BarConfig;
invoke-virtual {v1}, Lcom/gyf/barlibrary/BarConfig;->getStatusBarHeight()I
move-result v2
iput v2, p0, Lcom/gyf/barlibrary/KeyboardPatch;->statusBarHeight:I
.line 77
invoke-virtual {v1}, Lcom/gyf/barlibrary/BarConfig;->getNavigationBarHeight()I
move-result v2
iput v2, p0, Lcom/gyf/barlibrary/KeyboardPatch;->navigationBarHeight:I
.line 78
invoke-virtual {v1}, Lcom/gyf/barlibrary/BarConfig;->getActionBarHeight()I
move-result v2
iput v2, p0, Lcom/gyf/barlibrary/KeyboardPatch;->actionBarHeight:I
.line 79
invoke-virtual {v1}, Lcom/gyf/barlibrary/BarConfig;->isNavigationAtBottom()Z
move-result v2
iput-boolean v2, p0, Lcom/gyf/barlibrary/KeyboardPatch;->navigationAtBottom:Z
.line 81
return-void
.end method
.method static synthetic access$000(Lcom/gyf/barlibrary/KeyboardPatch;)Z
.registers 2
.param p0, "x0" # Lcom/gyf/barlibrary/KeyboardPatch;
.line 17
iget-boolean v0, p0, Lcom/gyf/barlibrary/KeyboardPatch;->navigationAtBottom:Z
return v0
.end method
.method static synthetic access$100(Lcom/gyf/barlibrary/KeyboardPatch;)Landroid/view/View;
.registers 2
.param p0, "x0" # Lcom/gyf/barlibrary/KeyboardPatch;
.line 17
iget-object v0, p0, Lcom/gyf/barlibrary/KeyboardPatch;->mDecorView:Landroid/view/View;
return-object v0
.end method
.method static synthetic access$1000(Lcom/gyf/barlibrary/KeyboardPatch;)I
.registers 2
.param p0, "x0" # Lcom/gyf/barlibrary/KeyboardPatch;
.line 17
iget v0, p0, Lcom/gyf/barlibrary/KeyboardPatch;->paddingTop:I
return v0
.end method
.method static synthetic access$1100(Lcom/gyf/barlibrary/KeyboardPatch;)I
.registers 2
.param p0, "x0" # Lcom/gyf/barlibrary/KeyboardPatch;
.line 17
iget v0, p0, Lcom/gyf/barlibrary/KeyboardPatch;->paddingRight:I
return v0
.end method
.method static synthetic access$1200(Lcom/gyf/barlibrary/KeyboardPatch;)I
.registers 2
.param p0, "x0" # Lcom/gyf/barlibrary/KeyboardPatch;
.line 17
iget v0, p0, Lcom/gyf/barlibrary/KeyboardPatch;->paddingBottom:I
return v0
.end method
.method static synthetic access$200(Lcom/gyf/barlibrary/KeyboardPatch;)Lcom/gyf/barlibrary/BarParams;
.registers 2
.param p0, "x0" # Lcom/gyf/barlibrary/KeyboardPatch;
.line 17
iget-object v0, p0, Lcom/gyf/barlibrary/KeyboardPatch;->mBarParams:Lcom/gyf/barlibrary/BarParams;
return-object v0
.end method
.method static synthetic access$300(Lcom/gyf/barlibrary/KeyboardPatch;)Landroid/view/View;
.registers 2
.param p0, "x0" # Lcom/gyf/barlibrary/KeyboardPatch;
.line 17
iget-object v0, p0, Lcom/gyf/barlibrary/KeyboardPatch;->mContentView:Landroid/view/View;
return-object v0
.end method
.method static synthetic access$400(Lcom/gyf/barlibrary/KeyboardPatch;)I
.registers 2
.param p0, "x0" # Lcom/gyf/barlibrary/KeyboardPatch;
.line 17
iget v0, p0, Lcom/gyf/barlibrary/KeyboardPatch;->navigationBarHeight:I
return v0
.end method
.method static synthetic access$500(Lcom/gyf/barlibrary/KeyboardPatch;)Landroid/view/View;
.registers 2
.param p0, "x0" # Lcom/gyf/barlibrary/KeyboardPatch;
.line 17
iget-object v0, p0, Lcom/gyf/barlibrary/KeyboardPatch;->mChildView:Landroid/view/View;
return-object v0
.end method
.method static synthetic access$600(Lcom/gyf/barlibrary/KeyboardPatch;)I
.registers 2
.param p0, "x0" # Lcom/gyf/barlibrary/KeyboardPatch;
.line 17
iget v0, p0, Lcom/gyf/barlibrary/KeyboardPatch;->statusBarHeight:I
return v0
.end method
.method static synthetic access$700(Lcom/gyf/barlibrary/KeyboardPatch;)I
.registers 2
.param p0, "x0" # Lcom/gyf/barlibrary/KeyboardPatch;
.line 17
iget v0, p0, Lcom/gyf/barlibrary/KeyboardPatch;->actionBarHeight:I
return v0
.end method
.method static synthetic access$800(Lcom/gyf/barlibrary/KeyboardPatch;)I
.registers 2
.param p0, "x0" # Lcom/gyf/barlibrary/KeyboardPatch;
.line 17
iget v0, p0, Lcom/gyf/barlibrary/KeyboardPatch;->keyboardHeightPrevious:I
return v0
.end method
.method static synthetic access$802(Lcom/gyf/barlibrary/KeyboardPatch;I)I
.registers 2
.param p0, "x0" # Lcom/gyf/barlibrary/KeyboardPatch;
.param p1, "x1" # I
.line 17
iput p1, p0, Lcom/gyf/barlibrary/KeyboardPatch;->keyboardHeightPrevious:I
return p1
.end method
.method static synthetic access$900(Lcom/gyf/barlibrary/KeyboardPatch;)I
.registers 2
.param p0, "x0" # Lcom/gyf/barlibrary/KeyboardPatch;
.line 17
iget v0, p0, Lcom/gyf/barlibrary/KeyboardPatch;->paddingLeft:I
return v0
.end method
.method public static patch(Landroid/app/Activity;)Lcom/gyf/barlibrary/KeyboardPatch;
.registers 2
.param p0, "activity" # Landroid/app/Activity;
.line 84
new-instance v0, Lcom/gyf/barlibrary/KeyboardPatch;
invoke-direct {v0, p0}, Lcom/gyf/barlibrary/KeyboardPatch;-><init>(Landroid/app/Activity;)V
return-object v0
.end method
.method public static patch(Landroid/app/Activity;Landroid/app/Dialog;Ljava/lang/String;)Lcom/gyf/barlibrary/KeyboardPatch;
.registers 4
.param p0, "activity" # Landroid/app/Activity;
.param p1, "dialog" # Landroid/app/Dialog;
.param p2, "tag" # Ljava/lang/String;
.line 92
new-instance v0, Lcom/gyf/barlibrary/KeyboardPatch;
invoke-direct {v0, p0, p1, p2}, Lcom/gyf/barlibrary/KeyboardPatch;-><init>(Landroid/app/Activity;Landroid/app/Dialog;Ljava/lang/String;)V
return-object v0
.end method
.method public static patch(Landroid/app/Activity;Landroid/app/Dialog;Ljava/lang/String;Landroid/view/View;)Lcom/gyf/barlibrary/KeyboardPatch;
.registers 5
.param p0, "activity" # Landroid/app/Activity;
.param p1, "dialog" # Landroid/app/Dialog;
.param p2, "tag" # Ljava/lang/String;
.param p3, "contentView" # Landroid/view/View;
.line 96
new-instance v0, Lcom/gyf/barlibrary/KeyboardPatch;
invoke-direct {v0, p0, p1, p2, p3}, Lcom/gyf/barlibrary/KeyboardPatch;-><init>(Landroid/app/Activity;Landroid/app/Dialog;Ljava/lang/String;Landroid/view/View;)V
return-object v0
.end method
.method public static patch(Landroid/app/Activity;Landroid/view/View;)Lcom/gyf/barlibrary/KeyboardPatch;
.registers 3
.param p0, "activity" # Landroid/app/Activity;
.param p1, "contentView" # Landroid/view/View;
.line 88
new-instance v0, Lcom/gyf/barlibrary/KeyboardPatch;
invoke-direct {v0, p0, p1}, Lcom/gyf/barlibrary/KeyboardPatch;-><init>(Landroid/app/Activity;Landroid/view/View;)V
return-object v0
.end method
.method protected static patch(Landroid/app/Activity;Landroid/view/Window;)Lcom/gyf/barlibrary/KeyboardPatch;
.registers 3
.param p0, "activity" # Landroid/app/Activity;
.param p1, "window" # Landroid/view/Window;
.line 100
new-instance v0, Lcom/gyf/barlibrary/KeyboardPatch;
invoke-direct {v0, p0, p1}, Lcom/gyf/barlibrary/KeyboardPatch;-><init>(Landroid/app/Activity;Landroid/view/Window;)V
return-object v0
.end method
# virtual methods
.method public disable()V
.registers 2
.line 126
const/16 v0, 0x12
invoke-virtual {p0, v0}, Lcom/gyf/barlibrary/KeyboardPatch;->disable(I)V
.line 128
return-void
.end method
.method public disable(I)V
.registers 4
.param p1, "mode" # I
.line 131
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
const/16 v1, 0x13
if-lt v0, v1, :cond_16
.line 132
iget-object v0, p0, Lcom/gyf/barlibrary/KeyboardPatch;->mWindow:Landroid/view/Window;
invoke-virtual {v0, p1}, Landroid/view/Window;->setSoftInputMode(I)V
.line 133
iget-object v0, p0, Lcom/gyf/barlibrary/KeyboardPatch;->mDecorView:Landroid/view/View;
invoke-virtual {v0}, Landroid/view/View;->getViewTreeObserver()Landroid/view/ViewTreeObserver;
move-result-object v0
iget-object v1, p0, Lcom/gyf/barlibrary/KeyboardPatch;->onGlobalLayoutListener:Landroid/view/ViewTreeObserver$OnGlobalLayoutListener;
invoke-virtual {v0, v1}, Landroid/view/ViewTreeObserver;->removeOnGlobalLayoutListener(Landroid/view/ViewTreeObserver$OnGlobalLayoutListener;)V
.line 135
:cond_16
return-void
.end method
.method public enable()V
.registers 2
.line 111
const/16 v0, 0x12
invoke-virtual {p0, v0}, Lcom/gyf/barlibrary/KeyboardPatch;->enable(I)V
.line 113
return-void
.end method
.method public enable(I)V
.registers 4
.param p1, "mode" # I
.line 116
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
const/16 v1, 0x13
if-lt v0, v1, :cond_16
.line 117
iget-object v0, p0, Lcom/gyf/barlibrary/KeyboardPatch;->mWindow:Landroid/view/Window;
invoke-virtual {v0, p1}, Landroid/view/Window;->setSoftInputMode(I)V
.line 118
iget-object v0, p0, Lcom/gyf/barlibrary/KeyboardPatch;->mDecorView:Landroid/view/View;
invoke-virtual {v0}, Landroid/view/View;->getViewTreeObserver()Landroid/view/ViewTreeObserver;
move-result-object v0
iget-object v1, p0, Lcom/gyf/barlibrary/KeyboardPatch;->onGlobalLayoutListener:Landroid/view/ViewTreeObserver$OnGlobalLayoutListener;
invoke-virtual {v0, v1}, Landroid/view/ViewTreeObserver;->addOnGlobalLayoutListener(Landroid/view/ViewTreeObserver$OnGlobalLayoutListener;)V
.line 120
:cond_16
return-void
.end method
.method protected setBarParams(Lcom/gyf/barlibrary/BarParams;)V
.registers 2
.param p1, "barParams" # Lcom/gyf/barlibrary/BarParams;
.line 104
iput-object p1, p0, Lcom/gyf/barlibrary/KeyboardPatch;->mBarParams:Lcom/gyf/barlibrary/BarParams;
.line 105
return-void
.end method