今奥全景相机
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

313 lines
7.9 KiB

.class Lcom/squareup/picasso/ContactsPhotoRequestHandler;
.super Lcom/squareup/picasso/RequestHandler;
.source "ContactsPhotoRequestHandler.java"
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lcom/squareup/picasso/ContactsPhotoRequestHandler$ContactPhotoStreamIcs;
}
.end annotation
# static fields
.field private static final ID_CONTACT:I = 0x3
.field private static final ID_DISPLAY_PHOTO:I = 0x4
.field private static final ID_LOOKUP:I = 0x1
.field private static final ID_THUMBNAIL:I = 0x2
.field private static final matcher:Landroid/content/UriMatcher;
# instance fields
.field private final context:Landroid/content/Context;
# direct methods
.method static constructor <clinit>()V
.locals 4
.prologue
const/4 v3, 0x1
.line 49
new-instance v0, Landroid/content/UriMatcher;
const/4 v1, -0x1
invoke-direct {v0, v1}, Landroid/content/UriMatcher;-><init>(I)V
sput-object v0, Lcom/squareup/picasso/ContactsPhotoRequestHandler;->matcher:Landroid/content/UriMatcher;
.line 50
sget-object v0, Lcom/squareup/picasso/ContactsPhotoRequestHandler;->matcher:Landroid/content/UriMatcher;
const-string v1, "com.android.contacts"
const-string v2, "contacts/lookup/*/#"
invoke-virtual {v0, v1, v2, v3}, Landroid/content/UriMatcher;->addURI(Ljava/lang/String;Ljava/lang/String;I)V
.line 51
sget-object v0, Lcom/squareup/picasso/ContactsPhotoRequestHandler;->matcher:Landroid/content/UriMatcher;
const-string v1, "com.android.contacts"
const-string v2, "contacts/lookup/*"
invoke-virtual {v0, v1, v2, v3}, Landroid/content/UriMatcher;->addURI(Ljava/lang/String;Ljava/lang/String;I)V
.line 52
sget-object v0, Lcom/squareup/picasso/ContactsPhotoRequestHandler;->matcher:Landroid/content/UriMatcher;
const-string v1, "com.android.contacts"
const-string v2, "contacts/#/photo"
const/4 v3, 0x2
invoke-virtual {v0, v1, v2, v3}, Landroid/content/UriMatcher;->addURI(Ljava/lang/String;Ljava/lang/String;I)V
.line 53
sget-object v0, Lcom/squareup/picasso/ContactsPhotoRequestHandler;->matcher:Landroid/content/UriMatcher;
const-string v1, "com.android.contacts"
const-string v2, "contacts/#"
const/4 v3, 0x3
invoke-virtual {v0, v1, v2, v3}, Landroid/content/UriMatcher;->addURI(Ljava/lang/String;Ljava/lang/String;I)V
.line 54
sget-object v0, Lcom/squareup/picasso/ContactsPhotoRequestHandler;->matcher:Landroid/content/UriMatcher;
const-string v1, "com.android.contacts"
const-string v2, "display_photo/#"
const/4 v3, 0x4
invoke-virtual {v0, v1, v2, v3}, Landroid/content/UriMatcher;->addURI(Ljava/lang/String;Ljava/lang/String;I)V
.line 55
return-void
.end method
.method constructor <init>(Landroid/content/Context;)V
.locals 0
.prologue
.line 59
invoke-direct {p0}, Lcom/squareup/picasso/RequestHandler;-><init>()V
.line 60
iput-object p1, p0, Lcom/squareup/picasso/ContactsPhotoRequestHandler;->context:Landroid/content/Context;
.line 61
return-void
.end method
.method private getInputStream(Lcom/squareup/picasso/Request;)Ljava/io/InputStream;
.locals 4
.prologue
.line 76
iget-object v0, p0, Lcom/squareup/picasso/ContactsPhotoRequestHandler;->context:Landroid/content/Context;
invoke-virtual {v0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v1
.line 77
iget-object v0, p1, Lcom/squareup/picasso/Request;->uri:Landroid/net/Uri;
.line 78
sget-object v2, Lcom/squareup/picasso/ContactsPhotoRequestHandler;->matcher:Landroid/content/UriMatcher;
invoke-virtual {v2, v0}, Landroid/content/UriMatcher;->match(Landroid/net/Uri;)I
move-result v2
packed-switch v2, :pswitch_data_0
.line 95
new-instance v1, Ljava/lang/IllegalStateException;
new-instance v2, Ljava/lang/StringBuilder;
invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V
const-string v3, "Invalid uri: "
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v2
invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
move-result-object v0
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v0
invoke-direct {v1, v0}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
throw v1
.line 80
:pswitch_0
invoke-static {v1, v0}, Landroid/provider/ContactsContract$Contacts;->lookupContact(Landroid/content/ContentResolver;Landroid/net/Uri;)Landroid/net/Uri;
move-result-object v0
.line 81
if-nez v0, :cond_0
.line 82
const/4 v0, 0x0
.line 93
:goto_0
return-object v0
.line 86
:cond_0
:pswitch_1
sget v2, Landroid/os/Build$VERSION;->SDK_INT:I
const/16 v3, 0xe
if-ge v2, v3, :cond_1
.line 87
invoke-static {v1, v0}, Landroid/provider/ContactsContract$Contacts;->openContactPhotoInputStream(Landroid/content/ContentResolver;Landroid/net/Uri;)Ljava/io/InputStream;
move-result-object v0
goto :goto_0
.line 89
:cond_1
invoke-static {v1, v0}, Lcom/squareup/picasso/ContactsPhotoRequestHandler$ContactPhotoStreamIcs;->get(Landroid/content/ContentResolver;Landroid/net/Uri;)Ljava/io/InputStream;
move-result-object v0
goto :goto_0
.line 93
:pswitch_2
invoke-virtual {v1, v0}, Landroid/content/ContentResolver;->openInputStream(Landroid/net/Uri;)Ljava/io/InputStream;
move-result-object v0
goto :goto_0
.line 78
nop
:pswitch_data_0
.packed-switch 0x1
:pswitch_0
:pswitch_2
:pswitch_1
:pswitch_2
.end packed-switch
.end method
# virtual methods
.method public canHandleRequest(Lcom/squareup/picasso/Request;)Z
.locals 3
.prologue
.line 64
iget-object v0, p1, Lcom/squareup/picasso/Request;->uri:Landroid/net/Uri;
.line 65
const-string v1, "content"
invoke-virtual {v0}, Landroid/net/Uri;->getScheme()Ljava/lang/String;
move-result-object v2
invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v1
if-eqz v1, :cond_0
sget-object v1, Landroid/provider/ContactsContract$Contacts;->CONTENT_URI:Landroid/net/Uri;
.line 66
invoke-virtual {v1}, Landroid/net/Uri;->getHost()Ljava/lang/String;
move-result-object v1
invoke-virtual {v0}, Landroid/net/Uri;->getHost()Ljava/lang/String;
move-result-object v0
invoke-virtual {v1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_0
sget-object v0, Lcom/squareup/picasso/ContactsPhotoRequestHandler;->matcher:Landroid/content/UriMatcher;
iget-object v1, p1, Lcom/squareup/picasso/Request;->uri:Landroid/net/Uri;
.line 67
invoke-virtual {v0, v1}, Landroid/content/UriMatcher;->match(Landroid/net/Uri;)I
move-result v0
const/4 v1, -0x1
if-eq v0, v1, :cond_0
const/4 v0, 0x1
.line 65
:goto_0
return v0
.line 67
:cond_0
const/4 v0, 0x0
goto :goto_0
.end method
.method public load(Lcom/squareup/picasso/Request;I)Lcom/squareup/picasso/RequestHandler$Result;
.locals 3
.prologue
.line 71
invoke-direct {p0, p1}, Lcom/squareup/picasso/ContactsPhotoRequestHandler;->getInputStream(Lcom/squareup/picasso/Request;)Ljava/io/InputStream;
move-result-object v1
.line 72
if-eqz v1, :cond_0
new-instance v0, Lcom/squareup/picasso/RequestHandler$Result;
sget-object v2, Lcom/squareup/picasso/Picasso$LoadedFrom;->DISK:Lcom/squareup/picasso/Picasso$LoadedFrom;
invoke-direct {v0, v1, v2}, Lcom/squareup/picasso/RequestHandler$Result;-><init>(Ljava/io/InputStream;Lcom/squareup/picasso/Picasso$LoadedFrom;)V
:goto_0
return-object v0
:cond_0
const/4 v0, 0x0
goto :goto_0
.end method