apkfuckery/com.discord/smali/androidx/preference/PreferenceFragment$DividerDecoration.smali
2020-11-21 21:10:53 +00:00

260 lines
7 KiB
Smali

.class public Landroidx/preference/PreferenceFragment$DividerDecoration;
.super Landroidx/recyclerview/widget/RecyclerView$ItemDecoration;
.source "PreferenceFragment.java"
# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
value = Landroidx/preference/PreferenceFragment;
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x1
name = "DividerDecoration"
.end annotation
# instance fields
.field public mAllowDividerAfterLastItem:Z
.field public mDivider:Landroid/graphics/drawable/Drawable;
.field public mDividerHeight:I
.field public final synthetic this$0:Landroidx/preference/PreferenceFragment;
# direct methods
.method public constructor <init>(Landroidx/preference/PreferenceFragment;)V
.locals 0
iput-object p1, p0, Landroidx/preference/PreferenceFragment$DividerDecoration;->this$0:Landroidx/preference/PreferenceFragment;
invoke-direct {p0}, Landroidx/recyclerview/widget/RecyclerView$ItemDecoration;-><init>()V
const/4 p1, 0x1
iput-boolean p1, p0, Landroidx/preference/PreferenceFragment$DividerDecoration;->mAllowDividerAfterLastItem:Z
return-void
.end method
.method private shouldDrawDividerBelow(Landroid/view/View;Landroidx/recyclerview/widget/RecyclerView;)Z
.locals 4
invoke-virtual {p2, p1}, Landroidx/recyclerview/widget/RecyclerView;->getChildViewHolder(Landroid/view/View;)Landroidx/recyclerview/widget/RecyclerView$ViewHolder;
move-result-object v0
instance-of v1, v0, Landroidx/preference/PreferenceViewHolder;
const/4 v2, 0x0
const/4 v3, 0x1
if-eqz v1, :cond_0
check-cast v0, Landroidx/preference/PreferenceViewHolder;
invoke-virtual {v0}, Landroidx/preference/PreferenceViewHolder;->isDividerAllowedBelow()Z
move-result v0
if-eqz v0, :cond_0
const/4 v0, 0x1
goto :goto_0
:cond_0
const/4 v0, 0x0
:goto_0
if-nez v0, :cond_1
return v2
:cond_1
iget-boolean v0, p0, Landroidx/preference/PreferenceFragment$DividerDecoration;->mAllowDividerAfterLastItem:Z
invoke-virtual {p2, p1}, Landroid/view/ViewGroup;->indexOfChild(Landroid/view/View;)I
move-result p1
invoke-virtual {p2}, Landroid/view/ViewGroup;->getChildCount()I
move-result v1
sub-int/2addr v1, v3
if-ge p1, v1, :cond_3
add-int/2addr p1, v3
invoke-virtual {p2, p1}, Landroid/view/ViewGroup;->getChildAt(I)Landroid/view/View;
move-result-object p1
invoke-virtual {p2, p1}, Landroidx/recyclerview/widget/RecyclerView;->getChildViewHolder(Landroid/view/View;)Landroidx/recyclerview/widget/RecyclerView$ViewHolder;
move-result-object p1
instance-of p2, p1, Landroidx/preference/PreferenceViewHolder;
if-eqz p2, :cond_2
check-cast p1, Landroidx/preference/PreferenceViewHolder;
invoke-virtual {p1}, Landroidx/preference/PreferenceViewHolder;->isDividerAllowedAbove()Z
move-result p1
if-eqz p1, :cond_2
const/4 v2, 0x1
:cond_2
move v0, v2
:cond_3
return v0
.end method
# virtual methods
.method public getItemOffsets(Landroid/graphics/Rect;Landroid/view/View;Landroidx/recyclerview/widget/RecyclerView;Landroidx/recyclerview/widget/RecyclerView$State;)V
.locals 0
invoke-direct {p0, p2, p3}, Landroidx/preference/PreferenceFragment$DividerDecoration;->shouldDrawDividerBelow(Landroid/view/View;Landroidx/recyclerview/widget/RecyclerView;)Z
move-result p2
if-eqz p2, :cond_0
iget p2, p0, Landroidx/preference/PreferenceFragment$DividerDecoration;->mDividerHeight:I
iput p2, p1, Landroid/graphics/Rect;->bottom:I
:cond_0
return-void
.end method
.method public onDrawOver(Landroid/graphics/Canvas;Landroidx/recyclerview/widget/RecyclerView;Landroidx/recyclerview/widget/RecyclerView$State;)V
.locals 6
iget-object p3, p0, Landroidx/preference/PreferenceFragment$DividerDecoration;->mDivider:Landroid/graphics/drawable/Drawable;
if-nez p3, :cond_0
return-void
:cond_0
invoke-virtual {p2}, Landroid/view/ViewGroup;->getChildCount()I
move-result p3
invoke-virtual {p2}, Landroid/view/ViewGroup;->getWidth()I
move-result v0
const/4 v1, 0x0
const/4 v2, 0x0
:goto_0
if-ge v2, p3, :cond_2
invoke-virtual {p2, v2}, Landroid/view/ViewGroup;->getChildAt(I)Landroid/view/View;
move-result-object v3
invoke-direct {p0, v3, p2}, Landroidx/preference/PreferenceFragment$DividerDecoration;->shouldDrawDividerBelow(Landroid/view/View;Landroidx/recyclerview/widget/RecyclerView;)Z
move-result v4
if-eqz v4, :cond_1
invoke-virtual {v3}, Landroid/view/View;->getY()F
move-result v4
float-to-int v4, v4
invoke-virtual {v3}, Landroid/view/View;->getHeight()I
move-result v3
add-int/2addr v3, v4
iget-object v4, p0, Landroidx/preference/PreferenceFragment$DividerDecoration;->mDivider:Landroid/graphics/drawable/Drawable;
iget v5, p0, Landroidx/preference/PreferenceFragment$DividerDecoration;->mDividerHeight:I
add-int/2addr v5, v3
invoke-virtual {v4, v1, v3, v0, v5}, Landroid/graphics/drawable/Drawable;->setBounds(IIII)V
iget-object v3, p0, Landroidx/preference/PreferenceFragment$DividerDecoration;->mDivider:Landroid/graphics/drawable/Drawable;
invoke-virtual {v3, p1}, Landroid/graphics/drawable/Drawable;->draw(Landroid/graphics/Canvas;)V
:cond_1
add-int/lit8 v2, v2, 0x1
goto :goto_0
:cond_2
return-void
.end method
.method public setAllowDividerAfterLastItem(Z)V
.locals 0
iput-boolean p1, p0, Landroidx/preference/PreferenceFragment$DividerDecoration;->mAllowDividerAfterLastItem:Z
return-void
.end method
.method public setDivider(Landroid/graphics/drawable/Drawable;)V
.locals 1
if-eqz p1, :cond_0
invoke-virtual {p1}, Landroid/graphics/drawable/Drawable;->getIntrinsicHeight()I
move-result v0
iput v0, p0, Landroidx/preference/PreferenceFragment$DividerDecoration;->mDividerHeight:I
goto :goto_0
:cond_0
const/4 v0, 0x0
iput v0, p0, Landroidx/preference/PreferenceFragment$DividerDecoration;->mDividerHeight:I
:goto_0
iput-object p1, p0, Landroidx/preference/PreferenceFragment$DividerDecoration;->mDivider:Landroid/graphics/drawable/Drawable;
iget-object p1, p0, Landroidx/preference/PreferenceFragment$DividerDecoration;->this$0:Landroidx/preference/PreferenceFragment;
iget-object p1, p1, Landroidx/preference/PreferenceFragment;->mList:Landroidx/recyclerview/widget/RecyclerView;
invoke-virtual {p1}, Landroidx/recyclerview/widget/RecyclerView;->invalidateItemDecorations()V
return-void
.end method
.method public setDividerHeight(I)V
.locals 0
iput p1, p0, Landroidx/preference/PreferenceFragment$DividerDecoration;->mDividerHeight:I
iget-object p1, p0, Landroidx/preference/PreferenceFragment$DividerDecoration;->this$0:Landroidx/preference/PreferenceFragment;
iget-object p1, p1, Landroidx/preference/PreferenceFragment;->mList:Landroidx/recyclerview/widget/RecyclerView;
invoke-virtual {p1}, Landroidx/recyclerview/widget/RecyclerView;->invalidateItemDecorations()V
return-void
.end method