forked from stud179277/Timer
		
	добавление упражнений для тренировки, отображение на форме
This commit is contained in:
		
							parent
							
								
									0745430fad
								
							
						
					
					
						commit
						a00d3b34b0
					
				| @ -1,6 +1,7 @@ | ||||
| plugins { | ||||
|     alias(libs.plugins.android.application) | ||||
|     alias(libs.plugins.kotlin.android) | ||||
|     id("kotlin-kapt") | ||||
| } | ||||
| 
 | ||||
| android { | ||||
| @ -45,4 +46,13 @@ dependencies { | ||||
|     testImplementation(libs.junit) | ||||
|     androidTestImplementation(libs.androidx.junit) | ||||
|     androidTestImplementation(libs.androidx.espresso.core) | ||||
|     implementation("androidx.room:room-runtime:2.7.1") | ||||
|     implementation("androidx.room:room-ktx:2.7.1") | ||||
|     kapt ("androidx.room:room-compiler:2.7.1") | ||||
|     implementation ("androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0") | ||||
|     implementation ("androidx.lifecycle:lifecycle-livedata-ktx:2.7.0") | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| } | ||||
| @ -1,36 +1,78 @@ | ||||
| package com.example.timert | ||||
| 
 | ||||
| import android.app.Activity | ||||
| import android.app.AlertDialog | ||||
| import android.content.Intent | ||||
| import android.os.Bundle | ||||
| import android.text.TextUtils | ||||
| import android.widget.Button | ||||
| import android.widget.EditText | ||||
| import android.widget.ImageView | ||||
| import android.widget.Toast | ||||
| import androidx.activity.enableEdgeToEdge | ||||
| import androidx.appcompat.app.AppCompatActivity | ||||
| import androidx.core.view.ViewCompat | ||||
| import androidx.core.view.WindowInsetsCompat | ||||
| import androidx.lifecycle.ViewModelProvider | ||||
| import com.example.timert.data.entity.Exercise | ||||
| import com.example.timert.data.viewModel.ExerciseViewModel | ||||
| 
 | ||||
| class AllTraining : AppCompatActivity() { | ||||
|     private var isSave = false | ||||
| 
 | ||||
|     private lateinit var editExerciseView: EditText | ||||
|     private lateinit var numExerciseView: EditText | ||||
|     private lateinit var numRestExerciseView: EditText | ||||
|     override fun onCreate(savedInstanceState: Bundle?) { | ||||
|         val exerciseViewModel = ViewModelProvider( | ||||
|             this, | ||||
|             ViewModelProvider.AndroidViewModelFactory.getInstance(application) | ||||
|         )[ExerciseViewModel::class.java] | ||||
|         super.onCreate(savedInstanceState) | ||||
|         enableEdgeToEdge() | ||||
|         setContentView(R.layout.activity_all_training) | ||||
|         editExerciseView = findViewById(R.id.name_training) | ||||
|         numExerciseView = findViewById(R.id.time_work) | ||||
|         numRestExerciseView = findViewById(R.id.rest_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_vse) | ||||
|         buttonSaveAll.setOnClickListener { | ||||
|             val intent = Intent(this, CreatingTraining::class.java) | ||||
|             startActivity(intent) | ||||
|             isSave = true | ||||
|             val exerciseName = editExerciseView.text.toString() | ||||
|             val numSetsText = numExerciseView.text.toString() | ||||
|             val restSetsText = numRestExerciseView.text.toString() | ||||
| 
 | ||||
|             if (exerciseName.isBlank() || numSetsText.isBlank() || restSetsText.isBlank()) { | ||||
|                 Toast.makeText(this, "Заполните все поля", Toast.LENGTH_SHORT).show() | ||||
|             } else { | ||||
|                 val numSets = numSetsText.toIntOrNull() | ||||
|                 val restSets = restSetsText.toIntOrNull() | ||||
| 
 | ||||
|                 if (numSets == null || restSets == null) { | ||||
|                     Toast.makeText(this, "Неверный формат чисел", Toast.LENGTH_SHORT).show() | ||||
|                     return@setOnClickListener | ||||
|                 } | ||||
|                 val newExercise = Exercise( | ||||
|                     name_exercise = exerciseName, | ||||
|                     num_sets = numSets, | ||||
|                     rest_of_sets = restSets | ||||
|                 ) | ||||
|                 exerciseViewModel.insert(newExercise) | ||||
|                 Toast.makeText(this, "Упражнение сохранено", Toast.LENGTH_SHORT).show() | ||||
|                 isSave = true | ||||
|                 finish() | ||||
|             } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|         } | ||||
| 
 | ||||
| 
 | ||||
|         val button_on_main_all: Button = findViewById(R.id.btn_on_main_all_vse) | ||||
|         button_on_main_all.setOnClickListener { | ||||
|             if (isSave == false) { | ||||
| @ -41,6 +83,7 @@ class AllTraining : AppCompatActivity() { | ||||
| 
 | ||||
|                         val intent = Intent(this, MainActivity::class.java) | ||||
|                         startActivity(intent) | ||||
|                         finish() | ||||
|                     } | ||||
|                     .setNegativeButton("Нет") { dialog, _ -> | ||||
|                         dialog.dismiss() | ||||
| @ -63,6 +106,12 @@ class AllTraining : AppCompatActivity() { | ||||
|         setupPlusMinus(timeInputRest, btnPlusTime, btnMinusTime, minValue = 5, maxValue = 600) | ||||
|         setupPlusMinus(setsInput, btnPlusSets, btnMinusSets, minValue = 5, maxValue = 600) | ||||
|     } | ||||
| 
 | ||||
|     companion object { | ||||
|         const val EXTRA_REPLY = "com.example.android.wordlistsql.REPLY" | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|     fun setupPlusMinus( | ||||
|         editText: EditText, | ||||
|         plus: ImageView, | ||||
|  | ||||
| @ -11,13 +11,45 @@ import androidx.activity.enableEdgeToEdge | ||||
| import androidx.appcompat.app.AppCompatActivity | ||||
| import androidx.core.view.ViewCompat | ||||
| import androidx.core.view.WindowInsetsCompat | ||||
| import androidx.lifecycle.ViewModelProvider | ||||
| import androidx.recyclerview.widget.LinearLayoutManager | ||||
| import androidx.recyclerview.widget.RecyclerView | ||||
| import com.example.timert.data.adapter.ExerciseAdapter | ||||
| import com.example.timert.data.viewModel.ExerciseViewModel | ||||
| 
 | ||||
| class CreatingTraining : AppCompatActivity() { | ||||
| 
 | ||||
|     private lateinit var viewModel: ExerciseViewModel | ||||
| 
 | ||||
|     private var isSave = false | ||||
|     override fun onCreate(savedInstanceState: Bundle?) { | ||||
|         super.onCreate(savedInstanceState) | ||||
|         enableEdgeToEdge() | ||||
|         setContentView(R.layout.activity_creating_training) | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|         viewModel = ViewModelProvider( | ||||
|             this, | ||||
|             ViewModelProvider.AndroidViewModelFactory.getInstance(application) | ||||
|         )[ExerciseViewModel::class.java] | ||||
| 
 | ||||
| 
 | ||||
|         val adapter = ExerciseAdapter { id -> | ||||
|             viewModel.deleteExerciseById(id) | ||||
|         } | ||||
|        // adapter = ExerciseAdapter(this) | ||||
|         val recyclerView = findViewById<RecyclerView>(R.id.exercise) | ||||
|         recyclerView.adapter = adapter | ||||
|         recyclerView.layoutManager = LinearLayoutManager(this) | ||||
| 
 | ||||
| 
 | ||||
|         viewModel.allExercise.observe(this) { exercises -> | ||||
|             exercises?.let { | ||||
|                 adapter.setExercises(it) | ||||
|             } | ||||
|         } | ||||
|         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) | ||||
|  | ||||
| @ -7,12 +7,18 @@ import androidx.activity.enableEdgeToEdge | ||||
| import androidx.appcompat.app.AppCompatActivity | ||||
| import androidx.core.view.ViewCompat | ||||
| import androidx.core.view.WindowInsetsCompat | ||||
| import androidx.lifecycle.ViewModelProvider | ||||
| import androidx.recyclerview.widget.LinearLayoutManager | ||||
| import androidx.recyclerview.widget.RecyclerView | ||||
| import com.example.timert.data.adapter.ExerciseAdapter | ||||
| import com.example.timert.data.viewModel.ExerciseViewModel | ||||
| 
 | ||||
| class History : AppCompatActivity() { | ||||
| 
 | ||||
|     override fun onCreate(savedInstanceState: Bundle?) { | ||||
|         super.onCreate(savedInstanceState) | ||||
|         enableEdgeToEdge() | ||||
|         setContentView(R.layout.activity_history) | ||||
| 
 | ||||
|         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) | ||||
|  | ||||
| @ -0,0 +1,55 @@ | ||||
| package com.example.timert.data.adapter | ||||
| 
 | ||||
| import android.content.Context | ||||
| import android.view.LayoutInflater | ||||
| import android.view.View | ||||
| import android.view.ViewGroup | ||||
| import android.widget.Button | ||||
| import android.widget.ImageButton | ||||
| import android.widget.TextView | ||||
| import androidx.recyclerview.widget.RecyclerView | ||||
| import com.example.timert.R | ||||
| import com.example.timert.data.entity.Exercise | ||||
| import kotlinx.coroutines.CoroutineScope | ||||
| import kotlinx.coroutines.Dispatchers | ||||
| import kotlinx.coroutines.launch | ||||
| 
 | ||||
| 
 | ||||
| //class ExerciseAdapter internal constructor(context: Context):RecyclerView.Adapter<ExerciseAdapter.ExerciseViewHolder>(){ | ||||
| class ExerciseAdapter( | ||||
|     private val onDeleteClick: (Int) -> Unit | ||||
| ) : RecyclerView.Adapter<ExerciseAdapter.ExerciseViewHolder>() { | ||||
|     private var exerciseList: List<Exercise> = emptyList() | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|     inner class ExerciseViewHolder(itemView: View):RecyclerView.ViewHolder(itemView){ | ||||
|         val textViewExercise: TextView = itemView.findViewById(R.id.textView13) | ||||
|         val deleteButton: ImageButton = itemView.findViewById(R.id.deleteButton) | ||||
|     } | ||||
|     override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ExerciseViewHolder { | ||||
|         val view = LayoutInflater.from(parent.context).inflate(R.layout.resyclerview_item, parent, false) | ||||
|         return ExerciseViewHolder(view) | ||||
|     } | ||||
| 
 | ||||
|     override fun onBindViewHolder(holder: ExerciseViewHolder, position: Int) { | ||||
| 
 | ||||
|         val exercise = exerciseList[position] | ||||
| 
 | ||||
|         holder.textViewExercise.text = | ||||
|             "${exercise.name_exercise} — работа: ${exercise.num_sets} сек, отдых: ${exercise.rest_of_sets} сек" | ||||
|         holder.deleteButton.setOnClickListener { | ||||
|             onDeleteClick(exercise.id) | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     override fun getItemCount() = exerciseList.size | ||||
| 
 | ||||
|     fun setExercises(exercises: List<Exercise>) { | ||||
|        this.exerciseList = exercises | ||||
|         notifyDataSetChanged() | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
| } | ||||
							
								
								
									
										26
									
								
								app/src/main/java/com/example/timert/data/dao/ExerciseDao.kt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								app/src/main/java/com/example/timert/data/dao/ExerciseDao.kt
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,26 @@ | ||||
| package com.example.timert.data.dao | ||||
| 
 | ||||
| import androidx.lifecycle.LiveData | ||||
| import androidx.room.Dao | ||||
| import androidx.room.Delete | ||||
| import androidx.room.Insert | ||||
| import androidx.room.OnConflictStrategy | ||||
| import androidx.room.Query | ||||
| import com.example.timert.data.entity.Exercise | ||||
| 
 | ||||
| 
 | ||||
| @Dao | ||||
| interface ExerciseDao { | ||||
|     @Insert(onConflict = OnConflictStrategy.REPLACE) | ||||
|     suspend fun insert(exercise: Exercise) | ||||
| 
 | ||||
|     @Query("SELECT * FROM exercise_table") | ||||
|     fun getExercise(): LiveData<List<Exercise>> | ||||
| 
 | ||||
| 
 | ||||
|     //@Delete | ||||
|    // suspend fun delete(exercise: Exercise) | ||||
| 
 | ||||
|     @Query("DELETE FROM exercise_table WHERE id = :id") | ||||
|     suspend fun deleteById(id: Int) | ||||
| } | ||||
| @ -0,0 +1,61 @@ | ||||
| package com.example.timert.data.database | ||||
| 
 | ||||
| import android.content.Context | ||||
| import androidx.room.Database | ||||
| import androidx.room.Room | ||||
| import androidx.room.RoomDatabase | ||||
| import androidx.sqlite.db.SupportSQLiteDatabase | ||||
| import com.example.timert.data.dao.ExerciseDao | ||||
| import com.example.timert.data.entity.Exercise | ||||
| import kotlinx.coroutines.CoroutineScope | ||||
| import kotlinx.coroutines.launch | ||||
| 
 | ||||
| @Database(entities = [Exercise::class], version = 1, exportSchema = false) | ||||
| abstract class ExerciseDatabase:RoomDatabase(){ | ||||
|     abstract fun exerciseDao():ExerciseDao | ||||
| 
 | ||||
|    // private class ExerciseDatabaseCallback (private val scope: CoroutineScope) : RoomDatabase.Callback(){ | ||||
| 
 | ||||
|         //override fun onOpen(db: SupportSQLiteDatabase) { | ||||
|          //   super.onOpen(db) | ||||
|         //    INSTANCE?.let { database -> | ||||
|          //       scope.launch { | ||||
|          //           populateDatabase(database.exerciseDao()) | ||||
|            //     } | ||||
|           //  } | ||||
|        // } | ||||
|         //suspend fun populateDatabase(exerciseDao: ExerciseDao) { | ||||
|             // Delete all content here. | ||||
|             //exerciseDao.deleteAll() | ||||
|             // Add sample words. | ||||
|             //var exercise = Exercise(0, "training", 10, 45 ) | ||||
|            // exerciseDao.insert(exercise) | ||||
| 
 | ||||
|             // TODO: Add your own words! | ||||
|      //   } | ||||
|     //} | ||||
|     companion object { | ||||
|         @Volatile | ||||
|         private var INSTANCE: ExerciseDatabase? = null | ||||
|         fun getDatabase(context: Context, | ||||
|                         scope: CoroutineScope | ||||
|         ): ExerciseDatabase { | ||||
|             val tempInstance = INSTANCE | ||||
|             if (tempInstance != null) { | ||||
|                 return tempInstance | ||||
|             } | ||||
|             synchronized(this) { | ||||
|                 val instance = Room.databaseBuilder( | ||||
|                     context.applicationContext, | ||||
|                     ExerciseDatabase::class.java, | ||||
|                     "exercise_database" | ||||
|                 ) | ||||
|                     //.addCallback(ExerciseDatabaseCallback(scope)) | ||||
|                     .build() | ||||
|                 INSTANCE = instance | ||||
|                 return instance | ||||
|             } | ||||
| 
 | ||||
|         } | ||||
|         } | ||||
| } | ||||
							
								
								
									
										11
									
								
								app/src/main/java/com/example/timert/data/entity/Exercise.kt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								app/src/main/java/com/example/timert/data/entity/Exercise.kt
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,11 @@ | ||||
| package com.example.timert.data.entity | ||||
| 
 | ||||
| import androidx.room.Entity | ||||
| import androidx.room.PrimaryKey | ||||
| 
 | ||||
| 
 | ||||
| @Entity(tableName = "exercise_table") | ||||
| data class Exercise(@PrimaryKey(autoGenerate = true) val id: Int = 0, | ||||
|                     val name_exercise: String, | ||||
|                     val num_sets: Int, | ||||
|                     val rest_of_sets: Int) | ||||
| @ -0,0 +1,17 @@ | ||||
| package com.example.timert.data.repository | ||||
| 
 | ||||
| import androidx.lifecycle.LiveData | ||||
| import com.example.timert.data.dao.ExerciseDao | ||||
| import com.example.timert.data.entity.Exercise | ||||
| 
 | ||||
| class ExerciseRepository(private val exerciseDao:ExerciseDao){ | ||||
|     val allExercise: LiveData<List<Exercise>> = exerciseDao.getExercise() | ||||
|     suspend fun insert(training: Exercise) { | ||||
|         exerciseDao.insert(training) | ||||
|     } | ||||
| 
 | ||||
|     suspend fun deleteExerciseById(id: Int) { | ||||
|         exerciseDao.deleteById(id) | ||||
|     } | ||||
| 
 | ||||
| } | ||||
| @ -0,0 +1,28 @@ | ||||
| package com.example.timert.data.viewModel | ||||
| 
 | ||||
| import android.app.Application | ||||
| import androidx.lifecycle.AndroidViewModel | ||||
| import androidx.lifecycle.LiveData | ||||
| import androidx.lifecycle.viewModelScope | ||||
| import com.example.timert.data.database.ExerciseDatabase | ||||
| import com.example.timert.data.entity.Exercise | ||||
| import com.example.timert.data.repository.ExerciseRepository | ||||
| import kotlinx.coroutines.launch | ||||
| 
 | ||||
| class ExerciseViewModel(application: Application):AndroidViewModel(application){ | ||||
|     private val repository: ExerciseRepository | ||||
|     val allExercise: LiveData<List<Exercise>> | ||||
| 
 | ||||
|     init{ | ||||
|         val exercisesDao = ExerciseDatabase.getDatabase(application, viewModelScope).exerciseDao() | ||||
|         repository = ExerciseRepository(exercisesDao) | ||||
|         allExercise = repository.allExercise | ||||
|     } | ||||
|     fun insert(exercise: Exercise) = viewModelScope.launch { | ||||
|         repository.insert(exercise) | ||||
|     } | ||||
| 
 | ||||
|     fun deleteExerciseById(id: Int) = viewModelScope.launch { | ||||
|         repository.deleteExerciseById(id) | ||||
|     } | ||||
| } | ||||
| @ -11,7 +11,7 @@ | ||||
|     <LinearLayout | ||||
|         android:id="@+id/linearLayout" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="130dp" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:layout_marginTop="25dp" | ||||
|         android:orientation="vertical" | ||||
|         app:layout_constraintTop_toTopOf="parent"> | ||||
| @ -31,7 +31,7 @@ | ||||
|             android:layout_marginTop="20dp" | ||||
|             android:ems="10" | ||||
|             android:inputType="text" | ||||
|             android:text="Упражнение 1" | ||||
|             android:text="Упражнение" | ||||
|             android:textAlignment="center" | ||||
|             android:textSize="20sp" /> | ||||
| 
 | ||||
| @ -40,8 +40,8 @@ | ||||
|     <LinearLayout | ||||
|         android:id="@+id/setting_training" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="250dp" | ||||
|         android:layout_marginTop="37dp" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:layout_marginTop="5dp" | ||||
|         android:orientation="vertical" | ||||
|         app:layout_constraintTop_toBottomOf="@+id/linearLayout" | ||||
|         tools:layout_editor_absoluteX="16dp"> | ||||
| @ -50,7 +50,7 @@ | ||||
|             android:id="@+id/textView3" | ||||
|             android:layout_width="match_parent" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:text="Время работы" | ||||
|             android:text="Время работы, сек" | ||||
|             android:textAlignment="center" | ||||
|             android:textSize="24sp" /> | ||||
| 
 | ||||
| @ -93,13 +93,13 @@ | ||||
|             android:id="@+id/textView8_all" | ||||
|             android:layout_width="match_parent" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:text="Отдых между упражнениями" | ||||
|             android:text="Отдых между упражнениями, сек" | ||||
|             android:textAlignment="center" | ||||
|             android:textSize="24sp" /> | ||||
| 
 | ||||
|         <LinearLayout | ||||
|             android:layout_width="match_parent" | ||||
|             android:layout_height="95dp" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:orientation="horizontal"> | ||||
| 
 | ||||
|             <ImageView | ||||
|  | ||||
| @ -11,7 +11,7 @@ | ||||
|     <LinearLayout | ||||
|         android:id="@+id/linearLayout" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="130dp" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:layout_marginTop="25dp" | ||||
|         android:orientation="vertical" | ||||
|         app:layout_constraintTop_toTopOf="parent"> | ||||
| @ -28,10 +28,9 @@ | ||||
|             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:text="Моя тренировка" | ||||
|             android:textAlignment="center" | ||||
|             android:textSize="20sp" /> | ||||
| 
 | ||||
| @ -40,11 +39,12 @@ | ||||
|     <LinearLayout | ||||
|         android:id="@+id/setting_training" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="220dp" | ||||
|         android:layout_marginTop="37dp" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:orientation="vertical" | ||||
|         app:layout_constraintTop_toBottomOf="@+id/linearLayout" | ||||
|         tools:layout_editor_absoluteX="16dp"> | ||||
|         app:layout_constraintBottom_toTopOf="@+id/exercise" | ||||
|         app:layout_constraintTop_toBottomOf="@+id/linearLayout"> | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|         <TextView | ||||
|             android:id="@+id/textView5" | ||||
| @ -57,7 +57,7 @@ | ||||
|         <LinearLayout | ||||
|             android:layout_width="match_parent" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:layout_marginBottom="20dp" | ||||
|             android:layout_marginBottom="8dp" | ||||
|             android:orientation="horizontal"> | ||||
| 
 | ||||
|             <ImageView | ||||
| @ -89,6 +89,7 @@ | ||||
|                 app:srcCompat="@drawable/ic_add_24px" /> | ||||
|         </LinearLayout> | ||||
| 
 | ||||
| 
 | ||||
|         <TextView | ||||
|             android:id="@+id/textView8" | ||||
|             android:layout_width="match_parent" | ||||
| @ -100,6 +101,7 @@ | ||||
|         <LinearLayout | ||||
|             android:layout_width="match_parent" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:layout_marginBottom="8dp" | ||||
|             android:orientation="horizontal"> | ||||
| 
 | ||||
|             <ImageView | ||||
| @ -131,20 +133,41 @@ | ||||
|                 app:srcCompat="@drawable/ic_add_24px" /> | ||||
|         </LinearLayout> | ||||
| 
 | ||||
|         <LinearLayout | ||||
|             android:layout_width="wrap_content" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:orientation="vertical" /> | ||||
| 
 | ||||
|     </LinearLayout> | ||||
| 
 | ||||
|     <FrameLayout | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="60dp" | ||||
|         android:layout_marginTop="19dp" | ||||
| 
 | ||||
|     <androidx.recyclerview.widget.RecyclerView | ||||
|         android:id="@+id/exercise" | ||||
|         android:layout_width="0dp" | ||||
|         android:layout_height="0dp" | ||||
|         app:layout_constraintBottom_toTopOf="@+id/frameLayout" | ||||
|         app:layout_constraintEnd_toEndOf="parent" | ||||
|         app:layout_constraintHorizontal_bias="0.373" | ||||
|         app:layout_constraintStart_toStartOf="parent" | ||||
|         app:layout_constraintTop_toBottomOf="@+id/setting_training" | ||||
|         tools:layout_editor_absoluteX="0dp"> | ||||
|         app:layout_constraintVertical_bias="0.178" /> | ||||
| 
 | ||||
|     <FrameLayout | ||||
|         android:id="@+id/frameLayout" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="wrap_content" | ||||
|         app:layout_constraintBottom_toTopOf="@+id/linearLayout2" | ||||
|         app:layout_constraintEnd_toEndOf="parent" | ||||
|         app:layout_constraintHorizontal_bias="1.0" | ||||
|         app:layout_constraintStart_toStartOf="parent"> | ||||
| 
 | ||||
|         <Button | ||||
|             android:id="@+id/add_workout" | ||||
|             android:layout_width="176dp" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:layout_gravity="center" | ||||
|             android:layout_marginTop="10dp" | ||||
|             android:layout_marginBottom="10dp" | ||||
|             android:background="@drawable/green_rectangle" | ||||
|             android:gravity="center" | ||||
|             android:text="+ упражнение" | ||||
| @ -154,12 +177,13 @@ | ||||
|     </FrameLayout> | ||||
| 
 | ||||
|     <LinearLayout | ||||
|         android:id="@+id/linearLayout2" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="60dp" | ||||
|         android:layout_marginBottom="35dp" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:orientation="horizontal" | ||||
|         app:layout_constraintBottom_toBottomOf="parent" | ||||
|         app:layout_constraintEnd_toEndOf="parent" | ||||
|         app:layout_constraintHorizontal_bias="0.0" | ||||
|         app:layout_constraintStart_toStartOf="parent"> | ||||
| 
 | ||||
|         <Button | ||||
| @ -167,8 +191,8 @@ | ||||
|             android:layout_width="150dp" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:layout_gravity="center" | ||||
|             android:layout_marginLeft="20dp" | ||||
|             android:layout_marginRight="20dp" | ||||
|             android:layout_marginLeft="8dp" | ||||
|             android:layout_marginRight="8dp" | ||||
|             android:layout_weight="1" | ||||
|             android:background="@drawable/gradient_purpure" | ||||
|             android:text="на главную" | ||||
| @ -180,8 +204,8 @@ | ||||
|             android:layout_width="150dp" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:layout_gravity="center" | ||||
|             android:layout_marginLeft="20dp" | ||||
|             android:layout_marginRight="20dp" | ||||
|             android:layout_marginLeft="8dp" | ||||
|             android:layout_marginRight="8dp" | ||||
|             android:layout_weight="1" | ||||
|             android:background="@drawable/gradient_purpure" | ||||
|             android:text="Сохранить" | ||||
|  | ||||
| @ -72,7 +72,7 @@ | ||||
|             android:layout_width="match_parent" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:background="@android:color/transparent" | ||||
|             android:text="Редактировать тренировку" | ||||
|             android:text="Создать новую тренировку" | ||||
|             android:textColor="@android:color/white" /> | ||||
|     </androidx.cardview.widget.CardView> | ||||
| 
 | ||||
|  | ||||
							
								
								
									
										39
									
								
								app/src/main/res/layout/resyclerview_item.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								app/src/main/res/layout/resyclerview_item.xml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,39 @@ | ||||
| <?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:layout_width="match_parent" | ||||
|     android:layout_height="wrap_content" | ||||
|     android:layout_marginTop="4dp" | ||||
|     android:layout_marginBottom="4dp"> | ||||
| 
 | ||||
| 
 | ||||
|     <LinearLayout | ||||
|         android:id="@+id/layout" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:background="#410F3FED" | ||||
|         android:orientation="horizontal" | ||||
|         android:paddingTop="8dp" | ||||
|         android:paddingBottom="8dp"> | ||||
| 
 | ||||
|         <TextView | ||||
|             android:id="@+id/textView13" | ||||
|             android:layout_width="353dp" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:layout_gravity="center" | ||||
|             android:gravity="center" | ||||
|             android:paddingTop="10dp" | ||||
|             android:paddingBottom="10dp" | ||||
|             android:text="Название упражнения" | ||||
|             android:textColor="#000000" | ||||
|             android:textSize="18sp" /> | ||||
| 
 | ||||
|         <ImageButton | ||||
|             android:id="@+id/deleteButton" | ||||
|             android:layout_width="wrap_content" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:backgroundTint="#00FFFFFF" | ||||
|             app:srcCompat="@android:drawable/ic_menu_delete" /> | ||||
|     </LinearLayout> | ||||
| </androidx.constraintlayout.widget.ConstraintLayout> | ||||
| @ -20,4 +20,5 @@ kotlin.code.style=official | ||||
| # Enables namespacing of each library's R class so that its R class includes only the | ||||
| # resources declared in the library itself and none from the library's dependencies, | ||||
| # thereby reducing the size of the R class for that library | ||||
| android.nonTransitiveRClass=true | ||||
| android.nonTransitiveRClass=true | ||||
| kapt.compiler.jvmtarget=11 | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user