圖片剪裁到了Android 7之後,改成使用FileProvider建立的uri,就是要把路徑給FileProvider.getUriForFile()轉換一下,但我一直卡在這邊沒成功,可惜
val sharedPreferences = getSharedPreferences(BaseConstants.ANDROID_SYSTEM, MODE_P
val pictureName = sharedPreferences.getString(BaseConstants.PICTURE_NAME, "") ?: 
val intent = Intent("com.android.camera.action.CROP").apply {
    this.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION or Intent.FLAG_GRANT_REA
    this.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
    this.putExtra("crop", true)
    this.putExtra("return-data", false)
    this.putExtra("outputFormat", Bitmap.CompressFormat.JPEG.toString())
    this.putExtra("scale", true)
}
val cropPictureName = "005_crop_${System.currentTimeMillis()}.jpg"
val phoneFile = File(
    Environment.getExternalStoragePublicDirectory("${Environment.DIRECTORY_PICTUR
    pictureName
)
val cropPhoneFile = File(
    Environment.getExternalStoragePublicDirectory("${Environment.DIRECTORY_PICTUR
    cropPictureName
)
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.P) {
    val pictureUri = getPictureUri(phoneFile)
    val cropUri = getPictureUri(cropPhoneFile)
    intent.setDataAndType(pictureUri, "image/*")
    intent.clipData = ClipData.newRawUri(MediaStore.EXTRA_OUTPUT, cropUri)
    intent.putExtra(MediaStore.EXTRA_OUTPUT, cropUri)
    Log.d("maho", "intent: $intent")
    cropPictureResultLauncher.launch(intent)
    return@registerForActivityResult
}