63 lines
2.6 KiB
Kotlin
63 lines
2.6 KiB
Kotlin
package com.example.timert
|
|
|
|
import android.content.Intent
|
|
import android.os.Bundle
|
|
import android.view.View
|
|
import android.widget.Button
|
|
import android.widget.Toast
|
|
import androidx.activity.enableEdgeToEdge
|
|
import androidx.appcompat.app.AppCompatActivity
|
|
import androidx.core.view.ViewCompat
|
|
import androidx.core.view.WindowInsetsCompat
|
|
|
|
class MainActivity : AppCompatActivity() {
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
super.onCreate(savedInstanceState)
|
|
enableEdgeToEdge()
|
|
setContentView(R.layout.activity_main)
|
|
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets ->
|
|
val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
|
|
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
|
|
insets
|
|
}
|
|
|
|
// Кнопки главной формы:
|
|
val settingsButton: Button = findViewById(R.id.settingsButton)
|
|
settingsButton.setOnClickListener {
|
|
val intent = Intent(this, SettingsActivity::class.java)
|
|
startActivity(intent)
|
|
}
|
|
|
|
val startTrainingButton: Button = findViewById(R.id.startTrainingButton)
|
|
startTrainingButton.setOnClickListener {
|
|
Toast.makeText(this, "Запуск тренировки!", Toast.LENGTH_SHORT).show() // Заглушка
|
|
//TODO: Intent для запуска Activity тренировки (форма 5)
|
|
val intent = Intent(this, timer::class.java)
|
|
startActivity(intent)
|
|
}
|
|
|
|
val templatesButton: Button = findViewById(R.id.templatesButton)
|
|
templatesButton.setOnClickListener {
|
|
//Toast.makeText(this, "Открытие шаблонов!", Toast.LENGTH_SHORT).show() // Заглушка
|
|
//TODO: Intent для открытия Activity шаблонов (форма 3)
|
|
val intent = Intent(this, AddWorkout::class.java)
|
|
startActivity(intent)
|
|
}
|
|
|
|
val newTemplateButton: Button = findViewById(R.id.newTemplateButton)
|
|
newTemplateButton.setOnClickListener {
|
|
//Toast.makeText(this, "Создание нового шаблона!", Toast.LENGTH_SHORT).show() // Заглушка
|
|
//TODO: Intent для открытия Activity создания шаблона (форма 7)
|
|
val intent = Intent(this, History::class.java)
|
|
startActivity(intent)
|
|
|
|
|
|
}
|
|
val exits: Button = findViewById(R.id.btn_exit)
|
|
exits.setOnClickListener {
|
|
finish()
|
|
|
|
}
|
|
}
|
|
}
|