Created
July 28, 2019 07:41
-
-
Save yudikarma/8ef8a48bae23413062969e08552ec666 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
imageview_insert_post.crop(View.MeasureSpec.makeMeasureSpec(1024,` View.MeasureSpec.AT_MOST), | |
View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED),object : InstaCropperView.BitmapCallback { | |
override fun onBitmapReady(bitmap: Bitmap?) { | |
if (bitmap == null){ | |
return | |
} | |
try { | |
val file = File(selected_file) | |
//get output stream dari copy file | |
val fileOutputStream = FileOutputStream(file) | |
bitmap.compress(Bitmap.CompressFormat.JPEG,100,fileOutputStream) | |
fileOutputStream.flush() | |
fileOutputStream.close() | |
if (!activity.isFinishing) { | |
//imageview_insert_post.setImageUri(Uri.fromFile(File(selected_file))) | |
activity.startActivity<InsertCaptionPostActivity>("file_name" to file.path) | |
} | |
}catch (e : IOException){ | |
Timber.e("GALERY FRAFMENT : ${e.message}") | |
} | |
} | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment