apkfuckery/com.discord/smali/androidx/media/app/NotificationCompat$MediaStyle.smali
2020-04-08 18:24:01 +02:00

573 lines
17 KiB
Smali

.class public Landroidx/media/app/NotificationCompat$MediaStyle;
.super Landroidx/core/app/NotificationCompat$Style;
.source "NotificationCompat.java"
# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
value = Landroidx/media/app/NotificationCompat;
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x9
name = "MediaStyle"
.end annotation
# static fields
.field public static final MAX_MEDIA_BUTTONS:I = 0x5
.field public static final MAX_MEDIA_BUTTONS_IN_COMPACT:I = 0x3
# instance fields
.field public mActionsToShowInCompact:[I
.field public mCancelButtonIntent:Landroid/app/PendingIntent;
.field public mShowCancelButton:Z
.field public mToken:Landroid/support/v4/media/session/MediaSessionCompat$Token;
# direct methods
.method public constructor <init>()V
.locals 1
invoke-direct {p0}, Landroidx/core/app/NotificationCompat$Style;-><init>()V
const/4 v0, 0x0
iput-object v0, p0, Landroidx/media/app/NotificationCompat$MediaStyle;->mActionsToShowInCompact:[I
return-void
.end method
.method public constructor <init>(Landroidx/core/app/NotificationCompat$Builder;)V
.locals 1
invoke-direct {p0}, Landroidx/core/app/NotificationCompat$Style;-><init>()V
const/4 v0, 0x0
iput-object v0, p0, Landroidx/media/app/NotificationCompat$MediaStyle;->mActionsToShowInCompact:[I
invoke-virtual {p0, p1}, Landroidx/core/app/NotificationCompat$Style;->setBuilder(Landroidx/core/app/NotificationCompat$Builder;)V
return-void
.end method
.method private generateMediaActionButton(Landroidx/core/app/NotificationCompat$Action;)Landroid/widget/RemoteViews;
.locals 4
invoke-virtual {p1}, Landroidx/core/app/NotificationCompat$Action;->getActionIntent()Landroid/app/PendingIntent;
move-result-object v0
if-nez v0, :cond_0
const/4 v0, 0x1
goto :goto_0
:cond_0
const/4 v0, 0x0
:goto_0
new-instance v1, Landroid/widget/RemoteViews;
iget-object v2, p0, Landroidx/core/app/NotificationCompat$Style;->mBuilder:Landroidx/core/app/NotificationCompat$Builder;
iget-object v2, v2, Landroidx/core/app/NotificationCompat$Builder;->mContext:Landroid/content/Context;
invoke-virtual {v2}, Landroid/content/Context;->getPackageName()Ljava/lang/String;
move-result-object v2
sget v3, Landroidx/media/R$layout;->notification_media_action:I
invoke-direct {v1, v2, v3}, Landroid/widget/RemoteViews;-><init>(Ljava/lang/String;I)V
sget v2, Landroidx/media/R$id;->action0:I
invoke-virtual {p1}, Landroidx/core/app/NotificationCompat$Action;->getIcon()I
move-result v3
invoke-virtual {v1, v2, v3}, Landroid/widget/RemoteViews;->setImageViewResource(II)V
if-nez v0, :cond_1
sget v0, Landroidx/media/R$id;->action0:I
invoke-virtual {p1}, Landroidx/core/app/NotificationCompat$Action;->getActionIntent()Landroid/app/PendingIntent;
move-result-object v2
invoke-virtual {v1, v0, v2}, Landroid/widget/RemoteViews;->setOnClickPendingIntent(ILandroid/app/PendingIntent;)V
:cond_1
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
sget v0, Landroidx/media/R$id;->action0:I
invoke-virtual {p1}, Landroidx/core/app/NotificationCompat$Action;->getTitle()Ljava/lang/CharSequence;
move-result-object p1
invoke-virtual {v1, v0, p1}, Landroid/widget/RemoteViews;->setContentDescription(ILjava/lang/CharSequence;)V
return-object v1
.end method
.method public static getMediaSession(Landroid/app/Notification;)Landroid/support/v4/media/session/MediaSessionCompat$Token;
.locals 2
invoke-static {p0}, Landroidx/core/app/NotificationCompat;->getExtras(Landroid/app/Notification;)Landroid/os/Bundle;
move-result-object p0
const/4 v0, 0x0
if-eqz p0, :cond_0
sget v1, Landroid/os/Build$VERSION;->SDK_INT:I
const-string v1, "android.mediaSession"
invoke-virtual {p0, v1}, Landroid/os/Bundle;->getParcelable(Ljava/lang/String;)Landroid/os/Parcelable;
move-result-object p0
if-eqz p0, :cond_0
invoke-static {p0, v0}, Landroid/support/v4/media/session/MediaSessionCompat$Token;->a(Ljava/lang/Object;Lr/a/b/b/b/b;)Landroid/support/v4/media/session/MediaSessionCompat$Token;
move-result-object p0
return-object p0
:cond_0
return-object v0
.end method
# virtual methods
.method public apply(Landroidx/core/app/NotificationBuilderWithBuilderAccessor;)V
.locals 1
.annotation build Landroidx/annotation/RestrictTo;
value = {
.enum Landroidx/annotation/RestrictTo$Scope;->LIBRARY_GROUP:Landroidx/annotation/RestrictTo$Scope;
}
.end annotation
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
invoke-interface {p1}, Landroidx/core/app/NotificationBuilderWithBuilderAccessor;->getBuilder()Landroid/app/Notification$Builder;
move-result-object p1
new-instance v0, Landroid/app/Notification$MediaStyle;
invoke-direct {v0}, Landroid/app/Notification$MediaStyle;-><init>()V
invoke-virtual {p0, v0}, Landroidx/media/app/NotificationCompat$MediaStyle;->fillInMediaStyle(Landroid/app/Notification$MediaStyle;)Landroid/app/Notification$MediaStyle;
move-result-object v0
invoke-virtual {p1, v0}, Landroid/app/Notification$Builder;->setStyle(Landroid/app/Notification$Style;)Landroid/app/Notification$Builder;
return-void
.end method
.method public fillInMediaStyle(Landroid/app/Notification$MediaStyle;)Landroid/app/Notification$MediaStyle;
.locals 1
.annotation build Landroidx/annotation/RequiresApi;
value = 0x15
.end annotation
iget-object v0, p0, Landroidx/media/app/NotificationCompat$MediaStyle;->mActionsToShowInCompact:[I
if-eqz v0, :cond_0
invoke-virtual {p1, v0}, Landroid/app/Notification$MediaStyle;->setShowActionsInCompactView([I)Landroid/app/Notification$MediaStyle;
:cond_0
iget-object v0, p0, Landroidx/media/app/NotificationCompat$MediaStyle;->mToken:Landroid/support/v4/media/session/MediaSessionCompat$Token;
if-eqz v0, :cond_1
invoke-virtual {v0}, Landroid/support/v4/media/session/MediaSessionCompat$Token;->q()Ljava/lang/Object;
move-result-object v0
check-cast v0, Landroid/media/session/MediaSession$Token;
invoke-virtual {p1, v0}, Landroid/app/Notification$MediaStyle;->setMediaSession(Landroid/media/session/MediaSession$Token;)Landroid/app/Notification$MediaStyle;
:cond_1
return-object p1
.end method
.method public generateBigContentView()Landroid/widget/RemoteViews;
.locals 6
iget-object v0, p0, Landroidx/core/app/NotificationCompat$Style;->mBuilder:Landroidx/core/app/NotificationCompat$Builder;
iget-object v0, v0, Landroidx/core/app/NotificationCompat$Builder;->mActions:Ljava/util/ArrayList;
invoke-virtual {v0}, Ljava/util/ArrayList;->size()I
move-result v0
const/4 v1, 0x5
invoke-static {v0, v1}, Ljava/lang/Math;->min(II)I
move-result v0
invoke-virtual {p0, v0}, Landroidx/media/app/NotificationCompat$MediaStyle;->getBigContentViewLayoutResource(I)I
move-result v1
const/4 v2, 0x0
invoke-virtual {p0, v2, v1, v2}, Landroidx/core/app/NotificationCompat$Style;->applyStandardTemplate(ZIZ)Landroid/widget/RemoteViews;
move-result-object v1
sget v3, Landroidx/media/R$id;->media_actions:I
invoke-virtual {v1, v3}, Landroid/widget/RemoteViews;->removeAllViews(I)V
if-lez v0, :cond_0
const/4 v3, 0x0
:goto_0
if-ge v3, v0, :cond_0
iget-object v4, p0, Landroidx/core/app/NotificationCompat$Style;->mBuilder:Landroidx/core/app/NotificationCompat$Builder;
iget-object v4, v4, Landroidx/core/app/NotificationCompat$Builder;->mActions:Ljava/util/ArrayList;
invoke-virtual {v4, v3}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;
move-result-object v4
check-cast v4, Landroidx/core/app/NotificationCompat$Action;
invoke-direct {p0, v4}, Landroidx/media/app/NotificationCompat$MediaStyle;->generateMediaActionButton(Landroidx/core/app/NotificationCompat$Action;)Landroid/widget/RemoteViews;
move-result-object v4
sget v5, Landroidx/media/R$id;->media_actions:I
invoke-virtual {v1, v5, v4}, Landroid/widget/RemoteViews;->addView(ILandroid/widget/RemoteViews;)V
add-int/lit8 v3, v3, 0x1
goto :goto_0
:cond_0
iget-boolean v0, p0, Landroidx/media/app/NotificationCompat$MediaStyle;->mShowCancelButton:Z
if-eqz v0, :cond_1
sget v0, Landroidx/media/R$id;->cancel_action:I
invoke-virtual {v1, v0, v2}, Landroid/widget/RemoteViews;->setViewVisibility(II)V
sget v0, Landroidx/media/R$id;->cancel_action:I
iget-object v2, p0, Landroidx/core/app/NotificationCompat$Style;->mBuilder:Landroidx/core/app/NotificationCompat$Builder;
iget-object v2, v2, Landroidx/core/app/NotificationCompat$Builder;->mContext:Landroid/content/Context;
invoke-virtual {v2}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;
move-result-object v2
sget v3, Landroidx/media/R$integer;->cancel_button_image_alpha:I
invoke-virtual {v2, v3}, Landroid/content/res/Resources;->getInteger(I)I
move-result v2
const-string v3, "setAlpha"
invoke-virtual {v1, v0, v3, v2}, Landroid/widget/RemoteViews;->setInt(ILjava/lang/String;I)V
sget v0, Landroidx/media/R$id;->cancel_action:I
iget-object v2, p0, Landroidx/media/app/NotificationCompat$MediaStyle;->mCancelButtonIntent:Landroid/app/PendingIntent;
invoke-virtual {v1, v0, v2}, Landroid/widget/RemoteViews;->setOnClickPendingIntent(ILandroid/app/PendingIntent;)V
goto :goto_1
:cond_1
sget v0, Landroidx/media/R$id;->cancel_action:I
const/16 v2, 0x8
invoke-virtual {v1, v0, v2}, Landroid/widget/RemoteViews;->setViewVisibility(II)V
:goto_1
return-object v1
.end method
.method public generateContentView()Landroid/widget/RemoteViews;
.locals 8
invoke-virtual {p0}, Landroidx/media/app/NotificationCompat$MediaStyle;->getContentViewLayoutResource()I
move-result v0
const/4 v1, 0x1
const/4 v2, 0x0
invoke-virtual {p0, v2, v0, v1}, Landroidx/core/app/NotificationCompat$Style;->applyStandardTemplate(ZIZ)Landroid/widget/RemoteViews;
move-result-object v0
iget-object v3, p0, Landroidx/core/app/NotificationCompat$Style;->mBuilder:Landroidx/core/app/NotificationCompat$Builder;
iget-object v3, v3, Landroidx/core/app/NotificationCompat$Builder;->mActions:Ljava/util/ArrayList;
invoke-virtual {v3}, Ljava/util/ArrayList;->size()I
move-result v3
iget-object v4, p0, Landroidx/media/app/NotificationCompat$MediaStyle;->mActionsToShowInCompact:[I
if-nez v4, :cond_0
const/4 v4, 0x0
goto :goto_0
:cond_0
array-length v4, v4
const/4 v5, 0x3
invoke-static {v4, v5}, Ljava/lang/Math;->min(II)I
move-result v4
:goto_0
sget v5, Landroidx/media/R$id;->media_actions:I
invoke-virtual {v0, v5}, Landroid/widget/RemoteViews;->removeAllViews(I)V
if-lez v4, :cond_2
const/4 v5, 0x0
:goto_1
if-ge v5, v4, :cond_2
if-ge v5, v3, :cond_1
iget-object v6, p0, Landroidx/core/app/NotificationCompat$Style;->mBuilder:Landroidx/core/app/NotificationCompat$Builder;
iget-object v6, v6, Landroidx/core/app/NotificationCompat$Builder;->mActions:Ljava/util/ArrayList;
iget-object v7, p0, Landroidx/media/app/NotificationCompat$MediaStyle;->mActionsToShowInCompact:[I
aget v7, v7, v5
invoke-virtual {v6, v7}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;
move-result-object v6
check-cast v6, Landroidx/core/app/NotificationCompat$Action;
invoke-direct {p0, v6}, Landroidx/media/app/NotificationCompat$MediaStyle;->generateMediaActionButton(Landroidx/core/app/NotificationCompat$Action;)Landroid/widget/RemoteViews;
move-result-object v6
sget v7, Landroidx/media/R$id;->media_actions:I
invoke-virtual {v0, v7, v6}, Landroid/widget/RemoteViews;->addView(ILandroid/widget/RemoteViews;)V
add-int/lit8 v5, v5, 0x1
goto :goto_1
:cond_1
new-instance v0, Ljava/lang/IllegalArgumentException;
const/4 v4, 0x2
new-array v4, v4, [Ljava/lang/Object;
invoke-static {v5}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v5
aput-object v5, v4, v2
sub-int/2addr v3, v1
invoke-static {v3}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v2
aput-object v2, v4, v1
const-string v1, "setShowActionsInCompactView: action %d out of bounds (max %d)"
invoke-static {v1, v4}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
move-result-object v1
invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw v0
:cond_2
iget-boolean v1, p0, Landroidx/media/app/NotificationCompat$MediaStyle;->mShowCancelButton:Z
const/16 v3, 0x8
if-eqz v1, :cond_3
sget v1, Landroidx/media/R$id;->end_padder:I
invoke-virtual {v0, v1, v3}, Landroid/widget/RemoteViews;->setViewVisibility(II)V
sget v1, Landroidx/media/R$id;->cancel_action:I
invoke-virtual {v0, v1, v2}, Landroid/widget/RemoteViews;->setViewVisibility(II)V
sget v1, Landroidx/media/R$id;->cancel_action:I
iget-object v2, p0, Landroidx/media/app/NotificationCompat$MediaStyle;->mCancelButtonIntent:Landroid/app/PendingIntent;
invoke-virtual {v0, v1, v2}, Landroid/widget/RemoteViews;->setOnClickPendingIntent(ILandroid/app/PendingIntent;)V
sget v1, Landroidx/media/R$id;->cancel_action:I
iget-object v2, p0, Landroidx/core/app/NotificationCompat$Style;->mBuilder:Landroidx/core/app/NotificationCompat$Builder;
iget-object v2, v2, Landroidx/core/app/NotificationCompat$Builder;->mContext:Landroid/content/Context;
invoke-virtual {v2}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;
move-result-object v2
sget v3, Landroidx/media/R$integer;->cancel_button_image_alpha:I
invoke-virtual {v2, v3}, Landroid/content/res/Resources;->getInteger(I)I
move-result v2
const-string v3, "setAlpha"
invoke-virtual {v0, v1, v3, v2}, Landroid/widget/RemoteViews;->setInt(ILjava/lang/String;I)V
goto :goto_2
:cond_3
sget v1, Landroidx/media/R$id;->end_padder:I
invoke-virtual {v0, v1, v2}, Landroid/widget/RemoteViews;->setViewVisibility(II)V
sget v1, Landroidx/media/R$id;->cancel_action:I
invoke-virtual {v0, v1, v3}, Landroid/widget/RemoteViews;->setViewVisibility(II)V
:goto_2
return-object v0
.end method
.method public getBigContentViewLayoutResource(I)I
.locals 1
const/4 v0, 0x3
if-gt p1, v0, :cond_0
sget p1, Landroidx/media/R$layout;->notification_template_big_media_narrow:I
goto :goto_0
:cond_0
sget p1, Landroidx/media/R$layout;->notification_template_big_media:I
:goto_0
return p1
.end method
.method public getContentViewLayoutResource()I
.locals 1
sget v0, Landroidx/media/R$layout;->notification_template_media:I
return v0
.end method
.method public makeBigContentView(Landroidx/core/app/NotificationBuilderWithBuilderAccessor;)Landroid/widget/RemoteViews;
.locals 0
.annotation build Landroidx/annotation/RestrictTo;
value = {
.enum Landroidx/annotation/RestrictTo$Scope;->LIBRARY_GROUP:Landroidx/annotation/RestrictTo$Scope;
}
.end annotation
sget p1, Landroid/os/Build$VERSION;->SDK_INT:I
const/4 p1, 0x0
return-object p1
.end method
.method public makeContentView(Landroidx/core/app/NotificationBuilderWithBuilderAccessor;)Landroid/widget/RemoteViews;
.locals 0
.annotation build Landroidx/annotation/RestrictTo;
value = {
.enum Landroidx/annotation/RestrictTo$Scope;->LIBRARY_GROUP:Landroidx/annotation/RestrictTo$Scope;
}
.end annotation
sget p1, Landroid/os/Build$VERSION;->SDK_INT:I
const/4 p1, 0x0
return-object p1
.end method
.method public setCancelButtonIntent(Landroid/app/PendingIntent;)Landroidx/media/app/NotificationCompat$MediaStyle;
.locals 0
iput-object p1, p0, Landroidx/media/app/NotificationCompat$MediaStyle;->mCancelButtonIntent:Landroid/app/PendingIntent;
return-object p0
.end method
.method public setMediaSession(Landroid/support/v4/media/session/MediaSessionCompat$Token;)Landroidx/media/app/NotificationCompat$MediaStyle;
.locals 0
iput-object p1, p0, Landroidx/media/app/NotificationCompat$MediaStyle;->mToken:Landroid/support/v4/media/session/MediaSessionCompat$Token;
return-object p0
.end method
.method public varargs setShowActionsInCompactView([I)Landroidx/media/app/NotificationCompat$MediaStyle;
.locals 0
iput-object p1, p0, Landroidx/media/app/NotificationCompat$MediaStyle;->mActionsToShowInCompact:[I
return-object p0
.end method
.method public setShowCancelButton(Z)Landroidx/media/app/NotificationCompat$MediaStyle;
.locals 0
sget p1, Landroid/os/Build$VERSION;->SDK_INT:I
return-object p0
.end method