497 lines
14 KiB
Smali
497 lines
14 KiB
Smali
.class public final Lcom/discord/widgets/main/WidgetMainHeaderManager;
|
|
.super Ljava/lang/Object;
|
|
.source "WidgetMainHeaderManager.kt"
|
|
|
|
|
|
# annotations
|
|
.annotation system Ldalvik/annotation/MemberClasses;
|
|
value = {
|
|
Lcom/discord/widgets/main/WidgetMainHeaderManager$HeaderData;
|
|
}
|
|
.end annotation
|
|
|
|
|
|
# static fields
|
|
.field public static final INSTANCE:Lcom/discord/widgets/main/WidgetMainHeaderManager;
|
|
|
|
|
|
# direct methods
|
|
.method public static constructor <clinit>()V
|
|
.locals 1
|
|
|
|
new-instance v0, Lcom/discord/widgets/main/WidgetMainHeaderManager;
|
|
|
|
invoke-direct {v0}, Lcom/discord/widgets/main/WidgetMainHeaderManager;-><init>()V
|
|
|
|
sput-object v0, Lcom/discord/widgets/main/WidgetMainHeaderManager;->INSTANCE:Lcom/discord/widgets/main/WidgetMainHeaderManager;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public constructor <init>()V
|
|
.locals 0
|
|
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method private final getHeaderData(Lcom/discord/widgets/main/WidgetMainModel;Landroid/content/Context;)Lcom/discord/widgets/main/WidgetMainHeaderManager$HeaderData;
|
|
.locals 7
|
|
|
|
invoke-virtual {p1}, Lcom/discord/widgets/main/WidgetMainModel;->getType()I
|
|
|
|
move-result v0
|
|
|
|
const/4 v1, -0x2
|
|
|
|
const/4 v2, 0x0
|
|
|
|
if-eq v0, v1, :cond_7
|
|
|
|
const/4 v1, -0x1
|
|
|
|
if-eq v0, v1, :cond_6
|
|
|
|
const/4 v1, 0x1
|
|
|
|
const/4 v3, 0x2
|
|
|
|
const/4 v4, 0x0
|
|
|
|
if-eq v0, v1, :cond_4
|
|
|
|
const/4 v1, 0x3
|
|
|
|
if-eq v0, v1, :cond_2
|
|
|
|
invoke-virtual {p1}, Lcom/discord/widgets/main/WidgetMainModel;->getChannelId()J
|
|
|
|
move-result-wide v0
|
|
|
|
const-wide/16 v5, 0x0
|
|
|
|
cmp-long v3, v0, v5
|
|
|
|
if-lez v3, :cond_1
|
|
|
|
new-instance v0, Lcom/discord/widgets/main/WidgetMainHeaderManager$HeaderData;
|
|
|
|
invoke-virtual {p1}, Lcom/discord/widgets/main/WidgetMainModel;->getChannel()Lcom/discord/models/domain/ModelChannel;
|
|
|
|
move-result-object v1
|
|
|
|
if-eqz v1, :cond_0
|
|
|
|
invoke-static {v1, p2, v4}, Lcom/discord/utilities/channel/ChannelUtils;->getDisplayName(Lcom/discord/models/domain/ModelChannel;Landroid/content/Context;Z)Ljava/lang/String;
|
|
|
|
move-result-object v2
|
|
|
|
:cond_0
|
|
invoke-virtual {p1}, Lcom/discord/widgets/main/WidgetMainModel;->getChannel()Lcom/discord/models/domain/ModelChannel;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-direct {p0, p2, p1}, Lcom/discord/widgets/main/WidgetMainHeaderManager;->guildChannelIcon(Landroid/content/Context;Lcom/discord/models/domain/ModelChannel;)I
|
|
|
|
move-result p1
|
|
|
|
invoke-static {p1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-direct {v0, v2, p1}, Lcom/discord/widgets/main/WidgetMainHeaderManager$HeaderData;-><init>(Ljava/lang/String;Ljava/lang/Integer;)V
|
|
|
|
goto :goto_2
|
|
|
|
:cond_1
|
|
new-instance v0, Lcom/discord/widgets/main/WidgetMainHeaderManager$HeaderData;
|
|
|
|
invoke-direct {v0, v2, v2}, Lcom/discord/widgets/main/WidgetMainHeaderManager$HeaderData;-><init>(Ljava/lang/String;Ljava/lang/Integer;)V
|
|
|
|
goto :goto_2
|
|
|
|
:cond_2
|
|
new-instance v0, Lcom/discord/widgets/main/WidgetMainHeaderManager$HeaderData;
|
|
|
|
invoke-virtual {p1}, Lcom/discord/widgets/main/WidgetMainModel;->getChannel()Lcom/discord/models/domain/ModelChannel;
|
|
|
|
move-result-object p1
|
|
|
|
if-eqz p1, :cond_3
|
|
|
|
invoke-static {p1, p2, v4}, Lcom/discord/utilities/channel/ChannelUtils;->getDisplayName(Lcom/discord/models/domain/ModelChannel;Landroid/content/Context;Z)Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_3
|
|
move-object p1, v2
|
|
|
|
:goto_0
|
|
const v1, 0x7f0401c6
|
|
|
|
invoke-static {p2, v1, v4, v3, v2}, Lcom/discord/utilities/drawable/DrawableCompat;->getThemedDrawableRes$default(Landroid/content/Context;IIILjava/lang/Object;)I
|
|
|
|
move-result p2
|
|
|
|
invoke-static {p2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
|
|
|
|
move-result-object p2
|
|
|
|
invoke-direct {v0, p1, p2}, Lcom/discord/widgets/main/WidgetMainHeaderManager$HeaderData;-><init>(Ljava/lang/String;Ljava/lang/Integer;)V
|
|
|
|
goto :goto_2
|
|
|
|
:cond_4
|
|
new-instance v0, Lcom/discord/widgets/main/WidgetMainHeaderManager$HeaderData;
|
|
|
|
invoke-virtual {p1}, Lcom/discord/widgets/main/WidgetMainModel;->getChannel()Lcom/discord/models/domain/ModelChannel;
|
|
|
|
move-result-object p1
|
|
|
|
if-eqz p1, :cond_5
|
|
|
|
invoke-static {p1, p2, v4}, Lcom/discord/utilities/channel/ChannelUtils;->getDisplayName(Lcom/discord/models/domain/ModelChannel;Landroid/content/Context;Z)Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
goto :goto_1
|
|
|
|
:cond_5
|
|
move-object p1, v2
|
|
|
|
:goto_1
|
|
const v1, 0x7f0401bc
|
|
|
|
invoke-static {p2, v1, v4, v3, v2}, Lcom/discord/utilities/drawable/DrawableCompat;->getThemedDrawableRes$default(Landroid/content/Context;IIILjava/lang/Object;)I
|
|
|
|
move-result p2
|
|
|
|
invoke-static {p2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
|
|
|
|
move-result-object p2
|
|
|
|
invoke-direct {v0, p1, p2}, Lcom/discord/widgets/main/WidgetMainHeaderManager$HeaderData;-><init>(Ljava/lang/String;Ljava/lang/Integer;)V
|
|
|
|
goto :goto_2
|
|
|
|
:cond_6
|
|
new-instance v0, Lcom/discord/widgets/main/WidgetMainHeaderManager$HeaderData;
|
|
|
|
const p1, 0x7f1203b7
|
|
|
|
invoke-virtual {p2, p1}, Landroid/content/Context;->getString(I)Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-direct {v0, p1, v2}, Lcom/discord/widgets/main/WidgetMainHeaderManager$HeaderData;-><init>(Ljava/lang/String;Ljava/lang/Integer;)V
|
|
|
|
goto :goto_2
|
|
|
|
:cond_7
|
|
new-instance v0, Lcom/discord/widgets/main/WidgetMainHeaderManager$HeaderData;
|
|
|
|
const p1, 0x7f1206bf
|
|
|
|
invoke-virtual {p2, p1}, Landroid/content/Context;->getString(I)Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-direct {v0, p1, v2}, Lcom/discord/widgets/main/WidgetMainHeaderManager$HeaderData;-><init>(Ljava/lang/String;Ljava/lang/Integer;)V
|
|
|
|
:goto_2
|
|
return-object v0
|
|
.end method
|
|
|
|
.method private final getOnConfigureAction(Lcom/discord/widgets/main/WidgetMainModel;)Lrx/functions/Action1;
|
|
.locals 1
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Lcom/discord/widgets/main/WidgetMainModel;",
|
|
")",
|
|
"Lrx/functions/Action1<",
|
|
"Landroid/view/Menu;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
|
|
new-instance v0, Lcom/discord/widgets/main/WidgetMainHeaderManager$getOnConfigureAction$1;
|
|
|
|
invoke-direct {v0, p1}, Lcom/discord/widgets/main/WidgetMainHeaderManager$getOnConfigureAction$1;-><init>(Lcom/discord/widgets/main/WidgetMainModel;)V
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method private final getOnSelectedAction(Lcom/discord/widgets/main/WidgetMainModel;Lcom/discord/app/AppFragment;Lcom/discord/widgets/main/WidgetMainDrawerLayout;)Lcom/discord/widgets/main/WidgetMainHeaderManager$getOnSelectedAction$1;
|
|
.locals 1
|
|
|
|
new-instance v0, Lcom/discord/widgets/main/WidgetMainHeaderManager$getOnSelectedAction$1;
|
|
|
|
invoke-direct {v0, p1, p2, p3}, Lcom/discord/widgets/main/WidgetMainHeaderManager$getOnSelectedAction$1;-><init>(Lcom/discord/widgets/main/WidgetMainModel;Lcom/discord/app/AppFragment;Lcom/discord/widgets/main/WidgetMainDrawerLayout;)V
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method private final guildChannelIcon(Landroid/content/Context;Lcom/discord/models/domain/ModelChannel;)I
|
|
.locals 3
|
|
|
|
if-eqz p2, :cond_0
|
|
|
|
invoke-virtual {p2}, Lcom/discord/models/domain/ModelChannel;->isNsfw()Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
const p2, 0x7f0401c9
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
if-eqz p2, :cond_1
|
|
|
|
invoke-virtual {p2}, Lcom/discord/models/domain/ModelChannel;->getPermissionOverwrites()Ljava/util/Map;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {p2}, Lcom/discord/models/domain/ModelChannel;->getGuildId()Ljava/lang/Long;
|
|
|
|
move-result-object p2
|
|
|
|
invoke-interface {v0, p2}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
move-result-object p2
|
|
|
|
check-cast p2, Lcom/discord/models/domain/ModelPermissionOverwrite;
|
|
|
|
const/16 v0, 0x400
|
|
|
|
invoke-static {p2, v0}, Lcom/discord/models/domain/ModelPermissionOverwrite;->denies(Lcom/discord/models/domain/ModelPermissionOverwrite;I)Z
|
|
|
|
move-result p2
|
|
|
|
if-eqz p2, :cond_1
|
|
|
|
const p2, 0x7f0401c8
|
|
|
|
goto :goto_0
|
|
|
|
:cond_1
|
|
const p2, 0x7f0401c7
|
|
|
|
:goto_0
|
|
const/4 v0, 0x0
|
|
|
|
const/4 v1, 0x2
|
|
|
|
const/4 v2, 0x0
|
|
|
|
invoke-static {p1, p2, v0, v1, v2}, Lcom/discord/utilities/drawable/DrawableCompat;->getThemedDrawableRes$default(Landroid/content/Context;IIILjava/lang/Object;)I
|
|
|
|
move-result p1
|
|
|
|
return p1
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public final configure(Lcom/discord/widgets/main/WidgetMain;Lcom/discord/widgets/main/WidgetMainModel;)V
|
|
.locals 6
|
|
|
|
const/4 v0, 0x0
|
|
|
|
if-eqz p1, :cond_9
|
|
|
|
if-eqz p2, :cond_8
|
|
|
|
invoke-virtual {p1}, Lcom/discord/widgets/main/WidgetMain;->getDrawerLayout()Lcom/discord/widgets/main/WidgetMainDrawerLayout;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {p2}, Lcom/discord/widgets/main/WidgetMainModel;->getType()I
|
|
|
|
move-result v2
|
|
|
|
const/4 v3, 0x3
|
|
|
|
const/4 v4, 0x1
|
|
|
|
const/4 v5, 0x0
|
|
|
|
if-eq v2, v3, :cond_0
|
|
|
|
invoke-virtual {p2}, Lcom/discord/widgets/main/WidgetMainModel;->getType()I
|
|
|
|
move-result v2
|
|
|
|
if-eqz v2, :cond_0
|
|
|
|
const/4 v2, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
const/4 v2, 0x0
|
|
|
|
:goto_0
|
|
invoke-virtual {v1, v2}, Lcom/discord/widgets/main/WidgetMainDrawerLayout;->lockRightDrawer(Z)V
|
|
|
|
invoke-virtual {p1}, Landroidx/fragment/app/Fragment;->getContext()Landroid/content/Context;
|
|
|
|
move-result-object v1
|
|
|
|
if-eqz v1, :cond_1
|
|
|
|
sget-object v2, Lcom/discord/widgets/main/WidgetMainHeaderManager;->INSTANCE:Lcom/discord/widgets/main/WidgetMainHeaderManager;
|
|
|
|
const-string v3, "it"
|
|
|
|
invoke-static {v1, v3}, Lt/u/b/j;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
invoke-direct {v2, p2, v1}, Lcom/discord/widgets/main/WidgetMainHeaderManager;->getHeaderData(Lcom/discord/widgets/main/WidgetMainModel;Landroid/content/Context;)Lcom/discord/widgets/main/WidgetMainHeaderManager$HeaderData;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v1}, Lcom/discord/widgets/main/WidgetMainHeaderManager$HeaderData;->component1()Ljava/lang/String;
|
|
|
|
move-result-object v2
|
|
|
|
invoke-virtual {v1}, Lcom/discord/widgets/main/WidgetMainHeaderManager$HeaderData;->component2()Ljava/lang/Integer;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {p1, v2, v1}, Lcom/discord/app/AppFragment;->setActionBarTitle(Ljava/lang/CharSequence;Ljava/lang/Integer;)Lkotlin/Unit;
|
|
|
|
:cond_1
|
|
new-instance v1, Lcom/discord/widgets/main/WidgetMainHeaderManager$configure$$inlined$apply$lambda$1;
|
|
|
|
invoke-direct {v1, p2, p1, p2}, Lcom/discord/widgets/main/WidgetMainHeaderManager$configure$$inlined$apply$lambda$1;-><init>(Lcom/discord/widgets/main/WidgetMainModel;Lcom/discord/widgets/main/WidgetMain;Lcom/discord/widgets/main/WidgetMainModel;)V
|
|
|
|
invoke-virtual {p1, v1}, Lcom/discord/app/AppFragment;->setActionBarTitleClick(Landroid/view/View$OnClickListener;)Lkotlin/Unit;
|
|
|
|
const v1, 0x7f0e0005
|
|
|
|
sget-object v2, Lcom/discord/widgets/main/WidgetMainHeaderManager;->INSTANCE:Lcom/discord/widgets/main/WidgetMainHeaderManager;
|
|
|
|
invoke-virtual {p1}, Lcom/discord/widgets/main/WidgetMain;->getDrawerLayout()Lcom/discord/widgets/main/WidgetMainDrawerLayout;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-direct {v2, p2, p1, v3}, Lcom/discord/widgets/main/WidgetMainHeaderManager;->getOnSelectedAction(Lcom/discord/widgets/main/WidgetMainModel;Lcom/discord/app/AppFragment;Lcom/discord/widgets/main/WidgetMainDrawerLayout;)Lcom/discord/widgets/main/WidgetMainHeaderManager$getOnSelectedAction$1;
|
|
|
|
move-result-object v2
|
|
|
|
sget-object v3, Lcom/discord/widgets/main/WidgetMainHeaderManager;->INSTANCE:Lcom/discord/widgets/main/WidgetMainHeaderManager;
|
|
|
|
invoke-direct {v3, p2}, Lcom/discord/widgets/main/WidgetMainHeaderManager;->getOnConfigureAction(Lcom/discord/widgets/main/WidgetMainModel;)Lrx/functions/Action1;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-virtual {p1, v1, v2, v3}, Lcom/discord/app/AppFragment;->setActionBarOptionsMenu(ILrx/functions/Action2;Lrx/functions/Action1;)Landroidx/appcompat/widget/Toolbar;
|
|
|
|
invoke-virtual {p2}, Lcom/discord/widgets/main/WidgetMainModel;->getChannel()Lcom/discord/models/domain/ModelChannel;
|
|
|
|
move-result-object v1
|
|
|
|
if-eqz v1, :cond_2
|
|
|
|
invoke-virtual {v1}, Lcom/discord/models/domain/ModelChannel;->isDM()Z
|
|
|
|
move-result v2
|
|
|
|
if-eqz v2, :cond_2
|
|
|
|
invoke-virtual {v1}, Lcom/discord/models/domain/ModelChannel;->isSystemDM()Z
|
|
|
|
move-result v1
|
|
|
|
if-nez v1, :cond_2
|
|
|
|
const/4 v1, 0x1
|
|
|
|
goto :goto_1
|
|
|
|
:cond_2
|
|
const/4 v1, 0x0
|
|
|
|
:goto_1
|
|
invoke-virtual {p1}, Lcom/discord/app/AppFragment;->getActionBarTitleLayout()Lcom/discord/views/ToolbarTitleLayout;
|
|
|
|
move-result-object v2
|
|
|
|
if-eqz v2, :cond_3
|
|
|
|
invoke-virtual {p2}, Lcom/discord/widgets/main/WidgetMainModel;->getDmPresence()Lcom/discord/models/domain/ModelPresence;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-virtual {v2, v3, v1}, Lcom/discord/views/ToolbarTitleLayout;->a(Lcom/discord/models/domain/ModelPresence;Z)V
|
|
|
|
:cond_3
|
|
invoke-virtual {p1}, Lcom/discord/widgets/main/WidgetMain;->getUnreadCountView()Landroid/widget/TextView;
|
|
|
|
move-result-object p1
|
|
|
|
if-eqz p1, :cond_7
|
|
|
|
invoke-virtual {p2}, Lcom/discord/widgets/main/WidgetMainModel;->getUnreadCount()I
|
|
|
|
move-result p2
|
|
|
|
invoke-static {p2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
|
|
|
|
move-result-object p2
|
|
|
|
invoke-virtual {p2}, Ljava/lang/Number;->intValue()I
|
|
|
|
move-result v1
|
|
|
|
if-lez v1, :cond_4
|
|
|
|
goto :goto_2
|
|
|
|
:cond_4
|
|
const/4 v4, 0x0
|
|
|
|
:goto_2
|
|
if-eqz v4, :cond_5
|
|
|
|
goto :goto_3
|
|
|
|
:cond_5
|
|
move-object p2, v0
|
|
|
|
:goto_3
|
|
if-eqz p2, :cond_6
|
|
|
|
invoke-virtual {p2}, Ljava/lang/Integer;->intValue()I
|
|
|
|
move-result p2
|
|
|
|
invoke-static {p2}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
:cond_6
|
|
invoke-static {p1, v0}, Lcom/discord/utilities/view/extensions/ViewExtensions;->setTextAndVisibilityBy(Landroid/widget/TextView;Ljava/lang/CharSequence;)V
|
|
|
|
:cond_7
|
|
return-void
|
|
|
|
:cond_8
|
|
const-string p1, "model"
|
|
|
|
invoke-static {p1}, Lt/u/b/j;->a(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
|
|
:cond_9
|
|
const-string p1, "main"
|
|
|
|
invoke-static {p1}, Lt/u/b/j;->a(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
.end method
|