mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-22 20:48:00 +01:00
use Glide for loading the initial image in the editor
This commit is contained in:
parent
1adb178e88
commit
d308dfb069
2 changed files with 22 additions and 13 deletions
|
@ -115,19 +115,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
|
|||
}
|
||||
|
||||
isCropIntent = intent.extras?.get(CROP) == "true"
|
||||
|
||||
crop_image_view.apply {
|
||||
setOnCropImageCompleteListener(this@EditActivity)
|
||||
setImageUriAsync(uri)
|
||||
guidelines = CropImageView.Guidelines.ON
|
||||
|
||||
if (isCropIntent && shouldCropSquare()) {
|
||||
currAspectRatio = ASPECT_RATIO_ONE_ONE
|
||||
setFixedAspectRatio(true)
|
||||
bottom_aspect_ratio.beGone()
|
||||
}
|
||||
}
|
||||
|
||||
Glide.with(this).load(uri).into(default_image_view)
|
||||
setupBottomActions()
|
||||
}
|
||||
|
||||
|
@ -157,6 +145,20 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
|
|||
return true
|
||||
}
|
||||
|
||||
private fun loadCropImageView() {
|
||||
crop_image_view.apply {
|
||||
setOnCropImageCompleteListener(this@EditActivity)
|
||||
setImageUriAsync(uri)
|
||||
guidelines = CropImageView.Guidelines.ON
|
||||
|
||||
if (isCropIntent && shouldCropSquare()) {
|
||||
currAspectRatio = ASPECT_RATIO_ONE_ONE
|
||||
setFixedAspectRatio(true)
|
||||
bottom_aspect_ratio.beGone()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupBottomActions() {
|
||||
setupPrimaryActionButtons()
|
||||
setupCropRotateActionButtons()
|
||||
|
|
|
@ -6,11 +6,18 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/default_image_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="@dimen/activity_margin"/>
|
||||
|
||||
<com.theartofdev.edmodo.cropper.CropImageView
|
||||
android:id="@+id/crop_image_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="@dimen/activity_margin"
|
||||
android:visibility="gone"
|
||||
app:cropBackgroundColor="@color/crop_image_view_background"
|
||||
app:cropInitialCropWindowPaddingRatio="0"/>
|
||||
|
||||
|
|
Loading…
Reference in a new issue