.class public Lcom/moji/mjweather/weather/control/CacheViewControlManager;
.super Ljava/lang/Object;
.source "CacheViewControlManager.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/moji/mjweather/weather/control/CacheViewControlManager$ControlType;,
        Lcom/moji/mjweather/weather/control/CacheViewControlManager$CreateViewRunnable;,
        Lcom/moji/mjweather/weather/control/CacheViewControlManager$InstanceHolder;
    }
.end annotation


# static fields
.field private static final a:Ljava/lang/Object;


# instance fields
.field private b:Landroid/support/v4/util/ArrayMap;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Landroid/support/v4/util/ArrayMap<",
            "Ljava/lang/Integer;",
            "Landroid/support/v4/util/ArrayMap<",
            "Ljava/lang/Integer;",
            "Lcom/moji/mjweather/weather/control/MJWhetherViewControl;",
            ">;>;"
        }
    .end annotation
.end field

.field private c:Landroid/util/SparseIntArray;

.field private d:I


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .line 24
    new-instance v0, Ljava/lang/Object;

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

    sput-object v0, Lcom/moji/mjweather/weather/control/CacheViewControlManager;->a:Ljava/lang/Object;

    return-void
.end method

.method private constructor <init>()V
    .locals 3

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

    const/4 v0, -0x1

    .line 27
    iput v0, p0, Lcom/moji/mjweather/weather/control/CacheViewControlManager;->d:I

    .line 32
    sget-object v0, Lcom/moji/mjweather/weather/control/CacheViewControlManager;->a:Ljava/lang/Object;

    monitor-enter v0

    .line 33
    :try_start_0
    new-instance v1, Landroid/support/v4/util/ArrayMap;

    const/4 v2, 0x7

    invoke-direct {v1, v2}, Landroid/support/v4/util/ArrayMap;-><init>(I)V

    iput-object v1, p0, Lcom/moji/mjweather/weather/control/CacheViewControlManager;->b:Landroid/support/v4/util/ArrayMap;

    .line 34
    new-instance v1, Landroid/util/SparseIntArray;

    const/16 v2, 0x9

    invoke-direct {v1, v2}, Landroid/util/SparseIntArray;-><init>(I)V

    iput-object v1, p0, Lcom/moji/mjweather/weather/control/CacheViewControlManager;->c:Landroid/util/SparseIntArray;

    .line 35
    monitor-exit v0

    return-void

    :catchall_0
    move-exception v1

    monitor-exit v0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v1
.end method

.method synthetic constructor <init>(Lcom/moji/mjweather/weather/control/CacheViewControlManager$1;)V
    .locals 0

    .line 22
    invoke-direct {p0}, Lcom/moji/mjweather/weather/control/CacheViewControlManager;-><init>()V

    return-void
.end method

.method static synthetic a(Lcom/moji/mjweather/weather/control/CacheViewControlManager;)Landroid/support/v4/util/ArrayMap;
    .locals 0

    .line 22
    iget-object p0, p0, Lcom/moji/mjweather/weather/control/CacheViewControlManager;->b:Landroid/support/v4/util/ArrayMap;

    return-object p0
.end method

.method public static b()Lcom/moji/mjweather/weather/control/CacheViewControlManager;
    .locals 1

    .line 52
    invoke-static {}, Lcom/moji/mjweather/weather/control/CacheViewControlManager$InstanceHolder;->a()Lcom/moji/mjweather/weather/control/CacheViewControlManager;

    move-result-object v0

    return-object v0
.end method

.method static synthetic d()Ljava/lang/Object;
    .locals 1

    .line 22
    sget-object v0, Lcom/moji/mjweather/weather/control/CacheViewControlManager;->a:Ljava/lang/Object;

    return-object v0
.end method


# virtual methods
.method public a()I
    .locals 1

    .line 39
    iget v0, p0, Lcom/moji/mjweather/weather/control/CacheViewControlManager;->d:I

    return v0
.end method

.method public a(Landroid/content/Context;Lcom/moji/common/area/AreaInfo;Lcom/moji/mjweather/weather/control/CacheViewControlManager$ControlType;)Lcom/moji/mjweather/weather/control/MJWhetherViewControl;
    .locals 3

    .line 105
    sget-object v0, Lcom/moji/mjweather/weather/control/CacheViewControlManager;->a:Ljava/lang/Object;

    monitor-enter v0

    .line 106
    :try_start_0
    iget-object v1, p0, Lcom/moji/mjweather/weather/control/CacheViewControlManager;->b:Landroid/support/v4/util/ArrayMap;

    if-eqz v1, :cond_0

    iget-object v1, p0, Lcom/moji/mjweather/weather/control/CacheViewControlManager;->c:Landroid/util/SparseIntArray;

    if-eqz v1, :cond_0

    if-eqz p2, :cond_0

    .line 107
    iget-object v1, p0, Lcom/moji/mjweather/weather/control/CacheViewControlManager;->c:Landroid/util/SparseIntArray;

    invoke-virtual {p2}, Lcom/moji/common/area/AreaInfo;->getCacheKey()I

    move-result v2

    invoke-virtual {v1, v2}, Landroid/util/SparseIntArray;->get(I)I

    move-result v1

    if-ltz v1, :cond_0

    .line 109
    iget-object v2, p0, Lcom/moji/mjweather/weather/control/CacheViewControlManager;->b:Landroid/support/v4/util/ArrayMap;

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

    move-result-object v1

    invoke-virtual {v2, v1}, Landroid/support/v4/util/ArrayMap;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Landroid/support/v4/util/ArrayMap;

    if-eqz v1, :cond_0

    .line 111
    invoke-virtual {p3}, Lcom/moji/mjweather/weather/control/CacheViewControlManager$ControlType;->ordinal()I

    move-result v2

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

    move-result-object v2

    invoke-virtual {v1, v2}, Landroid/support/v4/util/ArrayMap;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lcom/moji/mjweather/weather/control/MJWhetherViewControl;

    if-eqz v1, :cond_0

    .line 113
    monitor-exit v0

    return-object v1

    .line 118
    :cond_0
    monitor-exit v0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_1

    .line 120
    sget-object v0, Lcom/moji/mjweather/weather/control/CacheViewControlManager$1;->a:[I

    invoke-virtual {p3}, Lcom/moji/mjweather/weather/control/CacheViewControlManager$ControlType;->ordinal()I

    move-result v1

    aget v0, v0, v1

    packed-switch v0, :pswitch_data_0

    const/4 v0, 0x0

    goto :goto_0

    .line 140
    :pswitch_0
    new-instance v0, Lcom/moji/mjweather/weather/control/WeatherShorterAndInfoViewControl;

    invoke-direct {v0, p1}, Lcom/moji/mjweather/weather/control/WeatherShorterAndInfoViewControl;-><init>(Landroid/content/Context;)V

    goto :goto_0

    .line 137
    :pswitch_1
    new-instance v0, Lcom/moji/mjweather/weather/control/WeatherMiddleAdViewControl;

    invoke-direct {v0, p1}, Lcom/moji/mjweather/weather/control/WeatherMiddleAdViewControl;-><init>(Landroid/content/Context;)V

    goto :goto_0

    .line 134
    :pswitch_2
    new-instance v0, Lcom/moji/mjweather/weather/control/WeatherIndexViewControl;

    invoke-direct {v0, p1}, Lcom/moji/mjweather/weather/control/WeatherIndexViewControl;-><init>(Landroid/content/Context;)V

    goto :goto_0

    .line 128
    :pswitch_3
    new-instance v0, Lcom/moji/mjweather/weather/control/WeatherForecastViewControl;

    invoke-direct {v0, p1}, Lcom/moji/mjweather/weather/control/WeatherForecastViewControl;-><init>(Landroid/content/Context;)V

    goto :goto_0

    .line 125
    :pswitch_4
    new-instance v0, Lcom/moji/mjweather/weather/control/WeatherBottomAdViewControl;

    invoke-direct {v0, p1}, Lcom/moji/mjweather/weather/control/WeatherBottomAdViewControl;-><init>(Landroid/content/Context;)V

    .line 150
    :goto_0
    sget-object p1, Lcom/moji/mjweather/weather/control/CacheViewControlManager;->a:Ljava/lang/Object;

    monitor-enter p1

    .line 151
    :try_start_1
    iget-object v1, p0, Lcom/moji/mjweather/weather/control/CacheViewControlManager;->b:Landroid/support/v4/util/ArrayMap;

    if-eqz v1, :cond_2

    iget-object v1, p0, Lcom/moji/mjweather/weather/control/CacheViewControlManager;->c:Landroid/util/SparseIntArray;

    if-eqz v1, :cond_2

    if-eqz p2, :cond_2

    .line 152
    iget-object v1, p0, Lcom/moji/mjweather/weather/control/CacheViewControlManager;->c:Landroid/util/SparseIntArray;

    invoke-virtual {p2}, Lcom/moji/common/area/AreaInfo;->getCacheKey()I

    move-result p2

    invoke-virtual {v1, p2}, Landroid/util/SparseIntArray;->get(I)I

    move-result p2

    if-ltz p2, :cond_2

    .line 154
    iget-object v1, p0, Lcom/moji/mjweather/weather/control/CacheViewControlManager;->b:Landroid/support/v4/util/ArrayMap;

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

    move-result-object v2

    invoke-virtual {v1, v2}, Landroid/support/v4/util/ArrayMap;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Landroid/support/v4/util/ArrayMap;

    if-nez v1, :cond_1

    .line 156
    new-instance v1, Landroid/support/v4/util/ArrayMap;

    const/16 v2, 0x8

    invoke-direct {v1, v2}, Landroid/support/v4/util/ArrayMap;-><init>(I)V

    .line 158
    :cond_1
    invoke-virtual {p3}, Lcom/moji/mjweather/weather/control/CacheViewControlManager$ControlType;->ordinal()I

    move-result p3

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

    move-result-object p3

    invoke-virtual {v1, p3, v0}, Landroid/support/v4/util/ArrayMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 159
    iget-object p3, p0, Lcom/moji/mjweather/weather/control/CacheViewControlManager;->b:Landroid/support/v4/util/ArrayMap;

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

    move-result-object p2

    invoke-virtual {p3, p2, v1}, Landroid/support/v4/util/ArrayMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 162
    :cond_2
    monitor-exit p1

    return-object v0

    :catchall_0
    move-exception p2

    monitor-exit p1
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    throw p2

    :catchall_1
    move-exception p1

    .line 118
    :try_start_2
    monitor-exit v0
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_1

    throw p1

    :pswitch_data_0
    .packed-switch 0x1
        :pswitch_4
        :pswitch_3
        :pswitch_2
        :pswitch_1
        :pswitch_0
    .end packed-switch
.end method

.method public a(I)V
    .locals 3

    const-string v0, "evevo"

    .line 43
    new-instance v1, Ljava/lang/StringBuilder;

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

    const-string v2, "setVoicePos "

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

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

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

    move-result-object v1

    invoke-static {v0, v1}, Lcom/moji/tool/log/MJLogger;->b(Ljava/lang/String;Ljava/lang/String;)V

    .line 44
    iput p1, p0, Lcom/moji/mjweather/weather/control/CacheViewControlManager;->d:I

    return-void
.end method

.method public a(Landroid/content/Context;)V
    .locals 2

    .line 57
    new-instance v0, Lcom/moji/mjweather/weather/control/CacheViewControlManager$CreateViewRunnable;

    invoke-direct {v0, p0, p1}, Lcom/moji/mjweather/weather/control/CacheViewControlManager$CreateViewRunnable;-><init>(Lcom/moji/mjweather/weather/control/CacheViewControlManager;Landroid/content/Context;)V

    sget-object p1, Lcom/moji/tool/thread/ThreadType;->NORMAL_THREAD:Lcom/moji/tool/thread/ThreadType;

    sget-object v1, Lcom/moji/tool/thread/ThreadPriority;->HIGH:Lcom/moji/tool/thread/ThreadPriority;

    invoke-static {v0, p1, v1}, Lcom/moji/tool/thread/MJPools;->a(Ljava/lang/Runnable;Lcom/moji/tool/thread/ThreadType;Lcom/moji/tool/thread/ThreadPriority;)I

    return-void
.end method

.method public a(Lcom/moji/common/area/AreaInfo;I)V
    .locals 3

    .line 75
    sget-object v0, Lcom/moji/mjweather/weather/control/CacheViewControlManager;->a:Ljava/lang/Object;

    monitor-enter v0

    .line 76
    :try_start_0
    iget-object v1, p0, Lcom/moji/mjweather/weather/control/CacheViewControlManager;->c:Landroid/util/SparseIntArray;

    if-eqz v1, :cond_1

    .line 77
    iget-object v1, p0, Lcom/moji/mjweather/weather/control/CacheViewControlManager;->c:Landroid/util/SparseIntArray;

    invoke-virtual {p1}, Lcom/moji/common/area/AreaInfo;->getCacheKey()I

    move-result v2

    invoke-virtual {v1, v2}, Landroid/util/SparseIntArray;->get(I)I

    move-result v1

    if-ltz v1, :cond_0

    .line 79
    iget-object v1, p0, Lcom/moji/mjweather/weather/control/CacheViewControlManager;->c:Landroid/util/SparseIntArray;

    invoke-virtual {p1}, Lcom/moji/common/area/AreaInfo;->getCacheKey()I

    move-result v2

    invoke-virtual {v1, v2}, Landroid/util/SparseIntArray;->indexOfKey(I)I

    move-result v1

    if-ltz v1, :cond_0

    .line 80
    iget-object v2, p0, Lcom/moji/mjweather/weather/control/CacheViewControlManager;->c:Landroid/util/SparseIntArray;

    invoke-virtual {v2}, Landroid/util/SparseIntArray;->size()I

    move-result v2

    if-ge v1, v2, :cond_0

    .line 81
    iget-object v2, p0, Lcom/moji/mjweather/weather/control/CacheViewControlManager;->c:Landroid/util/SparseIntArray;

    invoke-virtual {v2, v1}, Landroid/util/SparseIntArray;->removeAt(I)V

    .line 84
    :cond_0
    iget-object v1, p0, Lcom/moji/mjweather/weather/control/CacheViewControlManager;->c:Landroid/util/SparseIntArray;

    invoke-virtual {p1}, Lcom/moji/common/area/AreaInfo;->getCacheKey()I

    move-result p1

    invoke-virtual {v1, p1, p2}, Landroid/util/SparseIntArray;->put(II)V

    .line 86
    :cond_1
    monitor-exit v0

    return-void

    :catchall_0
    move-exception p1

    monitor-exit v0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw p1
.end method

.method public b(Lcom/moji/common/area/AreaInfo;I)V
    .locals 3

    .line 90
    sget-object v0, Lcom/moji/mjweather/weather/control/CacheViewControlManager;->a:Ljava/lang/Object;

    monitor-enter v0

    .line 91
    :try_start_0
    iget-object v1, p0, Lcom/moji/mjweather/weather/control/CacheViewControlManager;->c:Landroid/util/SparseIntArray;

    if-eqz v1, :cond_0

    .line 92
    iget-object v1, p0, Lcom/moji/mjweather/weather/control/CacheViewControlManager;->c:Landroid/util/SparseIntArray;

    invoke-virtual {p1}, Lcom/moji/common/area/AreaInfo;->getCacheKey()I

    move-result v2

    invoke-virtual {v1, v2}, Landroid/util/SparseIntArray;->get(I)I

    move-result v1

    if-ne v1, p2, :cond_0

    if-ltz v1, :cond_0

    .line 94
    iget-object p2, p0, Lcom/moji/mjweather/weather/control/CacheViewControlManager;->c:Landroid/util/SparseIntArray;

    invoke-virtual {p1}, Lcom/moji/common/area/AreaInfo;->getCacheKey()I

    move-result p1

    invoke-virtual {p2, p1}, Landroid/util/SparseIntArray;->indexOfKey(I)I

    move-result p1

    if-ltz p1, :cond_0

    .line 95
    iget-object p2, p0, Lcom/moji/mjweather/weather/control/CacheViewControlManager;->c:Landroid/util/SparseIntArray;

    invoke-virtual {p2}, Landroid/util/SparseIntArray;->size()I

    move-result p2

    if-ge p1, p2, :cond_0

    .line 96
    iget-object p2, p0, Lcom/moji/mjweather/weather/control/CacheViewControlManager;->c:Landroid/util/SparseIntArray;

    invoke-virtual {p2, p1}, Landroid/util/SparseIntArray;->removeAt(I)V

    .line 100
    :cond_0
    monitor-exit v0

    return-void

    :catchall_0
    move-exception p1

    monitor-exit v0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw p1
.end method

.method public c()V
    .locals 4

    const-string v0, "CacheViewControlManager"

    const-string v1, "destroyViewControl() called"

    .line 61
    invoke-static {v0, v1}, Lcom/moji/tool/log/MJLogger;->b(Ljava/lang/String;Ljava/lang/String;)V

    .line 62
    sget-object v0, Lcom/moji/mjweather/weather/control/CacheViewControlManager;->a:Ljava/lang/Object;

    monitor-enter v0

    .line 63
    :try_start_0
    iget-object v1, p0, Lcom/moji/mjweather/weather/control/CacheViewControlManager;->b:Landroid/support/v4/util/ArrayMap;

    if-eqz v1, :cond_1

    iget-object v1, p0, Lcom/moji/mjweather/weather/control/CacheViewControlManager;->b:Landroid/support/v4/util/ArrayMap;

    invoke-virtual {v1}, Landroid/support/v4/util/ArrayMap;->size()I

    move-result v1

    if-lez v1, :cond_1

    const/4 v1, 0x0

    .line 64
    :goto_0
    iget-object v2, p0, Lcom/moji/mjweather/weather/control/CacheViewControlManager;->b:Landroid/support/v4/util/ArrayMap;

    invoke-virtual {v2}, Landroid/support/v4/util/ArrayMap;->size()I

    move-result v2

    if-ge v1, v2, :cond_1

    .line 65
    iget-object v2, p0, Lcom/moji/mjweather/weather/control/CacheViewControlManager;->b:Landroid/support/v4/util/ArrayMap;

    invoke-virtual {v2, v1}, Landroid/support/v4/util/ArrayMap;->valueAt(I)Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Landroid/support/v4/util/ArrayMap;

    if-eqz v2, :cond_0

    .line 66
    invoke-virtual {v2}, Landroid/support/v4/util/ArrayMap;->size()I

    move-result v3

    if-lez v3, :cond_0

    .line 67
    invoke-virtual {v2}, Landroid/support/v4/util/ArrayMap;->clear()V

    :cond_0
    add-int/lit8 v1, v1, 0x1

    goto :goto_0

    .line 71
    :cond_1
    monitor-exit v0

    return-void

    :catchall_0
    move-exception v1

    monitor-exit v0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v1
.end method
