.class public Lcom/android/settings/fragments/Theme;
.super Lcom/android/settings/MiuiSettingsPreferenceFragment;
.source "XThemeRoom.java"

# interfaces
.implements Landroidx/preference/Preference$b;


# instance fields
.field private mGradientColor:Landroidx/preference/XMiuiColorPickerPreference;

.field private mOverlayService:Landroid/content/om/IOverlayManager;

.field private mThemeColor:Landroidx/preference/XMiuiColorPickerPreference;


# direct methods
.method public constructor <init>()V
    .locals 0

    invoke-direct {p0}, Lcom/android/settings/MiuiSettingsPreferenceFragment;-><init>()V

    return-void
.end method

.method private setupAccentPref()V
    .locals 3

    const-string v0, "accent_color"

    invoke-virtual {p0, v0}, Lcom/android/settings/fragments/Theme;->findPreference(Ljava/lang/CharSequence;)Landroidx/preference/Preference;

    move-result-object v0

    check-cast v0, Landroidx/preference/XMiuiColorPickerPreference;

    iput-object v0, p0, Lcom/android/settings/fragments/Theme;->mThemeColor:Landroidx/preference/XMiuiColorPickerPreference;

    const-string v0, "persist.sys.theme.accentcolor"

    const-string v1, "-1"

    invoke-static {v0, v1}, Landroid/os/SystemProperties;->get(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    const-string v1, "-1"

    invoke-virtual {v1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_0

    const/4 v0, -0x1

    goto :goto_0

    :cond_0
    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "#"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I

    move-result v0

    :goto_0
    iget-object v1, p0, Lcom/android/settings/fragments/Theme;->mThemeColor:Landroidx/preference/XMiuiColorPickerPreference;

    invoke-virtual {v1, v0}, Landroidx/preference/XMiuiColorPickerPreference;->setNewPreviewColor(I)V

    iget-object v0, p0, Lcom/android/settings/fragments/Theme;->mThemeColor:Landroidx/preference/XMiuiColorPickerPreference;

    invoke-virtual {v0, p0}, Landroidx/preference/XMiuiColorPickerPreference;->setOnPreferenceChangeListener(Landroidx/preference/Preference$b;)V

    return-void
.end method

.method private setupGradientPref()V
    .locals 3

    const-string v0, "gradient_color"

    invoke-virtual {p0, v0}, Lcom/android/settings/fragments/Theme;->findPreference(Ljava/lang/CharSequence;)Landroidx/preference/Preference;

    move-result-object v0

    check-cast v0, Landroidx/preference/XMiuiColorPickerPreference;

    iput-object v0, p0, Lcom/android/settings/fragments/Theme;->mGradientColor:Landroidx/preference/XMiuiColorPickerPreference;

    const-string v0, "persist.sys.theme.gradientcolor"

    const-string v1, "-1"

    invoke-static {v0, v1}, Landroid/os/SystemProperties;->get(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    const-string v1, "-1"

    invoke-virtual {v1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_0

    const/4 v0, -0x1

    goto :goto_0

    :cond_0
    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "#"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-static {v0}, Landroid/graphics/Color;->parseColor(Ljava/lang/String;)I

    move-result v0

    :goto_0
    iget-object v1, p0, Lcom/android/settings/fragments/Theme;->mGradientColor:Landroidx/preference/XMiuiColorPickerPreference;

    invoke-virtual {v1, v0}, Landroidx/preference/XMiuiColorPickerPreference;->setNewPreviewColor(I)V

    iget-object v0, p0, Lcom/android/settings/fragments/Theme;->mGradientColor:Landroidx/preference/XMiuiColorPickerPreference;

    invoke-virtual {v0, p0}, Landroidx/preference/XMiuiColorPickerPreference;->setOnPreferenceChangeListener(Landroidx/preference/Preference$b;)V

    return-void
.end method


# virtual methods
.method public getMetricsCategory()I
    .locals 0

    const/16 p0, 0x7d0

    return p0
.end method

.method public onCreate(Landroid/os/Bundle;)V
    .locals 0

    invoke-super {p0, p1}, Lcom/android/settings/MiuiSettingsPreferenceFragment;->onCreate(Landroid/os/Bundle;)V

    const p1, 0x7f1501a9

    invoke-virtual {p0, p1}, Lcom/android/settings/fragments/Theme;->addPreferencesFromResource(I)V

    const-string p1, "overlay"

    invoke-static {p1}, Landroid/os/ServiceManager;->getService(Ljava/lang/String;)Landroid/os/IBinder;

    move-result-object p1

    invoke-static {p1}, Landroid/content/om/IOverlayManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/om/IOverlayManager;

    move-result-object p1

    iput-object p1, p0, Lcom/android/settings/fragments/Theme;->mOverlayService:Landroid/content/om/IOverlayManager;

    invoke-direct {p0}, Lcom/android/settings/fragments/Theme;->setupAccentPref()V

    invoke-direct {p0}, Lcom/android/settings/fragments/Theme;->setupGradientPref()V

    return-void
.end method

.method public onPreferenceChange(Landroidx/preference/Preference;Ljava/lang/Object;)Z
    .locals 5

    const/4 v1, 0x1

    const/4 v2, -0x2

    const/4 v3, 0x0

    iget-object v0, p0, Lcom/android/settings/fragments/Theme;->mThemeColor:Landroidx/preference/XMiuiColorPickerPreference;

    if-ne p1, v0, :cond_0

    check-cast p2, Ljava/lang/Integer;

    invoke-virtual {p2}, Ljava/lang/Integer;->intValue()I

    move-result p1

    const-string p2, "%08X"

    new-array v0, v1, [Ljava/lang/Object;

    const/4 v4, -0x1

    and-int/2addr p1, v4

    invoke-static {p1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object p1

    aput-object p1, v0, v3

    invoke-static {p2, v0}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object p1

    const-string p2, "persist.sys.theme.accentcolor"

    invoke-static {p2, p1}, Landroid/os/SystemProperties;->set(Ljava/lang/String;Ljava/lang/String;)V

    iget-object p1, p0, Lcom/android/settings/fragments/Theme;->mOverlayService:Landroid/content/om/IOverlayManager;

    invoke-interface {p1, v2}, Landroid/content/om/IOverlayManager;->reloadAndroidAssets(I)V

    iget-object p1, p0, Lcom/android/settings/fragments/Theme;->mOverlayService:Landroid/content/om/IOverlayManager;

    const-string p2, "android"

    invoke-interface {p1, p2, v2}, Landroid/content/om/IOverlayManager;->reloadAssets(Ljava/lang/String;I)V

    iget-object p1, p0, Lcom/android/settings/fragments/Theme;->mOverlayService:Landroid/content/om/IOverlayManager;

    const-string p2, "miui"

    invoke-interface {p1, p2, v2}, Landroid/content/om/IOverlayManager;->reloadAssets(Ljava/lang/String;I)V

    iget-object p1, p0, Lcom/android/settings/fragments/Theme;->mOverlayService:Landroid/content/om/IOverlayManager;

    const-string p2, "com.android.settings"

    invoke-interface {p1, p2, v2}, Landroid/content/om/IOverlayManager;->reloadAssets(Ljava/lang/String;I)V

    iget-object p1, p0, Lcom/android/settings/fragments/Theme;->mOverlayService:Landroid/content/om/IOverlayManager;

    const-string p2, "com.android.systemui"

    invoke-interface {p1, p2, v2}, Landroid/content/om/IOverlayManager;->reloadAssets(Ljava/lang/String;I)V

    return v1

    :cond_0
    iget-object v0, p0, Lcom/android/settings/fragments/Theme;->mGradientColor:Landroidx/preference/XMiuiColorPickerPreference;

    if-ne p1, v0, :cond_1

    check-cast p2, Ljava/lang/Integer;

    invoke-virtual {p2}, Ljava/lang/Integer;->intValue()I

    move-result p1

    const-string p2, "%08X"

    new-array v0, v1, [Ljava/lang/Object;

    const/4 v4, -0x1

    and-int/2addr p1, v4

    invoke-static {p1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object p1

    aput-object p1, v0, v3

    invoke-static {p2, v0}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object p1

    const-string p2, "persist.sys.theme.gradientcolor"

    invoke-static {p2, p1}, Landroid/os/SystemProperties;->set(Ljava/lang/String;Ljava/lang/String;)V

    iget-object p1, p0, Lcom/android/settings/fragments/Theme;->mOverlayService:Landroid/content/om/IOverlayManager;

    invoke-interface {p1, v2}, Landroid/content/om/IOverlayManager;->reloadAndroidAssets(I)V

    iget-object p1, p0, Lcom/android/settings/fragments/Theme;->mOverlayService:Landroid/content/om/IOverlayManager;

    const-string p2, "android"

    invoke-interface {p1, p2, v2}, Landroid/content/om/IOverlayManager;->reloadAssets(Ljava/lang/String;I)V

    iget-object p1, p0, Lcom/android/settings/fragments/Theme;->mOverlayService:Landroid/content/om/IOverlayManager;

    const-string p2, "miui"

    invoke-interface {p1, p2, v2}, Landroid/content/om/IOverlayManager;->reloadAssets(Ljava/lang/String;I)V

    iget-object p1, p0, Lcom/android/settings/fragments/Theme;->mOverlayService:Landroid/content/om/IOverlayManager;

    const-string p2, "com.android.settings"

    invoke-interface {p1, p2, v2}, Landroid/content/om/IOverlayManager;->reloadAssets(Ljava/lang/String;I)V

    iget-object p1, p0, Lcom/android/settings/fragments/Theme;->mOverlayService:Landroid/content/om/IOverlayManager;

    const-string p2, "com.android.systemui"

    invoke-interface {p1, p2, v2}, Landroid/content/om/IOverlayManager;->reloadAssets(Ljava/lang/String;I)V

    return v1

    :cond_1
    return v3
.end method
