|
|
@ -91,23 +91,23 @@ class SearchView : SearchView { |
|
|
|
super.setQueryHint(hint) |
|
|
|
super.setQueryHint(hint) |
|
|
|
updateQueryHint() |
|
|
|
updateQueryHint() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
internal class CenteredImageSpan(drawable: Drawable?) : ImageSpan(drawable!!) { |
|
|
|
internal class CenteredImageSpan(drawable: Drawable?) : ImageSpan(drawable!!) { |
|
|
|
override fun draw( |
|
|
|
override fun draw( |
|
|
|
canvas: Canvas, text: CharSequence, |
|
|
|
canvas: Canvas, text: CharSequence, |
|
|
|
start: Int, end: Int, x: Float, |
|
|
|
start: Int, end: Int, x: Float, |
|
|
|
top: Int, y: Int, bottom: Int, paint: Paint |
|
|
|
top: Int, y: Int, bottom: Int, paint: Paint |
|
|
|
) { |
|
|
|
) { |
|
|
|
// image to draw |
|
|
|
// image to draw |
|
|
|
val b = drawable |
|
|
|
val b = drawable |
|
|
|
// font metrics of text to be replaced |
|
|
|
// font metrics of text to be replaced |
|
|
|
val fm = paint.fontMetricsInt |
|
|
|
val fm = paint.fontMetricsInt |
|
|
|
val transY = ((y + fm.descent + y + fm.ascent) / 2 |
|
|
|
val transY = ((y + fm.descent + y + fm.ascent) / 2 |
|
|
|
- b.bounds.bottom / 2) |
|
|
|
- b.bounds.bottom / 2) |
|
|
|
canvas.save() |
|
|
|
canvas.save() |
|
|
|
canvas.translate(x, transY.toFloat()) |
|
|
|
canvas.translate(x, transY.toFloat()) |
|
|
|
b.draw(canvas) |
|
|
|
b.draw(canvas) |
|
|
|
canvas.restore() |
|
|
|
canvas.restore() |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|