mirror of
https://github.com/SimpleMobileTools/Simple-Gallery.git
synced 2025-06-05 21:59:19 +02:00
adjusting some editor related sizes/margins
This commit is contained in:
@ -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)
|
||||
|
@ -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) {
|
||||
|
Reference in New Issue
Block a user