fix white border

This commit is contained in:
skysamara 2022-09-02 21:23:21 +03:00
parent 2cb5a3825a
commit 930b93f91b
3 changed files with 20 additions and 29 deletions

View File

@ -41,7 +41,6 @@ class MainActivity : AppCompatActivity() {
}
// Включаем bluetooth
// TODO Bluetooth включается, но сообщение и иконка неправильные
turnOnBtn.setOnClickListener {
if (bAdapter.isEnabled) {
// Уже включен

View File

@ -22,24 +22,28 @@ class Shots {
}
fun draw(canvas: Canvas?, screenWidth: Int, screenHeight: Int) {
val paint: Paint = Paint()
paint.apply {
val paintWite: Paint = Paint()
paintWite.apply {
style = Paint.Style.FILL // стиль Заливка
color = Color.WHITE // белая кайма вокруг
}
val paintBlack: Paint = Paint()
paintBlack.apply {
style = Paint.Style.FILL // стиль Заливка
color = Color.BLACK // белая кайма вокруг
}
randomizeShots(screenWidth, screenHeight)
for (shot in arrayOfShots) {
val x = shot.x
val y = shot.y
var radius: Int = (screenWidth + screenHeight) / 100
canvas!!.drawCircle(x.toFloat(), y.toFloat(), radius.toFloat(), paint)
paint.apply {
color = Color.BLACK // закрашиваем холст белым цветом
}
var radius: Int = (screenWidth + screenHeight) / 100
canvas!!.drawCircle(x.toFloat(), y.toFloat(), radius.toFloat(), paintWite)
radius = (screenWidth + screenHeight) / 120
canvas.drawCircle(x.toFloat(), y.toFloat(), radius.toFloat(), paint)
canvas.drawCircle(x.toFloat(), y.toFloat(), radius.toFloat(), paintBlack)
}
}
}

View File

@ -13,18 +13,6 @@ class Target(context: Context?) : View(context) {
private val paint: Paint = Paint()
private val shots:Shots = Shots()
// override fun setOnTouchListener(l: OnTouchListener?) {
//// super.setOnTouchListener(l)
//// invalidate()
// }
//
// override fun setOnClickListener(l: OnClickListener?) {
//// super.setOnClickListener(l)
//// invalidate()
// }
override fun onDraw(canvas: Canvas?) {
super.onDraw(canvas)
val screenWidth: Int = getWidth()