diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt
index ae3747789..2a06ea6a5 100644
--- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt
@@ -242,31 +242,42 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
default_image_view.beGone()
crop_image_view.beGone()
editor_draw_canvas.beVisible()
+ editor_draw_canvas.onGlobalLayout {
+ Thread {
+ fillCanvasBackground()
+ }.start()
+ }
+ }
- Thread {
- val size = Point()
- windowManager.defaultDisplay.getSize(size)
- val options = RequestOptions()
- .format(DecodeFormat.PREFER_ARGB_8888)
- .skipMemoryCache(true)
- .diskCacheStrategy(DiskCacheStrategy.NONE)
- .fitCenter()
+ private fun fillCanvasBackground() {
+ val size = Point()
+ windowManager.defaultDisplay.getSize(size)
+ val options = RequestOptions()
+ .format(DecodeFormat.PREFER_ARGB_8888)
+ .skipMemoryCache(true)
+ .diskCacheStrategy(DiskCacheStrategy.NONE)
+ .fitCenter()
- try {
- val builder = Glide.with(applicationContext)
- .asBitmap()
- .load(uri)
- .apply(options)
- .into(size.x, size.y)
+ try {
+ val builder = Glide.with(applicationContext)
+ .asBitmap()
+ .load(uri)
+ .apply(options)
+ .into(editor_draw_canvas.width, editor_draw_canvas.height)
- val bitmap = builder.get()
- runOnUiThread {
- editor_draw_canvas.updateBackgroundBitmap(bitmap)
+ val bitmap = builder.get()
+ runOnUiThread {
+ editor_draw_canvas.apply {
+ updateBackgroundBitmap(bitmap)
+ layoutParams.width = bitmap.width
+ layoutParams.height = bitmap.height
+ (layoutParams as RelativeLayout.LayoutParams).removeRule(RelativeLayout.ABOVE)
+ requestLayout()
}
- } catch (e: Exception) {
- showErrorToast(e)
}
- }.start()
+ } catch (e: Exception) {
+ showErrorToast(e)
+ }
}
@TargetApi(Build.VERSION_CODES.N)
diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt
index 2db8dcbaa..4cc2e9dc9 100644
--- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt
@@ -44,9 +44,7 @@ class EditorDrawCanvas(context: Context, attrs: AttributeSet) : View(context, at
canvas.save()
if (backgroundBitmap != null) {
- val left = (width - backgroundBitmap!!.width) / 2
- val top = (height - backgroundBitmap!!.height) / 2
- canvas.drawBitmap(backgroundBitmap!!, left.toFloat(), top.toFloat(), null)
+ canvas.drawBitmap(backgroundBitmap!!, 0f, 0f, null)
}
for ((key, value) in mPaths) {
diff --git a/app/src/main/res/layout/activity_edit.xml b/app/src/main/res/layout/activity_edit.xml
index bef9caf69..bc2d1b016 100644
--- a/app/src/main/res/layout/activity_edit.xml
+++ b/app/src/main/res/layout/activity_edit.xml
@@ -11,14 +11,14 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/bottom_editor_crop_rotate_actions"
- android:layout_marginBottom="@dimen/activity_margin"/>
+ android:layout_marginBottom="@dimen/bottom_filters_height_with_margin"/>
@@ -28,7 +28,9 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/bottom_editor_crop_rotate_actions"
- android:layout_marginBottom="@dimen/activity_margin"
+ android:layout_alignParentTop="true"
+ android:layout_centerInParent="true"
+ android:layout_marginBottom="@dimen/bottom_actions_height"
android:background="@android:color/transparent"
android:visibility="gone"/>
diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
index 9185f05bb..936d72808 100644
--- a/app/src/main/res/values/dimens.xml
+++ b/app/src/main/res/values/dimens.xml
@@ -15,6 +15,7 @@
48dp
76dp
90dp
+ 98dp
180dp
86dp
110dp