Skip to content

Commit bf41ff7

Browse files
authored
Merge pull request #7 from Vicent9920/patch-1
Update EasyPhoto.kt
2 parents 443e566 + 39749b5 commit bf41ff7

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

utils/src/main/java/com/haoge/easyandroid/easy/EasyPhoto.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class EasyPhoto {
103103
return@start
104104
}
105105
try {
106-
val inputFile = uriToFile(data.data)
106+
val inputFile = uriToFile(activity,data.data)
107107

108108
if (isCrop) {//裁剪
109109
zoomPhoto(inputFile, mImgPath?:File(generateImagePath(activity)), activity)
@@ -116,9 +116,9 @@ class EasyPhoto {
116116
}
117117
}
118118

119-
private fun uriToFile(uri: Uri):File {
119+
private fun uriToFile(activity: Activity,uri: Uri):File {
120120
// 首先使用系统提供的CursorLoader进行file获取
121-
val context = EasyAndroid.getApplicationContext()
121+
val context = activity.application
122122
val projection = arrayOf(MediaStore.Images.Media.DATA)
123123
val cursor = CursorLoader(context, uri, projection, null, null, null)
124124
.loadInBackground()
@@ -345,4 +345,4 @@ class EasyPhoto {
345345
}
346346
}
347347
}
348-
}
348+
}

0 commit comments

Comments
 (0)