162 lines
4.2 KiB
Smali
162 lines
4.2 KiB
Smali
|
|
.class public Lren/yale/android/cachewebviewlib/CachePreLoadService;
|
||
|
|
.super Landroid/app/Service;
|
||
|
|
.source "CachePreLoadService.java"
|
||
|
|
|
||
|
|
|
||
|
|
# static fields
|
||
|
|
.field public static final KEY_URL:Ljava/lang/String; = "preload_url_key"
|
||
|
|
|
||
|
|
.field public static final KEY_URL_HEADER:Ljava/lang/String; = "preload_url_key_header"
|
||
|
|
|
||
|
|
|
||
|
|
# instance fields
|
||
|
|
.field private mLastFinish:Z
|
||
|
|
|
||
|
|
|
||
|
|
# direct methods
|
||
|
|
.method public constructor <init>()V
|
||
|
|
.locals 1
|
||
|
|
|
||
|
|
.line 20
|
||
|
|
invoke-direct {p0}, Landroid/app/Service;-><init>()V
|
||
|
|
|
||
|
|
const/4 v0, 0x1
|
||
|
|
|
||
|
|
.line 23
|
||
|
|
iput-boolean v0, p0, Lren/yale/android/cachewebviewlib/CachePreLoadService;->mLastFinish:Z
|
||
|
|
|
||
|
|
return-void
|
||
|
|
.end method
|
||
|
|
|
||
|
|
.method static synthetic access$002(Lren/yale/android/cachewebviewlib/CachePreLoadService;Z)Z
|
||
|
|
.locals 0
|
||
|
|
|
||
|
|
.line 20
|
||
|
|
iput-boolean p1, p0, Lren/yale/android/cachewebviewlib/CachePreLoadService;->mLastFinish:Z
|
||
|
|
|
||
|
|
return p1
|
||
|
|
.end method
|
||
|
|
|
||
|
|
|
||
|
|
# virtual methods
|
||
|
|
.method public onBind(Landroid/content/Intent;)Landroid/os/IBinder;
|
||
|
|
.locals 0
|
||
|
|
|
||
|
|
const/4 p1, 0x0
|
||
|
|
|
||
|
|
return-object p1
|
||
|
|
.end method
|
||
|
|
|
||
|
|
.method public onCreate()V
|
||
|
|
.locals 0
|
||
|
|
|
||
|
|
.line 32
|
||
|
|
invoke-super {p0}, Landroid/app/Service;->onCreate()V
|
||
|
|
|
||
|
|
return-void
|
||
|
|
.end method
|
||
|
|
|
||
|
|
.method public onDestroy()V
|
||
|
|
.locals 0
|
||
|
|
|
||
|
|
.line 74
|
||
|
|
invoke-super {p0}, Landroid/app/Service;->onDestroy()V
|
||
|
|
|
||
|
|
return-void
|
||
|
|
.end method
|
||
|
|
|
||
|
|
.method public onStartCommand(Landroid/content/Intent;II)I
|
||
|
|
.locals 4
|
||
|
|
|
||
|
|
.line 37
|
||
|
|
invoke-virtual {p0}, Lren/yale/android/cachewebviewlib/CachePreLoadService;->getApplicationContext()Landroid/content/Context;
|
||
|
|
|
||
|
|
move-result-object v0
|
||
|
|
|
||
|
|
invoke-static {v0}, Lren/yale/android/cachewebviewlib/utils/NetworkUtils;->isConnected(Landroid/content/Context;)Z
|
||
|
|
|
||
|
|
move-result v0
|
||
|
|
|
||
|
|
if-nez v0, :cond_0
|
||
|
|
|
||
|
|
.line 38
|
||
|
|
invoke-super {p0, p1, p2, p3}, Landroid/app/Service;->onStartCommand(Landroid/content/Intent;II)I
|
||
|
|
|
||
|
|
move-result p1
|
||
|
|
|
||
|
|
return p1
|
||
|
|
|
||
|
|
:cond_0
|
||
|
|
const-string v0, "preload_url_key"
|
||
|
|
|
||
|
|
.line 40
|
||
|
|
invoke-virtual {p1, v0}, Landroid/content/Intent;->getStringExtra(Ljava/lang/String;)Ljava/lang/String;
|
||
|
|
|
||
|
|
move-result-object v0
|
||
|
|
|
||
|
|
.line 41
|
||
|
|
invoke-static {v0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
|
||
|
|
|
||
|
|
move-result v1
|
||
|
|
|
||
|
|
if-nez v1, :cond_1
|
||
|
|
|
||
|
|
iget-boolean v1, p0, Lren/yale/android/cachewebviewlib/CachePreLoadService;->mLastFinish:Z
|
||
|
|
|
||
|
|
if-eqz v1, :cond_1
|
||
|
|
|
||
|
|
const/4 v1, 0x0
|
||
|
|
|
||
|
|
.line 42
|
||
|
|
iput-boolean v1, p0, Lren/yale/android/cachewebviewlib/CachePreLoadService;->mLastFinish:Z
|
||
|
|
|
||
|
|
.line 43
|
||
|
|
new-instance v1, Lren/yale/android/cachewebviewlib/CacheWebView;
|
||
|
|
|
||
|
|
invoke-virtual {p0}, Lren/yale/android/cachewebviewlib/CachePreLoadService;->getApplicationContext()Landroid/content/Context;
|
||
|
|
|
||
|
|
move-result-object v2
|
||
|
|
|
||
|
|
invoke-direct {v1, v2}, Lren/yale/android/cachewebviewlib/CacheWebView;-><init>(Landroid/content/Context;)V
|
||
|
|
|
||
|
|
.line 44
|
||
|
|
sget-object v2, Lren/yale/android/cachewebviewlib/WebViewCache$CacheStrategy;->FORCE:Lren/yale/android/cachewebviewlib/WebViewCache$CacheStrategy;
|
||
|
|
|
||
|
|
invoke-virtual {v1, v2}, Lren/yale/android/cachewebviewlib/CacheWebView;->setCacheStrategy(Lren/yale/android/cachewebviewlib/WebViewCache$CacheStrategy;)V
|
||
|
|
|
||
|
|
const/4 v2, 0x0
|
||
|
|
|
||
|
|
:try_start_0
|
||
|
|
const-string v3, "preload_url_key_header"
|
||
|
|
|
||
|
|
.line 47
|
||
|
|
invoke-virtual {p1, v3}, Landroid/content/Intent;->getSerializableExtra(Ljava/lang/String;)Ljava/io/Serializable;
|
||
|
|
|
||
|
|
move-result-object v3
|
||
|
|
|
||
|
|
check-cast v3, Ljava/util/Map;
|
||
|
|
:try_end_0
|
||
|
|
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
|
||
|
|
|
||
|
|
move-object v2, v3
|
||
|
|
|
||
|
|
.line 50
|
||
|
|
:catch_0
|
||
|
|
invoke-virtual {v1, v0, v2}, Lren/yale/android/cachewebviewlib/CacheWebView;->loadUrl(Ljava/lang/String;Ljava/util/Map;)V
|
||
|
|
|
||
|
|
.line 51
|
||
|
|
new-instance v0, Lren/yale/android/cachewebviewlib/CachePreLoadService$1;
|
||
|
|
|
||
|
|
invoke-direct {v0, p0}, Lren/yale/android/cachewebviewlib/CachePreLoadService$1;-><init>(Lren/yale/android/cachewebviewlib/CachePreLoadService;)V
|
||
|
|
|
||
|
|
invoke-virtual {v1, v0}, Lren/yale/android/cachewebviewlib/CacheWebView;->setWebViewClient(Landroid/webkit/WebViewClient;)V
|
||
|
|
|
||
|
|
.line 69
|
||
|
|
:cond_1
|
||
|
|
invoke-super {p0, p1, p2, p3}, Landroid/app/Service;->onStartCommand(Landroid/content/Intent;II)I
|
||
|
|
|
||
|
|
move-result p1
|
||
|
|
|
||
|
|
return p1
|
||
|
|
.end method
|