Skip to content

Commit

Permalink
changed ui folder to presentation folder
Browse files Browse the repository at this point in the history
  • Loading branch information
braiso-22 committed Apr 13, 2024
1 parent 4d3c5c1 commit 9560580
Show file tree
Hide file tree
Showing 13 changed files with 35 additions and 35 deletions.
1 change: 0 additions & 1 deletion app/src/main/java/com/braiso_22/cozycave/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import androidx.compose.material3.Surface
import androidx.compose.material3.windowsizeclass.ExperimentalMaterial3WindowSizeClassApi
import androidx.compose.material3.windowsizeclass.calculateWindowSizeClass
import androidx.compose.ui.Modifier
import com.braiso_22.cozycave.feature_task.ui.tasks.TasksScreen
import com.braiso_22.cozycave.router.AppNavigation
import com.braiso_22.cozycave.ui.theme.CozyCaveTheme
import dagger.hilt.android.AndroidEntryPoint
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.braiso_22.cozycave.feature_task.ui.add_edit_task
package com.braiso_22.cozycave.feature_task.presentation.add_edit_task

import java.time.LocalDate
import java.time.LocalTime
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.braiso_22.cozycave.feature_task.ui.add_edit_task
package com.braiso_22.cozycave.feature_task.presentation.add_edit_task

import android.os.Build
import androidx.annotation.RequiresApi
Expand All @@ -15,8 +15,8 @@ import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import com.braiso_22.cozycave.feature_task.ui.add_edit_task.components.TimePickerDialog
import com.braiso_22.cozycave.feature_task.ui.add_edit_task.components.selectedTime
import com.braiso_22.cozycave.feature_task.presentation.add_edit_task.components.TimePickerDialog
import com.braiso_22.cozycave.feature_task.presentation.add_edit_task.components.selectedTime
import java.time.LocalDate
import java.time.LocalTime
import java.time.format.DateTimeFormatter
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.braiso_22.cozycave.feature_task.ui.add_edit_task
package com.braiso_22.cozycave.feature_task.presentation.add_edit_task

import java.time.LocalDate
import java.time.LocalTime
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.braiso_22.cozycave.feature_task.ui.add_edit_task
package com.braiso_22.cozycave.feature_task.presentation.add_edit_task


import android.os.Build
Expand All @@ -12,7 +12,7 @@ import com.braiso_22.cozycave.feature_task.domain.InvalidTaskException
import com.braiso_22.cozycave.feature_task.domain.Task
import com.braiso_22.cozycave.feature_task.domain.use_case.AddTaskUseCase
import com.braiso_22.cozycave.feature_task.domain.use_case.GetTaskByIdUseCase
import com.braiso_22.cozycave.feature_task.ui.add_edit_task.AddEditTaskEvent.*
import com.braiso_22.cozycave.feature_task.presentation.add_edit_task.AddEditTaskEvent.*
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.Job
import kotlinx.coroutines.flow.MutableSharedFlow
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.braiso_22.cozycave.feature_task.ui.add_edit_task.components
package com.braiso_22.cozycave.feature_task.presentation.add_edit_task.components

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.braiso_22.cozycave.feature_task.ui.tasks
package com.braiso_22.cozycave.feature_task.presentation.tasks

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.*
Expand All @@ -15,7 +13,7 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.DpSize
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import com.braiso_22.cozycave.feature_task.ui.tasks.components.TasksList
import com.braiso_22.cozycave.feature_task.presentation.tasks.components.TasksList
import com.braiso_22.cozycave.ui.common.isVertical

@Composable
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.braiso_22.cozycave.feature_task.presentation.tasks

import com.braiso_22.cozycave.feature_task.domain.Task

data class TasksUiState(val tasks: List<TaskUiState> = emptyList())

data class TaskUiState(
val name: String,
val description: String = "",
)

fun Task.toUiState(): TaskUiState {
return TaskUiState(
name = name,
description = description ?: ""
)
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package com.braiso_22.cozycave.feature_task.ui.tasks
package com.braiso_22.cozycave.feature_task.presentation.tasks

import androidx.compose.runtime.State
import androidx.compose.runtime.mutableStateOf
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.braiso_22.cozycave.feature_task.domain.Task
import com.braiso_22.cozycave.feature_task.domain.use_case.DeleteTaskUseCase
import com.braiso_22.cozycave.feature_task.domain.use_case.GetTasksUseCase
import dagger.hilt.android.lifecycle.HiltViewModel
Expand All @@ -29,13 +30,7 @@ class TasksViewModel @Inject constructor(
updateStateJob?.cancel()
updateStateJob = getTasksUseCase().onEach { taskList ->
_state.value = state.value.copy(
tasks = taskList.map {
TaskUiState(
name = it.name,
description = it.description,
days = it.days,
)
}
tasks = taskList.map(Task::toUiState)
)
}.launchIn(viewModelScope)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.braiso_22.cozycave.feature_task.ui.tasks.components
package com.braiso_22.cozycave.feature_task.presentation.tasks.components

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
Expand All @@ -12,7 +12,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.braiso_22.cozycave.feature_task.ui.tasks.TaskUiState
import com.braiso_22.cozycave.feature_task.presentation.tasks.TaskUiState

@Composable
fun TaskItem(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.braiso_22.cozycave.feature_task.ui.tasks.components
package com.braiso_22.cozycave.feature_task.presentation.tasks.components

import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
Expand All @@ -8,7 +8,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.braiso_22.cozycave.feature_task.ui.tasks.TaskUiState
import com.braiso_22.cozycave.feature_task.presentation.tasks.TaskUiState

@Composable
fun TasksList(
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import androidx.compose.material3.windowsizeclass.WindowSizeClass
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import androidx.navigation.compose.rememberNavController
import com.braiso_22.cozycave.feature_task.ui.tasks.TasksScreen
import com.braiso_22.cozycave.feature_task.presentation.tasks.TasksScreen

/**
* A composable function that sets up the navigation in the app
Expand Down

0 comments on commit 9560580

Please sign in to comment.