359 lines
13 KiB
Smali
359 lines
13 KiB
Smali
|
.class public Landroidx/appcompat/widget/ShareActionProvider;
|
||
|
.super Landroidx/core/view/ActionProvider;
|
||
|
.source "ShareActionProvider.java"
|
||
|
|
||
|
|
||
|
# annotations
|
||
|
.annotation system Ldalvik/annotation/MemberClasses;
|
||
|
value = {
|
||
|
Landroidx/appcompat/widget/ShareActionProvider$ShareActivityChooserModelPolicy;,
|
||
|
Landroidx/appcompat/widget/ShareActionProvider$ShareMenuItemOnMenuItemClickListener;,
|
||
|
Landroidx/appcompat/widget/ShareActionProvider$OnShareTargetSelectedListener;
|
||
|
}
|
||
|
.end annotation
|
||
|
|
||
|
|
||
|
# static fields
|
||
|
.field public static final DEFAULT_INITIAL_ACTIVITY_COUNT:I = 0x4
|
||
|
|
||
|
.field public static final DEFAULT_SHARE_HISTORY_FILE_NAME:Ljava/lang/String; = "share_history.xml"
|
||
|
|
||
|
|
||
|
# instance fields
|
||
|
.field public final mContext:Landroid/content/Context;
|
||
|
|
||
|
.field public mMaxShownActivityCount:I
|
||
|
|
||
|
.field public mOnChooseActivityListener:Landroidx/appcompat/widget/ActivityChooserModel$OnChooseActivityListener;
|
||
|
|
||
|
.field public final mOnMenuItemClickListener:Landroidx/appcompat/widget/ShareActionProvider$ShareMenuItemOnMenuItemClickListener;
|
||
|
|
||
|
.field public mOnShareTargetSelectedListener:Landroidx/appcompat/widget/ShareActionProvider$OnShareTargetSelectedListener;
|
||
|
|
||
|
.field public mShareHistoryFileName:Ljava/lang/String;
|
||
|
|
||
|
|
||
|
# direct methods
|
||
|
.method public constructor <init>(Landroid/content/Context;)V
|
||
|
.locals 1
|
||
|
|
||
|
invoke-direct {p0, p1}, Landroidx/core/view/ActionProvider;-><init>(Landroid/content/Context;)V
|
||
|
|
||
|
const/4 v0, 0x4
|
||
|
|
||
|
iput v0, p0, Landroidx/appcompat/widget/ShareActionProvider;->mMaxShownActivityCount:I
|
||
|
|
||
|
new-instance v0, Landroidx/appcompat/widget/ShareActionProvider$ShareMenuItemOnMenuItemClickListener;
|
||
|
|
||
|
invoke-direct {v0, p0}, Landroidx/appcompat/widget/ShareActionProvider$ShareMenuItemOnMenuItemClickListener;-><init>(Landroidx/appcompat/widget/ShareActionProvider;)V
|
||
|
|
||
|
iput-object v0, p0, Landroidx/appcompat/widget/ShareActionProvider;->mOnMenuItemClickListener:Landroidx/appcompat/widget/ShareActionProvider$ShareMenuItemOnMenuItemClickListener;
|
||
|
|
||
|
const-string v0, "share_history.xml"
|
||
|
|
||
|
iput-object v0, p0, Landroidx/appcompat/widget/ShareActionProvider;->mShareHistoryFileName:Ljava/lang/String;
|
||
|
|
||
|
iput-object p1, p0, Landroidx/appcompat/widget/ShareActionProvider;->mContext:Landroid/content/Context;
|
||
|
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
.method private setActivityChooserPolicyIfNeeded()V
|
||
|
.locals 2
|
||
|
|
||
|
iget-object v0, p0, Landroidx/appcompat/widget/ShareActionProvider;->mOnShareTargetSelectedListener:Landroidx/appcompat/widget/ShareActionProvider$OnShareTargetSelectedListener;
|
||
|
|
||
|
if-nez v0, :cond_0
|
||
|
|
||
|
return-void
|
||
|
|
||
|
:cond_0
|
||
|
iget-object v0, p0, Landroidx/appcompat/widget/ShareActionProvider;->mOnChooseActivityListener:Landroidx/appcompat/widget/ActivityChooserModel$OnChooseActivityListener;
|
||
|
|
||
|
if-nez v0, :cond_1
|
||
|
|
||
|
new-instance v0, Landroidx/appcompat/widget/ShareActionProvider$ShareActivityChooserModelPolicy;
|
||
|
|
||
|
invoke-direct {v0, p0}, Landroidx/appcompat/widget/ShareActionProvider$ShareActivityChooserModelPolicy;-><init>(Landroidx/appcompat/widget/ShareActionProvider;)V
|
||
|
|
||
|
iput-object v0, p0, Landroidx/appcompat/widget/ShareActionProvider;->mOnChooseActivityListener:Landroidx/appcompat/widget/ActivityChooserModel$OnChooseActivityListener;
|
||
|
|
||
|
:cond_1
|
||
|
iget-object v0, p0, Landroidx/appcompat/widget/ShareActionProvider;->mContext:Landroid/content/Context;
|
||
|
|
||
|
iget-object v1, p0, Landroidx/appcompat/widget/ShareActionProvider;->mShareHistoryFileName:Ljava/lang/String;
|
||
|
|
||
|
invoke-static {v0, v1}, Landroidx/appcompat/widget/ActivityChooserModel;->get(Landroid/content/Context;Ljava/lang/String;)Landroidx/appcompat/widget/ActivityChooserModel;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
iget-object v1, p0, Landroidx/appcompat/widget/ShareActionProvider;->mOnChooseActivityListener:Landroidx/appcompat/widget/ActivityChooserModel$OnChooseActivityListener;
|
||
|
|
||
|
invoke-virtual {v0, v1}, Landroidx/appcompat/widget/ActivityChooserModel;->setOnChooseActivityListener(Landroidx/appcompat/widget/ActivityChooserModel$OnChooseActivityListener;)V
|
||
|
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
|
||
|
# virtual methods
|
||
|
.method public hasSubMenu()Z
|
||
|
.locals 1
|
||
|
|
||
|
const/4 v0, 0x1
|
||
|
|
||
|
return v0
|
||
|
.end method
|
||
|
|
||
|
.method public onCreateActionView()Landroid/view/View;
|
||
|
.locals 5
|
||
|
|
||
|
new-instance v0, Landroidx/appcompat/widget/ActivityChooserView;
|
||
|
|
||
|
iget-object v1, p0, Landroidx/appcompat/widget/ShareActionProvider;->mContext:Landroid/content/Context;
|
||
|
|
||
|
invoke-direct {v0, v1}, Landroidx/appcompat/widget/ActivityChooserView;-><init>(Landroid/content/Context;)V
|
||
|
|
||
|
invoke-virtual {v0}, Landroid/view/ViewGroup;->isInEditMode()Z
|
||
|
|
||
|
move-result v1
|
||
|
|
||
|
if-nez v1, :cond_0
|
||
|
|
||
|
iget-object v1, p0, Landroidx/appcompat/widget/ShareActionProvider;->mContext:Landroid/content/Context;
|
||
|
|
||
|
iget-object v2, p0, Landroidx/appcompat/widget/ShareActionProvider;->mShareHistoryFileName:Ljava/lang/String;
|
||
|
|
||
|
invoke-static {v1, v2}, Landroidx/appcompat/widget/ActivityChooserModel;->get(Landroid/content/Context;Ljava/lang/String;)Landroidx/appcompat/widget/ActivityChooserModel;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
invoke-virtual {v0, v1}, Landroidx/appcompat/widget/ActivityChooserView;->setActivityChooserModel(Landroidx/appcompat/widget/ActivityChooserModel;)V
|
||
|
|
||
|
:cond_0
|
||
|
new-instance v1, Landroid/util/TypedValue;
|
||
|
|
||
|
invoke-direct {v1}, Landroid/util/TypedValue;-><init>()V
|
||
|
|
||
|
iget-object v2, p0, Landroidx/appcompat/widget/ShareActionProvider;->mContext:Landroid/content/Context;
|
||
|
|
||
|
invoke-virtual {v2}, Landroid/content/Context;->getTheme()Landroid/content/res/Resources$Theme;
|
||
|
|
||
|
move-result-object v2
|
||
|
|
||
|
sget v3, Landroidx/appcompat/R$attr;->actionModeShareDrawable:I
|
||
|
|
||
|
const/4 v4, 0x1
|
||
|
|
||
|
invoke-virtual {v2, v3, v1, v4}, Landroid/content/res/Resources$Theme;->resolveAttribute(ILandroid/util/TypedValue;Z)Z
|
||
|
|
||
|
iget-object v2, p0, Landroidx/appcompat/widget/ShareActionProvider;->mContext:Landroid/content/Context;
|
||
|
|
||
|
iget v1, v1, Landroid/util/TypedValue;->resourceId:I
|
||
|
|
||
|
invoke-static {v2, v1}, Landroidx/appcompat/content/res/AppCompatResources;->getDrawable(Landroid/content/Context;I)Landroid/graphics/drawable/Drawable;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
invoke-virtual {v0, v1}, Landroidx/appcompat/widget/ActivityChooserView;->setExpandActivityOverflowButtonDrawable(Landroid/graphics/drawable/Drawable;)V
|
||
|
|
||
|
invoke-virtual {v0, p0}, Landroidx/appcompat/widget/ActivityChooserView;->setProvider(Landroidx/core/view/ActionProvider;)V
|
||
|
|
||
|
sget v1, Landroidx/appcompat/R$string;->abc_shareactionprovider_share_with_application:I
|
||
|
|
||
|
invoke-virtual {v0, v1}, Landroidx/appcompat/widget/ActivityChooserView;->setDefaultActionButtonContentDescription(I)V
|
||
|
|
||
|
sget v1, Landroidx/appcompat/R$string;->abc_shareactionprovider_share_with:I
|
||
|
|
||
|
invoke-virtual {v0, v1}, Landroidx/appcompat/widget/ActivityChooserView;->setExpandActivityOverflowButtonContentDescription(I)V
|
||
|
|
||
|
return-object v0
|
||
|
.end method
|
||
|
|
||
|
.method public onPrepareSubMenu(Landroid/view/SubMenu;)V
|
||
|
.locals 8
|
||
|
|
||
|
invoke-interface {p1}, Landroid/view/SubMenu;->clear()V
|
||
|
|
||
|
iget-object v0, p0, Landroidx/appcompat/widget/ShareActionProvider;->mContext:Landroid/content/Context;
|
||
|
|
||
|
iget-object v1, p0, Landroidx/appcompat/widget/ShareActionProvider;->mShareHistoryFileName:Ljava/lang/String;
|
||
|
|
||
|
invoke-static {v0, v1}, Landroidx/appcompat/widget/ActivityChooserModel;->get(Landroid/content/Context;Ljava/lang/String;)Landroidx/appcompat/widget/ActivityChooserModel;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
iget-object v1, p0, Landroidx/appcompat/widget/ShareActionProvider;->mContext:Landroid/content/Context;
|
||
|
|
||
|
invoke-virtual {v1}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
invoke-virtual {v0}, Landroidx/appcompat/widget/ActivityChooserModel;->getActivityCount()I
|
||
|
|
||
|
move-result v2
|
||
|
|
||
|
iget v3, p0, Landroidx/appcompat/widget/ShareActionProvider;->mMaxShownActivityCount:I
|
||
|
|
||
|
invoke-static {v2, v3}, Ljava/lang/Math;->min(II)I
|
||
|
|
||
|
move-result v3
|
||
|
|
||
|
const/4 v4, 0x0
|
||
|
|
||
|
const/4 v5, 0x0
|
||
|
|
||
|
:goto_0
|
||
|
if-ge v5, v3, :cond_0
|
||
|
|
||
|
invoke-virtual {v0, v5}, Landroidx/appcompat/widget/ActivityChooserModel;->getActivity(I)Landroid/content/pm/ResolveInfo;
|
||
|
|
||
|
move-result-object v6
|
||
|
|
||
|
invoke-virtual {v6, v1}, Landroid/content/pm/ResolveInfo;->loadLabel(Landroid/content/pm/PackageManager;)Ljava/lang/CharSequence;
|
||
|
|
||
|
move-result-object v7
|
||
|
|
||
|
invoke-interface {p1, v4, v5, v5, v7}, Landroid/view/SubMenu;->add(IIILjava/lang/CharSequence;)Landroid/view/MenuItem;
|
||
|
|
||
|
move-result-object v7
|
||
|
|
||
|
invoke-virtual {v6, v1}, Landroid/content/pm/ResolveInfo;->loadIcon(Landroid/content/pm/PackageManager;)Landroid/graphics/drawable/Drawable;
|
||
|
|
||
|
move-result-object v6
|
||
|
|
||
|
invoke-interface {v7, v6}, Landroid/view/MenuItem;->setIcon(Landroid/graphics/drawable/Drawable;)Landroid/view/MenuItem;
|
||
|
|
||
|
move-result-object v6
|
||
|
|
||
|
iget-object v7, p0, Landroidx/appcompat/widget/ShareActionProvider;->mOnMenuItemClickListener:Landroidx/appcompat/widget/ShareActionProvider$ShareMenuItemOnMenuItemClickListener;
|
||
|
|
||
|
invoke-interface {v6, v7}, Landroid/view/MenuItem;->setOnMenuItemClickListener(Landroid/view/MenuItem$OnMenuItemClickListener;)Landroid/view/MenuItem;
|
||
|
|
||
|
add-int/lit8 v5, v5, 0x1
|
||
|
|
||
|
goto :goto_0
|
||
|
|
||
|
:cond_0
|
||
|
if-ge v3, v2, :cond_1
|
||
|
|
||
|
iget-object v5, p0, Landroidx/appcompat/widget/ShareActionProvider;->mContext:Landroid/content/Context;
|
||
|
|
||
|
sget v6, Landroidx/appcompat/R$string;->abc_activity_chooser_view_see_all:I
|
||
|
|
||
|
invoke-virtual {v5, v6}, Landroid/content/Context;->getString(I)Ljava/lang/String;
|
||
|
|
||
|
move-result-object v5
|
||
|
|
||
|
invoke-interface {p1, v4, v3, v3, v5}, Landroid/view/SubMenu;->addSubMenu(IIILjava/lang/CharSequence;)Landroid/view/SubMenu;
|
||
|
|
||
|
move-result-object p1
|
||
|
|
||
|
const/4 v3, 0x0
|
||
|
|
||
|
:goto_1
|
||
|
if-ge v3, v2, :cond_1
|
||
|
|
||
|
invoke-virtual {v0, v3}, Landroidx/appcompat/widget/ActivityChooserModel;->getActivity(I)Landroid/content/pm/ResolveInfo;
|
||
|
|
||
|
move-result-object v5
|
||
|
|
||
|
invoke-virtual {v5, v1}, Landroid/content/pm/ResolveInfo;->loadLabel(Landroid/content/pm/PackageManager;)Ljava/lang/CharSequence;
|
||
|
|
||
|
move-result-object v6
|
||
|
|
||
|
invoke-interface {p1, v4, v3, v3, v6}, Landroid/view/SubMenu;->add(IIILjava/lang/CharSequence;)Landroid/view/MenuItem;
|
||
|
|
||
|
move-result-object v6
|
||
|
|
||
|
invoke-virtual {v5, v1}, Landroid/content/pm/ResolveInfo;->loadIcon(Landroid/content/pm/PackageManager;)Landroid/graphics/drawable/Drawable;
|
||
|
|
||
|
move-result-object v5
|
||
|
|
||
|
invoke-interface {v6, v5}, Landroid/view/MenuItem;->setIcon(Landroid/graphics/drawable/Drawable;)Landroid/view/MenuItem;
|
||
|
|
||
|
move-result-object v5
|
||
|
|
||
|
iget-object v6, p0, Landroidx/appcompat/widget/ShareActionProvider;->mOnMenuItemClickListener:Landroidx/appcompat/widget/ShareActionProvider$ShareMenuItemOnMenuItemClickListener;
|
||
|
|
||
|
invoke-interface {v5, v6}, Landroid/view/MenuItem;->setOnMenuItemClickListener(Landroid/view/MenuItem$OnMenuItemClickListener;)Landroid/view/MenuItem;
|
||
|
|
||
|
add-int/lit8 v3, v3, 0x1
|
||
|
|
||
|
goto :goto_1
|
||
|
|
||
|
:cond_1
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
.method public setOnShareTargetSelectedListener(Landroidx/appcompat/widget/ShareActionProvider$OnShareTargetSelectedListener;)V
|
||
|
.locals 0
|
||
|
|
||
|
iput-object p1, p0, Landroidx/appcompat/widget/ShareActionProvider;->mOnShareTargetSelectedListener:Landroidx/appcompat/widget/ShareActionProvider$OnShareTargetSelectedListener;
|
||
|
|
||
|
invoke-direct {p0}, Landroidx/appcompat/widget/ShareActionProvider;->setActivityChooserPolicyIfNeeded()V
|
||
|
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
.method public setShareHistoryFileName(Ljava/lang/String;)V
|
||
|
.locals 0
|
||
|
|
||
|
iput-object p1, p0, Landroidx/appcompat/widget/ShareActionProvider;->mShareHistoryFileName:Ljava/lang/String;
|
||
|
|
||
|
invoke-direct {p0}, Landroidx/appcompat/widget/ShareActionProvider;->setActivityChooserPolicyIfNeeded()V
|
||
|
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
.method public setShareIntent(Landroid/content/Intent;)V
|
||
|
.locals 2
|
||
|
|
||
|
if-eqz p1, :cond_1
|
||
|
|
||
|
invoke-virtual {p1}, Landroid/content/Intent;->getAction()Ljava/lang/String;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
const-string v1, "android.intent.action.SEND"
|
||
|
|
||
|
invoke-virtual {v1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
|
||
|
|
||
|
move-result v1
|
||
|
|
||
|
if-nez v1, :cond_0
|
||
|
|
||
|
const-string v1, "android.intent.action.SEND_MULTIPLE"
|
||
|
|
||
|
invoke-virtual {v1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
if-eqz v0, :cond_1
|
||
|
|
||
|
:cond_0
|
||
|
invoke-virtual {p0, p1}, Landroidx/appcompat/widget/ShareActionProvider;->updateIntent(Landroid/content/Intent;)V
|
||
|
|
||
|
:cond_1
|
||
|
iget-object v0, p0, Landroidx/appcompat/widget/ShareActionProvider;->mContext:Landroid/content/Context;
|
||
|
|
||
|
iget-object v1, p0, Landroidx/appcompat/widget/ShareActionProvider;->mShareHistoryFileName:Ljava/lang/String;
|
||
|
|
||
|
invoke-static {v0, v1}, Landroidx/appcompat/widget/ActivityChooserModel;->get(Landroid/content/Context;Ljava/lang/String;)Landroidx/appcompat/widget/ActivityChooserModel;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
invoke-virtual {v0, p1}, Landroidx/appcompat/widget/ActivityChooserModel;->setIntent(Landroid/content/Intent;)V
|
||
|
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
.method public updateIntent(Landroid/content/Intent;)V
|
||
|
.locals 1
|
||
|
|
||
|
const/high16 v0, 0x8080000
|
||
|
|
||
|
invoke-virtual {p1, v0}, Landroid/content/Intent;->addFlags(I)Landroid/content/Intent;
|
||
|
|
||
|
return-void
|
||
|
.end method
|