2020-05-17 12:40:10 +00:00
|
|
|
.class public Lcom/miguelgaeta/media_picker/MediaPickerUri;
|
|
|
|
.super Ljava/lang/Object;
|
|
|
|
.source "MediaPickerUri.java"
|
|
|
|
|
|
|
|
|
|
|
|
# static fields
|
|
|
|
.field public static final AUTHORITY_DOWNLOADS_DOCUMENT:Ljava/lang/String; = "com.android.providers.downloads.documents"
|
|
|
|
|
|
|
|
.field public static final AUTHORITY_EXTERNAL_STORAGE:Ljava/lang/String; = "com.android.externalstorage.documents"
|
|
|
|
|
|
|
|
.field public static final AUTHORITY_GOOGLE_PHOTOS:Ljava/lang/String; = "com.google.android.apps.photos.content"
|
|
|
|
|
|
|
|
.field public static final AUTHORITY_MEDIA_DOCUMENT:Ljava/lang/String; = "com.android.providers.media.documents"
|
|
|
|
|
|
|
|
|
|
|
|
# direct methods
|
|
|
|
.method public constructor <init>()V
|
|
|
|
.locals 0
|
|
|
|
|
|
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
|
|
|
|
return-void
|
|
|
|
.end method
|
|
|
|
|
|
|
|
.method public static getDataColumn(Landroid/content/Context;Landroid/net/Uri;Ljava/lang/String;[Ljava/lang/String;)Ljava/lang/String;
|
|
|
|
.locals 8
|
|
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
|
|
value = {
|
|
|
|
Ljava/io/IOException;
|
|
|
|
}
|
|
|
|
.end annotation
|
|
|
|
|
|
|
|
const-string v0, "_data"
|
|
|
|
|
|
|
|
filled-new-array {v0}, [Ljava/lang/String;
|
|
|
|
|
|
|
|
move-result-object v3
|
|
|
|
|
|
|
|
const/4 v7, 0x0
|
|
|
|
|
|
|
|
:try_start_0
|
|
|
|
invoke-virtual {p0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
|
|
|
|
|
|
|
|
move-result-object v1
|
|
|
|
|
|
|
|
const/4 v6, 0x0
|
|
|
|
|
|
|
|
move-object v2, p1
|
|
|
|
|
|
|
|
move-object v4, p2
|
|
|
|
|
|
|
|
move-object v5, p3
|
|
|
|
|
|
|
|
invoke-virtual/range {v1 .. v6}, Landroid/content/ContentResolver;->query(Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;
|
|
|
|
|
|
|
|
move-result-object p0
|
|
|
|
:try_end_0
|
|
|
|
.catch Ljava/lang/IllegalArgumentException; {:try_start_0 .. :try_end_0} :catch_1
|
|
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_1
|
|
|
|
|
|
|
|
if-eqz p0, :cond_0
|
|
|
|
|
|
|
|
:try_start_1
|
|
|
|
invoke-interface {p0}, Landroid/database/Cursor;->moveToFirst()Z
|
|
|
|
|
|
|
|
move-result p1
|
|
|
|
|
|
|
|
if-eqz p1, :cond_0
|
|
|
|
|
|
|
|
invoke-interface {p0, v0}, Landroid/database/Cursor;->getColumnIndexOrThrow(Ljava/lang/String;)I
|
|
|
|
|
|
|
|
move-result p1
|
|
|
|
|
|
|
|
invoke-interface {p0, p1}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;
|
|
|
|
|
|
|
|
move-result-object p1
|
|
|
|
:try_end_1
|
|
|
|
.catch Ljava/lang/IllegalArgumentException; {:try_start_1 .. :try_end_1} :catch_0
|
|
|
|
.catchall {:try_start_1 .. :try_end_1} :catchall_0
|
|
|
|
|
|
|
|
invoke-interface {p0}, Landroid/database/Cursor;->close()V
|
|
|
|
|
|
|
|
return-object p1
|
|
|
|
|
|
|
|
:catchall_0
|
|
|
|
move-exception p1
|
|
|
|
|
|
|
|
move-object v7, p0
|
|
|
|
|
|
|
|
goto :goto_1
|
|
|
|
|
|
|
|
:catch_0
|
|
|
|
move-exception p1
|
|
|
|
|
|
|
|
move-object v7, p0
|
|
|
|
|
|
|
|
goto :goto_0
|
|
|
|
|
|
|
|
:cond_0
|
|
|
|
if-eqz p0, :cond_1
|
|
|
|
|
|
|
|
invoke-interface {p0}, Landroid/database/Cursor;->close()V
|
|
|
|
|
|
|
|
:cond_1
|
|
|
|
return-object v7
|
|
|
|
|
|
|
|
:catchall_1
|
|
|
|
move-exception p1
|
|
|
|
|
|
|
|
goto :goto_1
|
|
|
|
|
|
|
|
:catch_1
|
|
|
|
move-exception p1
|
|
|
|
|
|
|
|
:goto_0
|
|
|
|
:try_start_2
|
|
|
|
new-instance p0, Ljava/io/IOException;
|
|
|
|
|
|
|
|
const-string p2, "Unable to read data column for intent."
|
|
|
|
|
|
|
|
invoke-direct {p0, p2, p1}, Ljava/io/IOException;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V
|
|
|
|
|
|
|
|
throw p0
|
|
|
|
:try_end_2
|
|
|
|
.catchall {:try_start_2 .. :try_end_2} :catchall_1
|
|
|
|
|
|
|
|
:goto_1
|
|
|
|
if-eqz v7, :cond_2
|
|
|
|
|
|
|
|
invoke-interface {v7}, Landroid/database/Cursor;->close()V
|
|
|
|
|
|
|
|
:cond_2
|
|
|
|
throw p1
|
|
|
|
.end method
|
|
|
|
|
|
|
|
.method public static getPath(Landroid/content/Context;Landroid/net/Uri;)Ljava/lang/String;
|
|
|
|
.locals 5
|
|
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
|
|
value = {
|
|
|
|
Ljava/io/IOException;
|
|
|
|
}
|
|
|
|
.end annotation
|
|
|
|
|
|
|
|
invoke-static {p0, p1}, Lcom/miguelgaeta/media_picker/MediaPickerUri;->isDocumentsProviderUri(Landroid/content/Context;Landroid/net/Uri;)Z
|
|
|
|
|
|
|
|
move-result v0
|
|
|
|
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
|
|
|
|
invoke-static {p0, p1}, Lcom/miguelgaeta/media_picker/MediaPickerUri;->getPathFromDocumentsProvider(Landroid/content/Context;Landroid/net/Uri;)Ljava/lang/String;
|
|
|
|
|
|
|
|
move-result-object p0
|
|
|
|
|
|
|
|
return-object p0
|
|
|
|
|
|
|
|
:cond_0
|
|
|
|
invoke-virtual {p1}, Landroid/net/Uri;->getScheme()Ljava/lang/String;
|
|
|
|
|
|
|
|
move-result-object v0
|
|
|
|
|
|
|
|
if-eqz v0, :cond_8
|
|
|
|
|
|
|
|
invoke-virtual {p1}, Landroid/net/Uri;->getScheme()Ljava/lang/String;
|
|
|
|
|
|
|
|
move-result-object v0
|
|
|
|
|
|
|
|
const/4 v1, -0x1
|
|
|
|
|
|
|
|
invoke-virtual {v0}, Ljava/lang/String;->hashCode()I
|
|
|
|
|
|
|
|
move-result v2
|
|
|
|
|
|
|
|
const v3, 0x2ff57c
|
|
|
|
|
|
|
|
const/4 v4, 0x1
|
|
|
|
|
|
|
|
if-eq v2, v3, :cond_2
|
|
|
|
|
|
|
|
const v3, 0x38b73479
|
|
|
|
|
|
|
|
if-eq v2, v3, :cond_1
|
|
|
|
|
|
|
|
goto :goto_0
|
|
|
|
|
|
|
|
:cond_1
|
|
|
|
const-string v2, "content"
|
|
|
|
|
|
|
|
invoke-virtual {v0, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
|
|
|
|
|
|
|
|
move-result v0
|
|
|
|
|
|
|
|
if-eqz v0, :cond_3
|
|
|
|
|
|
|
|
const/4 v1, 0x0
|
|
|
|
|
|
|
|
goto :goto_0
|
|
|
|
|
|
|
|
:cond_2
|
|
|
|
const-string v2, "file"
|
|
|
|
|
|
|
|
invoke-virtual {v0, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
|
|
|
|
|
|
|
|
move-result v0
|
|
|
|
|
|
|
|
if-eqz v0, :cond_3
|
|
|
|
|
|
|
|
const/4 v1, 0x1
|
|
|
|
|
|
|
|
:cond_3
|
|
|
|
:goto_0
|
|
|
|
if-eqz v1, :cond_6
|
|
|
|
|
|
|
|
if-ne v1, v4, :cond_5
|
|
|
|
|
|
|
|
invoke-virtual {p1}, Landroid/net/Uri;->getPath()Ljava/lang/String;
|
|
|
|
|
|
|
|
move-result-object p0
|
|
|
|
|
|
|
|
if-eqz p0, :cond_4
|
|
|
|
|
|
|
|
return-object p0
|
|
|
|
|
|
|
|
:cond_4
|
|
|
|
new-instance p0, Ljava/io/IOException;
|
|
|
|
|
|
|
|
const-string p1, "URI file path cannot be null."
|
|
|
|
|
|
|
|
invoke-direct {p0, p1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
|
|
|
|
|
|
|
|
throw p0
|
|
|
|
|
|
|
|
:cond_5
|
|
|
|
new-instance p0, Ljava/io/IOException;
|
|
|
|
|
|
|
|
const-string v0, "Unknown URI scheme encountered: "
|
|
|
|
|
2020-07-14 22:43:59 +00:00
|
|
|
invoke-static {v0}, Lf/e/b/a/a;->D(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
2020-05-17 12:40:10 +00:00
|
|
|
|
|
|
|
move-result-object v0
|
|
|
|
|
|
|
|
invoke-virtual {p1}, Landroid/net/Uri;->getScheme()Ljava/lang/String;
|
|
|
|
|
|
|
|
move-result-object p1
|
|
|
|
|
|
|
|
invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
|
|
|
|
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
|
|
|
|
move-result-object p1
|
|
|
|
|
|
|
|
invoke-direct {p0, p1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
|
|
|
|
|
|
|
|
throw p0
|
|
|
|
|
|
|
|
:cond_6
|
|
|
|
invoke-virtual {p1}, Landroid/net/Uri;->getAuthority()Ljava/lang/String;
|
|
|
|
|
|
|
|
move-result-object v0
|
|
|
|
|
|
|
|
const-string v1, "com.google.android.apps.photos.content"
|
|
|
|
|
|
|
|
invoke-virtual {v1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
|
|
|
|
|
|
|
|
move-result v0
|
|
|
|
|
|
|
|
if-eqz v0, :cond_7
|
|
|
|
|
|
|
|
invoke-virtual {p1}, Landroid/net/Uri;->getLastPathSegment()Ljava/lang/String;
|
|
|
|
|
|
|
|
move-result-object p0
|
|
|
|
|
|
|
|
return-object p0
|
|
|
|
|
|
|
|
:cond_7
|
|
|
|
const/4 v0, 0x0
|
|
|
|
|
|
|
|
invoke-static {p0, p1, v0, v0}, Lcom/miguelgaeta/media_picker/MediaPickerUri;->getDataColumn(Landroid/content/Context;Landroid/net/Uri;Ljava/lang/String;[Ljava/lang/String;)Ljava/lang/String;
|
|
|
|
|
|
|
|
move-result-object p0
|
|
|
|
|
|
|
|
return-object p0
|
|
|
|
|
|
|
|
:cond_8
|
|
|
|
new-instance p0, Ljava/io/IOException;
|
|
|
|
|
|
|
|
const-string p1, "Unknown URI scheme encountered."
|
|
|
|
|
|
|
|
invoke-direct {p0, p1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
|
|
|
|
|
|
|
|
throw p0
|
|
|
|
.end method
|
|
|
|
|
|
|
|
.method public static getPathFromDocumentsProvider(Landroid/content/Context;Landroid/net/Uri;)Ljava/lang/String;
|
|
|
|
.locals 8
|
|
|
|
.annotation build Landroid/annotation/TargetApi;
|
|
|
|
value = 0x13
|
|
|
|
.end annotation
|
|
|
|
|
|
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
|
|
value = {
|
|
|
|
Ljava/io/IOException;
|
|
|
|
}
|
|
|
|
.end annotation
|
|
|
|
|
|
|
|
invoke-virtual {p1}, Landroid/net/Uri;->getAuthority()Ljava/lang/String;
|
|
|
|
|
|
|
|
move-result-object v0
|
|
|
|
|
|
|
|
if-eqz v0, :cond_d
|
|
|
|
|
|
|
|
invoke-static {p1}, Landroid/provider/DocumentsContract;->getDocumentId(Landroid/net/Uri;)Ljava/lang/String;
|
|
|
|
|
|
|
|
move-result-object v0
|
|
|
|
|
|
|
|
invoke-virtual {p1}, Landroid/net/Uri;->getAuthority()Ljava/lang/String;
|
|
|
|
|
|
|
|
move-result-object v1
|
|
|
|
|
|
|
|
const/4 v2, -0x1
|
|
|
|
|
|
|
|
invoke-virtual {v1}, Ljava/lang/String;->hashCode()I
|
|
|
|
|
|
|
|
move-result v3
|
|
|
|
|
|
|
|
const v4, 0x131d7c3d
|
|
|
|
|
|
|
|
const/4 v5, 0x2
|
|
|
|
|
|
|
|
const/4 v6, 0x0
|
|
|
|
|
|
|
|
const/4 v7, 0x1
|
|
|
|
|
|
|
|
if-eq v3, v4, :cond_2
|
|
|
|
|
|
|
|
const v4, 0x23919eae
|
|
|
|
|
|
|
|
if-eq v3, v4, :cond_1
|
|
|
|
|
|
|
|
const v4, 0x6763a3f6
|
|
|
|
|
|
|
|
if-eq v3, v4, :cond_0
|
|
|
|
|
|
|
|
goto :goto_0
|
|
|
|
|
|
|
|
:cond_0
|
|
|
|
const-string v3, "com.android.providers.media.documents"
|
|
|
|
|
|
|
|
invoke-virtual {v1, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
|
|
|
|
|
|
|
|
move-result v1
|
|
|
|
|
|
|
|
if-eqz v1, :cond_3
|
|
|
|
|
|
|
|
const/4 v2, 0x2
|
|
|
|
|
|
|
|
goto :goto_0
|
|
|
|
|
|
|
|
:cond_1
|
|
|
|
const-string v3, "com.android.externalstorage.documents"
|
|
|
|
|
|
|
|
invoke-virtual {v1, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
|
|
|
|
|
|
|
|
move-result v1
|
|
|
|
|
|
|
|
if-eqz v1, :cond_3
|
|
|
|
|
|
|
|
const/4 v2, 0x0
|
|
|
|
|
|
|
|
goto :goto_0
|
|
|
|
|
|
|
|
:cond_2
|
|
|
|
const-string v3, "com.android.providers.downloads.documents"
|
|
|
|
|
|
|
|
invoke-virtual {v1, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
|
|
|
|
|
|
|
|
move-result v1
|
|
|
|
|
|
|
|
if-eqz v1, :cond_3
|
|
|
|
|
|
|
|
const/4 v2, 0x1
|
|
|
|
|
|
|
|
:cond_3
|
|
|
|
:goto_0
|
|
|
|
const-string v1, ":"
|
|
|
|
|
|
|
|
if-eqz v2, :cond_b
|
|
|
|
|
|
|
|
const/4 v3, 0x0
|
|
|
|
|
|
|
|
if-eq v2, v7, :cond_9
|
|
|
|
|
|
|
|
if-ne v2, v5, :cond_8
|
|
|
|
|
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/String;->split(Ljava/lang/String;)[Ljava/lang/String;
|
|
|
|
|
|
|
|
move-result-object p1
|
|
|
|
|
|
|
|
aget-object v0, p1, v6
|
|
|
|
|
|
|
|
const-string v1, "image"
|
|
|
|
|
|
|
|
invoke-virtual {v1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
|
|
|
|
|
|
|
|
move-result v1
|
|
|
|
|
|
|
|
if-eqz v1, :cond_4
|
|
|
|
|
|
|
|
sget-object v3, Landroid/provider/MediaStore$Images$Media;->EXTERNAL_CONTENT_URI:Landroid/net/Uri;
|
|
|
|
|
|
|
|
goto :goto_1
|
|
|
|
|
|
|
|
:cond_4
|
|
|
|
const-string v1, "video"
|
|
|
|
|
|
|
|
invoke-virtual {v1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
|
|
|
|
|
|
|
|
move-result v1
|
|
|
|
|
|
|
|
if-eqz v1, :cond_5
|
|
|
|
|
|
|
|
sget-object v3, Landroid/provider/MediaStore$Video$Media;->EXTERNAL_CONTENT_URI:Landroid/net/Uri;
|
|
|
|
|
|
|
|
goto :goto_1
|
|
|
|
|
|
|
|
:cond_5
|
|
|
|
const-string v1, "audio"
|
|
|
|
|
|
|
|
invoke-virtual {v1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
|
|
|
|
|
|
|
|
move-result v0
|
|
|
|
|
|
|
|
if-eqz v0, :cond_6
|
|
|
|
|
|
|
|
sget-object v3, Landroid/provider/MediaStore$Audio$Media;->EXTERNAL_CONTENT_URI:Landroid/net/Uri;
|
|
|
|
|
|
|
|
:cond_6
|
|
|
|
:goto_1
|
|
|
|
new-array v0, v7, [Ljava/lang/String;
|
|
|
|
|
|
|
|
aget-object p1, p1, v7
|
|
|
|
|
|
|
|
aput-object p1, v0, v6
|
|
|
|
|
|
|
|
const-string p1, "_id=?"
|
|
|
|
|
|
|
|
invoke-static {p0, v3, p1, v0}, Lcom/miguelgaeta/media_picker/MediaPickerUri;->getDataColumn(Landroid/content/Context;Landroid/net/Uri;Ljava/lang/String;[Ljava/lang/String;)Ljava/lang/String;
|
|
|
|
|
|
|
|
move-result-object p0
|
|
|
|
|
|
|
|
if-eqz p0, :cond_7
|
|
|
|
|
|
|
|
return-object p0
|
|
|
|
|
|
|
|
:cond_7
|
|
|
|
new-instance p0, Ljava/io/IOException;
|
|
|
|
|
|
|
|
const-string p1, "Unable to find media document path."
|
|
|
|
|
|
|
|
invoke-direct {p0, p1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
|
|
|
|
|
|
|
|
throw p0
|
|
|
|
|
|
|
|
:cond_8
|
|
|
|
new-instance p0, Ljava/io/IOException;
|
|
|
|
|
|
|
|
const-string v0, "Unknown URI document authority encountered: "
|
|
|
|
|
2020-07-14 22:43:59 +00:00
|
|
|
invoke-static {v0}, Lf/e/b/a/a;->D(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
2020-05-17 12:40:10 +00:00
|
|
|
|
|
|
|
move-result-object v0
|
|
|
|
|
|
|
|
invoke-virtual {p1}, Landroid/net/Uri;->getAuthority()Ljava/lang/String;
|
|
|
|
|
|
|
|
move-result-object p1
|
|
|
|
|
|
|
|
invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
|
|
|
|
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
|
|
|
|
move-result-object p1
|
|
|
|
|
|
|
|
invoke-direct {p0, p1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
|
|
|
|
|
|
|
|
throw p0
|
|
|
|
|
|
|
|
:cond_9
|
|
|
|
const-string p1, "content://downloads/public_downloads"
|
|
|
|
|
|
|
|
invoke-static {p1}, Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;
|
|
|
|
|
|
|
|
move-result-object p1
|
|
|
|
|
|
|
|
:try_start_0
|
|
|
|
invoke-static {v0}, Ljava/lang/Long;->valueOf(Ljava/lang/String;)Ljava/lang/Long;
|
|
|
|
|
|
|
|
move-result-object v0
|
|
|
|
|
|
|
|
invoke-virtual {v0}, Ljava/lang/Long;->longValue()J
|
|
|
|
|
|
|
|
move-result-wide v0
|
|
|
|
|
|
|
|
invoke-static {p1, v0, v1}, Landroid/content/ContentUris;->withAppendedId(Landroid/net/Uri;J)Landroid/net/Uri;
|
|
|
|
|
|
|
|
move-result-object p1
|
|
|
|
|
|
|
|
invoke-static {p0, p1, v3, v3}, Lcom/miguelgaeta/media_picker/MediaPickerUri;->getDataColumn(Landroid/content/Context;Landroid/net/Uri;Ljava/lang/String;[Ljava/lang/String;)Ljava/lang/String;
|
|
|
|
|
|
|
|
move-result-object p0
|
|
|
|
|
|
|
|
if-eqz p0, :cond_a
|
|
|
|
|
|
|
|
return-object p0
|
|
|
|
|
|
|
|
:cond_a
|
|
|
|
new-instance p0, Ljava/io/IOException;
|
|
|
|
|
|
|
|
const-string p1, "Unable to find downloaded document path."
|
|
|
|
|
|
|
|
invoke-direct {p0, p1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
|
|
|
|
|
|
|
|
throw p0
|
|
|
|
:try_end_0
|
|
|
|
.catch Ljava/lang/NumberFormatException; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
|
|
|
|
:catch_0
|
|
|
|
new-instance p0, Ljava/io/IOException;
|
|
|
|
|
|
|
|
const-string p1, "Unable to fetch document id."
|
|
|
|
|
|
|
|
invoke-direct {p0, p1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
|
|
|
|
|
|
|
|
throw p0
|
|
|
|
|
|
|
|
:cond_b
|
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/String;->split(Ljava/lang/String;)[Ljava/lang/String;
|
|
|
|
|
|
|
|
move-result-object p0
|
|
|
|
|
|
|
|
aget-object p1, p0, v6
|
|
|
|
|
|
|
|
const-string v0, "primary"
|
|
|
|
|
|
|
|
invoke-virtual {v0, p1}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z
|
|
|
|
|
|
|
|
move-result p1
|
|
|
|
|
|
|
|
if-eqz p1, :cond_c
|
|
|
|
|
|
|
|
new-instance p1, Ljava/lang/StringBuilder;
|
|
|
|
|
|
|
|
invoke-direct {p1}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
|
|
|
|
invoke-static {}, Landroid/os/Environment;->getExternalStorageDirectory()Ljava/io/File;
|
|
|
|
|
|
|
|
move-result-object v0
|
|
|
|
|
|
|
|
invoke-virtual {p1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
|
|
|
|
|
|
|
const-string v0, "/"
|
|
|
|
|
|
|
|
invoke-virtual {p1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
|
|
|
|
aget-object p0, p0, v7
|
|
|
|
|
|
|
|
invoke-virtual {p1, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
|
|
|
|
invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
|
|
|
|
move-result-object p0
|
|
|
|
|
|
|
|
return-object p0
|
|
|
|
|
|
|
|
:cond_c
|
|
|
|
new-instance p0, Ljava/io/IOException;
|
|
|
|
|
|
|
|
const-string p1, "Unable to handle non-primary external storage volumes."
|
|
|
|
|
|
|
|
invoke-direct {p0, p1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
|
|
|
|
|
|
|
|
throw p0
|
|
|
|
|
|
|
|
:cond_d
|
|
|
|
new-instance p0, Ljava/io/IOException;
|
|
|
|
|
|
|
|
const-string p1, "URI authority cannot be null."
|
|
|
|
|
|
|
|
invoke-direct {p0, p1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
|
|
|
|
|
|
|
|
throw p0
|
|
|
|
.end method
|
|
|
|
|
|
|
|
.method public static isDocumentsProviderUri(Landroid/content/Context;Landroid/net/Uri;)Z
|
2020-07-08 16:44:49 +00:00
|
|
|
.locals 0
|
2020-05-17 12:40:10 +00:00
|
|
|
|
|
|
|
invoke-static {p0, p1}, Landroid/provider/DocumentsContract;->isDocumentUri(Landroid/content/Context;Landroid/net/Uri;)Z
|
|
|
|
|
|
|
|
move-result p0
|
|
|
|
|
|
|
|
if-eqz p0, :cond_0
|
|
|
|
|
|
|
|
const/4 p0, 0x1
|
|
|
|
|
|
|
|
goto :goto_0
|
|
|
|
|
|
|
|
:cond_0
|
|
|
|
const/4 p0, 0x0
|
|
|
|
|
|
|
|
:goto_0
|
|
|
|
return p0
|
|
|
|
.end method
|
|
|
|
|
|
|
|
.method public static isLocal(Ljava/lang/String;)Z
|
|
|
|
.locals 1
|
|
|
|
|
|
|
|
if-eqz p0, :cond_0
|
|
|
|
|
|
|
|
const-string v0, "http://"
|
|
|
|
|
|
|
|
invoke-virtual {p0, v0}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z
|
|
|
|
|
|
|
|
move-result v0
|
|
|
|
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
|
|
|
|
const-string v0, "https://"
|
|
|
|
|
|
|
|
invoke-virtual {p0, v0}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z
|
|
|
|
|
|
|
|
move-result p0
|
|
|
|
|
|
|
|
if-nez p0, :cond_0
|
|
|
|
|
|
|
|
const/4 p0, 0x1
|
|
|
|
|
|
|
|
goto :goto_0
|
|
|
|
|
|
|
|
:cond_0
|
|
|
|
const/4 p0, 0x0
|
|
|
|
|
|
|
|
:goto_0
|
|
|
|
return p0
|
|
|
|
.end method
|
|
|
|
|
|
|
|
.method public static resolveToFile(Landroid/content/Context;Landroid/content/Intent;)Ljava/io/File;
|
|
|
|
.locals 1
|
|
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
|
|
value = {
|
|
|
|
Ljava/io/IOException;
|
|
|
|
}
|
|
|
|
.end annotation
|
|
|
|
|
|
|
|
const-string v0, "android.intent.extra.STREAM"
|
|
|
|
|
|
|
|
invoke-static {p0, p1, v0}, Lcom/miguelgaeta/media_picker/MediaPickerUri;->resolveToFile(Landroid/content/Context;Landroid/content/Intent;Ljava/lang/String;)Ljava/io/File;
|
|
|
|
|
|
|
|
move-result-object p0
|
|
|
|
|
|
|
|
return-object p0
|
|
|
|
.end method
|
|
|
|
|
|
|
|
.method public static resolveToFile(Landroid/content/Context;Landroid/content/Intent;Ljava/lang/String;)Ljava/io/File;
|
|
|
|
.locals 0
|
|
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
|
|
value = {
|
|
|
|
Ljava/io/IOException;
|
|
|
|
}
|
|
|
|
.end annotation
|
|
|
|
|
|
|
|
invoke-virtual {p1, p2}, Landroid/content/Intent;->getParcelableExtra(Ljava/lang/String;)Landroid/os/Parcelable;
|
|
|
|
|
|
|
|
move-result-object p1
|
|
|
|
|
|
|
|
check-cast p1, Landroid/net/Uri;
|
|
|
|
|
|
|
|
invoke-static {p0, p1}, Lcom/miguelgaeta/media_picker/MediaPickerUri;->resolveToFile(Landroid/content/Context;Landroid/net/Uri;)Ljava/io/File;
|
|
|
|
|
|
|
|
move-result-object p0
|
|
|
|
|
|
|
|
return-object p0
|
|
|
|
.end method
|
|
|
|
|
|
|
|
.method public static resolveToFile(Landroid/content/Context;Landroid/net/Uri;)Ljava/io/File;
|
|
|
|
.locals 0
|
|
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
|
|
value = {
|
|
|
|
Ljava/io/IOException;
|
|
|
|
}
|
|
|
|
.end annotation
|
|
|
|
|
|
|
|
if-eqz p0, :cond_4
|
|
|
|
|
|
|
|
if-eqz p1, :cond_3
|
|
|
|
|
|
|
|
invoke-static {p0, p1}, Lcom/miguelgaeta/media_picker/MediaPickerUri;->getPath(Landroid/content/Context;Landroid/net/Uri;)Ljava/lang/String;
|
|
|
|
|
|
|
|
move-result-object p0
|
|
|
|
|
|
|
|
if-eqz p0, :cond_2
|
|
|
|
|
|
|
|
invoke-static {p0}, Lcom/miguelgaeta/media_picker/MediaPickerUri;->isLocal(Ljava/lang/String;)Z
|
|
|
|
|
|
|
|
move-result p1
|
|
|
|
|
|
|
|
if-eqz p1, :cond_1
|
|
|
|
|
|
|
|
new-instance p1, Ljava/io/File;
|
|
|
|
|
|
|
|
invoke-direct {p1, p0}, Ljava/io/File;-><init>(Ljava/lang/String;)V
|
|
|
|
|
|
|
|
invoke-virtual {p1}, Ljava/io/File;->exists()Z
|
|
|
|
|
|
|
|
move-result p1
|
|
|
|
|
|
|
|
if-eqz p1, :cond_0
|
|
|
|
|
|
|
|
new-instance p1, Ljava/io/File;
|
|
|
|
|
|
|
|
invoke-direct {p1, p0}, Ljava/io/File;-><init>(Ljava/lang/String;)V
|
|
|
|
|
|
|
|
return-object p1
|
|
|
|
|
|
|
|
:cond_0
|
|
|
|
new-instance p0, Ljava/io/IOException;
|
|
|
|
|
|
|
|
const-string p1, "File path was found, but file does not exist."
|
|
|
|
|
|
|
|
invoke-direct {p0, p1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
|
|
|
|
|
|
|
|
throw p0
|
|
|
|
|
|
|
|
:cond_1
|
|
|
|
new-instance p0, Ljava/io/IOException;
|
|
|
|
|
|
|
|
const-string p1, "File path was found, but path must be a local URI."
|
|
|
|
|
|
|
|
invoke-direct {p0, p1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
|
|
|
|
|
|
|
|
throw p0
|
|
|
|
|
|
|
|
:cond_2
|
|
|
|
new-instance p0, Ljava/io/IOException;
|
|
|
|
|
|
|
|
const-string p1, "File path was not found."
|
|
|
|
|
|
|
|
invoke-direct {p0, p1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
|
|
|
|
|
|
|
|
throw p0
|
|
|
|
|
|
|
|
:cond_3
|
|
|
|
new-instance p0, Ljava/io/IOException;
|
|
|
|
|
|
|
|
const-string p1, "File URI cannot be null."
|
|
|
|
|
|
|
|
invoke-direct {p0, p1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
|
|
|
|
|
|
|
|
throw p0
|
|
|
|
|
|
|
|
:cond_4
|
|
|
|
new-instance p0, Ljava/io/IOException;
|
|
|
|
|
|
|
|
const-string p1, "A valid android application context is required."
|
|
|
|
|
|
|
|
invoke-direct {p0, p1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
|
|
|
|
|
|
|
|
throw p0
|
|
|
|
.end method
|