.class Lcom/moji/location/worker/AmapLocationWorker$1;
.super Ljava/lang/Object;
.source "AmapLocationWorker.java"

# interfaces
.implements Lcom/amap/api/location/AMapLocationListener;


# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Lcom/moji/location/worker/AmapLocationWorker;->a(Landroid/content/Context;Lcom/moji/location/worker/AbsLocationWorker$AbsMJLocationListener;Lcom/amap/api/location/AMapLocationClientOption;)V
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation


# instance fields
.field final synthetic a:Landroid/content/Context;

.field final synthetic b:Lcom/moji/location/worker/AbsLocationWorker$AbsMJLocationListener;

.field final synthetic c:Lcom/amap/api/location/AMapLocationClientOption;

.field final synthetic d:Lcom/moji/location/worker/AmapLocationWorker;


# direct methods
.method constructor <init>(Lcom/moji/location/worker/AmapLocationWorker;Landroid/content/Context;Lcom/moji/location/worker/AbsLocationWorker$AbsMJLocationListener;Lcom/amap/api/location/AMapLocationClientOption;)V
    .locals 0

    .line 82
    iput-object p1, p0, Lcom/moji/location/worker/AmapLocationWorker$1;->d:Lcom/moji/location/worker/AmapLocationWorker;

    iput-object p2, p0, Lcom/moji/location/worker/AmapLocationWorker$1;->a:Landroid/content/Context;

    iput-object p3, p0, Lcom/moji/location/worker/AmapLocationWorker$1;->b:Lcom/moji/location/worker/AbsLocationWorker$AbsMJLocationListener;

    iput-object p4, p0, Lcom/moji/location/worker/AmapLocationWorker$1;->c:Lcom/amap/api/location/AMapLocationClientOption;

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

    return-void
.end method


# virtual methods
.method public onLocationChanged(Lcom/amap/api/location/AMapLocation;)V
    .locals 9

    const-string v0, "AmapLocationWorker"

    const-string v1, "onLocationChanged:"

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

    .line 86
    iget-object v0, p0, Lcom/moji/location/worker/AmapLocationWorker$1;->d:Lcom/moji/location/worker/AmapLocationWorker;

    invoke-virtual {v0}, Lcom/moji/location/worker/AmapLocationWorker;->e()V

    .line 87
    iget-object v0, p0, Lcom/moji/location/worker/AmapLocationWorker$1;->d:Lcom/moji/location/worker/AmapLocationWorker;

    invoke-static {v0}, Lcom/moji/location/worker/AmapLocationWorker;->a(Lcom/moji/location/worker/AmapLocationWorker;)I

    move-result v0

    if-nez v0, :cond_0

    .line 88
    iget-object v0, p0, Lcom/moji/location/worker/AmapLocationWorker$1;->d:Lcom/moji/location/worker/AmapLocationWorker;

    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v1

    invoke-static {v0, v1, v2}, Lcom/moji/location/worker/AmapLocationWorker;->a(Lcom/moji/location/worker/AmapLocationWorker;J)J

    .line 90
    :cond_0
    iget-object v0, p0, Lcom/moji/location/worker/AmapLocationWorker$1;->d:Lcom/moji/location/worker/AmapLocationWorker;

    invoke-static {v0}, Lcom/moji/location/worker/AmapLocationWorker;->b(Lcom/moji/location/worker/AmapLocationWorker;)Z

    move-result v0

    const-wide/16 v1, 0x3a98

    if-nez v0, :cond_3

    .line 91
    iget-object v0, p0, Lcom/moji/location/worker/AmapLocationWorker$1;->d:Lcom/moji/location/worker/AmapLocationWorker;

    invoke-static {v0}, Lcom/moji/location/worker/AmapLocationWorker;->c(Lcom/moji/location/worker/AmapLocationWorker;)Landroid/os/Handler;

    move-result-object v0

    const/16 v3, 0x21

    invoke-virtual {v0, v3, v1, v2}, Landroid/os/Handler;->sendEmptyMessageDelayed(IJ)Z

    .line 92
    iget-object v0, p0, Lcom/moji/location/worker/AmapLocationWorker$1;->d:Lcom/moji/location/worker/AmapLocationWorker;

    invoke-static {v0}, Lcom/moji/location/worker/AmapLocationWorker;->d(Lcom/moji/location/worker/AmapLocationWorker;)Z

    move-result v0

    if-eqz v0, :cond_1

    return-void

    .line 95
    :cond_1
    invoke-static {}, Lcom/moji/location/util/LocationUtil;->a()Z

    move-result v0

    if-eqz v0, :cond_2

    if-eqz p1, :cond_2

    invoke-virtual {p1}, Lcom/amap/api/location/AMapLocation;->getStreet()Ljava/lang/String;

    move-result-object v0

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

    move-result v0

    if-eqz v0, :cond_2

    invoke-virtual {p1}, Lcom/amap/api/location/AMapLocation;->getAoiName()Ljava/lang/String;

    move-result-object v0

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

    move-result v0

    if-eqz v0, :cond_2

    .line 96
    invoke-virtual {p1}, Lcom/amap/api/location/AMapLocation;->getLatitude()D

    move-result-wide v3

    invoke-virtual {p1}, Lcom/amap/api/location/AMapLocation;->getLongitude()D

    move-result-wide v5

    invoke-static {v3, v4, v5, v6}, Lcom/moji/location/util/LocationUtil;->a(DD)Z

    move-result v0

    if-eqz v0, :cond_2

    const-string v0, "AmapLocationWorker"

    const-string v1, "amap location return with no address need to use ReGeo search"

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

    .line 98
    new-instance v0, Lcom/moji/location/geo/MJLatLonPoint;

    invoke-virtual {p1}, Lcom/amap/api/location/AMapLocation;->getLatitude()D

    move-result-wide v1

    invoke-virtual {p1}, Lcom/amap/api/location/AMapLocation;->getLongitude()D

    move-result-wide v3

    invoke-direct {v0, v1, v2, v3, v4}, Lcom/moji/location/geo/MJLatLonPoint;-><init>(DD)V

    .line 99
    new-instance v1, Lcom/moji/location/geo/MJReGeoCodeQuery;

    const/4 v2, 0x0

    invoke-direct {v1, v0, v2}, Lcom/moji/location/geo/MJReGeoCodeQuery;-><init>(Lcom/moji/location/geo/MJLatLonPoint;F)V

    .line 100
    new-instance v0, Lcom/moji/location/MJLocationManager;

    invoke-direct {v0}, Lcom/moji/location/MJLocationManager;-><init>()V

    iget-object v2, p0, Lcom/moji/location/worker/AmapLocationWorker$1;->a:Landroid/content/Context;

    new-instance v3, Lcom/moji/location/worker/AmapLocationWorker$1$1;

    invoke-direct {v3, p0, p1}, Lcom/moji/location/worker/AmapLocationWorker$1$1;-><init>(Lcom/moji/location/worker/AmapLocationWorker$1;Lcom/amap/api/location/AMapLocation;)V

    invoke-virtual {v0, v2, v1, v3}, Lcom/moji/location/MJLocationManager;->a(Landroid/content/Context;Lcom/moji/location/geo/MJReGeoCodeQuery;Lcom/moji/location/MJOnGeoCodeSearchListener;)V

    return-void

    .line 115
    :cond_2
    iget-object v0, p0, Lcom/moji/location/worker/AmapLocationWorker$1;->d:Lcom/moji/location/worker/AmapLocationWorker;

    iget-object v3, p0, Lcom/moji/location/worker/AmapLocationWorker$1;->a:Landroid/content/Context;

    iget-object v4, p0, Lcom/moji/location/worker/AmapLocationWorker$1;->b:Lcom/moji/location/worker/AbsLocationWorker$AbsMJLocationListener;

    invoke-static {v0, v3, p1, v4}, Lcom/moji/location/worker/AmapLocationWorker;->a(Lcom/moji/location/worker/AmapLocationWorker;Landroid/content/Context;Lcom/amap/api/location/AMapLocation;Lcom/moji/location/worker/AbsLocationWorker$AbsMJLocationListener;)V

    .line 116
    iget-object v0, p0, Lcom/moji/location/worker/AmapLocationWorker$1;->d:Lcom/moji/location/worker/AmapLocationWorker;

    const/4 v3, 0x1

    invoke-static {v0, v3}, Lcom/moji/location/worker/AmapLocationWorker;->a(Lcom/moji/location/worker/AmapLocationWorker;Z)Z

    .line 119
    :cond_3
    iget-object v0, p0, Lcom/moji/location/worker/AmapLocationWorker$1;->c:Lcom/amap/api/location/AMapLocationClientOption;

    invoke-virtual {v0}, Lcom/amap/api/location/AMapLocationClientOption;->isSensorEnable()Z

    move-result v0

    const-wide/16 v3, 0x0

    if-eqz v0, :cond_5

    invoke-static {}, Lcom/moji/tool/DeviceTool;->n()Z

    move-result v0

    if-eqz v0, :cond_5

    iget-object v0, p0, Lcom/moji/location/worker/AmapLocationWorker$1;->d:Lcom/moji/location/worker/AmapLocationWorker;

    invoke-static {v0}, Lcom/moji/location/worker/AmapLocationWorker;->e(Lcom/moji/location/worker/AmapLocationWorker;)I

    move-result v0

    const/16 v5, 0xa

    if-ge v0, v5, :cond_5

    if-eqz p1, :cond_4

    invoke-virtual {p1}, Lcom/amap/api/location/AMapLocation;->getAltitude()D

    move-result-wide v5

    cmpl-double v0, v5, v3

    if-nez v0, :cond_5

    .line 120
    :cond_4
    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v5

    iget-object v0, p0, Lcom/moji/location/worker/AmapLocationWorker$1;->d:Lcom/moji/location/worker/AmapLocationWorker;

    invoke-static {v0}, Lcom/moji/location/worker/AmapLocationWorker;->f(Lcom/moji/location/worker/AmapLocationWorker;)J

    move-result-wide v7

    sub-long/2addr v5, v7

    cmp-long v0, v5, v1

    if-gez v0, :cond_5

    const-string p1, "AmapLocationWorker"

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

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

    const-string v1, "wait for altitude mLocTimes:"

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

    iget-object v1, p0, Lcom/moji/location/worker/AmapLocationWorker$1;->d:Lcom/moji/location/worker/AmapLocationWorker;

    invoke-static {v1}, Lcom/moji/location/worker/AmapLocationWorker;->a(Lcom/moji/location/worker/AmapLocationWorker;)I

    move-result v1

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

    const-string v1, ", waiting time:"

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

    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v1

    iget-object v3, p0, Lcom/moji/location/worker/AmapLocationWorker$1;->d:Lcom/moji/location/worker/AmapLocationWorker;

    invoke-static {v3}, Lcom/moji/location/worker/AmapLocationWorker;->f(Lcom/moji/location/worker/AmapLocationWorker;)J

    move-result-wide v3

    sub-long/2addr v1, v3

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

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

    move-result-object v0

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

    return-void

    .line 125
    :cond_5
    iget-object v0, p0, Lcom/moji/location/worker/AmapLocationWorker$1;->c:Lcom/amap/api/location/AMapLocationClientOption;

    invoke-virtual {v0}, Lcom/amap/api/location/AMapLocationClientOption;->isSensorEnable()Z

    move-result v0

    if-eqz v0, :cond_6

    if-eqz p1, :cond_6

    invoke-virtual {p1}, Lcom/amap/api/location/AMapLocation;->getAltitude()D

    move-result-wide v0

    cmpl-double v2, v0, v3

    if-eqz v2, :cond_6

    invoke-virtual {p1}, Lcom/amap/api/location/AMapLocation;->getLatitude()D

    move-result-wide v0

    invoke-virtual {p1}, Lcom/amap/api/location/AMapLocation;->getLongitude()D

    move-result-wide v2

    invoke-static {v0, v1, v2, v3}, Lcom/moji/location/util/LocationUtil;->a(DD)Z

    move-result v0

    if-eqz v0, :cond_6

    .line 126
    iget-object v0, p0, Lcom/moji/location/worker/AmapLocationWorker$1;->a:Landroid/content/Context;

    sget-object v1, Lcom/moji/location/MJLocationSource;->AMAP_LOCATION:Lcom/moji/location/MJLocationSource;

    new-instance v2, Lcom/moji/location/entity/AmapLocationParser;

    invoke-direct {v2}, Lcom/moji/location/entity/AmapLocationParser;-><init>()V

    invoke-virtual {v2, p1}, Lcom/moji/location/entity/AmapLocationParser;->a(Lcom/amap/api/location/AMapLocation;)Lcom/moji/location/entity/MJLocation;

    move-result-object v2

    invoke-static {v0, v1, v2}, Lcom/moji/location/provider/HistoryLocationHelper;->a(Landroid/content/Context;Lcom/moji/location/MJLocationSource;Lcom/moji/location/entity/MJLocation;)V

    .line 128
    :cond_6
    iget-object v0, p0, Lcom/moji/location/worker/AmapLocationWorker$1;->b:Lcom/moji/location/worker/AbsLocationWorker$AbsMJLocationListener;

    if-eqz v0, :cond_7

    .line 129
    iget-object v0, p0, Lcom/moji/location/worker/AmapLocationWorker$1;->d:Lcom/moji/location/worker/AmapLocationWorker;

    invoke-static {v0}, Lcom/moji/location/worker/AmapLocationWorker;->c(Lcom/moji/location/worker/AmapLocationWorker;)Landroid/os/Handler;

    move-result-object v0

    const/16 v1, 0x16

    invoke-virtual {v0, v1}, Landroid/os/Handler;->obtainMessage(I)Landroid/os/Message;

    move-result-object v0

    .line 130
    iput-object p1, v0, Landroid/os/Message;->obj:Ljava/lang/Object;

    .line 131
    iget-object p1, p0, Lcom/moji/location/worker/AmapLocationWorker$1;->d:Lcom/moji/location/worker/AmapLocationWorker;

    invoke-static {p1}, Lcom/moji/location/worker/AmapLocationWorker;->c(Lcom/moji/location/worker/AmapLocationWorker;)Landroid/os/Handler;

    move-result-object p1

    invoke-virtual {p1, v0}, Landroid/os/Handler;->sendMessage(Landroid/os/Message;)Z

    .line 134
    :cond_7
    :try_start_0
    iget-object p1, p0, Lcom/moji/location/worker/AmapLocationWorker$1;->d:Lcom/moji/location/worker/AmapLocationWorker;

    invoke-static {p1}, Lcom/moji/location/worker/AmapLocationWorker;->g(Lcom/moji/location/worker/AmapLocationWorker;)Lcom/amap/api/location/AMapLocationClient;

    move-result-object p1

    invoke-virtual {p1}, Lcom/amap/api/location/AMapLocationClient;->stopLocation()V

    .line 135
    iget-object p1, p0, Lcom/moji/location/worker/AmapLocationWorker$1;->d:Lcom/moji/location/worker/AmapLocationWorker;

    invoke-static {p1}, Lcom/moji/location/worker/AmapLocationWorker;->g(Lcom/moji/location/worker/AmapLocationWorker;)Lcom/amap/api/location/AMapLocationClient;

    move-result-object p1

    iget-object v0, p0, Lcom/moji/location/worker/AmapLocationWorker$1;->d:Lcom/moji/location/worker/AmapLocationWorker;

    invoke-static {v0}, Lcom/moji/location/worker/AmapLocationWorker;->h(Lcom/moji/location/worker/AmapLocationWorker;)Lcom/amap/api/location/AMapLocationListener;

    move-result-object v0

    invoke-virtual {p1, v0}, Lcom/amap/api/location/AMapLocationClient;->unRegisterLocationListener(Lcom/amap/api/location/AMapLocationListener;)V

    .line 136
    iget-object p1, p0, Lcom/moji/location/worker/AmapLocationWorker$1;->d:Lcom/moji/location/worker/AmapLocationWorker;

    invoke-static {p1}, Lcom/moji/location/worker/AmapLocationWorker;->g(Lcom/moji/location/worker/AmapLocationWorker;)Lcom/amap/api/location/AMapLocationClient;

    move-result-object p1

    invoke-virtual {p1}, Lcom/amap/api/location/AMapLocationClient;->onDestroy()V

    const-string p1, "AmapLocationWorker"

    const-string v0, "stop and destroy location client"

    .line 137
    invoke-static {p1, v0}, Lcom/moji/tool/log/MJLogger;->c(Ljava/lang/String;Ljava/lang/String;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    :catch_0
    move-exception p1

    const-string v0, "AmapLocationWorker"

    .line 139
    invoke-static {v0, p1}, Lcom/moji/tool/log/MJLogger;->a(Ljava/lang/String;Ljava/lang/Throwable;)V

    :goto_0
    return-void
.end method
