mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-23 04:57:59 +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"
|
isCropIntent = intent.extras?.get(CROP) == "true"
|
||||||
|
Glide.with(this).load(uri).into(default_image_view)
|
||||||
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()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
setupBottomActions()
|
setupBottomActions()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,6 +145,20 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
|
||||||
return true
|
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() {
|
private fun setupBottomActions() {
|
||||||
setupPrimaryActionButtons()
|
setupPrimaryActionButtons()
|
||||||
setupCropRotateActionButtons()
|
setupCropRotateActionButtons()
|
||||||
|
|
|
@ -6,11 +6,18 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="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
|
<com.theartofdev.edmodo.cropper.CropImageView
|
||||||
android:id="@+id/crop_image_view"
|
android:id="@+id/crop_image_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="@dimen/activity_margin"
|
android:layout_margin="@dimen/activity_margin"
|
||||||
|
android:visibility="gone"
|
||||||
app:cropBackgroundColor="@color/crop_image_view_background"
|
app:cropBackgroundColor="@color/crop_image_view_background"
|
||||||
app:cropInitialCropWindowPaddingRatio="0"/>
|
app:cropInitialCropWindowPaddingRatio="0"/>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue