320 lines
9.6 KiB
Smali
320 lines
9.6 KiB
Smali
|
.class public Lcom/discord/widgets/settings/WidgetSettingsLanguage;
|
||
|
.super Lcom/discord/utilities/app/AppFragment;
|
||
|
.source "WidgetSettingsLanguage.java"
|
||
|
|
||
|
|
||
|
# static fields
|
||
|
.field private static final TRANSLATION_SITE:Ljava/lang/String; = "https://i18n.discordapp.com"
|
||
|
|
||
|
|
||
|
# instance fields
|
||
|
.field language:Landroid/view/View;
|
||
|
.annotation build Lbutterknife/Bind;
|
||
|
value = {
|
||
|
0x7f0e01d3
|
||
|
}
|
||
|
.end annotation
|
||
|
.end field
|
||
|
|
||
|
.field languageFlag:Landroid/widget/ImageView;
|
||
|
.annotation build Lbutterknife/Bind;
|
||
|
value = {
|
||
|
0x7f0e01d4
|
||
|
}
|
||
|
.end annotation
|
||
|
.end field
|
||
|
|
||
|
.field languageText:Landroid/widget/TextView;
|
||
|
.annotation build Lbutterknife/Bind;
|
||
|
value = {
|
||
|
0x7f0e01d5
|
||
|
}
|
||
|
.end annotation
|
||
|
.end field
|
||
|
|
||
|
.field sync:Landroid/view/View;
|
||
|
.annotation build Lbutterknife/Bind;
|
||
|
value = {
|
||
|
0x7f0e01d7
|
||
|
}
|
||
|
.end annotation
|
||
|
.end field
|
||
|
|
||
|
.field syncToggle:Landroid/view/View;
|
||
|
.annotation build Lbutterknife/Bind;
|
||
|
value = {
|
||
|
0x7f0e01d8
|
||
|
}
|
||
|
.end annotation
|
||
|
.end field
|
||
|
|
||
|
.field translationHelp:Lcom/discord/utilities/app/AppTextView;
|
||
|
.annotation build Lbutterknife/Bind;
|
||
|
value = {
|
||
|
0x7f0e01d6
|
||
|
}
|
||
|
.end annotation
|
||
|
.end field
|
||
|
|
||
|
|
||
|
# direct methods
|
||
|
.method public constructor <init>()V
|
||
|
.locals 0
|
||
|
|
||
|
.prologue
|
||
|
invoke-direct {p0}, Lcom/discord/utilities/app/AppFragment;-><init>()V
|
||
|
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
.method static synthetic access$lambda$0(Lcom/discord/widgets/settings/WidgetSettingsLanguage;Lcom/discord/models/application/ModelAppSettingsLocale;)V
|
||
|
.locals 0
|
||
|
|
||
|
invoke-direct {p0, p1}, Lcom/discord/widgets/settings/WidgetSettingsLanguage;->configureUI(Lcom/discord/models/application/ModelAppSettingsLocale;)V
|
||
|
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
.method static synthetic access$lambda$1(Lcom/discord/models/application/ModelAppSettingsLocale;Landroid/view/View;)V
|
||
|
.locals 0
|
||
|
|
||
|
invoke-static {p0, p1}, Lcom/discord/widgets/settings/WidgetSettingsLanguage;->lambda$configureUI$755(Lcom/discord/models/application/ModelAppSettingsLocale;Landroid/view/View;)V
|
||
|
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
.method static synthetic access$lambda$2(Lcom/discord/widgets/settings/WidgetSettingsLanguage;Landroid/view/View;)V
|
||
|
.locals 0
|
||
|
|
||
|
invoke-direct {p0, p1}, Lcom/discord/widgets/settings/WidgetSettingsLanguage;->lambda$configureUI$756(Landroid/view/View;)V
|
||
|
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
.method private configureUI(Lcom/discord/models/application/ModelAppSettingsLocale;)V
|
||
|
.locals 2
|
||
|
.param p1, "locale" # Lcom/discord/models/application/ModelAppSettingsLocale;
|
||
|
|
||
|
.prologue
|
||
|
iget-object v0, p0, Lcom/discord/widgets/settings/WidgetSettingsLanguage;->syncToggle:Landroid/view/View;
|
||
|
|
||
|
if-eqz v0, :cond_0
|
||
|
|
||
|
iget-object v0, p0, Lcom/discord/widgets/settings/WidgetSettingsLanguage;->syncToggle:Landroid/view/View;
|
||
|
|
||
|
invoke-virtual {p1}, Lcom/discord/models/application/ModelAppSettingsLocale;->isSync()Z
|
||
|
|
||
|
move-result v1
|
||
|
|
||
|
invoke-virtual {v0, v1}, Landroid/view/View;->setEnabled(Z)V
|
||
|
|
||
|
:cond_0
|
||
|
iget-object v0, p0, Lcom/discord/widgets/settings/WidgetSettingsLanguage;->sync:Landroid/view/View;
|
||
|
|
||
|
if-eqz v0, :cond_1
|
||
|
|
||
|
iget-object v0, p0, Lcom/discord/widgets/settings/WidgetSettingsLanguage;->sync:Landroid/view/View;
|
||
|
|
||
|
invoke-static {p1}, Lcom/discord/widgets/settings/WidgetSettingsLanguage$$Lambda$2;->lambdaFactory$(Lcom/discord/models/application/ModelAppSettingsLocale;)Landroid/view/View$OnClickListener;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
invoke-virtual {v0, v1}, Landroid/view/View;->setOnClickListener(Landroid/view/View$OnClickListener;)V
|
||
|
|
||
|
:cond_1
|
||
|
iget-object v0, p0, Lcom/discord/widgets/settings/WidgetSettingsLanguage;->language:Landroid/view/View;
|
||
|
|
||
|
if-eqz v0, :cond_2
|
||
|
|
||
|
iget-object v0, p0, Lcom/discord/widgets/settings/WidgetSettingsLanguage;->language:Landroid/view/View;
|
||
|
|
||
|
invoke-static {p0}, Lcom/discord/widgets/settings/WidgetSettingsLanguage$$Lambda$3;->lambdaFactory$(Lcom/discord/widgets/settings/WidgetSettingsLanguage;)Landroid/view/View$OnClickListener;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
invoke-virtual {v0, v1}, Landroid/view/View;->setOnClickListener(Landroid/view/View$OnClickListener;)V
|
||
|
|
||
|
:cond_2
|
||
|
iget-object v0, p0, Lcom/discord/widgets/settings/WidgetSettingsLanguage;->languageText:Landroid/widget/TextView;
|
||
|
|
||
|
if-eqz v0, :cond_3
|
||
|
|
||
|
iget-object v0, p0, Lcom/discord/widgets/settings/WidgetSettingsLanguage;->languageText:Landroid/widget/TextView;
|
||
|
|
||
|
invoke-virtual {p0}, Lcom/discord/widgets/settings/WidgetSettingsLanguage;->getResources()Landroid/content/res/Resources;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
invoke-virtual {p1, v1}, Lcom/discord/models/application/ModelAppSettingsLocale;->getAsString(Landroid/content/res/Resources;)Ljava/lang/String;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
invoke-virtual {v0, v1}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V
|
||
|
|
||
|
:cond_3
|
||
|
iget-object v0, p0, Lcom/discord/widgets/settings/WidgetSettingsLanguage;->languageFlag:Landroid/widget/ImageView;
|
||
|
|
||
|
if-eqz v0, :cond_4
|
||
|
|
||
|
iget-object v0, p0, Lcom/discord/widgets/settings/WidgetSettingsLanguage;->languageFlag:Landroid/widget/ImageView;
|
||
|
|
||
|
invoke-virtual {p1}, Lcom/discord/models/application/ModelAppSettingsLocale;->getLocaleFlagResId()I
|
||
|
|
||
|
move-result v1
|
||
|
|
||
|
invoke-virtual {v0, v1}, Landroid/widget/ImageView;->setImageResource(I)V
|
||
|
|
||
|
:cond_4
|
||
|
iget-object v0, p0, Lcom/discord/widgets/settings/WidgetSettingsLanguage;->translationHelp:Lcom/discord/utilities/app/AppTextView;
|
||
|
|
||
|
if-eqz v0, :cond_5
|
||
|
|
||
|
iget-object v0, p0, Lcom/discord/widgets/settings/WidgetSettingsLanguage;->translationHelp:Lcom/discord/utilities/app/AppTextView;
|
||
|
|
||
|
invoke-direct {p0}, Lcom/discord/widgets/settings/WidgetSettingsLanguage;->getTranslationHelp()Ljava/lang/String;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
invoke-virtual {v0, v1}, Lcom/discord/utilities/app/AppTextView;->setText(Ljava/lang/CharSequence;)V
|
||
|
|
||
|
:cond_5
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
.method private getTranslationHelp()Ljava/lang/String;
|
||
|
.locals 4
|
||
|
|
||
|
.prologue
|
||
|
iget-object v0, p0, Lcom/discord/widgets/settings/WidgetSettingsLanguage;->translationHelp:Lcom/discord/utilities/app/AppTextView;
|
||
|
|
||
|
invoke-virtual {v0}, Lcom/discord/utilities/app/AppTextView;->getAttrText()Ljava/lang/String;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
const/4 v1, 0x1
|
||
|
|
||
|
new-array v1, v1, [Ljava/lang/Object;
|
||
|
|
||
|
const/4 v2, 0x0
|
||
|
|
||
|
const-string v3, "https://i18n.discordapp.com"
|
||
|
|
||
|
aput-object v3, v1, v2
|
||
|
|
||
|
invoke-static {v0, v1}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
const-string v1, "["
|
||
|
|
||
|
const-string v2, ""
|
||
|
|
||
|
invoke-virtual {v0, v1, v2}, Ljava/lang/String;->replace(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Ljava/lang/String;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
const-string v1, "]"
|
||
|
|
||
|
const-string v2, ". "
|
||
|
|
||
|
invoke-virtual {v0, v1, v2}, Ljava/lang/String;->replace(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Ljava/lang/String;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
return-object v0
|
||
|
.end method
|
||
|
|
||
|
.method private static synthetic lambda$configureUI$755(Lcom/discord/models/application/ModelAppSettingsLocale;Landroid/view/View;)V
|
||
|
.locals 2
|
||
|
.param p1, "v" # Landroid/view/View;
|
||
|
|
||
|
.prologue
|
||
|
invoke-static {}, Lcom/discord/stores/StoreStream;->getUserSettings()Lcom/discord/stores/StoreUserSettings;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
invoke-virtual {p0}, Lcom/discord/models/application/ModelAppSettingsLocale;->isSync()Z
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
if-nez v0, :cond_0
|
||
|
|
||
|
const/4 v0, 0x1
|
||
|
|
||
|
:goto_0
|
||
|
invoke-virtual {v1, v0}, Lcom/discord/stores/StoreUserSettings;->setLocaleSync(Z)V
|
||
|
|
||
|
return-void
|
||
|
|
||
|
:cond_0
|
||
|
const/4 v0, 0x0
|
||
|
|
||
|
goto :goto_0
|
||
|
.end method
|
||
|
|
||
|
.method private synthetic lambda$configureUI$756(Landroid/view/View;)V
|
||
|
.locals 1
|
||
|
.param p1, "v" # Landroid/view/View;
|
||
|
|
||
|
.prologue
|
||
|
const-class v0, Lcom/discord/widgets/settings/WidgetSettingsLanguageSelect;
|
||
|
|
||
|
invoke-static {p0, v0}, Lcom/discord/widgets/settings/WidgetSettingsLanguageSelect;->create(Landroid/support/v4/app/Fragment;Ljava/lang/Class;)Landroid/support/v4/app/DialogFragment;
|
||
|
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
|
||
|
# virtual methods
|
||
|
.method public getContentViewResId()Ljava/lang/Integer;
|
||
|
.locals 1
|
||
|
|
||
|
.prologue
|
||
|
const v0, 0x7f040087
|
||
|
|
||
|
invoke-static {v0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
return-object v0
|
||
|
.end method
|
||
|
|
||
|
.method public onCreateViewOrOnResume()V
|
||
|
.locals 3
|
||
|
|
||
|
.prologue
|
||
|
invoke-super {p0}, Lcom/discord/utilities/app/AppFragment;->onCreateViewOrOnResume()V
|
||
|
|
||
|
invoke-static {}, Lcom/discord/stores/StoreStream;->getUserSettings()Lcom/discord/stores/StoreUserSettings;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
invoke-virtual {v0}, Lcom/discord/stores/StoreUserSettings;->getLocale()Lrx/Observable;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
invoke-static {p0}, Lcom/discord/utilities/app/AppTransformers;->ui(Lcom/discord/utilities/app/AppFragment;)Lrx/Observable$Transformer;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
invoke-virtual {v0, v1}, Lrx/Observable;->compose(Lrx/Observable$Transformer;)Lrx/Observable;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
invoke-static {p0}, Lcom/discord/widgets/settings/WidgetSettingsLanguage$$Lambda$1;->lambdaFactory$(Lcom/discord/widgets/settings/WidgetSettingsLanguage;)Lrx/functions/Action1;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
invoke-virtual {p0}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
|
||
|
|
||
|
move-result-object v2
|
||
|
|
||
|
invoke-static {v1, v2}, Lcom/discord/utilities/app/AppTransformers;->subscribe(Lrx/functions/Action1;Ljava/lang/Class;)Lrx/Observable$Transformer;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
invoke-virtual {v0, v1}, Lrx/Observable;->compose(Lrx/Observable$Transformer;)Lrx/Observable;
|
||
|
|
||
|
return-void
|
||
|
.end method
|