apkfuckery/com.discord/smali/androidx/preference/DropDownPreference.smali
2020-11-14 02:19:59 +00:00

265 lines
7.4 KiB
Smali

.class public Landroidx/preference/DropDownPreference;
.super Landroidx/preference/ListPreference;
.source "DropDownPreference.java"
# instance fields
.field public final mAdapter:Landroid/widget/ArrayAdapter;
.field public final mContext:Landroid/content/Context;
.field public final mItemSelectedListener:Landroid/widget/AdapterView$OnItemSelectedListener;
.field public mSpinner:Landroid/widget/Spinner;
# direct methods
.method public constructor <init>(Landroid/content/Context;)V
.locals 1
const/4 v0, 0x0
invoke-direct {p0, p1, v0}, Landroidx/preference/DropDownPreference;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
return-void
.end method
.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
.locals 1
sget v0, Landroidx/preference/R$attr;->dropdownPreferenceStyle:I
invoke-direct {p0, p1, p2, v0}, Landroidx/preference/DropDownPreference;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
return-void
.end method
.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
.locals 1
const/4 v0, 0x0
invoke-direct {p0, p1, p2, p3, v0}, Landroidx/preference/DropDownPreference;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;II)V
return-void
.end method
.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;II)V
.locals 0
invoke-direct {p0, p1, p2, p3, p4}, Landroidx/preference/ListPreference;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;II)V
new-instance p2, Landroidx/preference/DropDownPreference$1;
invoke-direct {p2, p0}, Landroidx/preference/DropDownPreference$1;-><init>(Landroidx/preference/DropDownPreference;)V
iput-object p2, p0, Landroidx/preference/DropDownPreference;->mItemSelectedListener:Landroid/widget/AdapterView$OnItemSelectedListener;
iput-object p1, p0, Landroidx/preference/DropDownPreference;->mContext:Landroid/content/Context;
invoke-virtual {p0}, Landroidx/preference/DropDownPreference;->createAdapter()Landroid/widget/ArrayAdapter;
move-result-object p1
iput-object p1, p0, Landroidx/preference/DropDownPreference;->mAdapter:Landroid/widget/ArrayAdapter;
invoke-direct {p0}, Landroidx/preference/DropDownPreference;->updateEntries()V
return-void
.end method
.method private findSpinnerIndexOfValue(Ljava/lang/String;)I
.locals 3
invoke-virtual {p0}, Landroidx/preference/ListPreference;->getEntryValues()[Ljava/lang/CharSequence;
move-result-object v0
if-eqz p1, :cond_1
if-eqz v0, :cond_1
array-length v1, v0
add-int/lit8 v1, v1, -0x1
:goto_0
if-ltz v1, :cond_1
aget-object v2, v0, v1
invoke-virtual {v2, p1}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z
move-result v2
if-eqz v2, :cond_0
return v1
:cond_0
add-int/lit8 v1, v1, -0x1
goto :goto_0
:cond_1
const/4 p1, -0x1
return p1
.end method
.method private updateEntries()V
.locals 5
iget-object v0, p0, Landroidx/preference/DropDownPreference;->mAdapter:Landroid/widget/ArrayAdapter;
invoke-virtual {v0}, Landroid/widget/ArrayAdapter;->clear()V
invoke-virtual {p0}, Landroidx/preference/ListPreference;->getEntries()[Ljava/lang/CharSequence;
move-result-object v0
if-eqz v0, :cond_0
invoke-virtual {p0}, Landroidx/preference/ListPreference;->getEntries()[Ljava/lang/CharSequence;
move-result-object v0
array-length v1, v0
const/4 v2, 0x0
:goto_0
if-ge v2, v1, :cond_0
aget-object v3, v0, v2
iget-object v4, p0, Landroidx/preference/DropDownPreference;->mAdapter:Landroid/widget/ArrayAdapter;
invoke-interface {v3}, Ljava/lang/CharSequence;->toString()Ljava/lang/String;
move-result-object v3
invoke-virtual {v4, v3}, Landroid/widget/ArrayAdapter;->add(Ljava/lang/Object;)V
add-int/lit8 v2, v2, 0x1
goto :goto_0
:cond_0
return-void
.end method
# virtual methods
.method public createAdapter()Landroid/widget/ArrayAdapter;
.locals 3
new-instance v0, Landroid/widget/ArrayAdapter;
iget-object v1, p0, Landroidx/preference/DropDownPreference;->mContext:Landroid/content/Context;
const v2, 0x1090009
invoke-direct {v0, v1, v2}, Landroid/widget/ArrayAdapter;-><init>(Landroid/content/Context;I)V
return-object v0
.end method
.method public notifyChanged()V
.locals 1
invoke-super {p0}, Landroidx/preference/Preference;->notifyChanged()V
iget-object v0, p0, Landroidx/preference/DropDownPreference;->mAdapter:Landroid/widget/ArrayAdapter;
if-eqz v0, :cond_0
invoke-virtual {v0}, Landroid/widget/ArrayAdapter;->notifyDataSetChanged()V
:cond_0
return-void
.end method
.method public onBindViewHolder(Landroidx/preference/PreferenceViewHolder;)V
.locals 2
iget-object v0, p1, Landroidx/recyclerview/widget/RecyclerView$ViewHolder;->itemView:Landroid/view/View;
sget v1, Landroidx/preference/R$id;->spinner:I
invoke-virtual {v0, v1}, Landroid/view/View;->findViewById(I)Landroid/view/View;
move-result-object v0
check-cast v0, Landroid/widget/Spinner;
iput-object v0, p0, Landroidx/preference/DropDownPreference;->mSpinner:Landroid/widget/Spinner;
iget-object v1, p0, Landroidx/preference/DropDownPreference;->mAdapter:Landroid/widget/ArrayAdapter;
invoke-virtual {v0, v1}, Landroid/widget/Spinner;->setAdapter(Landroid/widget/SpinnerAdapter;)V
iget-object v0, p0, Landroidx/preference/DropDownPreference;->mSpinner:Landroid/widget/Spinner;
iget-object v1, p0, Landroidx/preference/DropDownPreference;->mItemSelectedListener:Landroid/widget/AdapterView$OnItemSelectedListener;
invoke-virtual {v0, v1}, Landroid/widget/Spinner;->setOnItemSelectedListener(Landroid/widget/AdapterView$OnItemSelectedListener;)V
iget-object v0, p0, Landroidx/preference/DropDownPreference;->mSpinner:Landroid/widget/Spinner;
invoke-virtual {p0}, Landroidx/preference/ListPreference;->getValue()Ljava/lang/String;
move-result-object v1
invoke-direct {p0, v1}, Landroidx/preference/DropDownPreference;->findSpinnerIndexOfValue(Ljava/lang/String;)I
move-result v1
invoke-virtual {v0, v1}, Landroid/widget/Spinner;->setSelection(I)V
invoke-super {p0, p1}, Landroidx/preference/Preference;->onBindViewHolder(Landroidx/preference/PreferenceViewHolder;)V
return-void
.end method
.method public onClick()V
.locals 1
iget-object v0, p0, Landroidx/preference/DropDownPreference;->mSpinner:Landroid/widget/Spinner;
invoke-virtual {v0}, Landroid/widget/Spinner;->performClick()Z
return-void
.end method
.method public setEntries([Ljava/lang/CharSequence;)V
.locals 0
.param p1 # [Ljava/lang/CharSequence;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
invoke-super {p0, p1}, Landroidx/preference/ListPreference;->setEntries([Ljava/lang/CharSequence;)V
invoke-direct {p0}, Landroidx/preference/DropDownPreference;->updateEntries()V
return-void
.end method
.method public setValueIndex(I)V
.locals 1
invoke-virtual {p0}, Landroidx/preference/ListPreference;->getEntryValues()[Ljava/lang/CharSequence;
move-result-object v0
aget-object p1, v0, p1
invoke-interface {p1}, Ljava/lang/CharSequence;->toString()Ljava/lang/String;
move-result-object p1
invoke-virtual {p0, p1}, Landroidx/preference/ListPreference;->setValue(Ljava/lang/String;)V
return-void
.end method