Skip to content

Commit 1eedebd

Browse files
committed
uri2path support asset path
1 parent 1bfc136 commit 1eedebd

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

androidx/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ android {
99
defaultConfig {
1010
minSdkVersion 19
1111
targetSdkVersion 30
12-
versionCode 31
13-
versionName "1.3.1"
12+
versionCode 32
13+
versionName "1.3.2"
1414
archivesBaseName = "androidx-$versionName"
1515

1616
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

androidx/src/main/java/com/androidx/utils/Uri2Path.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
*/
2222

2323
final class Uri2Path {
24+
static final String ASSET_PREFIX = "file:///android_asset/"; //assets路径 file:///android_asset/PixelHot/01_Cryptoboyz/cryptoboyz_01.png
25+
2426
private Uri2Path() {
2527
}
2628

@@ -127,6 +129,9 @@ else if ("content".equalsIgnoreCase(uri.getScheme())) {
127129
}
128130
// File
129131
else if ("file".equalsIgnoreCase(uri.getScheme())) {
132+
if (uri.toString().startsWith(ASSET_PREFIX)) {
133+
return uri.toString();
134+
}
130135
return uri.getPath();
131136
}
132137

0 commit comments

Comments
 (0)