.class public Lcom/tcn/tools/lang/ChangeSkinLang;
.super Ljava/lang/Object;
.source "ChangeSkinLang.java"


# static fields
.field private static final TAG:Ljava/lang/String; = "ChangeSkinLang"

.field private static instance:Lcom/tcn/tools/lang/ChangeSkinLang;


# instance fields
.field private language:Ljava/lang/String;

.field private mContext:Landroid/content/Context;

.field protected skinsList:Ljava/util/List;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/List<",
            "Ljava/lang/String;",
            ">;"
        }
    .end annotation
.end field


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

    .line 25
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    const/4 v0, 0x0

    .line 30
    iput-object v0, p0, Lcom/tcn/tools/lang/ChangeSkinLang;->language:Ljava/lang/String;

    .line 47
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    iput-object v0, p0, Lcom/tcn/tools/lang/ChangeSkinLang;->skinsList:Ljava/util/List;

    return-void
.end method

.method static synthetic access$000(Lcom/tcn/tools/lang/ChangeSkinLang;Ljava/lang/String;)V
    .locals 0

    .line 25
    invoke-direct {p0, p1}, Lcom/tcn/tools/lang/ChangeSkinLang;->logX(Ljava/lang/String;)V

    return-void
.end method

.method public static getInstance()Lcom/tcn/tools/lang/ChangeSkinLang;
    .locals 1

    .line 32
    sget-object v0, Lcom/tcn/tools/lang/ChangeSkinLang;->instance:Lcom/tcn/tools/lang/ChangeSkinLang;

    if-nez v0, :cond_0

    .line 33
    new-instance v0, Lcom/tcn/tools/lang/ChangeSkinLang;

    invoke-direct {v0}, Lcom/tcn/tools/lang/ChangeSkinLang;-><init>()V

    sput-object v0, Lcom/tcn/tools/lang/ChangeSkinLang;->instance:Lcom/tcn/tools/lang/ChangeSkinLang;

    .line 35
    :cond_0
    sget-object v0, Lcom/tcn/tools/lang/ChangeSkinLang;->instance:Lcom/tcn/tools/lang/ChangeSkinLang;

    return-object v0
.end method

.method private logX(Ljava/lang/String;)V
    .locals 3

    .line 169
    invoke-static {}, Lcom/tcn/logger/TcnLog;->getInstance()Lcom/tcn/logger/TcnLog;

    move-result-object v0

    const-string v1, "ChangeSkinLang"

    const-string v2, "changeLanguage"

    invoke-virtual {v0, v1, v2, v2, p1}, Lcom/tcn/logger/TcnLog;->LoggerInfo(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V

    return-void
.end method


# virtual methods
.method public changeLanguage(Ljava/lang/String;Z)Z
    .locals 3

    .line 79
    new-instance v0, Ljava/lang/StringBuilder;

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

    const-string v1, "\u5207\u6362\u8bed\u8a00\u5305 => "

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

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

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

    move-result-object v0

    invoke-direct {p0, v0}, Lcom/tcn/tools/lang/ChangeSkinLang;->logX(Ljava/lang/String;)V

    if-eqz p2, :cond_1

    const-string p2, "zh"

    .line 81
    invoke-virtual {p1, p2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_0

    .line 82
    invoke-static {}, Lcom/tcn/tools/ysConfig/TcnShareUseData;->getInstance()Lcom/tcn/tools/ysConfig/TcnShareUseData;

    move-result-object v0

    invoke-virtual {v0, p2}, Lcom/tcn/tools/ysConfig/TcnShareUseData;->setNewBackgroundLanguage(Ljava/lang/String;)V

    goto :goto_0

    .line 84
    :cond_0
    invoke-static {}, Lcom/tcn/tools/ysConfig/TcnShareUseData;->getInstance()Lcom/tcn/tools/ysConfig/TcnShareUseData;

    move-result-object p2

    invoke-virtual {p2, p1}, Lcom/tcn/tools/ysConfig/TcnShareUseData;->setNewBackgroundLanguage(Ljava/lang/String;)V

    .line 85
    invoke-static {}, Lcom/tcn/tools/ysConfig/TcnShareUseData;->getInstance()Lcom/tcn/tools/ysConfig/TcnShareUseData;

    move-result-object p2

    const/4 v0, 0x3

    invoke-virtual {p2, v0}, Lcom/tcn/tools/ysConfig/TcnShareUseData;->setShopCarLimitNumber(I)V

    :cond_1
    :goto_0
    const/4 p2, 0x0

    .line 89
    iget-object v0, p0, Lcom/tcn/tools/lang/ChangeSkinLang;->skinsList:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v0

    :cond_2
    :goto_1
    invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z

    move-result v1

    if-eqz v1, :cond_3

    invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Ljava/lang/String;

    .line 90
    invoke-virtual {v1, p1}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z

    move-result v2

    if-eqz v2, :cond_2

    move-object p2, v1

    goto :goto_1

    .line 94
    :cond_3
    invoke-static {p2}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result p1

    if-nez p1, :cond_4

    .line 95
    invoke-virtual {p0, p2}, Lcom/tcn/tools/lang/ChangeSkinLang;->loadSkins(Ljava/lang/String;)V

    const/4 p1, 0x1

    return p1

    :cond_4
    const/4 p1, 0x0

    return p1
.end method

.method public changeLanguage(Ljava/lang/String;ZLskin/support/SkinCompatManager$SkinLoaderListener;)Z
    .locals 4

    .line 104
    new-instance v0, Ljava/lang/StringBuilder;

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

    const-string v1, "\u5207\u6362\u8bed\u8a00\u5305 => "

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

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

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

    move-result-object v0

    invoke-direct {p0, v0}, Lcom/tcn/tools/lang/ChangeSkinLang;->logX(Ljava/lang/String;)V

    if-eqz p2, :cond_1

    const-string p2, "default"

    .line 106
    invoke-virtual {p1, p2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result p2

    if-eqz p2, :cond_0

    .line 107
    invoke-static {}, Lcom/tcn/tools/ysConfig/TcnShareUseData;->getInstance()Lcom/tcn/tools/ysConfig/TcnShareUseData;

    move-result-object p2

    const-string v0, "zh"

    invoke-virtual {p2, v0}, Lcom/tcn/tools/ysConfig/TcnShareUseData;->setNewBackgroundLanguage(Ljava/lang/String;)V

    goto :goto_0

    .line 109
    :cond_0
    invoke-static {}, Lcom/tcn/tools/ysConfig/TcnShareUseData;->getInstance()Lcom/tcn/tools/ysConfig/TcnShareUseData;

    move-result-object p2

    invoke-virtual {p2, p1}, Lcom/tcn/tools/ysConfig/TcnShareUseData;->setNewBackgroundLanguage(Ljava/lang/String;)V

    :cond_1
    :goto_0
    const/4 p2, 0x0

    .line 113
    iget-object v0, p0, Lcom/tcn/tools/lang/ChangeSkinLang;->skinsList:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v0

    :cond_2
    :goto_1
    invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z

    move-result v2

    if-eqz v2, :cond_3

    invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Ljava/lang/String;

    .line 114
    invoke-virtual {v2, p1}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z

    move-result v3

    if-eqz v3, :cond_2

    move-object p2, v2

    goto :goto_1

    .line 118
    :cond_3
    invoke-static {p2}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result p1

    if-nez p1, :cond_4

    .line 119
    new-instance p1, Ljava/lang/StringBuilder;

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

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

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

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

    move-result-object p1

    invoke-direct {p0, p1}, Lcom/tcn/tools/lang/ChangeSkinLang;->logX(Ljava/lang/String;)V

    .line 120
    invoke-static {}, Lskin/support/SkinCompatManager;->getInstance()Lskin/support/SkinCompatManager;

    move-result-object p1

    new-instance v0, Lcom/tcn/tools/lang/ChangeSkinLang$1;

    invoke-direct {v0, p0}, Lcom/tcn/tools/lang/ChangeSkinLang$1;-><init>(Lcom/tcn/tools/lang/ChangeSkinLang;)V

    invoke-virtual {p1, v0}, Lskin/support/SkinCompatManager;->addObserver(Lskin/support/observe/SkinObserver;)V

    .line 127
    invoke-static {}, Lskin/support/SkinCompatManager;->getInstance()Lskin/support/SkinCompatManager;

    move-result-object p1

    invoke-virtual {p1, p2, p3}, Lskin/support/SkinCompatManager;->loadSkin(Ljava/lang/String;Lskin/support/SkinCompatManager$SkinLoaderListener;)Landroid/os/AsyncTask;

    const/4 p1, 0x1

    return p1

    :cond_4
    const/4 p1, 0x0

    return p1
.end method

.method public getSkinsList()Ljava/util/List;
    .locals 1
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/List<",
            "Ljava/lang/String;",
            ">;"
        }
    .end annotation

    .line 73
    invoke-virtual {p0}, Lcom/tcn/tools/lang/ChangeSkinLang;->initSkinApkDir()V

    .line 74
    iget-object v0, p0, Lcom/tcn/tools/lang/ChangeSkinLang;->skinsList:Ljava/util/List;

    return-object v0
.end method

.method public init(Landroid/content/Context;)V
    .locals 0

    .line 41
    iput-object p1, p0, Lcom/tcn/tools/lang/ChangeSkinLang;->mContext:Landroid/content/Context;

    .line 43
    invoke-virtual {p0}, Lcom/tcn/tools/lang/ChangeSkinLang;->initSkinApkDir()V

    return-void
.end method

.method public initSkinApkDir()V
    .locals 4

    .line 50
    iget-object v0, p0, Lcom/tcn/tools/lang/ChangeSkinLang;->skinsList:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->clear()V

    .line 51
    invoke-static {}, Lcom/tcn/tools/utils/TcnUtility;->getExternalStorageDirectory()Ljava/lang/String;

    move-result-object v0

    if-nez v0, :cond_0

    return-void

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

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

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

    const-string v0, "/TcnFolder/v3Skins"

    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

    .line 56
    invoke-static {v0}, Lcom/blankj/utilcode/util/FileUtils;->createOrExistsDir(Ljava/lang/String;)Z

    .line 57
    invoke-static {v0}, Lcom/tcn/tools/utils/TcnUtility;->getSkinPathFromUDisk(Ljava/lang/String;)Ljava/util/List;

    move-result-object v0

    .line 58
    invoke-interface {v0}, Ljava/util/List;->size()I

    move-result v1

    if-lez v1, :cond_1

    .line 59
    invoke-interface {v0}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v0

    :goto_0
    invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z

    move-result v1

    if-eqz v1, :cond_1

    invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Ljava/lang/String;

    .line 60
    iget-object v2, p0, Lcom/tcn/tools/lang/ChangeSkinLang;->skinsList:Ljava/util/List;

    const-string v3, "/"

    invoke-virtual {v1, v3}, Ljava/lang/String;->lastIndexOf(Ljava/lang/String;)I

    move-result v3

    add-int/lit8 v3, v3, 0x1

    invoke-virtual {v1, v3}, Ljava/lang/String;->substring(I)Ljava/lang/String;

    move-result-object v1

    invoke-interface {v2, v1}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    goto :goto_0

    .line 65
    :cond_1
    new-instance v0, Ljava/lang/StringBuilder;

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

    const-string v1, "skinsList => "

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

    iget-object v1, p0, Lcom/tcn/tools/lang/ChangeSkinLang;->skinsList:Ljava/util/List;

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

    move-result-object v1

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

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

    move-result-object v0

    invoke-direct {p0, v0}, Lcom/tcn/tools/lang/ChangeSkinLang;->logX(Ljava/lang/String;)V

    .line 66
    invoke-static {}, Ljava/util/Locale;->getDefault()Ljava/util/Locale;

    move-result-object v0

    invoke-virtual {v0}, Ljava/util/Locale;->getLanguage()Ljava/lang/String;

    move-result-object v0

    iput-object v0, p0, Lcom/tcn/tools/lang/ChangeSkinLang;->language:Ljava/lang/String;

    .line 67
    invoke-static {v0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v0

    if-eqz v0, :cond_2

    iget-object v0, p0, Lcom/tcn/tools/lang/ChangeSkinLang;->language:Ljava/lang/String;

    const-string v1, "zh"

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

    move-result v0

    if-nez v0, :cond_2

    .line 68
    invoke-static {}, Lcom/tcn/tools/ysConfig/TcnShareUseData;->getInstance()Lcom/tcn/tools/ysConfig/TcnShareUseData;

    move-result-object v0

    const/4 v1, 0x3

    invoke-virtual {v0, v1}, Lcom/tcn/tools/ysConfig/TcnShareUseData;->setShopCarLimitNumber(I)V

    :cond_2
    return-void
.end method

.method public loadDefaultSkin()V
    .locals 2

    const-string v0, "loadDefaultSkin => \u6062\u590d\u9ed8\u8ba4"

    .line 135
    invoke-direct {p0, v0}, Lcom/tcn/tools/lang/ChangeSkinLang;->logX(Ljava/lang/String;)V

    .line 136
    iget-object v0, p0, Lcom/tcn/tools/lang/ChangeSkinLang;->language:Ljava/lang/String;

    if-eqz v0, :cond_0

    .line 137
    invoke-static {}, Lcom/tcn/tools/ysConfig/TcnShareUseData;->getInstance()Lcom/tcn/tools/ysConfig/TcnShareUseData;

    move-result-object v0

    iget-object v1, p0, Lcom/tcn/tools/lang/ChangeSkinLang;->language:Ljava/lang/String;

    invoke-virtual {v0, v1}, Lcom/tcn/tools/ysConfig/TcnShareUseData;->setNewBackgroundLanguage(Ljava/lang/String;)V

    .line 139
    :cond_0
    invoke-static {}, Lskin/support/SkinCompatManager;->getInstance()Lskin/support/SkinCompatManager;

    move-result-object v0

    invoke-virtual {v0}, Lskin/support/SkinCompatManager;->restoreDefaultTheme()V

    return-void
.end method

.method protected loadSkins(Ljava/lang/String;)V
    .locals 3

    .line 144
    new-instance v0, Ljava/lang/StringBuilder;

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

    const-string v1, "\u5207\u6362\u8bed\u8a00\u5305 => "

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

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

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

    move-result-object v0

    invoke-direct {p0, v0}, Lcom/tcn/tools/lang/ChangeSkinLang;->logX(Ljava/lang/String;)V

    .line 145
    invoke-static {}, Lskin/support/SkinCompatManager;->getInstance()Lskin/support/SkinCompatManager;

    move-result-object v0

    new-instance v1, Lcom/tcn/tools/lang/ChangeSkinLang$2;

    invoke-direct {v1, p0}, Lcom/tcn/tools/lang/ChangeSkinLang$2;-><init>(Lcom/tcn/tools/lang/ChangeSkinLang;)V

    invoke-virtual {v0, v1}, Lskin/support/SkinCompatManager;->addObserver(Lskin/support/observe/SkinObserver;)V

    .line 151
    invoke-static {}, Lskin/support/SkinCompatManager;->getInstance()Lskin/support/SkinCompatManager;

    move-result-object v0

    new-instance v1, Lcom/tcn/tools/lang/ChangeSkinLang$3;

    invoke-direct {v1, p0}, Lcom/tcn/tools/lang/ChangeSkinLang$3;-><init>(Lcom/tcn/tools/lang/ChangeSkinLang;)V

    const v2, 0x7fffffff

    invoke-virtual {v0, p1, v1, v2}, Lskin/support/SkinCompatManager;->loadSkin(Ljava/lang/String;Lskin/support/SkinCompatManager$SkinLoaderListener;I)Landroid/os/AsyncTask;

    return-void
.end method
