435 lines
9.2 KiB
Smali
435 lines
9.2 KiB
Smali
.class public Landroidx/appcompat/widget/ButtonBarLayout;
|
|
.super Landroid/widget/LinearLayout;
|
|
.source "ButtonBarLayout.java"
|
|
|
|
|
|
# annotations
|
|
.annotation build Landroidx/annotation/RestrictTo;
|
|
value = {
|
|
.enum Landroidx/annotation/RestrictTo$Scope;->LIBRARY_GROUP:Landroidx/annotation/RestrictTo$Scope;
|
|
}
|
|
.end annotation
|
|
|
|
|
|
# static fields
|
|
.field private static final PEEK_BUTTON_DP:I = 0x10
|
|
|
|
|
|
# instance fields
|
|
.field private mAllowStacking:Z
|
|
|
|
.field private mLastWidthSize:I
|
|
|
|
.field private mMinimumHeight:I
|
|
|
|
|
|
# direct methods
|
|
.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
|
|
.locals 1
|
|
|
|
invoke-direct {p0, p1, p2}, Landroid/widget/LinearLayout;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
|
|
|
|
const/4 v0, -0x1
|
|
|
|
iput v0, p0, Landroidx/appcompat/widget/ButtonBarLayout;->mLastWidthSize:I
|
|
|
|
const/4 v0, 0x0
|
|
|
|
iput v0, p0, Landroidx/appcompat/widget/ButtonBarLayout;->mMinimumHeight:I
|
|
|
|
sget-object v0, Landroidx/appcompat/R$styleable;->ButtonBarLayout:[I
|
|
|
|
invoke-virtual {p1, p2, v0}, Landroid/content/Context;->obtainStyledAttributes(Landroid/util/AttributeSet;[I)Landroid/content/res/TypedArray;
|
|
|
|
move-result-object p1
|
|
|
|
sget p2, Landroidx/appcompat/R$styleable;->ButtonBarLayout_allowStacking:I
|
|
|
|
const/4 v0, 0x1
|
|
|
|
invoke-virtual {p1, p2, v0}, Landroid/content/res/TypedArray;->getBoolean(IZ)Z
|
|
|
|
move-result p2
|
|
|
|
iput-boolean p2, p0, Landroidx/appcompat/widget/ButtonBarLayout;->mAllowStacking:Z
|
|
|
|
invoke-virtual {p1}, Landroid/content/res/TypedArray;->recycle()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method private getNextVisibleChildIndex(I)I
|
|
.locals 2
|
|
|
|
invoke-virtual {p0}, Landroidx/appcompat/widget/ButtonBarLayout;->getChildCount()I
|
|
|
|
move-result v0
|
|
|
|
:goto_0
|
|
if-ge p1, v0, :cond_1
|
|
|
|
invoke-virtual {p0, p1}, Landroidx/appcompat/widget/ButtonBarLayout;->getChildAt(I)Landroid/view/View;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v1}, Landroid/view/View;->getVisibility()I
|
|
|
|
move-result v1
|
|
|
|
if-nez v1, :cond_0
|
|
|
|
return p1
|
|
|
|
:cond_0
|
|
add-int/lit8 p1, p1, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_1
|
|
const/4 p1, -0x1
|
|
|
|
return p1
|
|
.end method
|
|
|
|
.method private isStacked()Z
|
|
.locals 2
|
|
|
|
invoke-virtual {p0}, Landroidx/appcompat/widget/ButtonBarLayout;->getOrientation()I
|
|
|
|
move-result v0
|
|
|
|
const/4 v1, 0x1
|
|
|
|
if-ne v0, v1, :cond_0
|
|
|
|
return v1
|
|
|
|
:cond_0
|
|
const/4 v0, 0x0
|
|
|
|
return v0
|
|
.end method
|
|
|
|
.method private setStacked(Z)V
|
|
.locals 1
|
|
|
|
invoke-virtual {p0, p1}, Landroidx/appcompat/widget/ButtonBarLayout;->setOrientation(I)V
|
|
|
|
if-eqz p1, :cond_0
|
|
|
|
const/4 v0, 0x5
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
const/16 v0, 0x50
|
|
|
|
:goto_0
|
|
invoke-virtual {p0, v0}, Landroidx/appcompat/widget/ButtonBarLayout;->setGravity(I)V
|
|
|
|
sget v0, Landroidx/appcompat/R$id;->spacer:I
|
|
|
|
invoke-virtual {p0, v0}, Landroidx/appcompat/widget/ButtonBarLayout;->findViewById(I)Landroid/view/View;
|
|
|
|
move-result-object v0
|
|
|
|
if-eqz v0, :cond_2
|
|
|
|
if-eqz p1, :cond_1
|
|
|
|
const/16 p1, 0x8
|
|
|
|
goto :goto_1
|
|
|
|
:cond_1
|
|
const/4 p1, 0x4
|
|
|
|
:goto_1
|
|
invoke-virtual {v0, p1}, Landroid/view/View;->setVisibility(I)V
|
|
|
|
:cond_2
|
|
invoke-virtual {p0}, Landroidx/appcompat/widget/ButtonBarLayout;->getChildCount()I
|
|
|
|
move-result p1
|
|
|
|
add-int/lit8 p1, p1, -0x2
|
|
|
|
:goto_2
|
|
if-ltz p1, :cond_3
|
|
|
|
invoke-virtual {p0, p1}, Landroidx/appcompat/widget/ButtonBarLayout;->getChildAt(I)Landroid/view/View;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {p0, v0}, Landroidx/appcompat/widget/ButtonBarLayout;->bringChildToFront(Landroid/view/View;)V
|
|
|
|
add-int/lit8 p1, p1, -0x1
|
|
|
|
goto :goto_2
|
|
|
|
:cond_3
|
|
return-void
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public getMinimumHeight()I
|
|
.locals 2
|
|
|
|
iget v0, p0, Landroidx/appcompat/widget/ButtonBarLayout;->mMinimumHeight:I
|
|
|
|
invoke-super {p0}, Landroid/widget/LinearLayout;->getMinimumHeight()I
|
|
|
|
move-result v1
|
|
|
|
invoke-static {v0, v1}, Ljava/lang/Math;->max(II)I
|
|
|
|
move-result v0
|
|
|
|
return v0
|
|
.end method
|
|
|
|
.method protected onMeasure(II)V
|
|
.locals 5
|
|
|
|
invoke-static {p1}, Landroid/view/View$MeasureSpec;->getSize(I)I
|
|
|
|
move-result v0
|
|
|
|
iget-boolean v1, p0, Landroidx/appcompat/widget/ButtonBarLayout;->mAllowStacking:Z
|
|
|
|
const/4 v2, 0x0
|
|
|
|
if-eqz v1, :cond_1
|
|
|
|
iget v1, p0, Landroidx/appcompat/widget/ButtonBarLayout;->mLastWidthSize:I
|
|
|
|
if-le v0, v1, :cond_0
|
|
|
|
invoke-direct {p0}, Landroidx/appcompat/widget/ButtonBarLayout;->isStacked()Z
|
|
|
|
move-result v1
|
|
|
|
if-eqz v1, :cond_0
|
|
|
|
invoke-direct {p0, v2}, Landroidx/appcompat/widget/ButtonBarLayout;->setStacked(Z)V
|
|
|
|
:cond_0
|
|
iput v0, p0, Landroidx/appcompat/widget/ButtonBarLayout;->mLastWidthSize:I
|
|
|
|
:cond_1
|
|
invoke-direct {p0}, Landroidx/appcompat/widget/ButtonBarLayout;->isStacked()Z
|
|
|
|
move-result v1
|
|
|
|
const/4 v3, 0x1
|
|
|
|
if-nez v1, :cond_2
|
|
|
|
invoke-static {p1}, Landroid/view/View$MeasureSpec;->getMode(I)I
|
|
|
|
move-result v1
|
|
|
|
const/high16 v4, 0x40000000 # 2.0f
|
|
|
|
if-ne v1, v4, :cond_2
|
|
|
|
const/high16 v1, -0x80000000
|
|
|
|
invoke-static {v0, v1}, Landroid/view/View$MeasureSpec;->makeMeasureSpec(II)I
|
|
|
|
move-result v0
|
|
|
|
const/4 v1, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_2
|
|
move v0, p1
|
|
|
|
const/4 v1, 0x0
|
|
|
|
:goto_0
|
|
invoke-super {p0, v0, p2}, Landroid/widget/LinearLayout;->onMeasure(II)V
|
|
|
|
iget-boolean v0, p0, Landroidx/appcompat/widget/ButtonBarLayout;->mAllowStacking:Z
|
|
|
|
if-eqz v0, :cond_4
|
|
|
|
invoke-direct {p0}, Landroidx/appcompat/widget/ButtonBarLayout;->isStacked()Z
|
|
|
|
move-result v0
|
|
|
|
if-nez v0, :cond_4
|
|
|
|
invoke-virtual {p0}, Landroidx/appcompat/widget/ButtonBarLayout;->getMeasuredWidthAndState()I
|
|
|
|
move-result v0
|
|
|
|
const/high16 v4, -0x1000000
|
|
|
|
and-int/2addr v0, v4
|
|
|
|
const/high16 v4, 0x1000000
|
|
|
|
if-ne v0, v4, :cond_3
|
|
|
|
const/4 v0, 0x1
|
|
|
|
goto :goto_1
|
|
|
|
:cond_3
|
|
const/4 v0, 0x0
|
|
|
|
:goto_1
|
|
if-eqz v0, :cond_4
|
|
|
|
invoke-direct {p0, v3}, Landroidx/appcompat/widget/ButtonBarLayout;->setStacked(Z)V
|
|
|
|
const/4 v1, 0x1
|
|
|
|
:cond_4
|
|
if-eqz v1, :cond_5
|
|
|
|
invoke-super {p0, p1, p2}, Landroid/widget/LinearLayout;->onMeasure(II)V
|
|
|
|
:cond_5
|
|
invoke-direct {p0, v2}, Landroidx/appcompat/widget/ButtonBarLayout;->getNextVisibleChildIndex(I)I
|
|
|
|
move-result p1
|
|
|
|
if-ltz p1, :cond_8
|
|
|
|
invoke-virtual {p0, p1}, Landroidx/appcompat/widget/ButtonBarLayout;->getChildAt(I)Landroid/view/View;
|
|
|
|
move-result-object p2
|
|
|
|
invoke-virtual {p2}, Landroid/view/View;->getLayoutParams()Landroid/view/ViewGroup$LayoutParams;
|
|
|
|
move-result-object v0
|
|
|
|
check-cast v0, Landroid/widget/LinearLayout$LayoutParams;
|
|
|
|
invoke-virtual {p0}, Landroidx/appcompat/widget/ButtonBarLayout;->getPaddingTop()I
|
|
|
|
move-result v1
|
|
|
|
invoke-virtual {p2}, Landroid/view/View;->getMeasuredHeight()I
|
|
|
|
move-result p2
|
|
|
|
add-int/2addr v1, p2
|
|
|
|
iget p2, v0, Landroid/widget/LinearLayout$LayoutParams;->topMargin:I
|
|
|
|
add-int/2addr v1, p2
|
|
|
|
iget p2, v0, Landroid/widget/LinearLayout$LayoutParams;->bottomMargin:I
|
|
|
|
add-int/2addr v1, p2
|
|
|
|
add-int/2addr v1, v2
|
|
|
|
invoke-direct {p0}, Landroidx/appcompat/widget/ButtonBarLayout;->isStacked()Z
|
|
|
|
move-result p2
|
|
|
|
if-eqz p2, :cond_7
|
|
|
|
add-int/2addr p1, v3
|
|
|
|
invoke-direct {p0, p1}, Landroidx/appcompat/widget/ButtonBarLayout;->getNextVisibleChildIndex(I)I
|
|
|
|
move-result p1
|
|
|
|
if-ltz p1, :cond_6
|
|
|
|
invoke-virtual {p0, p1}, Landroidx/appcompat/widget/ButtonBarLayout;->getChildAt(I)Landroid/view/View;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-virtual {p1}, Landroid/view/View;->getPaddingTop()I
|
|
|
|
move-result p1
|
|
|
|
const/high16 p2, 0x41800000 # 16.0f
|
|
|
|
invoke-virtual {p0}, Landroidx/appcompat/widget/ButtonBarLayout;->getResources()Landroid/content/res/Resources;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {v0}, Landroid/content/res/Resources;->getDisplayMetrics()Landroid/util/DisplayMetrics;
|
|
|
|
move-result-object v0
|
|
|
|
iget v0, v0, Landroid/util/DisplayMetrics;->density:F
|
|
|
|
mul-float v0, v0, p2
|
|
|
|
float-to-int p2, v0
|
|
|
|
add-int/2addr p1, p2
|
|
|
|
add-int/2addr v1, p1
|
|
|
|
move v2, v1
|
|
|
|
goto :goto_2
|
|
|
|
:cond_6
|
|
move v2, v1
|
|
|
|
goto :goto_2
|
|
|
|
:cond_7
|
|
invoke-virtual {p0}, Landroidx/appcompat/widget/ButtonBarLayout;->getPaddingBottom()I
|
|
|
|
move-result p1
|
|
|
|
add-int v2, v1, p1
|
|
|
|
:cond_8
|
|
:goto_2
|
|
invoke-static {p0}, Landroidx/core/view/ViewCompat;->getMinimumHeight(Landroid/view/View;)I
|
|
|
|
move-result p1
|
|
|
|
if-eq p1, v2, :cond_9
|
|
|
|
invoke-virtual {p0, v2}, Landroidx/appcompat/widget/ButtonBarLayout;->setMinimumHeight(I)V
|
|
|
|
:cond_9
|
|
return-void
|
|
.end method
|
|
|
|
.method public setAllowStacking(Z)V
|
|
.locals 1
|
|
|
|
iget-boolean v0, p0, Landroidx/appcompat/widget/ButtonBarLayout;->mAllowStacking:Z
|
|
|
|
if-eq v0, p1, :cond_1
|
|
|
|
iput-boolean p1, p0, Landroidx/appcompat/widget/ButtonBarLayout;->mAllowStacking:Z
|
|
|
|
iget-boolean p1, p0, Landroidx/appcompat/widget/ButtonBarLayout;->mAllowStacking:Z
|
|
|
|
if-nez p1, :cond_0
|
|
|
|
invoke-virtual {p0}, Landroidx/appcompat/widget/ButtonBarLayout;->getOrientation()I
|
|
|
|
move-result p1
|
|
|
|
const/4 v0, 0x1
|
|
|
|
if-ne p1, v0, :cond_0
|
|
|
|
const/4 p1, 0x0
|
|
|
|
invoke-direct {p0, p1}, Landroidx/appcompat/widget/ButtonBarLayout;->setStacked(Z)V
|
|
|
|
:cond_0
|
|
invoke-virtual {p0}, Landroidx/appcompat/widget/ButtonBarLayout;->requestLayout()V
|
|
|
|
:cond_1
|
|
return-void
|
|
.end method
|