413 lines
10 KiB
Smali
413 lines
10 KiB
Smali
.class public Lcom/moji/router/MJRouter;
|
|
.super Ljava/lang/Object;
|
|
.source "MJRouter.java"
|
|
|
|
|
|
# static fields
|
|
.field private static a:Lcom/moji/router/MJRouter;
|
|
|
|
.field private static b:Landroid/app/Application;
|
|
|
|
.field private static e:Z
|
|
|
|
|
|
# instance fields
|
|
.field private c:Ljava/util/Map;
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Ljava/util/Map<",
|
|
"Ljava/lang/String;",
|
|
"Lcom/moji/router/RouteMeta;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
.end field
|
|
|
|
.field private d:Landroid/util/LruCache;
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Landroid/util/LruCache<",
|
|
"Ljava/lang/String;",
|
|
"Lcom/moji/router/ISyringe;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
.end field
|
|
|
|
|
|
# direct methods
|
|
.method static constructor <clinit>()V
|
|
.locals 1
|
|
|
|
.line 24
|
|
new-instance v0, Lcom/moji/router/MJRouter;
|
|
|
|
invoke-direct {v0}, Lcom/moji/router/MJRouter;-><init>()V
|
|
|
|
sput-object v0, Lcom/moji/router/MJRouter;->a:Lcom/moji/router/MJRouter;
|
|
|
|
const/4 v0, 0x0
|
|
|
|
.line 28
|
|
sput-boolean v0, Lcom/moji/router/MJRouter;->e:Z
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method private constructor <init>()V
|
|
.locals 2
|
|
|
|
.line 30
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
.line 26
|
|
new-instance v0, Ljava/util/HashMap;
|
|
|
|
invoke-direct {v0}, Ljava/util/HashMap;-><init>()V
|
|
|
|
iput-object v0, p0, Lcom/moji/router/MJRouter;->c:Ljava/util/Map;
|
|
|
|
.line 27
|
|
new-instance v0, Landroid/util/LruCache;
|
|
|
|
const/16 v1, 0xa
|
|
|
|
invoke-direct {v0, v1}, Landroid/util/LruCache;-><init>(I)V
|
|
|
|
iput-object v0, p0, Lcom/moji/router/MJRouter;->d:Landroid/util/LruCache;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static a()Lcom/moji/router/MJRouter;
|
|
.locals 1
|
|
|
|
.line 34
|
|
sget-object v0, Lcom/moji/router/MJRouter;->a:Lcom/moji/router/MJRouter;
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public static a(Landroid/app/Application;)V
|
|
.locals 0
|
|
|
|
.line 38
|
|
sput-object p0, Lcom/moji/router/MJRouter;->b:Landroid/app/Application;
|
|
|
|
.line 39
|
|
invoke-static {}, Lcom/moji/router/MJRouter;->a()Lcom/moji/router/MJRouter;
|
|
|
|
move-result-object p0
|
|
|
|
iget-object p0, p0, Lcom/moji/router/MJRouter;->c:Ljava/util/Map;
|
|
|
|
invoke-static {p0}, Lcom/moji/router/ActivityInfo;->a(Ljava/util/Map;)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public a(Ljava/lang/String;)Lcom/moji/router/Postcard;
|
|
.locals 1
|
|
|
|
.line 62
|
|
invoke-static {p1}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
|
|
|
|
move-result v0
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
.line 65
|
|
new-instance v0, Lcom/moji/router/Postcard;
|
|
|
|
invoke-direct {v0, p1}, Lcom/moji/router/Postcard;-><init>(Ljava/lang/String;)V
|
|
|
|
return-object v0
|
|
|
|
.line 63
|
|
:cond_0
|
|
new-instance p1, Ljava/lang/IllegalArgumentException;
|
|
|
|
const-string v0, "MJRouter\uff1aParameter is invalid!"
|
|
|
|
invoke-direct {p1, v0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw p1
|
|
.end method
|
|
|
|
.method a(Landroid/content/Context;ILcom/moji/router/Postcard;)V
|
|
.locals 5
|
|
|
|
.line 74
|
|
sget-boolean v0, Lcom/moji/router/MJRouter;->e:Z
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
.line 75
|
|
iget-object v0, p0, Lcom/moji/router/MJRouter;->c:Ljava/util/Map;
|
|
|
|
invoke-interface {v0}, Ljava/util/Map;->entrySet()Ljava/util/Set;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-interface {v0}, Ljava/util/Set;->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_0
|
|
|
|
invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
|
|
|
|
move-result-object v1
|
|
|
|
check-cast v1, Ljava/util/Map$Entry;
|
|
|
|
const-string v2, "MJRouter"
|
|
|
|
.line 76
|
|
new-instance v3, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
const-string v4, "start: "
|
|
|
|
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-interface {v1}, Ljava/util/Map$Entry;->getKey()Ljava/lang/Object;
|
|
|
|
move-result-object v4
|
|
|
|
check-cast v4, Ljava/lang/String;
|
|
|
|
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
const-string v4, ", "
|
|
|
|
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-interface {v1}, Ljava/util/Map$Entry;->getValue()Ljava/lang/Object;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v3, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-static {v2, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
|
|
|
|
goto :goto_0
|
|
|
|
.line 79
|
|
:cond_0
|
|
iget-object v0, p0, Lcom/moji/router/MJRouter;->c:Ljava/util/Map;
|
|
|
|
invoke-virtual {p3}, Lcom/moji/router/Postcard;->b()Ljava/lang/String;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-interface {v0, v1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
move-result-object v0
|
|
|
|
check-cast v0, Lcom/moji/router/RouteMeta;
|
|
|
|
if-eqz v0, :cond_7
|
|
|
|
.line 81
|
|
new-instance v1, Landroid/content/Intent;
|
|
|
|
invoke-direct {v1}, Landroid/content/Intent;-><init>()V
|
|
|
|
.line 82
|
|
new-instance v2, Landroid/content/ComponentName;
|
|
|
|
sget-object v3, Lcom/moji/router/MJRouter;->b:Landroid/app/Application;
|
|
|
|
invoke-virtual {v3}, Landroid/app/Application;->getPackageName()Ljava/lang/String;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-virtual {v0}, Lcom/moji/router/RouteMeta;->a()Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-direct {v2, v3, v0}, Landroid/content/ComponentName;-><init>(Ljava/lang/String;Ljava/lang/String;)V
|
|
|
|
invoke-virtual {v1, v2}, Landroid/content/Intent;->setComponent(Landroid/content/ComponentName;)Landroid/content/Intent;
|
|
|
|
.line 83
|
|
invoke-virtual {p3}, Lcom/moji/router/Postcard;->f()Landroid/os/Bundle;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {v1, v0}, Landroid/content/Intent;->putExtras(Landroid/os/Bundle;)Landroid/content/Intent;
|
|
|
|
.line 85
|
|
invoke-virtual {p3}, Lcom/moji/router/Postcard;->d()Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
.line 86
|
|
invoke-static {v0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
|
|
|
|
move-result v2
|
|
|
|
if-nez v2, :cond_1
|
|
|
|
.line 87
|
|
invoke-virtual {v1, v0}, Landroid/content/Intent;->setAction(Ljava/lang/String;)Landroid/content/Intent;
|
|
|
|
.line 90
|
|
:cond_1
|
|
invoke-virtual {p3}, Lcom/moji/router/Postcard;->e()Ljava/util/ArrayList;
|
|
|
|
move-result-object v0
|
|
|
|
if-eqz v0, :cond_2
|
|
|
|
.line 91
|
|
invoke-virtual {v0}, Ljava/util/ArrayList;->isEmpty()Z
|
|
|
|
move-result v2
|
|
|
|
if-nez v2, :cond_2
|
|
|
|
.line 92
|
|
invoke-virtual {v0}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator;
|
|
|
|
move-result-object v0
|
|
|
|
:goto_1
|
|
invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z
|
|
|
|
move-result v2
|
|
|
|
if-eqz v2, :cond_2
|
|
|
|
invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
|
|
|
|
move-result-object v2
|
|
|
|
check-cast v2, Ljava/lang/String;
|
|
|
|
.line 93
|
|
invoke-virtual {v1, v2}, Landroid/content/Intent;->addCategory(Ljava/lang/String;)Landroid/content/Intent;
|
|
|
|
goto :goto_1
|
|
|
|
.line 97
|
|
:cond_2
|
|
invoke-virtual {p3}, Lcom/moji/router/Postcard;->c()I
|
|
|
|
move-result p3
|
|
|
|
.line 98
|
|
instance-of v0, p1, Landroid/app/Activity;
|
|
|
|
const/4 v2, -0x1
|
|
|
|
if-nez v0, :cond_5
|
|
|
|
const/high16 v0, 0x10000000
|
|
|
|
if-eq v2, p3, :cond_4
|
|
|
|
and-int v2, p3, v0
|
|
|
|
if-nez v2, :cond_3
|
|
|
|
.line 101
|
|
invoke-virtual {v1, v0}, Landroid/content/Intent;->addFlags(I)Landroid/content/Intent;
|
|
|
|
const-string v0, "Router"
|
|
|
|
const-string v2, "Current context is not activity and flags not contain Intent.FLAG_ACTIVITY_NEW_TASK"
|
|
|
|
.line 102
|
|
invoke-static {v0, v2}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I
|
|
|
|
.line 105
|
|
:cond_3
|
|
invoke-virtual {v1, p3}, Landroid/content/Intent;->setFlags(I)Landroid/content/Intent;
|
|
|
|
goto :goto_2
|
|
|
|
.line 107
|
|
:cond_4
|
|
invoke-virtual {v1, v0}, Landroid/content/Intent;->setFlags(I)Landroid/content/Intent;
|
|
|
|
goto :goto_2
|
|
|
|
:cond_5
|
|
if-eq v2, p3, :cond_6
|
|
|
|
.line 111
|
|
invoke-virtual {v1, p3}, Landroid/content/Intent;->setFlags(I)Landroid/content/Intent;
|
|
|
|
.line 114
|
|
:cond_6
|
|
:goto_2
|
|
new-instance p3, Landroid/os/Handler;
|
|
|
|
invoke-static {}, Landroid/os/Looper;->getMainLooper()Landroid/os/Looper;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-direct {p3, v0}, Landroid/os/Handler;-><init>(Landroid/os/Looper;)V
|
|
|
|
new-instance v0, Lcom/moji/router/MJRouter$1;
|
|
|
|
invoke-direct {v0, p0, p2, p1, v1}, Lcom/moji/router/MJRouter$1;-><init>(Lcom/moji/router/MJRouter;ILandroid/content/Context;Landroid/content/Intent;)V
|
|
|
|
invoke-virtual {p3, v0}, Landroid/os/Handler;->post(Ljava/lang/Runnable;)Z
|
|
|
|
return-void
|
|
|
|
.line 128
|
|
:cond_7
|
|
new-instance p1, Ljava/lang/IllegalArgumentException;
|
|
|
|
new-instance p2, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {p2}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
const-string v0, "MJRouter\uff1aCan not find activity which path is "
|
|
|
|
invoke-virtual {p2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {p3}, Lcom/moji/router/Postcard;->b()Ljava/lang/String;
|
|
|
|
move-result-object p3
|
|
|
|
invoke-virtual {p2, p3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {p2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p2
|
|
|
|
invoke-direct {p1, p2}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw p1
|
|
.end method
|
|
|
|
.method a(Lcom/moji/router/Postcard;)V
|
|
.locals 2
|
|
|
|
.line 70
|
|
sget-object v0, Lcom/moji/router/MJRouter;->b:Landroid/app/Application;
|
|
|
|
const/4 v1, -0x1
|
|
|
|
invoke-virtual {p0, v0, v1, p1}, Lcom/moji/router/MJRouter;->a(Landroid/content/Context;ILcom/moji/router/Postcard;)V
|
|
|
|
return-void
|
|
.end method
|