package com.example.drievka

import android.content.Intent
import android.os.Bundle
import android.util.DisplayMetrics
import android.util.Log
import androidx.appcompat.app.AppCompatActivity
import kotlinx.android.synthetic.main.activity_main.*


class MainActivity : AppCompatActivity() {
    var TAG = "MAIN"
    var width = 0
    var task1Level = 1

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        imageButtonFirstTask.setOnClickListener {
            val intent = Intent(this, GameActivity1::class.java)
            startActivity(intent)
        }

        imageButtonSecondTask.setOnClickListener {
            val intent = Intent(this, GameActivity1::class.java)
            startActivity(intent)
        }

        imageButtonThirdTask.setOnClickListener {
            val intent = Intent(this, GameActivity1::class.java)
            startActivity(intent)
        }

        imageButtonFourthTask.setOnClickListener {
            val intent = Intent(this, GameActivity1::class.java)
            startActivity(intent)
        }

        imageButtonFifthTask.setOnClickListener {
            val intent = Intent(this, GameActivity1::class.java)
            startActivity(intent)
        }

        imageButtonSettings.setOnClickListener{
            task1Level = 1
        }

        val display = windowManager.defaultDisplay
        val metricsB = DisplayMetrics()
        display.getMetrics(metricsB)

        width = metricsB.widthPixels
        var height = metricsB.heightPixels

        Log.d(TAG, "width = " + width + " height = " + height)

        var imageWidth = width / 7
        var smallImageWidth = width / 15

//        imageButton2.width = imageWidth

//        imageButton2.layout(imageWidth, imageHeight*5, imageWidth*6, imageHeight*3)
//        imageButton2.layoutParams.height = imageHeight
        imageButtonFirstTask.layoutParams.width = imageWidth
        imageButtonSecondTask.layoutParams.width = imageWidth
        imageButtonThirdTask.layoutParams.width = imageWidth
        imageButtonFourthTask.layoutParams.width = imageWidth
        imageButtonFifthTask.layoutParams.width = imageWidth

        imageButtonSettings.layoutParams.width = smallImageWidth
        imageButton8.layoutParams.width = smallImageWidth

    }


}