466 lines
12 KiB
Smali
466 lines
12 KiB
Smali
.class public Lcom/moji/index/TidePresenter;
|
|
.super Lcom/moji/base/MJPresenter;
|
|
.source "TidePresenter.java"
|
|
|
|
|
|
# annotations
|
|
.annotation system Ldalvik/annotation/MemberClasses;
|
|
value = {
|
|
Lcom/moji/index/TidePresenter$TideCallBack;
|
|
}
|
|
.end annotation
|
|
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Lcom/moji/base/MJPresenter<",
|
|
"Lcom/moji/index/TidePresenter$TideCallBack;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
|
|
|
|
# instance fields
|
|
.field private b:Landroid/content/Context;
|
|
|
|
.field private c:Lcom/moji/index/TidePresenter$TideCallBack;
|
|
|
|
.field private d:Ljava/util/List;
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Ljava/util/List<",
|
|
"Lcom/moji/weatherprovider/data/ForecastDayList$ForecastDay;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
.end field
|
|
|
|
.field private e:Ljava/text/DateFormat;
|
|
|
|
.field private f:Lcom/moji/weatherprovider/data/Detail;
|
|
|
|
.field private g:Ljava/util/TimeZone;
|
|
|
|
.field private h:Ljava/util/List;
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Ljava/util/List<",
|
|
"Lcom/moji/index/DailyTideBriefInfo;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
.end field
|
|
|
|
.field private i:Landroid/os/Handler;
|
|
|
|
|
|
# direct methods
|
|
.method public constructor <init>(Lcom/moji/index/TidePresenter$TideCallBack;Ljava/util/List;)V
|
|
.locals 1
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Lcom/moji/index/TidePresenter$TideCallBack;",
|
|
"Ljava/util/List<",
|
|
"Lcom/moji/weatherprovider/data/ForecastDayList$ForecastDay;",
|
|
">;)V"
|
|
}
|
|
.end annotation
|
|
|
|
.line 62
|
|
invoke-direct {p0, p1}, Lcom/moji/base/MJPresenter;-><init>(Lcom/moji/base/MJPresenter$ICallback;)V
|
|
|
|
.line 47
|
|
new-instance v0, Ljava/util/ArrayList;
|
|
|
|
invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V
|
|
|
|
iput-object v0, p0, Lcom/moji/index/TidePresenter;->h:Ljava/util/List;
|
|
|
|
.line 48
|
|
new-instance v0, Lcom/moji/index/TidePresenter$1;
|
|
|
|
invoke-direct {v0, p0}, Lcom/moji/index/TidePresenter$1;-><init>(Lcom/moji/index/TidePresenter;)V
|
|
|
|
iput-object v0, p0, Lcom/moji/index/TidePresenter;->i:Landroid/os/Handler;
|
|
|
|
.line 63
|
|
invoke-static {}, Lcom/moji/tool/AppDelegate;->a()Landroid/content/Context;
|
|
|
|
move-result-object v0
|
|
|
|
iput-object v0, p0, Lcom/moji/index/TidePresenter;->b:Landroid/content/Context;
|
|
|
|
.line 64
|
|
iput-object p1, p0, Lcom/moji/index/TidePresenter;->c:Lcom/moji/index/TidePresenter$TideCallBack;
|
|
|
|
.line 65
|
|
iput-object p2, p0, Lcom/moji/index/TidePresenter;->d:Ljava/util/List;
|
|
|
|
.line 66
|
|
new-instance p1, Ljava/text/SimpleDateFormat;
|
|
|
|
const-string p2, "yyyy-MM-dd"
|
|
|
|
invoke-static {}, Ljava/util/Locale;->getDefault()Ljava/util/Locale;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-direct {p1, p2, v0}, Ljava/text/SimpleDateFormat;-><init>(Ljava/lang/String;Ljava/util/Locale;)V
|
|
|
|
iput-object p1, p0, Lcom/moji/index/TidePresenter;->e:Ljava/text/DateFormat;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method static synthetic a(Lcom/moji/index/TidePresenter;)Lcom/moji/index/TidePresenter$TideCallBack;
|
|
.locals 0
|
|
|
|
.line 39
|
|
iget-object p0, p0, Lcom/moji/index/TidePresenter;->c:Lcom/moji/index/TidePresenter$TideCallBack;
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method static synthetic a(Lcom/moji/index/TidePresenter;Lcom/moji/weatherprovider/data/Detail;)Lcom/moji/weatherprovider/data/Detail;
|
|
.locals 0
|
|
|
|
.line 39
|
|
iput-object p1, p0, Lcom/moji/index/TidePresenter;->f:Lcom/moji/weatherprovider/data/Detail;
|
|
|
|
return-object p1
|
|
.end method
|
|
|
|
.method private a(J)Ljava/lang/String;
|
|
.locals 4
|
|
|
|
.line 178
|
|
:try_start_0
|
|
new-instance v0, Ljava/text/SimpleDateFormat;
|
|
|
|
const-string v1, "HH:mm"
|
|
|
|
invoke-direct {v0, v1}, Ljava/text/SimpleDateFormat;-><init>(Ljava/lang/String;)V
|
|
|
|
.line 179
|
|
iget-object v1, p0, Lcom/moji/index/TidePresenter;->g:Ljava/util/TimeZone;
|
|
|
|
invoke-virtual {v0, v1}, Ljava/text/SimpleDateFormat;->setTimeZone(Ljava/util/TimeZone;)V
|
|
|
|
.line 180
|
|
new-instance v1, Ljava/util/Date;
|
|
|
|
const-wide/16 v2, 0x3e8
|
|
|
|
mul-long p1, p1, v2
|
|
|
|
invoke-direct {v1, p1, p2}, Ljava/util/Date;-><init>(J)V
|
|
|
|
invoke-virtual {v0, v1}, Ljava/text/SimpleDateFormat;->format(Ljava/util/Date;)Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
:try_end_0
|
|
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
return-object p1
|
|
|
|
:catch_0
|
|
const-string p1, "--:--"
|
|
|
|
return-object p1
|
|
.end method
|
|
|
|
.method private a(Ljava/text/DateFormat;J)Ljava/lang/String;
|
|
.locals 1
|
|
|
|
.line 171
|
|
invoke-static {}, Ljava/util/Calendar;->getInstance()Ljava/util/Calendar;
|
|
|
|
move-result-object v0
|
|
|
|
.line 172
|
|
invoke-virtual {v0, p2, p3}, Ljava/util/Calendar;->setTimeInMillis(J)V
|
|
|
|
.line 173
|
|
invoke-virtual {v0}, Ljava/util/Calendar;->getTime()Ljava/util/Date;
|
|
|
|
move-result-object p2
|
|
|
|
invoke-virtual {p1, p2}, Ljava/text/DateFormat;->format(Ljava/util/Date;)Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
return-object p1
|
|
.end method
|
|
|
|
.method static synthetic b(Lcom/moji/index/TidePresenter;)Ljava/util/List;
|
|
.locals 0
|
|
|
|
.line 39
|
|
iget-object p0, p0, Lcom/moji/index/TidePresenter;->h:Ljava/util/List;
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method static synthetic c(Lcom/moji/index/TidePresenter;)Landroid/content/Context;
|
|
.locals 0
|
|
|
|
.line 39
|
|
iget-object p0, p0, Lcom/moji/index/TidePresenter;->b:Landroid/content/Context;
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method static synthetic d(Lcom/moji/index/TidePresenter;)Landroid/os/Handler;
|
|
.locals 0
|
|
|
|
.line 39
|
|
iget-object p0, p0, Lcom/moji/index/TidePresenter;->i:Landroid/os/Handler;
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public a()V
|
|
.locals 1
|
|
|
|
.line 163
|
|
iget-object v0, p0, Lcom/moji/index/TidePresenter;->f:Lcom/moji/weatherprovider/data/Detail;
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
.line 164
|
|
invoke-static {}, Ljava/util/TimeZone;->getDefault()Ljava/util/TimeZone;
|
|
|
|
move-result-object v0
|
|
|
|
iput-object v0, p0, Lcom/moji/index/TidePresenter;->g:Ljava/util/TimeZone;
|
|
|
|
return-void
|
|
|
|
.line 167
|
|
:cond_0
|
|
iget-object v0, p0, Lcom/moji/index/TidePresenter;->f:Lcom/moji/weatherprovider/data/Detail;
|
|
|
|
invoke-virtual {v0}, Lcom/moji/weatherprovider/data/Detail;->getTimeZone()Ljava/util/TimeZone;
|
|
|
|
move-result-object v0
|
|
|
|
iput-object v0, p0, Lcom/moji/index/TidePresenter;->g:Ljava/util/TimeZone;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public a(Lcom/moji/weatherprovider/data/Detail;)V
|
|
.locals 2
|
|
|
|
if-nez p1, :cond_0
|
|
|
|
return-void
|
|
|
|
.line 73
|
|
:cond_0
|
|
new-instance v0, Lcom/moji/index/TidePresenter$2;
|
|
|
|
invoke-direct {v0, p0, p1}, Lcom/moji/index/TidePresenter$2;-><init>(Lcom/moji/index/TidePresenter;Lcom/moji/weatherprovider/data/Detail;)V
|
|
|
|
sget-object p1, Lcom/moji/tool/thread/ThreadType;->IO_THREAD:Lcom/moji/tool/thread/ThreadType;
|
|
|
|
sget-object v1, Lcom/moji/tool/thread/ThreadPriority;->NORMAL: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(Lorg/json/JSONObject;)V
|
|
.locals 11
|
|
|
|
.line 123
|
|
:try_start_0
|
|
iget-object v0, p0, Lcom/moji/index/TidePresenter;->d:Ljava/util/List;
|
|
|
|
if-eqz v0, :cond_3
|
|
|
|
const-string v0, "ranges"
|
|
|
|
.line 124
|
|
invoke-virtual {p1, v0}, Lorg/json/JSONObject;->optJSONObject(Ljava/lang/String;)Lorg/json/JSONObject;
|
|
|
|
move-result-object p1
|
|
|
|
const/4 v0, 0x0
|
|
|
|
const/4 v1, 0x0
|
|
|
|
.line 125
|
|
:goto_0
|
|
iget-object v2, p0, Lcom/moji/index/TidePresenter;->d:Ljava/util/List;
|
|
|
|
invoke-interface {v2}, Ljava/util/List;->size()I
|
|
|
|
move-result v2
|
|
|
|
if-ge v1, v2, :cond_2
|
|
|
|
.line 126
|
|
new-instance v2, Lcom/moji/index/DailyTideBriefInfo;
|
|
|
|
invoke-direct {v2}, Lcom/moji/index/DailyTideBriefInfo;-><init>()V
|
|
|
|
.line 127
|
|
iget-object v3, p0, Lcom/moji/index/TidePresenter;->e:Ljava/text/DateFormat;
|
|
|
|
iget-object v4, p0, Lcom/moji/index/TidePresenter;->d:Ljava/util/List;
|
|
|
|
invoke-interface {v4, v1}, Ljava/util/List;->get(I)Ljava/lang/Object;
|
|
|
|
move-result-object v4
|
|
|
|
check-cast v4, Lcom/moji/weatherprovider/data/ForecastDayList$ForecastDay;
|
|
|
|
iget-wide v4, v4, Lcom/moji/weatherprovider/data/ForecastDayList$ForecastDay;->mPredictDate:J
|
|
|
|
invoke-direct {p0, v3, v4, v5}, Lcom/moji/index/TidePresenter;->a(Ljava/text/DateFormat;J)Ljava/lang/String;
|
|
|
|
move-result-object v3
|
|
|
|
.line 128
|
|
invoke-virtual {p1, v3}, Lorg/json/JSONObject;->optJSONObject(Ljava/lang/String;)Lorg/json/JSONObject;
|
|
|
|
move-result-object v3
|
|
|
|
if-eqz v3, :cond_1
|
|
|
|
const-string v4, "port"
|
|
|
|
.line 130
|
|
invoke-virtual {v3, v4}, Lorg/json/JSONObject;->optJSONObject(Ljava/lang/String;)Lorg/json/JSONObject;
|
|
|
|
move-result-object v4
|
|
|
|
const-string v5, "baseline"
|
|
|
|
.line 131
|
|
invoke-virtual {v4, v5}, Lorg/json/JSONObject;->optDouble(Ljava/lang/String;)D
|
|
|
|
move-result-wide v4
|
|
|
|
const-wide/high16 v6, 0x4059000000000000L # 100.0
|
|
|
|
mul-double v4, v4, v6
|
|
|
|
double-to-int v4, v4
|
|
|
|
.line 132
|
|
iput v4, v2, Lcom/moji/index/DailyTideBriefInfo;->baseline:I
|
|
|
|
const-string v4, "range"
|
|
|
|
.line 134
|
|
invoke-virtual {v3, v4}, Lorg/json/JSONObject;->optJSONArray(Ljava/lang/String;)Lorg/json/JSONArray;
|
|
|
|
move-result-object v4
|
|
|
|
const-string v5, "counts"
|
|
|
|
.line 136
|
|
invoke-virtual {v3, v5}, Lorg/json/JSONObject;->getInt(Ljava/lang/String;)I
|
|
|
|
move-result v3
|
|
|
|
iput v3, v2, Lcom/moji/index/DailyTideBriefInfo;->counts:I
|
|
|
|
const/4 v3, 0x0
|
|
|
|
.line 137
|
|
:goto_1
|
|
invoke-virtual {v4}, Lorg/json/JSONArray;->length()I
|
|
|
|
move-result v5
|
|
|
|
if-ge v3, v5, :cond_0
|
|
|
|
.line 139
|
|
invoke-virtual {v4, v3}, Lorg/json/JSONArray;->getJSONObject(I)Lorg/json/JSONObject;
|
|
|
|
move-result-object v5
|
|
|
|
const-string v6, "timestamp"
|
|
|
|
.line 141
|
|
invoke-virtual {v5, v6}, Lorg/json/JSONObject;->optLong(Ljava/lang/String;)J
|
|
|
|
move-result-wide v6
|
|
|
|
.line 142
|
|
invoke-direct {p0, v6, v7}, Lcom/moji/index/TidePresenter;->a(J)Ljava/lang/String;
|
|
|
|
move-result-object v8
|
|
|
|
const-string v9, "date"
|
|
|
|
.line 143
|
|
invoke-virtual {v5, v9}, Lorg/json/JSONObject;->optString(Ljava/lang/String;)Ljava/lang/String;
|
|
|
|
move-result-object v9
|
|
|
|
const-string v10, "level"
|
|
|
|
.line 144
|
|
invoke-virtual {v5, v10}, Lorg/json/JSONObject;->optInt(Ljava/lang/String;)I
|
|
|
|
move-result v5
|
|
|
|
.line 146
|
|
new-instance v10, Lcom/moji/index/TideRangeData;
|
|
|
|
invoke-direct {v10}, Lcom/moji/index/TideRangeData;-><init>()V
|
|
|
|
.line 147
|
|
iput-object v8, v10, Lcom/moji/index/TideRangeData;->date:Ljava/lang/String;
|
|
|
|
.line 148
|
|
iput v5, v10, Lcom/moji/index/TideRangeData;->level:I
|
|
|
|
.line 149
|
|
iput-wide v6, v10, Lcom/moji/index/TideRangeData;->time:J
|
|
|
|
.line 150
|
|
iput-object v9, v10, Lcom/moji/index/TideRangeData;->dayDate:Ljava/lang/String;
|
|
|
|
.line 151
|
|
iget-object v5, v2, Lcom/moji/index/DailyTideBriefInfo;->tideRanges:Ljava/util/ArrayList;
|
|
|
|
invoke-virtual {v5, v10}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
|
|
|
|
add-int/lit8 v3, v3, 0x1
|
|
|
|
goto :goto_1
|
|
|
|
.line 153
|
|
:cond_0
|
|
iget-object v3, p0, Lcom/moji/index/TidePresenter;->h:Ljava/util/List;
|
|
|
|
invoke-interface {v3, v2}, Ljava/util/List;->add(Ljava/lang/Object;)Z
|
|
|
|
:cond_1
|
|
add-int/lit8 v1, v1, 0x1
|
|
|
|
goto/16 :goto_0
|
|
|
|
.line 156
|
|
:cond_2
|
|
iget-object p1, p0, Lcom/moji/index/TidePresenter;->i:Landroid/os/Handler;
|
|
|
|
const/4 v0, 0x1
|
|
|
|
invoke-virtual {p1, v0}, Landroid/os/Handler;->sendEmptyMessage(I)Z
|
|
:try_end_0
|
|
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
:catch_0
|
|
:cond_3
|
|
return-void
|
|
.end method
|