mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2025-01-19 06:48:00 +01:00
adjusting some editor related sizes/margins
This commit is contained in:
parent
99d4cdbced
commit
b039a6f8d8
4 changed files with 38 additions and 26 deletions
|
@ -242,31 +242,42 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
|
||||||
default_image_view.beGone()
|
default_image_view.beGone()
|
||||||
crop_image_view.beGone()
|
crop_image_view.beGone()
|
||||||
editor_draw_canvas.beVisible()
|
editor_draw_canvas.beVisible()
|
||||||
|
editor_draw_canvas.onGlobalLayout {
|
||||||
|
Thread {
|
||||||
|
fillCanvasBackground()
|
||||||
|
}.start()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Thread {
|
private fun fillCanvasBackground() {
|
||||||
val size = Point()
|
val size = Point()
|
||||||
windowManager.defaultDisplay.getSize(size)
|
windowManager.defaultDisplay.getSize(size)
|
||||||
val options = RequestOptions()
|
val options = RequestOptions()
|
||||||
.format(DecodeFormat.PREFER_ARGB_8888)
|
.format(DecodeFormat.PREFER_ARGB_8888)
|
||||||
.skipMemoryCache(true)
|
.skipMemoryCache(true)
|
||||||
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
||||||
.fitCenter()
|
.fitCenter()
|
||||||
|
|
||||||
try {
|
try {
|
||||||
val builder = Glide.with(applicationContext)
|
val builder = Glide.with(applicationContext)
|
||||||
.asBitmap()
|
.asBitmap()
|
||||||
.load(uri)
|
.load(uri)
|
||||||
.apply(options)
|
.apply(options)
|
||||||
.into(size.x, size.y)
|
.into(editor_draw_canvas.width, editor_draw_canvas.height)
|
||||||
|
|
||||||
val bitmap = builder.get()
|
val bitmap = builder.get()
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
editor_draw_canvas.updateBackgroundBitmap(bitmap)
|
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)
|
@TargetApi(Build.VERSION_CODES.N)
|
||||||
|
|
|
@ -44,9 +44,7 @@ class EditorDrawCanvas(context: Context, attrs: AttributeSet) : View(context, at
|
||||||
canvas.save()
|
canvas.save()
|
||||||
|
|
||||||
if (backgroundBitmap != null) {
|
if (backgroundBitmap != null) {
|
||||||
val left = (width - backgroundBitmap!!.width) / 2
|
canvas.drawBitmap(backgroundBitmap!!, 0f, 0f, null)
|
||||||
val top = (height - backgroundBitmap!!.height) / 2
|
|
||||||
canvas.drawBitmap(backgroundBitmap!!, left.toFloat(), top.toFloat(), null)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for ((key, value) in mPaths) {
|
for ((key, value) in mPaths) {
|
||||||
|
|
|
@ -11,14 +11,14 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_above="@+id/bottom_editor_crop_rotate_actions"
|
android:layout_above="@+id/bottom_editor_crop_rotate_actions"
|
||||||
android:layout_marginBottom="@dimen/activity_margin"/>
|
android:layout_marginBottom="@dimen/bottom_filters_height_with_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_above="@+id/bottom_editor_crop_rotate_actions"
|
android:layout_above="@+id/bottom_editor_crop_rotate_actions"
|
||||||
android:layout_marginBottom="@dimen/activity_margin"
|
android:layout_marginBottom="@dimen/bottom_actions_height"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
app:cropBackgroundColor="@color/crop_image_view_background"
|
app:cropBackgroundColor="@color/crop_image_view_background"
|
||||||
app:cropInitialCropWindowPaddingRatio="0"/>
|
app:cropInitialCropWindowPaddingRatio="0"/>
|
||||||
|
@ -28,7 +28,9 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_above="@+id/bottom_editor_crop_rotate_actions"
|
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:background="@android:color/transparent"
|
||||||
android:visibility="gone"/>
|
android:visibility="gone"/>
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
<dimen name="bottom_editor_color_picker_size">48dp</dimen>
|
<dimen name="bottom_editor_color_picker_size">48dp</dimen>
|
||||||
<dimen name="bottom_filters_thumbnail_size">76dp</dimen>
|
<dimen name="bottom_filters_thumbnail_size">76dp</dimen>
|
||||||
<dimen name="bottom_filters_height">90dp</dimen>
|
<dimen name="bottom_filters_height">90dp</dimen>
|
||||||
|
<dimen name="bottom_filters_height_with_margin">98dp</dimen>
|
||||||
<dimen name="bottom_editor_actions_shadow_height">180dp</dimen>
|
<dimen name="bottom_editor_actions_shadow_height">180dp</dimen>
|
||||||
<dimen name="default_status_action_height">86dp</dimen>
|
<dimen name="default_status_action_height">86dp</dimen>
|
||||||
<dimen name="widget_initial_size">110dp</dimen>
|
<dimen name="widget_initial_size">110dp</dimen>
|
||||||
|
|
Loading…
Reference in a new issue