Добавлены формы 1 и 6
							
								
								
									
										1
									
								
								.idea/.name
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						| @ -0,0 +1 @@ | ||||
| TimerT | ||||
							
								
								
									
										1
									
								
								.idea/misc.xml
									
									
									
										generated
									
									
									
								
							
							
						
						| @ -1,4 +1,3 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <project version="4"> | ||||
|   <component name="ExternalStorageConfigurationManager" enabled="true" /> | ||||
|   <component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="jbr-21" project-jdk-type="JavaSDK"> | ||||
|  | ||||
| @ -12,6 +12,9 @@ | ||||
|         android:supportsRtl="true" | ||||
|         android:theme="@style/Theme.TimerT" | ||||
|         tools:targetApi="31"> | ||||
|         <activity | ||||
|             android:name=".SettingsActivity" | ||||
|             android:exported="false" /> | ||||
|         <activity | ||||
|             android:name=".CreatingTraining" | ||||
|             android:exported="false" /> | ||||
|  | ||||
							
								
								
									
										
											BIN
										
									
								
								app/src/main/ic_launcher-playstore.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 42 KiB | 
| @ -3,6 +3,7 @@ package com.example.timert | ||||
| import android.content.Intent | ||||
| import android.os.Bundle | ||||
| import android.widget.Button | ||||
| import android.widget.Toast | ||||
| import androidx.activity.enableEdgeToEdge | ||||
| import androidx.appcompat.app.AppCompatActivity | ||||
| import androidx.core.view.ViewCompat | ||||
| @ -18,18 +19,30 @@ class MainActivity : AppCompatActivity() { | ||||
|             v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom) | ||||
|             insets | ||||
|         } | ||||
|         var button: Button = findViewById(R.id.button1) | ||||
| 
 | ||||
|         button.setOnClickListener{ | ||||
|             val intent = Intent(this,timer::class.java) | ||||
|         // Кнопки главной формы: | ||||
|         val settingsButton: Button = findViewById(R.id.settingsButton) | ||||
|         settingsButton.setOnClickListener { | ||||
|             val intent = Intent(this, SettingsActivity::class.java) | ||||
|             startActivity(intent) | ||||
|         } | ||||
|         var button2: Button = findViewById(R.id.button2) | ||||
| 
 | ||||
|         button2.setOnClickListener{ | ||||
|             val intent = Intent(this,CreatingTraining::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 templatesButton: Button = findViewById(R.id.templatesButton) | ||||
|         templatesButton.setOnClickListener { | ||||
|             Toast.makeText(this, "Открытие шаблонов!", Toast.LENGTH_SHORT).show() // Заглушка | ||||
|             //TODO: Intent для открытия Activity шаблонов (форма 3) | ||||
|         } | ||||
| 
 | ||||
|         val newTemplateButton: Button = findViewById(R.id.newTemplateButton) | ||||
|         newTemplateButton.setOnClickListener { | ||||
|             Toast.makeText(this, "Создание нового шаблона!", Toast.LENGTH_SHORT).show() // Заглушка | ||||
|             //TODO: Intent для открытия Activity создания шаблона (форма 3) | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										83
									
								
								app/src/main/java/com/example/timert/SettingsActivity.kt
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @ -0,0 +1,83 @@ | ||||
| package com.example.timert | ||||
| 
 | ||||
| import android.content.Context | ||||
| import android.content.pm.PackageManager | ||||
| import android.os.Bundle | ||||
| import android.widget.Switch | ||||
| import android.widget.TextView | ||||
| import androidx.appcompat.app.AppCompatActivity | ||||
| import androidx.appcompat.app.AppCompatDelegate | ||||
| import android.widget.Button | ||||
| import androidx.appcompat.app.AlertDialog | ||||
| import androidx.core.text.HtmlCompat | ||||
| 
 | ||||
| class SettingsActivity : AppCompatActivity() { | ||||
|     override fun onCreate(savedInstanceState: Bundle?) { | ||||
|         super.onCreate(savedInstanceState) | ||||
|         setContentView(R.layout.activity_settings2) | ||||
| 
 | ||||
|         val versionTextView: TextView = findViewById(R.id.versionTextView) | ||||
|         val darkModeSwitch: Switch = findViewById(R.id.darkModeSwitch) | ||||
|         val aboutButton: Button = findViewById(R.id.aboutButton) | ||||
|         val developersButton: Button = findViewById(R.id.developersButton) | ||||
| 
 | ||||
|         // Получаем сохраненное состояние темы из SharedPreferences | ||||
|         val sharedPreferences = getSharedPreferences("AppSettings", Context.MODE_PRIVATE) | ||||
|         val isDarkMode = sharedPreferences.getBoolean("DarkMode", false) // По умолчанию - светлая тема | ||||
|         darkModeSwitch.isChecked = isDarkMode | ||||
| 
 | ||||
|         // Применяем тему | ||||
|         if (isDarkMode) { | ||||
|             AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES) | ||||
|         } else { | ||||
|             AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO) | ||||
|         } | ||||
| 
 | ||||
|         try { | ||||
|             val packageInfo = packageManager.getPackageInfo(packageName, 0) | ||||
|             val versionName = packageInfo.versionName | ||||
|             versionTextView.text = "Версия: $versionName" | ||||
|         } catch (e: PackageManager.NameNotFoundException) { | ||||
|             versionTextView.text = "Версия: Неизвестно" | ||||
|         } | ||||
| 
 | ||||
|         // Устанавливаем слушатель для Switch | ||||
|         darkModeSwitch.setOnCheckedChangeListener { _, isChecked -> | ||||
|             // Сохраняем состояние темы в SharedPreferences | ||||
|             val editor = sharedPreferences.edit() | ||||
|             editor.putBoolean("DarkMode", isChecked) | ||||
|             editor.apply() | ||||
| 
 | ||||
|             // Применяем тему | ||||
|             if (isChecked) { | ||||
|                 AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES) | ||||
|             } else { | ||||
|                 AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO) | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         // Обработчик нажатия на кнопку "О программе" | ||||
|         aboutButton.setOnClickListener { | ||||
|             AlertDialog.Builder(this) | ||||
|                 .setTitle("О программе") | ||||
|                 .setMessage("Краткое описание пользования приложением.\n\nНапример: Это приложение позволяет тренироваться, чтобы быть как арнольдшварцнигер 😄") | ||||
|                 .setPositiveButton("ОК", null) | ||||
|                 .show() | ||||
|         } | ||||
| 
 | ||||
|         // Обработчик нажатия на кнопку "Разработчики" | ||||
|         developersButton.setOnClickListener { | ||||
|             AlertDialog.Builder(this) | ||||
|                 .setTitle("Разработчики") | ||||
|                 .setMessage(HtmlCompat.fromHtml( | ||||
|                     "<p style='margin-left: 2em;'><b>Вятский государственный университет</b></p><br>" + | ||||
|                             "<p style='margin-left: 2em;'>Емцова Надежда Александровна</p>" + | ||||
|                             "<p style='margin-left: 2em;'>Новиков Николай Алексеевич</p>" + | ||||
|                             "<p style='margin-left: 2em;'>Пискун Алёна Викторовна</p>", | ||||
|                     HtmlCompat.FROM_HTML_MODE_LEGACY | ||||
|                 )) | ||||
|                 .setPositiveButton("ОК", null) | ||||
|                 .show() | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/drawable/background_image2.jpg
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 4.4 KiB | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/drawable/background_imagemain.jpg
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 1.1 MiB | 
							
								
								
									
										5
									
								
								app/src/main/res/drawable/ic_settings.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @ -0,0 +1,5 @@ | ||||
| <vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#3D6ADC" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp"> | ||||
|        | ||||
|     <path android:fillColor="@android:color/white" android:pathData="M19.14,12.94c0.04,-0.3 0.06,-0.61 0.06,-0.94c0,-0.32 -0.02,-0.64 -0.07,-0.94l2.03,-1.58c0.18,-0.14 0.23,-0.41 0.12,-0.61l-1.92,-3.32c-0.12,-0.22 -0.37,-0.29 -0.59,-0.22l-2.39,0.96c-0.5,-0.38 -1.03,-0.7 -1.62,-0.94L14.4,2.81c-0.04,-0.24 -0.24,-0.41 -0.48,-0.41h-3.84c-0.24,0 -0.43,0.17 -0.47,0.41L9.25,5.35C8.66,5.59 8.12,5.92 7.63,6.29L5.24,5.33c-0.22,-0.08 -0.47,0 -0.59,0.22L2.74,8.87C2.62,9.08 2.66,9.34 2.86,9.48l2.03,1.58C4.84,11.36 4.8,11.69 4.8,12s0.02,0.64 0.07,0.94l-2.03,1.58c-0.18,0.14 -0.23,0.41 -0.12,0.61l1.92,3.32c0.12,0.22 0.37,0.29 0.59,0.22l2.39,-0.96c0.5,0.38 1.03,0.7 1.62,0.94l0.36,2.54c0.05,0.24 0.24,0.41 0.48,0.41h3.84c0.24,0 0.44,-0.17 0.47,-0.41l0.36,-2.54c0.59,-0.24 1.13,-0.56 1.62,-0.94l2.39,0.96c0.22,0.08 0.47,0 0.59,-0.22l1.92,-3.32c0.12,-0.22 0.07,-0.47 -0.12,-0.61L19.14,12.94zM12,15.6c-1.98,0 -3.6,-1.62 -3.6,-3.6s1.62,-3.6 3.6,-3.6s3.6,1.62 3.6,3.6S13.98,15.6 12,15.6z"/> | ||||
|      | ||||
| </vector> | ||||
| @ -7,24 +7,92 @@ | ||||
|     android:layout_height="match_parent" | ||||
|     tools:context=".MainActivity"> | ||||
| 
 | ||||
|     <LinearLayout | ||||
|     <ImageView | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="match_parent" | ||||
|         android:orientation="horizontal"> | ||||
|         android:scaleType="centerCrop" | ||||
|         android:src="@drawable/background_imagemain" | ||||
|         app:layout_constraintBottom_toBottomOf="parent" | ||||
|         app:layout_constraintEnd_toEndOf="parent" | ||||
|         app:layout_constraintStart_toStartOf="parent" | ||||
|         app:layout_constraintTop_toTopOf="parent" /> | ||||
| 
 | ||||
|     <Button | ||||
|             android:id="@+id/button1" | ||||
|             android:layout_width="171dp" | ||||
|         android:id="@+id/settingsButton" | ||||
|         android:layout_width="48dp" | ||||
|         android:layout_height="48dp" | ||||
|         android:background="@drawable/ic_settings" | ||||
|         app:layout_constraintEnd_toEndOf="parent" | ||||
|         app:layout_constraintTop_toTopOf="parent" | ||||
|         android:layout_marginTop="16dp" | ||||
|         android:layout_marginEnd="16dp" | ||||
|         android:contentDescription="Настройки" | ||||
|         android:backgroundTint="@color/black" /> | ||||
| 
 | ||||
|     <androidx.cardview.widget.CardView | ||||
|         android:id="@+id/startTrainingCardView" | ||||
|         android:layout_width="0dp" | ||||
|         android:layout_height="wrap_content" | ||||
|             android:layout_weight="1" | ||||
|             android:text="Button" /> | ||||
|         android:layout_marginStart="32dp" | ||||
|         android:layout_marginTop="32dp" | ||||
|         android:layout_marginEnd="32dp" | ||||
|         app:cardBackgroundColor="#80000000" | ||||
|         app:cardCornerRadius="8dp" | ||||
|         app:layout_constraintEnd_toEndOf="parent" | ||||
|         app:layout_constraintStart_toStartOf="parent" | ||||
|         app:layout_constraintTop_toBottomOf="@+id/settingsButton"> | ||||
| 
 | ||||
|         <Button | ||||
|             android:id="@+id/button2" | ||||
|             android:layout_width="wrap_content" | ||||
|             android:id="@+id/startTrainingButton" | ||||
|             android:layout_width="match_parent" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:layout_weight="1" | ||||
|             android:text="Button2" /> | ||||
|     </LinearLayout> | ||||
|             android:background="@android:color/transparent" | ||||
|             android:text="Начать тренировку" | ||||
|             android:textColor="@android:color/white" /> | ||||
|     </androidx.cardview.widget.CardView> | ||||
| 
 | ||||
|     <androidx.cardview.widget.CardView | ||||
|         android:id="@+id/templatesCardView" | ||||
|         android:layout_width="0dp" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:layout_marginStart="32dp" | ||||
|         android:layout_marginTop="16dp" | ||||
|         android:layout_marginEnd="32dp" | ||||
|         app:cardBackgroundColor="#80000000" | ||||
|         app:cardCornerRadius="8dp" | ||||
|         app:layout_constraintEnd_toEndOf="parent" | ||||
|         app:layout_constraintStart_toStartOf="parent" | ||||
|         app:layout_constraintTop_toBottomOf="@+id/startTrainingCardView"> | ||||
| 
 | ||||
|         <Button | ||||
|             android:id="@+id/templatesButton" | ||||
|             android:layout_width="match_parent" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:background="@android:color/transparent" | ||||
|             android:text="Редактировать тренировку" | ||||
|             android:textColor="@android:color/white" /> | ||||
|     </androidx.cardview.widget.CardView> | ||||
| 
 | ||||
|     <androidx.cardview.widget.CardView | ||||
|         android:id="@+id/newTemplateCardView" | ||||
|         android:layout_width="0dp" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:layout_marginStart="32dp" | ||||
|         android:layout_marginTop="16dp" | ||||
|         android:layout_marginEnd="32dp" | ||||
|         app:cardBackgroundColor="#80000000" | ||||
|         app:cardCornerRadius="8dp" | ||||
|         app:layout_constraintEnd_toEndOf="parent" | ||||
|         app:layout_constraintStart_toStartOf="parent" | ||||
|         app:layout_constraintTop_toBottomOf="@+id/templatesCardView"> | ||||
| 
 | ||||
|         <Button | ||||
|             android:id="@+id/newTemplateButton" | ||||
|             android:layout_width="match_parent" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:background="@android:color/transparent" | ||||
|             android:text="История тренировок" | ||||
|             android:textColor="@android:color/white" /> | ||||
|     </androidx.cardview.widget.CardView> | ||||
| 
 | ||||
| </androidx.constraintlayout.widget.ConstraintLayout> | ||||
| 
 | ||||
|  | ||||
							
								
								
									
										65
									
								
								app/src/main/res/layout/activity_settings2.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @ -0,0 +1,65 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     android:layout_width="match_parent" | ||||
|     android:layout_height="match_parent" | ||||
|     android:orientation="vertical" | ||||
|     android:padding="16dp" | ||||
|     android:background="@drawable/background_image2">  <!-- Добавили background --> | ||||
| 
 | ||||
|     <TextView | ||||
|         android:layout_width="wrap_content" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:text="Настройки" | ||||
|         android:textSize="24sp" | ||||
|         android:textStyle="bold" | ||||
|         android:layout_marginBottom="16dp"/> | ||||
| 
 | ||||
|     <TextView | ||||
|         android:layout_width="wrap_content" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:text="Таймер для тренировок" | ||||
|         android:textSize="18sp" | ||||
|         android:layout_marginBottom="8dp"/> | ||||
| 
 | ||||
|     <TextView | ||||
|         android:id="@+id/versionTextView" | ||||
|         android:layout_width="wrap_content" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:text="Версия: 1.0" | ||||
|         android:layout_marginBottom="16dp"/> | ||||
| 
 | ||||
|     <LinearLayout | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:orientation="horizontal" | ||||
|         android:gravity="center_vertical" | ||||
|         android:layout_marginBottom="8dp"> | ||||
| 
 | ||||
|         <TextView | ||||
|             android:layout_width="0dp" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:layout_weight="1" | ||||
|             android:text="Темная тема" | ||||
|             android:textSize="16sp"/> | ||||
| 
 | ||||
|         <Switch | ||||
|             android:id="@+id/darkModeSwitch" | ||||
|             android:layout_width="wrap_content" | ||||
|             android:layout_height="wrap_content"/> | ||||
| 
 | ||||
|     </LinearLayout> | ||||
| 
 | ||||
|     <Button | ||||
|         android:id="@+id/aboutButton" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:text="О программе" | ||||
|         android:layout_marginBottom="8dp"/> | ||||
| 
 | ||||
|     <Button | ||||
|         android:id="@+id/developersButton" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:text="Разработчики"/> | ||||
| 
 | ||||
| </LinearLayout> | ||||
| @ -1,6 +1,5 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> | ||||
|     <background android:drawable="@drawable/ic_launcher_background" /> | ||||
|     <foreground android:drawable="@drawable/ic_launcher_foreground" /> | ||||
|     <monochrome android:drawable="@drawable/ic_launcher_foreground" /> | ||||
|     <background android:drawable="@color/ic_launcher_background"/> | ||||
|     <foreground android:drawable="@mipmap/ic_launcher_foreground"/> | ||||
| </adaptive-icon> | ||||
| @ -1,6 +1,5 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> | ||||
|     <background android:drawable="@drawable/ic_launcher_background" /> | ||||
|     <foreground android:drawable="@drawable/ic_launcher_foreground" /> | ||||
|     <monochrome android:drawable="@drawable/ic_launcher_foreground" /> | ||||
|     <background android:drawable="@color/ic_launcher_background"/> | ||||
|     <foreground android:drawable="@mipmap/ic_launcher_foreground"/> | ||||
| </adaptive-icon> | ||||
| Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 2.8 KiB | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 3.8 KiB | 
| Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 4.9 KiB | 
| Before Width: | Height: | Size: 982 B After Width: | Height: | Size: 2.0 KiB | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 2.6 KiB | 
| Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 3.2 KiB | 
| Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 3.7 KiB | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 4.8 KiB | 
| Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 6.6 KiB | 
| Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 5.4 KiB | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 7.7 KiB | 
| Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 10 KiB | 
| Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 7.1 KiB | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 11 KiB | 
| Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 14 KiB | 
							
								
								
									
										4
									
								
								app/src/main/res/values/ic_launcher_background.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @ -0,0 +1,4 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <resources> | ||||
|     <color name="ic_launcher_background">#943DDC</color> | ||||
| </resources> | ||||
| @ -1,5 +1,5 @@ | ||||
| [versions] | ||||
| agp = "8.9.1" | ||||
| agp = "8.9.2" | ||||
| kotlin = "2.0.21" | ||||
| coreKtx = "1.16.0" | ||||
| junit = "4.13.2" | ||||
|  | ||||