mirror of
				https://github.com/SimpleMobileTools/Simple-Keyboard.git
				synced 2025-06-05 21:49:26 +02:00 
			
		
		
		
	properly calculate the Enter icons position after enlarging it
This commit is contained in:
		| @@ -623,15 +623,22 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut | |||||||
|                     key.icon = resources.getDrawable(drawableId) |                     key.icon = resources.getDrawable(drawableId) | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
|                 val drawableX = (key.width - padding.left - padding.right - key.icon!!.intrinsicWidth) / 2 + padding.left |                 val iconWidthToUse = if (key.codes.firstOrNull() == MyKeyboard.KEYCODE_ENTER) { | ||||||
|                 val drawableY = (key.height - key.icon!!.intrinsicHeight) / 2 |                     (key.icon!!.intrinsicWidth * 1.2).toInt() | ||||||
|                 canvas.translate(drawableX.toFloat(), drawableY.toFloat()) |  | ||||||
|  |  | ||||||
|                 if (key.codes.firstOrNull() == MyKeyboard.KEYCODE_ENTER) { |  | ||||||
|                     key.icon!!.setBounds(0, 0, (key.icon!!.intrinsicWidth * 1.2).toInt(), (key.icon!!.intrinsicHeight * 1.2).toInt()) |  | ||||||
|                 } else { |                 } else { | ||||||
|                     key.icon!!.setBounds(0, 0, key.icon!!.intrinsicWidth, key.icon!!.intrinsicHeight) |                     key.icon!!.intrinsicWidth | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
|  |                 val iconHeightToUse = if (key.codes.firstOrNull() == MyKeyboard.KEYCODE_ENTER) { | ||||||
|  |                     (key.icon!!.intrinsicHeight * 1.2).toInt() | ||||||
|  |                 } else { | ||||||
|  |                     key.icon!!.intrinsicHeight | ||||||
|  |                 } | ||||||
|  |  | ||||||
|  |                 val drawableX = (key.width - iconWidthToUse) / 2 | ||||||
|  |                 val drawableY = (key.height - iconHeightToUse) / 2 | ||||||
|  |                 canvas.translate(drawableX.toFloat(), drawableY.toFloat()) | ||||||
|  |                 key.icon!!.setBounds(0, 0, iconWidthToUse, iconHeightToUse) | ||||||
|                 key.icon!!.draw(canvas) |                 key.icon!!.draw(canvas) | ||||||
|                 canvas.translate(-drawableX.toFloat(), -drawableY.toFloat()) |                 canvas.translate(-drawableX.toFloat(), -drawableY.toFloat()) | ||||||
|             } |             } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user