From 91af70dcce4e920efbb1e3588fef29ff551eda7d Mon Sep 17 00:00:00 2001 From: alexxk2 Date: Wed, 14 Jun 2023 15:37:38 +0300 Subject: [PATCH] 14.06.2023 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -исправлен баг с переносом класса в domain(баг был из-за старой ссылки в nav graph) -заменен kapt на ksp -сдела небольшой рефакторинг пакетов Tasks: -перевести таймер на чистую архитектуру -подумать над тем, чтобы сделать мульти таймеровое приложение, т.е. сделать возможность прекращать тренировку, а также пускать её на заднем фоне с кнопкой континью и минитаймером вместо start workout. Так можно будет вести несколько тренировок, но надо будет делать фабрики вместо синглов в дата слое и что-то придумать со звуками( в целом спорная фича) -почистить код от мусора(старого кода, лишних картинок, стрингов и тд) -сделать выбор при нажатии назад(отменить тренировку или нет) поменять кнопку старт на главной с старт на котинью --- app/build.gradle | 8 +- .../com/practice/getup/data/db/WorkoutDao.kt | 6 +- .../practice/getup/data/db/WorkoutDatabase.kt | 1 - .../impl/StorageRepositoryImpl.kt | 4 +- .../com/practice/getup/database/Workout.kt | 30 ---- .../practice/getup/domain/models/Workout.kt | 14 ++ .../domain/repositories/StorageRepository.kt | 2 +- .../domain/storage/AddNewWorkoutUseCase.kt | 2 +- .../domain/storage/DeleteWorkoutUseCase.kt | 2 +- .../domain/storage/GetAllWorkoutsUseCase.kt | 2 +- .../getup/domain/storage/GetWorkoutUseCase.kt | 3 +- .../domain/storage/UpdateWorkoutUseCase.kt | 2 +- .../presentation/WorkoutDatabaseViewModel.kt | 139 ------------------ .../presentation/edit/ui/OptionsFragment.kt | 2 +- .../edit/view_model/OptionsViewModel.kt | 2 +- .../main_menu/adapter/WorkoutListAdapter.kt | 2 +- .../presentation/main_menu/ui/MainFragment.kt | 5 +- .../main_menu/view_model/MainMenuViewModel.kt | 6 +- .../timer/adapter/WorkoutAdapter.kt | 2 +- .../{ => presentation/timer}/models/Stage.kt | 4 +- .../presentation/timer/ui/WorkoutFragment.kt | 4 +- .../{ => presentation/timer}/utils/UiText.kt | 2 +- .../timer/view_model/WorkoutViewModel.kt | 6 +- app/src/main/res/navigation/nav_graph.xml | 2 +- build.gradle | 2 +- 25 files changed, 46 insertions(+), 208 deletions(-) delete mode 100644 app/src/main/java/com/practice/getup/database/Workout.kt create mode 100644 app/src/main/java/com/practice/getup/domain/models/Workout.kt delete mode 100644 app/src/main/java/com/practice/getup/presentation/WorkoutDatabaseViewModel.kt rename app/src/main/java/com/practice/getup/{ => presentation/timer}/models/Stage.kt (52%) rename app/src/main/java/com/practice/getup/{ => presentation/timer}/utils/UiText.kt (87%) diff --git a/app/build.gradle b/app/build.gradle index 59cfbd2..2014551 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -4,8 +4,9 @@ plugins { id 'kotlin-parcelize' // Navigation id 'androidx.navigation.safeargs.kotlin' - //Kotlin annotation processing tool for Room - id 'kotlin-kapt' + //Kotlin symbol processing for Room + id("com.google.devtools.ksp") + } android { @@ -69,7 +70,8 @@ dependencies { // Room libraries implementation "androidx.room:room-runtime:$room_version" implementation "androidx.room:room-ktx:$room_version" - kapt "androidx.room:room-compiler:$room_version" + //Kotlin symbol processing for Room + ksp "androidx.room:room-compiler:$room_version" //Koin implementation "io.insert-koin:koin-core:$koin_version" implementation "io.insert-koin:koin-android:$koin_version" diff --git a/app/src/main/java/com/practice/getup/data/db/WorkoutDao.kt b/app/src/main/java/com/practice/getup/data/db/WorkoutDao.kt index 27c8713..bb626f0 100644 --- a/app/src/main/java/com/practice/getup/data/db/WorkoutDao.kt +++ b/app/src/main/java/com/practice/getup/data/db/WorkoutDao.kt @@ -13,13 +13,13 @@ import kotlinx.coroutines.flow.Flow @Dao interface WorkoutDao { @Insert(onConflict = OnConflictStrategy.IGNORE) - suspend fun insert(workout: WorkoutDto) + suspend fun insert(workoutDto: WorkoutDto) @Update - suspend fun update(workout: WorkoutDto) + suspend fun update(workoutDto: WorkoutDto) @Delete - suspend fun delete(workout: WorkoutDto) + suspend fun delete(workoutDto: WorkoutDto) @Query("SELECT * FROM workout ORDER BY name ASC") fun getAll(): Flow> diff --git a/app/src/main/java/com/practice/getup/data/db/WorkoutDatabase.kt b/app/src/main/java/com/practice/getup/data/db/WorkoutDatabase.kt index e811cb9..736bd7e 100644 --- a/app/src/main/java/com/practice/getup/data/db/WorkoutDatabase.kt +++ b/app/src/main/java/com/practice/getup/data/db/WorkoutDatabase.kt @@ -5,7 +5,6 @@ import androidx.room.Database import androidx.room.Room import androidx.room.RoomDatabase import com.practice.getup.data.db.dto.WorkoutDto -import com.practice.getup.database.Workout @Database(entities = [WorkoutDto::class], version = 1, exportSchema = false) abstract class WorkoutDatabase() : RoomDatabase() { diff --git a/app/src/main/java/com/practice/getup/data/repositories/impl/StorageRepositoryImpl.kt b/app/src/main/java/com/practice/getup/data/repositories/impl/StorageRepositoryImpl.kt index 69f4f14..72ea5ec 100644 --- a/app/src/main/java/com/practice/getup/data/repositories/impl/StorageRepositoryImpl.kt +++ b/app/src/main/java/com/practice/getup/data/repositories/impl/StorageRepositoryImpl.kt @@ -2,7 +2,7 @@ package com.practice.getup.data.repositories.impl import com.practice.getup.data.db.RoomStorage import com.practice.getup.data.db.dto.WorkoutDto -import com.practice.getup.database.Workout +import com.practice.getup.domain.models.Workout import com.practice.getup.domain.repositories.StorageRepository import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.map @@ -59,7 +59,7 @@ class StorageRepositoryImpl(private val roomStorage: RoomStorage): StorageReposi } } - private fun mapToDomain(workoutDto: WorkoutDto): Workout{ + private fun mapToDomain(workoutDto: WorkoutDto): Workout { with(workoutDto) { return Workout( diff --git a/app/src/main/java/com/practice/getup/database/Workout.kt b/app/src/main/java/com/practice/getup/database/Workout.kt deleted file mode 100644 index 950bb47..0000000 --- a/app/src/main/java/com/practice/getup/database/Workout.kt +++ /dev/null @@ -1,30 +0,0 @@ -package com.practice.getup.database - -import android.os.Parcelable -import androidx.annotation.NonNull -import androidx.room.ColumnInfo -import androidx.room.Entity -import androidx.room.PrimaryKey -import kotlinx.parcelize.Parcelize - -@Parcelize -data class Workout( - val id: Int = 0, - val name: String, - val preparingTime: Int, - val workTime: Int, - val restTime: Int, - val numberOfSets: Int -) : Parcelable - -/* -@Parcelize -@Entity(tableName = "workout") -data class Workout( - @PrimaryKey(autoGenerate = true) val id: Int = 0, - @NonNull @ColumnInfo val name: String, - @NonNull @ColumnInfo("preparing_time") val preparingTime: Int, - @NonNull @ColumnInfo("work_time") val workTime: Int, - @NonNull @ColumnInfo("rest_time") val restTime: Int, - @NonNull @ColumnInfo("number_of_sets") val numberOfSets: Int -): Parcelable*/ diff --git a/app/src/main/java/com/practice/getup/domain/models/Workout.kt b/app/src/main/java/com/practice/getup/domain/models/Workout.kt new file mode 100644 index 0000000..1e00971 --- /dev/null +++ b/app/src/main/java/com/practice/getup/domain/models/Workout.kt @@ -0,0 +1,14 @@ +package com.practice.getup.domain.models + +import android.os.Parcelable +import kotlinx.parcelize.Parcelize + +@Parcelize +data class Workout( + val id: Int = 0, + val name: String, + val preparingTime: Int, + val workTime: Int, + val restTime: Int, + val numberOfSets: Int +): Parcelable diff --git a/app/src/main/java/com/practice/getup/domain/repositories/StorageRepository.kt b/app/src/main/java/com/practice/getup/domain/repositories/StorageRepository.kt index 1e5339a..69a9566 100644 --- a/app/src/main/java/com/practice/getup/domain/repositories/StorageRepository.kt +++ b/app/src/main/java/com/practice/getup/domain/repositories/StorageRepository.kt @@ -1,6 +1,6 @@ package com.practice.getup.domain.repositories -import com.practice.getup.database.Workout +import com.practice.getup.domain.models.Workout import kotlinx.coroutines.flow.Flow interface StorageRepository { diff --git a/app/src/main/java/com/practice/getup/domain/storage/AddNewWorkoutUseCase.kt b/app/src/main/java/com/practice/getup/domain/storage/AddNewWorkoutUseCase.kt index 7b07bcf..900e1b1 100644 --- a/app/src/main/java/com/practice/getup/domain/storage/AddNewWorkoutUseCase.kt +++ b/app/src/main/java/com/practice/getup/domain/storage/AddNewWorkoutUseCase.kt @@ -1,6 +1,6 @@ package com.practice.getup.domain.storage -import com.practice.getup.database.Workout +import com.practice.getup.domain.models.Workout import com.practice.getup.domain.repositories.StorageRepository class AddNewWorkoutUseCase(private val storageRepository: StorageRepository) { diff --git a/app/src/main/java/com/practice/getup/domain/storage/DeleteWorkoutUseCase.kt b/app/src/main/java/com/practice/getup/domain/storage/DeleteWorkoutUseCase.kt index a78f479..81082fe 100644 --- a/app/src/main/java/com/practice/getup/domain/storage/DeleteWorkoutUseCase.kt +++ b/app/src/main/java/com/practice/getup/domain/storage/DeleteWorkoutUseCase.kt @@ -1,6 +1,6 @@ package com.practice.getup.domain.storage -import com.practice.getup.database.Workout +import com.practice.getup.domain.models.Workout import com.practice.getup.domain.repositories.StorageRepository class DeleteWorkoutUseCase(private val storageRepository: StorageRepository) { diff --git a/app/src/main/java/com/practice/getup/domain/storage/GetAllWorkoutsUseCase.kt b/app/src/main/java/com/practice/getup/domain/storage/GetAllWorkoutsUseCase.kt index 04902ec..56a5ca6 100644 --- a/app/src/main/java/com/practice/getup/domain/storage/GetAllWorkoutsUseCase.kt +++ b/app/src/main/java/com/practice/getup/domain/storage/GetAllWorkoutsUseCase.kt @@ -1,6 +1,6 @@ package com.practice.getup.domain.storage -import com.practice.getup.database.Workout +import com.practice.getup.domain.models.Workout import com.practice.getup.domain.repositories.StorageRepository import kotlinx.coroutines.flow.Flow diff --git a/app/src/main/java/com/practice/getup/domain/storage/GetWorkoutUseCase.kt b/app/src/main/java/com/practice/getup/domain/storage/GetWorkoutUseCase.kt index 98a62fa..5846022 100644 --- a/app/src/main/java/com/practice/getup/domain/storage/GetWorkoutUseCase.kt +++ b/app/src/main/java/com/practice/getup/domain/storage/GetWorkoutUseCase.kt @@ -1,8 +1,7 @@ package com.practice.getup.domain.storage -import com.practice.getup.database.Workout +import com.practice.getup.domain.models.Workout import com.practice.getup.domain.repositories.StorageRepository -import kotlinx.coroutines.flow.Flow class GetWorkoutUseCase(private val storageRepository: StorageRepository) { diff --git a/app/src/main/java/com/practice/getup/domain/storage/UpdateWorkoutUseCase.kt b/app/src/main/java/com/practice/getup/domain/storage/UpdateWorkoutUseCase.kt index 046c668..8d44430 100644 --- a/app/src/main/java/com/practice/getup/domain/storage/UpdateWorkoutUseCase.kt +++ b/app/src/main/java/com/practice/getup/domain/storage/UpdateWorkoutUseCase.kt @@ -1,6 +1,6 @@ package com.practice.getup.domain.storage -import com.practice.getup.database.Workout +import com.practice.getup.domain.models.Workout import com.practice.getup.domain.repositories.StorageRepository class UpdateWorkoutUseCase(private val storageRepository: StorageRepository) { diff --git a/app/src/main/java/com/practice/getup/presentation/WorkoutDatabaseViewModel.kt b/app/src/main/java/com/practice/getup/presentation/WorkoutDatabaseViewModel.kt deleted file mode 100644 index 3434cb2..0000000 --- a/app/src/main/java/com/practice/getup/presentation/WorkoutDatabaseViewModel.kt +++ /dev/null @@ -1,139 +0,0 @@ -/* -package com.practice.getup.presentation - -import androidx.lifecycle.LiveData -import androidx.lifecycle.ViewModel -import androidx.lifecycle.ViewModelProvider -import androidx.lifecycle.asLiveData -import androidx.lifecycle.viewModelScope -import com.practice.getup.database.Workout -import com.practice.getup.data.db.WorkoutDao -import kotlinx.coroutines.launch -import java.lang.IllegalArgumentException - -class WorkoutDatabaseViewModel(private val workoutDao: WorkoutDao) : ViewModel() { - - val allWorkouts: LiveData> = workoutDao.getAll().asLiveData() - - - private fun insertWorkout(workout: Workout) { - viewModelScope.launch { - workoutDao.insert(workout) - } - } - - private fun getNewWorkoutInput( - name: String, - preparingTime: String, - workTime: String, - restTime: String, - numberOfSets: String - ) = Workout( - name = name, - preparingTime = preparingTime.toInt(), - workTime = workTime.toInt(), - restTime = restTime.toInt(), - numberOfSets = numberOfSets.toInt() - ) - - private fun getUpdatedWorkoutInput( - id: Int, - name: String, - preparingTime: String, - workTime: String, - restTime: String, - numberOfSets: String - ) = Workout( - id = id, - name = name, - preparingTime = preparingTime.toInt(), - workTime = workTime.toInt(), - restTime = restTime.toInt(), - numberOfSets = numberOfSets.toInt() - ) - - fun addNewWorkout( - name: String, - preparingTime: String, - workTime: String, - restTime: String, - numberOfSets: String - ) { - val newWorkout = getNewWorkoutInput( - name = name, - preparingTime = preparingTime, - workTime = workTime, - restTime = restTime, - numberOfSets = numberOfSets - ) - insertWorkout(newWorkout) - } - - fun isNumberInputValid( - preparingTime: String, - workTime: String, - restTime: String, - numberOfSets: String - ) = - (preparingTime.isNotBlank() && workTime.isNotBlank() && restTime.isNotBlank() && numberOfSets.isNotBlank() - && preparingTime.toInt()>0 && workTime.toInt()>0 && restTime.toInt()>0 && numberOfSets.toInt()>0) - - - fun isNameInputValid( - name: String - ) = (name.isNotBlank()) - - fun retrieveWorkout(id: Int): LiveData{ - return workoutDao.getWorkout(id).asLiveData() - } - - fun deleteWorkout(workout: Workout){ - viewModelScope.launch { - workoutDao.delete(workout) - } - } - - private fun updateWorkout(workout: Workout){ - viewModelScope.launch { - workoutDao.update(workout) - } - } - - fun updateWorkout( - id: Int, - name: String, - preparingTime: String, - workTime: String, - restTime: String, - numberOfSets: String - - ) { - val updatedWorkout = getUpdatedWorkoutInput( - id = id, - name = name, - preparingTime = preparingTime, - workTime = workTime, - restTime = restTime, - numberOfSets = numberOfSets - ) - updateWorkout(updatedWorkout) - } - - fun deleteAll(){ - viewModelScope.launch { - workoutDao.deleteAll() - } - } - -} - -class WorkoutDatabaseViewModelFactory(private val workoutDao: WorkoutDao) : - ViewModelProvider.Factory { - - override fun create(modelClass: Class): T { - if (modelClass.isAssignableFrom(WorkoutDatabaseViewModel::class.java)) { - @Suppress("UNCHECKED_CAST") - return WorkoutDatabaseViewModel(workoutDao) as T - } else throw IllegalArgumentException("Unknown ViewModel class") - } -}*/ diff --git a/app/src/main/java/com/practice/getup/presentation/edit/ui/OptionsFragment.kt b/app/src/main/java/com/practice/getup/presentation/edit/ui/OptionsFragment.kt index 1906313..85e84d3 100644 --- a/app/src/main/java/com/practice/getup/presentation/edit/ui/OptionsFragment.kt +++ b/app/src/main/java/com/practice/getup/presentation/edit/ui/OptionsFragment.kt @@ -14,8 +14,8 @@ import androidx.navigation.fragment.findNavController import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.snackbar.Snackbar import com.practice.getup.R -import com.practice.getup.database.Workout import com.practice.getup.databinding.FragmentOptionsBinding +import com.practice.getup.domain.models.Workout import com.practice.getup.presentation.edit.view_model.OptionsViewModel import org.koin.androidx.viewmodel.ext.android.viewModel diff --git a/app/src/main/java/com/practice/getup/presentation/edit/view_model/OptionsViewModel.kt b/app/src/main/java/com/practice/getup/presentation/edit/view_model/OptionsViewModel.kt index ee76b48..bcde9f9 100644 --- a/app/src/main/java/com/practice/getup/presentation/edit/view_model/OptionsViewModel.kt +++ b/app/src/main/java/com/practice/getup/presentation/edit/view_model/OptionsViewModel.kt @@ -5,7 +5,7 @@ import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.practice.getup.database.Workout +import com.practice.getup.domain.models.Workout import com.practice.getup.domain.storage.AddNewWorkoutUseCase import com.practice.getup.domain.storage.DeleteWorkoutUseCase import com.practice.getup.domain.storage.GetWorkoutUseCase diff --git a/app/src/main/java/com/practice/getup/presentation/main_menu/adapter/WorkoutListAdapter.kt b/app/src/main/java/com/practice/getup/presentation/main_menu/adapter/WorkoutListAdapter.kt index f926de3..0342726 100644 --- a/app/src/main/java/com/practice/getup/presentation/main_menu/adapter/WorkoutListAdapter.kt +++ b/app/src/main/java/com/practice/getup/presentation/main_menu/adapter/WorkoutListAdapter.kt @@ -8,7 +8,7 @@ import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.ListAdapter import androidx.recyclerview.widget.RecyclerView import com.practice.getup.R -import com.practice.getup.database.Workout +import com.practice.getup.domain.models.Workout import com.practice.getup.databinding.WorkoutListItemBinding diff --git a/app/src/main/java/com/practice/getup/presentation/main_menu/ui/MainFragment.kt b/app/src/main/java/com/practice/getup/presentation/main_menu/ui/MainFragment.kt index 11f7e84..7f7143f 100644 --- a/app/src/main/java/com/practice/getup/presentation/main_menu/ui/MainFragment.kt +++ b/app/src/main/java/com/practice/getup/presentation/main_menu/ui/MainFragment.kt @@ -6,15 +6,12 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.fragment.app.Fragment -import androidx.fragment.app.activityViewModels -import androidx.fragment.app.viewModels import androidx.navigation.NavDirections import androidx.navigation.fragment.findNavController import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.snackbar.Snackbar -import com.practice.getup.app.App import com.practice.getup.R -import com.practice.getup.database.Workout +import com.practice.getup.domain.models.Workout import com.practice.getup.databinding.FragmentMainBinding import com.practice.getup.presentation.main_menu.view_model.MainMenuViewModel import com.practice.getup.presentation.main_menu.adapter.WorkoutListAdapter diff --git a/app/src/main/java/com/practice/getup/presentation/main_menu/view_model/MainMenuViewModel.kt b/app/src/main/java/com/practice/getup/presentation/main_menu/view_model/MainMenuViewModel.kt index 76e480c..7a5b1cf 100644 --- a/app/src/main/java/com/practice/getup/presentation/main_menu/view_model/MainMenuViewModel.kt +++ b/app/src/main/java/com/practice/getup/presentation/main_menu/view_model/MainMenuViewModel.kt @@ -4,13 +4,9 @@ import androidx.lifecycle.LiveData import androidx.lifecycle.ViewModel import androidx.lifecycle.asLiveData import androidx.lifecycle.viewModelScope -import com.practice.getup.database.Workout -import com.practice.getup.domain.storage.AddNewWorkoutUseCase +import com.practice.getup.domain.models.Workout import com.practice.getup.domain.storage.DeleteAllWorkoutsUseCase -import com.practice.getup.domain.storage.DeleteWorkoutUseCase import com.practice.getup.domain.storage.GetAllWorkoutsUseCase -import com.practice.getup.domain.storage.GetWorkoutUseCase -import com.practice.getup.domain.storage.UpdateWorkoutUseCase import kotlinx.coroutines.launch class MainMenuViewModel( diff --git a/app/src/main/java/com/practice/getup/presentation/timer/adapter/WorkoutAdapter.kt b/app/src/main/java/com/practice/getup/presentation/timer/adapter/WorkoutAdapter.kt index 9ef7eab..ea7ed95 100644 --- a/app/src/main/java/com/practice/getup/presentation/timer/adapter/WorkoutAdapter.kt +++ b/app/src/main/java/com/practice/getup/presentation/timer/adapter/WorkoutAdapter.kt @@ -7,7 +7,7 @@ import android.view.ViewGroup import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.RecyclerView import com.practice.getup.databinding.WorkoutItemBinding -import com.practice.getup.models.Stage +import com.practice.getup.presentation.timer.models.Stage class WorkoutDiffCallback( diff --git a/app/src/main/java/com/practice/getup/models/Stage.kt b/app/src/main/java/com/practice/getup/presentation/timer/models/Stage.kt similarity index 52% rename from app/src/main/java/com/practice/getup/models/Stage.kt rename to app/src/main/java/com/practice/getup/presentation/timer/models/Stage.kt index b96d0be..71f494f 100644 --- a/app/src/main/java/com/practice/getup/models/Stage.kt +++ b/app/src/main/java/com/practice/getup/presentation/timer/models/Stage.kt @@ -1,6 +1,6 @@ -package com.practice.getup.models +package com.practice.getup.presentation.timer.models -import com.practice.getup.utils.UiText +import com.practice.getup.presentation.timer.utils.UiText data class Stage( val id: String, diff --git a/app/src/main/java/com/practice/getup/presentation/timer/ui/WorkoutFragment.kt b/app/src/main/java/com/practice/getup/presentation/timer/ui/WorkoutFragment.kt index 2408f0b..4aa17b4 100644 --- a/app/src/main/java/com/practice/getup/presentation/timer/ui/WorkoutFragment.kt +++ b/app/src/main/java/com/practice/getup/presentation/timer/ui/WorkoutFragment.kt @@ -1,6 +1,7 @@ package com.practice.getup.presentation.timer.ui + import android.media.MediaPlayer import android.os.Build import android.os.Bundle @@ -14,14 +15,13 @@ import androidx.navigation.fragment.findNavController import androidx.recyclerview.widget.LinearLayoutManager import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.practice.getup.R +import com.practice.getup.domain.models.Workout import com.practice.getup.presentation.timer.adapter.WorkoutAdapter -import com.practice.getup.database.Workout import com.practice.getup.databinding.FragmentWorkoutBinding import com.practice.getup.presentation.timer.models.SoundStages import com.practice.getup.presentation.timer.models.TimerStages import com.practice.getup.presentation.timer.view_model.ViewModelFactoryFragments import com.practice.getup.presentation.timer.view_model.WorkoutViewModel -import kotlinx.coroutines.Runnable class WorkoutFragment : Fragment() { diff --git a/app/src/main/java/com/practice/getup/utils/UiText.kt b/app/src/main/java/com/practice/getup/presentation/timer/utils/UiText.kt similarity index 87% rename from app/src/main/java/com/practice/getup/utils/UiText.kt rename to app/src/main/java/com/practice/getup/presentation/timer/utils/UiText.kt index 5bd72f1..3a478ef 100644 --- a/app/src/main/java/com/practice/getup/utils/UiText.kt +++ b/app/src/main/java/com/practice/getup/presentation/timer/utils/UiText.kt @@ -1,4 +1,4 @@ -package com.practice.getup.utils +package com.practice.getup.presentation.timer.utils import android.content.Context import androidx.annotation.StringRes diff --git a/app/src/main/java/com/practice/getup/presentation/timer/view_model/WorkoutViewModel.kt b/app/src/main/java/com/practice/getup/presentation/timer/view_model/WorkoutViewModel.kt index 99f58c8..9654618 100644 --- a/app/src/main/java/com/practice/getup/presentation/timer/view_model/WorkoutViewModel.kt +++ b/app/src/main/java/com/practice/getup/presentation/timer/view_model/WorkoutViewModel.kt @@ -6,10 +6,10 @@ import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModelProvider import com.practice.getup.R -import com.practice.getup.models.Stage +import com.practice.getup.domain.models.Workout +import com.practice.getup.presentation.timer.models.Stage import com.practice.getup.presentation.timer.models.TimerStages -import com.practice.getup.utils.UiText -import com.practice.getup.database.Workout +import com.practice.getup.presentation.timer.utils.UiText import com.practice.getup.presentation.timer.models.SoundStages import java.lang.IllegalArgumentException diff --git a/app/src/main/res/navigation/nav_graph.xml b/app/src/main/res/navigation/nav_graph.xml index 0b0a53a..c72a650 100644 --- a/app/src/main/res/navigation/nav_graph.xml +++ b/app/src/main/res/navigation/nav_graph.xml @@ -27,7 +27,7 @@ tools:layout="@layout/fragment_workout" > + app:argType="com.practice.getup.domain.models.Workout" /> diff --git a/build.gradle b/build.gradle index a365895..01e265f 100644 --- a/build.gradle +++ b/build.gradle @@ -20,5 +20,5 @@ plugins { id 'com.android.application' version '7.4.0' apply false id 'com.android.library' version '7.4.0' apply false id 'org.jetbrains.kotlin.android' version '1.8.21' apply false - + id("com.google.devtools.ksp") version "1.8.22-1.0.11" apply false } \ No newline at end of file