Создание 2 формы #2
57
app/src/main/java/com/example/timert/AddWorkout.kt
Normal file
57
app/src/main/java/com/example/timert/AddWorkout.kt
Normal file
@ -0,0 +1,57 @@
|
||||
package com.example.timert
|
||||
|
||||
import android.app.AlertDialog
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.widget.Button
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
|
||||
class AddWorkout : AppCompatActivity() {
|
||||
private var isSave = false
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
enableEdgeToEdge()
|
||||
setContentView(R.layout.activity_add_workout)
|
||||
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 buttonSaveAll: Button = findViewById(R.id.btn_save_all)
|
||||
buttonSaveAll.setOnClickListener {
|
||||
val intent = Intent(this, MainActivity::class.java)
|
||||
startActivity(intent)
|
||||
isSave = true
|
||||
|
||||
}
|
||||
val button_on_main_all: Button = findViewById(R.id.btn_on_main_all)
|
||||
button_on_main_all.setOnClickListener {
|
||||
if (isSave == false) {
|
||||
AlertDialog.Builder(this)
|
||||
.setTitle("Изменения не сохранены")
|
||||
.setMessage("Продолжить без сохранения?")
|
||||
.setPositiveButton("Да") { _, _ ->
|
||||
|
||||
val intent = Intent(this, MainActivity::class.java)
|
||||
startActivity(intent)
|
||||
}
|
||||
.setNegativeButton("Нет") { dialog, _ ->
|
||||
dialog.dismiss()
|
||||
}
|
||||
.show()
|
||||
} else {
|
||||
val intent = Intent(this, MainActivity::class.java)
|
||||
startActivity(intent)
|
||||
}
|
||||
}
|
||||
val button_add: Button = findViewById(R.id.add_workoutadd)
|
||||
button_add.setOnClickListener {
|
||||
val intent = Intent(this, CreatingTraining::class.java)
|
||||
startActivity(intent)
|
||||
}
|
||||
}
|
||||
}
|
52
app/src/main/java/com/example/timert/AllTraining.kt
Normal file
52
app/src/main/java/com/example/timert/AllTraining.kt
Normal file
@ -0,0 +1,52 @@
|
||||
package com.example.timert
|
||||
|
||||
import android.app.AlertDialog
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.widget.Button
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
|
||||
class AllTraining : AppCompatActivity() {
|
||||
private var isSave = false
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
enableEdgeToEdge()
|
||||
setContentView(R.layout.activity_all_training)
|
||||
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 buttonSaveAll: Button = findViewById(R.id.btn_save_all_vse)
|
||||
buttonSaveAll.setOnClickListener {
|
||||
val intent = Intent(this, MainActivity::class.java)
|
||||
startActivity(intent)
|
||||
isSave = true
|
||||
|
||||
}
|
||||
val button_on_main_all: Button = findViewById(R.id.btn_on_main_all_vse)
|
||||
button_on_main_all.setOnClickListener {
|
||||
if (isSave == false) {
|
||||
AlertDialog.Builder(this)
|
||||
.setTitle("Изменения не сохранены")
|
||||
.setMessage("Продолжить без сохранения?")
|
||||
.setPositiveButton("Да") { _, _ ->
|
||||
|
||||
val intent = Intent(this, MainActivity::class.java)
|
||||
startActivity(intent)
|
||||
}
|
||||
.setNegativeButton("Нет") { dialog, _ ->
|
||||
dialog.dismiss()
|
||||
}
|
||||
.show()
|
||||
} else {
|
||||
val intent = Intent(this, MainActivity::class.java)
|
||||
startActivity(intent)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
257
app/src/main/res/layout/activity_add_workout.xml
Normal file
257
app/src/main/res/layout/activity_add_workout.xml
Normal file
@ -0,0 +1,257 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/blue_gradient"
|
||||
tools:context=".AddWorkout">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linearLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="130dp"
|
||||
android:layout_marginTop="25dp"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Тренировка"
|
||||
android:textAlignment="center"
|
||||
android:textSize="34sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/name_training"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:ems="10"
|
||||
android:inputType="text"
|
||||
android:text="Тренировка 1"
|
||||
android:textAlignment="center"
|
||||
android:textSize="20sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/setting_training"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="400dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintTop_toBottomOf="@+id/linearLayout"
|
||||
tools:layout_editor_absoluteX="16dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView6"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Количество подходов"
|
||||
android:textAlignment="center"
|
||||
android:textSize="24sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/del_set3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="37dp"
|
||||
android:layout_weight="1"
|
||||
app:srcCompat="@drawable/ic_remove_24px" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/numbers_of_sets_all3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="38dp"
|
||||
android:layout_weight="1"
|
||||
android:text="0"
|
||||
android:textAlignment="center"
|
||||
android:textSize="34sp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/add_set3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="37dp"
|
||||
android:layout_weight="1"
|
||||
app:srcCompat="@drawable/ic_add_24px" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView8_all2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Отдых между подходами"
|
||||
android:textAlignment="center"
|
||||
android:textSize="24sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/del_set2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="37dp"
|
||||
android:layout_weight="1"
|
||||
app:srcCompat="@drawable/ic_remove_24px" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/numbers_of_sets_all2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="38dp"
|
||||
android:layout_weight="1"
|
||||
android:text="0"
|
||||
android:textAlignment="center"
|
||||
android:textSize="34sp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/add_set2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="37dp"
|
||||
android:layout_weight="1"
|
||||
app:srcCompat="@drawable/ic_add_24px" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView5"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Время работы"
|
||||
android:textAlignment="center"
|
||||
android:textSize="24sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/del_set"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="37dp"
|
||||
android:layout_weight="1"
|
||||
app:srcCompat="@drawable/ic_remove_24px" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/numbers_of_sets_allall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="38dp"
|
||||
android:layout_weight="1"
|
||||
android:text="0"
|
||||
android:textAlignment="center"
|
||||
android:textSize="34sp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/add_set"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="37dp"
|
||||
android:layout_weight="1"
|
||||
app:srcCompat="@drawable/ic_add_24px" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView8_all"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Отдых между упражнениями"
|
||||
android:textAlignment="center"
|
||||
android:textSize="24sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/del_res"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="37dp"
|
||||
android:layout_weight="1"
|
||||
app:srcCompat="@drawable/ic_remove_24px" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/rest_sets_allall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="39dp"
|
||||
android:layout_weight="1"
|
||||
android:text="0"
|
||||
android:textAlignment="center"
|
||||
android:textSize="34sp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/add_res"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="37dp"
|
||||
android:layout_weight="1"
|
||||
app:srcCompat="@drawable/ic_add_24px" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:layout_marginTop="10dp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/setting_training"
|
||||
tools:layout_editor_absoluteX="0dp">
|
||||
|
||||
<Button
|
||||
android:id="@+id/add_workoutadd"
|
||||
android:layout_width="208dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/green_rectangle"
|
||||
android:gravity="center"
|
||||
android:text="Выбор упражнений"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp" />
|
||||
</FrameLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:layout_marginBottom="35dp"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_on_main_all"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/gradient_purpure"
|
||||
android:text="на главную"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/white" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_save_all"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/gradient_purpure"
|
||||
android:text="Сохранить"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/white" />
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
164
app/src/main/res/layout/activity_all_training.xml
Normal file
164
app/src/main/res/layout/activity_all_training.xml
Normal file
@ -0,0 +1,164 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/gradient_pink"
|
||||
tools:context=".AllTraining">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linearLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="130dp"
|
||||
android:layout_marginTop="25dp"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Тренировка"
|
||||
android:textAlignment="center"
|
||||
android:textSize="34sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/name_training"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:ems="10"
|
||||
android:inputType="text"
|
||||
android:text="Упражнение 1"
|
||||
android:textAlignment="center"
|
||||
android:textSize="20sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/setting_training"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="200dp"
|
||||
android:layout_marginTop="37dp"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintTop_toBottomOf="@+id/linearLayout"
|
||||
tools:layout_editor_absoluteX="16dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Время работы"
|
||||
android:textAlignment="center"
|
||||
android:textSize="24sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/del_set"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="37dp"
|
||||
android:layout_weight="1"
|
||||
app:srcCompat="@drawable/ic_remove_24px" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/numbers_of_sets_allall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="38dp"
|
||||
android:layout_weight="1"
|
||||
android:text="0"
|
||||
android:textAlignment="center"
|
||||
android:textSize="34sp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/add_set"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="37dp"
|
||||
android:layout_weight="1"
|
||||
app:srcCompat="@drawable/ic_add_24px" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView8_all"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Отдых между подходами"
|
||||
android:textAlignment="center"
|
||||
android:textSize="24sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/del_res"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="37dp"
|
||||
android:layout_weight="1"
|
||||
app:srcCompat="@drawable/ic_remove_24px" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/rest_sets_allall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="39dp"
|
||||
android:layout_weight="1"
|
||||
android:text="0"
|
||||
android:textAlignment="center"
|
||||
android:textSize="34sp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/add_res"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="37dp"
|
||||
android:layout_weight="1"
|
||||
app:srcCompat="@drawable/ic_add_24px" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:layout_marginBottom="35dp"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
tools:layout_editor_absoluteX="7dp">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_save_all_vse"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/gradient_purpure"
|
||||
android:text="Сохранить"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/white"
|
||||
tools:layout_editor_absoluteX="245dp"
|
||||
tools:layout_editor_absoluteY="653dp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_on_main_all_vse"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/gradient_purpure"
|
||||
android:text="на главную"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/white"
|
||||
tools:layout_editor_absoluteX="16dp"
|
||||
tools:layout_editor_absoluteY="653dp" />
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
Loading…
Reference in New Issue
Block a user