apkfuckery/com.discord/smali/androidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter.smali
2019-12-06 04:29:40 +01:00

568 lines
17 KiB
Smali

.class public Landroidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter;
.super Landroid/widget/BaseAdapter;
.source "ActivityChooserView.java"
# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
value = Landroidx/appcompat/widget/ActivityChooserView;
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x1
name = "ActivityChooserViewAdapter"
.end annotation
# static fields
.field public static final ITEM_VIEW_TYPE_ACTIVITY:I = 0x0
.field public static final ITEM_VIEW_TYPE_COUNT:I = 0x3
.field public static final ITEM_VIEW_TYPE_FOOTER:I = 0x1
.field public static final MAX_ACTIVITY_COUNT_DEFAULT:I = 0x4
.field public static final MAX_ACTIVITY_COUNT_UNLIMITED:I = 0x7fffffff
# instance fields
.field public mDataModel:Landroidx/appcompat/widget/ActivityChooserModel;
.field public mHighlightDefaultActivity:Z
.field public mMaxActivityCount:I
.field public mShowDefaultActivity:Z
.field public mShowFooterView:Z
.field public final synthetic this$0:Landroidx/appcompat/widget/ActivityChooserView;
# direct methods
.method public constructor <init>(Landroidx/appcompat/widget/ActivityChooserView;)V
.locals 0
iput-object p1, p0, Landroidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter;->this$0:Landroidx/appcompat/widget/ActivityChooserView;
invoke-direct {p0}, Landroid/widget/BaseAdapter;-><init>()V
const/4 p1, 0x4
iput p1, p0, Landroidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter;->mMaxActivityCount:I
return-void
.end method
# virtual methods
.method public getActivityCount()I
.locals 1
iget-object v0, p0, Landroidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter;->mDataModel:Landroidx/appcompat/widget/ActivityChooserModel;
invoke-virtual {v0}, Landroidx/appcompat/widget/ActivityChooserModel;->getActivityCount()I
move-result v0
return v0
.end method
.method public getCount()I
.locals 2
iget-object v0, p0, Landroidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter;->mDataModel:Landroidx/appcompat/widget/ActivityChooserModel;
invoke-virtual {v0}, Landroidx/appcompat/widget/ActivityChooserModel;->getActivityCount()I
move-result v0
iget-boolean v1, p0, Landroidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter;->mShowDefaultActivity:Z
if-nez v1, :cond_0
iget-object v1, p0, Landroidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter;->mDataModel:Landroidx/appcompat/widget/ActivityChooserModel;
invoke-virtual {v1}, Landroidx/appcompat/widget/ActivityChooserModel;->getDefaultActivity()Landroid/content/pm/ResolveInfo;
move-result-object v1
if-eqz v1, :cond_0
add-int/lit8 v0, v0, -0x1
:cond_0
iget v1, p0, Landroidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter;->mMaxActivityCount:I
invoke-static {v0, v1}, Ljava/lang/Math;->min(II)I
move-result v0
iget-boolean v1, p0, Landroidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter;->mShowFooterView:Z
if-eqz v1, :cond_1
add-int/lit8 v0, v0, 0x1
:cond_1
return v0
.end method
.method public getDataModel()Landroidx/appcompat/widget/ActivityChooserModel;
.locals 1
iget-object v0, p0, Landroidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter;->mDataModel:Landroidx/appcompat/widget/ActivityChooserModel;
return-object v0
.end method
.method public getDefaultActivity()Landroid/content/pm/ResolveInfo;
.locals 1
iget-object v0, p0, Landroidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter;->mDataModel:Landroidx/appcompat/widget/ActivityChooserModel;
invoke-virtual {v0}, Landroidx/appcompat/widget/ActivityChooserModel;->getDefaultActivity()Landroid/content/pm/ResolveInfo;
move-result-object v0
return-object v0
.end method
.method public getHistorySize()I
.locals 1
iget-object v0, p0, Landroidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter;->mDataModel:Landroidx/appcompat/widget/ActivityChooserModel;
invoke-virtual {v0}, Landroidx/appcompat/widget/ActivityChooserModel;->getHistorySize()I
move-result v0
return v0
.end method
.method public getItem(I)Ljava/lang/Object;
.locals 1
invoke-virtual {p0, p1}, Landroidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter;->getItemViewType(I)I
move-result v0
if-eqz v0, :cond_1
const/4 p1, 0x1
if-ne v0, p1, :cond_0
const/4 p1, 0x0
return-object p1
:cond_0
new-instance p1, Ljava/lang/IllegalArgumentException;
invoke-direct {p1}, Ljava/lang/IllegalArgumentException;-><init>()V
throw p1
:cond_1
iget-boolean v0, p0, Landroidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter;->mShowDefaultActivity:Z
if-nez v0, :cond_2
iget-object v0, p0, Landroidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter;->mDataModel:Landroidx/appcompat/widget/ActivityChooserModel;
invoke-virtual {v0}, Landroidx/appcompat/widget/ActivityChooserModel;->getDefaultActivity()Landroid/content/pm/ResolveInfo;
move-result-object v0
if-eqz v0, :cond_2
add-int/lit8 p1, p1, 0x1
:cond_2
iget-object v0, p0, Landroidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter;->mDataModel:Landroidx/appcompat/widget/ActivityChooserModel;
invoke-virtual {v0, p1}, Landroidx/appcompat/widget/ActivityChooserModel;->getActivity(I)Landroid/content/pm/ResolveInfo;
move-result-object p1
return-object p1
.end method
.method public getItemId(I)J
.locals 2
int-to-long v0, p1
return-wide v0
.end method
.method public getItemViewType(I)I
.locals 2
iget-boolean v0, p0, Landroidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter;->mShowFooterView:Z
if-eqz v0, :cond_0
invoke-virtual {p0}, Landroidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter;->getCount()I
move-result v0
const/4 v1, 0x1
sub-int/2addr v0, v1
if-ne p1, v0, :cond_0
return v1
:cond_0
const/4 p1, 0x0
return p1
.end method
.method public getShowDefaultActivity()Z
.locals 1
iget-boolean v0, p0, Landroidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter;->mShowDefaultActivity:Z
return v0
.end method
.method public getView(ILandroid/view/View;Landroid/view/ViewGroup;)Landroid/view/View;
.locals 5
invoke-virtual {p0, p1}, Landroidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter;->getItemViewType(I)I
move-result v0
const/4 v1, 0x0
const/4 v2, 0x1
if-eqz v0, :cond_3
if-ne v0, v2, :cond_2
if-eqz p2, :cond_0
invoke-virtual {p2}, Landroid/view/View;->getId()I
move-result p1
if-eq p1, v2, :cond_1
:cond_0
iget-object p1, p0, Landroidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter;->this$0:Landroidx/appcompat/widget/ActivityChooserView;
invoke-virtual {p1}, Landroid/view/ViewGroup;->getContext()Landroid/content/Context;
move-result-object p1
invoke-static {p1}, Landroid/view/LayoutInflater;->from(Landroid/content/Context;)Landroid/view/LayoutInflater;
move-result-object p1
sget p2, Landroidx/appcompat/R$layout;->abc_activity_chooser_view_list_item:I
invoke-virtual {p1, p2, p3, v1}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;Z)Landroid/view/View;
move-result-object p2
invoke-virtual {p2, v2}, Landroid/view/View;->setId(I)V
sget p1, Landroidx/appcompat/R$id;->title:I
invoke-virtual {p2, p1}, Landroid/view/View;->findViewById(I)Landroid/view/View;
move-result-object p1
check-cast p1, Landroid/widget/TextView;
iget-object p3, p0, Landroidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter;->this$0:Landroidx/appcompat/widget/ActivityChooserView;
invoke-virtual {p3}, Landroid/view/ViewGroup;->getContext()Landroid/content/Context;
move-result-object p3
sget v0, Landroidx/appcompat/R$string;->abc_activity_chooser_view_see_all:I
invoke-virtual {p3, v0}, Landroid/content/Context;->getString(I)Ljava/lang/String;
move-result-object p3
invoke-virtual {p1, p3}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V
:cond_1
return-object p2
:cond_2
new-instance p1, Ljava/lang/IllegalArgumentException;
invoke-direct {p1}, Ljava/lang/IllegalArgumentException;-><init>()V
throw p1
:cond_3
if-eqz p2, :cond_4
invoke-virtual {p2}, Landroid/view/View;->getId()I
move-result v0
sget v3, Landroidx/appcompat/R$id;->list_item:I
if-eq v0, v3, :cond_5
:cond_4
iget-object p2, p0, Landroidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter;->this$0:Landroidx/appcompat/widget/ActivityChooserView;
invoke-virtual {p2}, Landroid/view/ViewGroup;->getContext()Landroid/content/Context;
move-result-object p2
invoke-static {p2}, Landroid/view/LayoutInflater;->from(Landroid/content/Context;)Landroid/view/LayoutInflater;
move-result-object p2
sget v0, Landroidx/appcompat/R$layout;->abc_activity_chooser_view_list_item:I
invoke-virtual {p2, v0, p3, v1}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;Z)Landroid/view/View;
move-result-object p2
:cond_5
iget-object p3, p0, Landroidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter;->this$0:Landroidx/appcompat/widget/ActivityChooserView;
invoke-virtual {p3}, Landroid/view/ViewGroup;->getContext()Landroid/content/Context;
move-result-object p3
invoke-virtual {p3}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;
move-result-object p3
sget v0, Landroidx/appcompat/R$id;->icon:I
invoke-virtual {p2, v0}, Landroid/view/View;->findViewById(I)Landroid/view/View;
move-result-object v0
check-cast v0, Landroid/widget/ImageView;
invoke-virtual {p0, p1}, Landroidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter;->getItem(I)Ljava/lang/Object;
move-result-object v3
check-cast v3, Landroid/content/pm/ResolveInfo;
invoke-virtual {v3, p3}, Landroid/content/pm/ResolveInfo;->loadIcon(Landroid/content/pm/PackageManager;)Landroid/graphics/drawable/Drawable;
move-result-object v4
invoke-virtual {v0, v4}, Landroid/widget/ImageView;->setImageDrawable(Landroid/graphics/drawable/Drawable;)V
sget v0, Landroidx/appcompat/R$id;->title:I
invoke-virtual {p2, v0}, Landroid/view/View;->findViewById(I)Landroid/view/View;
move-result-object v0
check-cast v0, Landroid/widget/TextView;
invoke-virtual {v3, p3}, Landroid/content/pm/ResolveInfo;->loadLabel(Landroid/content/pm/PackageManager;)Ljava/lang/CharSequence;
move-result-object p3
invoke-virtual {v0, p3}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V
iget-boolean p3, p0, Landroidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter;->mShowDefaultActivity:Z
if-eqz p3, :cond_6
if-nez p1, :cond_6
iget-boolean p1, p0, Landroidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter;->mHighlightDefaultActivity:Z
if-eqz p1, :cond_6
invoke-virtual {p2, v2}, Landroid/view/View;->setActivated(Z)V
goto :goto_0
:cond_6
invoke-virtual {p2, v1}, Landroid/view/View;->setActivated(Z)V
:goto_0
return-object p2
.end method
.method public getViewTypeCount()I
.locals 1
const/4 v0, 0x3
return v0
.end method
.method public measureContentWidth()I
.locals 9
iget v0, p0, Landroidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter;->mMaxActivityCount:I
const v1, 0x7fffffff
iput v1, p0, Landroidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter;->mMaxActivityCount:I
const/4 v1, 0x0
invoke-static {v1, v1}, Landroid/view/View$MeasureSpec;->makeMeasureSpec(II)I
move-result v2
invoke-static {v1, v1}, Landroid/view/View$MeasureSpec;->makeMeasureSpec(II)I
move-result v3
invoke-virtual {p0}, Landroidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter;->getCount()I
move-result v4
const/4 v5, 0x0
move-object v7, v5
const/4 v6, 0x0
:goto_0
if-ge v1, v4, :cond_0
invoke-virtual {p0, v1, v7, v5}, Landroidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter;->getView(ILandroid/view/View;Landroid/view/ViewGroup;)Landroid/view/View;
move-result-object v7
invoke-virtual {v7, v2, v3}, Landroid/view/View;->measure(II)V
invoke-virtual {v7}, Landroid/view/View;->getMeasuredWidth()I
move-result v8
invoke-static {v6, v8}, Ljava/lang/Math;->max(II)I
move-result v6
add-int/lit8 v1, v1, 0x1
goto :goto_0
:cond_0
iput v0, p0, Landroidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter;->mMaxActivityCount:I
return v6
.end method
.method public setDataModel(Landroidx/appcompat/widget/ActivityChooserModel;)V
.locals 2
iget-object v0, p0, Landroidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter;->this$0:Landroidx/appcompat/widget/ActivityChooserView;
iget-object v0, v0, Landroidx/appcompat/widget/ActivityChooserView;->mAdapter:Landroidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter;
invoke-virtual {v0}, Landroidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter;->getDataModel()Landroidx/appcompat/widget/ActivityChooserModel;
move-result-object v0
if-eqz v0, :cond_0
iget-object v1, p0, Landroidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter;->this$0:Landroidx/appcompat/widget/ActivityChooserView;
invoke-virtual {v1}, Landroid/view/ViewGroup;->isShown()Z
move-result v1
if-eqz v1, :cond_0
iget-object v1, p0, Landroidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter;->this$0:Landroidx/appcompat/widget/ActivityChooserView;
iget-object v1, v1, Landroidx/appcompat/widget/ActivityChooserView;->mModelDataSetObserver:Landroid/database/DataSetObserver;
invoke-virtual {v0, v1}, Landroid/database/DataSetObservable;->unregisterObserver(Ljava/lang/Object;)V
:cond_0
iput-object p1, p0, Landroidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter;->mDataModel:Landroidx/appcompat/widget/ActivityChooserModel;
if-eqz p1, :cond_1
iget-object v0, p0, Landroidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter;->this$0:Landroidx/appcompat/widget/ActivityChooserView;
invoke-virtual {v0}, Landroid/view/ViewGroup;->isShown()Z
move-result v0
if-eqz v0, :cond_1
iget-object v0, p0, Landroidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter;->this$0:Landroidx/appcompat/widget/ActivityChooserView;
iget-object v0, v0, Landroidx/appcompat/widget/ActivityChooserView;->mModelDataSetObserver:Landroid/database/DataSetObserver;
invoke-virtual {p1, v0}, Landroid/database/DataSetObservable;->registerObserver(Ljava/lang/Object;)V
:cond_1
invoke-virtual {p0}, Landroid/widget/BaseAdapter;->notifyDataSetChanged()V
return-void
.end method
.method public setMaxActivityCount(I)V
.locals 1
iget v0, p0, Landroidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter;->mMaxActivityCount:I
if-eq v0, p1, :cond_0
iput p1, p0, Landroidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter;->mMaxActivityCount:I
invoke-virtual {p0}, Landroid/widget/BaseAdapter;->notifyDataSetChanged()V
:cond_0
return-void
.end method
.method public setShowDefaultActivity(ZZ)V
.locals 1
iget-boolean v0, p0, Landroidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter;->mShowDefaultActivity:Z
if-ne v0, p1, :cond_0
iget-boolean v0, p0, Landroidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter;->mHighlightDefaultActivity:Z
if-eq v0, p2, :cond_1
:cond_0
iput-boolean p1, p0, Landroidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter;->mShowDefaultActivity:Z
iput-boolean p2, p0, Landroidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter;->mHighlightDefaultActivity:Z
invoke-virtual {p0}, Landroid/widget/BaseAdapter;->notifyDataSetChanged()V
:cond_1
return-void
.end method
.method public setShowFooterView(Z)V
.locals 1
iget-boolean v0, p0, Landroidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter;->mShowFooterView:Z
if-eq v0, p1, :cond_0
iput-boolean p1, p0, Landroidx/appcompat/widget/ActivityChooserView$ActivityChooserViewAdapter;->mShowFooterView:Z
invoke-virtual {p0}, Landroid/widget/BaseAdapter;->notifyDataSetChanged()V
:cond_0
return-void
.end method