mirror of
https://github.com/Skysamara/airshot_a.git
synced 2025-12-06 06:16:05 +00:00
fix white border
This commit is contained in:
parent
2cb5a3825a
commit
930b93f91b
@ -41,7 +41,6 @@ class MainActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Включаем bluetooth
|
// Включаем bluetooth
|
||||||
// TODO Bluetooth включается, но сообщение и иконка неправильные
|
|
||||||
turnOnBtn.setOnClickListener {
|
turnOnBtn.setOnClickListener {
|
||||||
if (bAdapter.isEnabled) {
|
if (bAdapter.isEnabled) {
|
||||||
// Уже включен
|
// Уже включен
|
||||||
|
|||||||
@ -22,24 +22,28 @@ class Shots {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun draw(canvas: Canvas?, screenWidth: Int, screenHeight: Int) {
|
fun draw(canvas: Canvas?, screenWidth: Int, screenHeight: Int) {
|
||||||
val paint: Paint = Paint()
|
val paintWite: Paint = Paint()
|
||||||
paint.apply {
|
paintWite.apply {
|
||||||
style = Paint.Style.FILL // стиль Заливка
|
style = Paint.Style.FILL // стиль Заливка
|
||||||
color = Color.WHITE // белая кайма вокруг
|
color = Color.WHITE // белая кайма вокруг
|
||||||
}
|
}
|
||||||
|
val paintBlack: Paint = Paint()
|
||||||
|
|
||||||
|
paintBlack.apply {
|
||||||
|
style = Paint.Style.FILL // стиль Заливка
|
||||||
|
color = Color.BLACK // белая кайма вокруг
|
||||||
|
}
|
||||||
|
|
||||||
randomizeShots(screenWidth, screenHeight)
|
randomizeShots(screenWidth, screenHeight)
|
||||||
for (shot in arrayOfShots) {
|
for (shot in arrayOfShots) {
|
||||||
val x = shot.x
|
val x = shot.x
|
||||||
val y = shot.y
|
val y = shot.y
|
||||||
var radius: Int = (screenWidth + screenHeight) / 100
|
|
||||||
canvas!!.drawCircle(x.toFloat(), y.toFloat(), radius.toFloat(), paint)
|
|
||||||
|
|
||||||
paint.apply {
|
var radius: Int = (screenWidth + screenHeight) / 100
|
||||||
color = Color.BLACK // закрашиваем холст белым цветом
|
canvas!!.drawCircle(x.toFloat(), y.toFloat(), radius.toFloat(), paintWite)
|
||||||
}
|
|
||||||
radius = (screenWidth + screenHeight) / 120
|
radius = (screenWidth + screenHeight) / 120
|
||||||
canvas.drawCircle(x.toFloat(), y.toFloat(), radius.toFloat(), paint)
|
canvas.drawCircle(x.toFloat(), y.toFloat(), radius.toFloat(), paintBlack)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -13,18 +13,6 @@ class Target(context: Context?) : View(context) {
|
|||||||
private val paint: Paint = Paint()
|
private val paint: Paint = Paint()
|
||||||
private val shots:Shots = Shots()
|
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?) {
|
override fun onDraw(canvas: Canvas?) {
|
||||||
super.onDraw(canvas)
|
super.onDraw(canvas)
|
||||||
val screenWidth: Int = getWidth()
|
val screenWidth: Int = getWidth()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user