@ -4,6 +4,10 @@ import org.isoron.uhabits.core.commands.CommandRunner
import org.isoron.uhabits.core.models.HabitGroup
import org.isoron.uhabits.core.models.HabitGroup
import org.isoron.uhabits.core.models.PaletteColor
import org.isoron.uhabits.core.models.PaletteColor
import org.isoron.uhabits.core.preferences.Preferences
import org.isoron.uhabits.core.preferences.Preferences
import org.isoron.uhabits.core.ui.screens.habits.show.views.BarCardPresenter
import org.isoron.uhabits.core.ui.screens.habits.show.views.BarCardState
import org.isoron.uhabits.core.ui.screens.habits.show.views.FrequencyCardPresenter
import org.isoron.uhabits.core.ui.screens.habits.show.views.FrequencyCardState
import org.isoron.uhabits.core.ui.screens.habits.show.views.NotesCardPresenter
import org.isoron.uhabits.core.ui.screens.habits.show.views.NotesCardPresenter
import org.isoron.uhabits.core.ui.screens.habits.show.views.NotesCardState
import org.isoron.uhabits.core.ui.screens.habits.show.views.NotesCardState
import org.isoron.uhabits.core.ui.screens.habits.show.views.OverviewCardPresenter
import org.isoron.uhabits.core.ui.screens.habits.show.views.OverviewCardPresenter
@ -14,16 +18,24 @@ import org.isoron.uhabits.core.ui.screens.habits.show.views.StreakCardState
import org.isoron.uhabits.core.ui.screens.habits.show.views.StreakCartPresenter
import org.isoron.uhabits.core.ui.screens.habits.show.views.StreakCartPresenter
import org.isoron.uhabits.core.ui.screens.habits.show.views.SubtitleCardPresenter
import org.isoron.uhabits.core.ui.screens.habits.show.views.SubtitleCardPresenter
import org.isoron.uhabits.core.ui.screens.habits.show.views.SubtitleCardState
import org.isoron.uhabits.core.ui.screens.habits.show.views.SubtitleCardState
import org.isoron.uhabits.core.ui.screens.habits.show.views.TargetCardPresenter
import org.isoron.uhabits.core.ui.screens.habits.show.views.TargetCardState
import org.isoron.uhabits.core.ui.views.Theme
import org.isoron.uhabits.core.ui.views.Theme
data class ShowHabitGroupState (
data class ShowHabitGroupState (
val title : String = " " ,
val title : String = " " ,
val isEmpty : Boolean = false ,
val isNumerical : Boolean = false ,
val isBoolean : Boolean = false ,
val color : PaletteColor = PaletteColor ( 1 ) ,
val color : PaletteColor = PaletteColor ( 1 ) ,
val subtitle : SubtitleCardState ,
val subtitle : SubtitleCardState ,
val overview : OverviewCardState ,
val overview : OverviewCardState ,
val notes : NotesCardState ,
val notes : NotesCardState ,
val target : TargetCardState ,
val streaks : StreakCardState ,
val streaks : StreakCardState ,
val scores : ScoreCardState ,
val scores : ScoreCardState ,
val frequency : FrequencyCardState ,
val bar : BarCardState ,
val theme : Theme
val theme : Theme
)
)
@ -33,6 +45,12 @@ class ShowHabitGroupPresenter(
val screen : Screen ,
val screen : Screen ,
val commandRunner : CommandRunner
val commandRunner : CommandRunner
) {
) {
val barCardPresenter = BarCardPresenter (
preferences = preferences ,
screen = screen
)
val scoreCardPresenter = ScoreCardPresenter (
val scoreCardPresenter = ScoreCardPresenter (
preferences = preferences ,
preferences = preferences ,
screen = screen
screen = screen
@ -46,6 +64,9 @@ class ShowHabitGroupPresenter(
) : ShowHabitGroupState {
) : ShowHabitGroupState {
return ShowHabitGroupState (
return ShowHabitGroupState (
title = habitGroup . name ,
title = habitGroup . name ,
isEmpty = habitGroup . habitList . isEmpty ,
isNumerical = habitGroup . habitList . all { it . isNumerical } ,
isBoolean = habitGroup . habitList . all { ! it . isNumerical } ,
color = habitGroup . color ,
color = habitGroup . color ,
theme = theme ,
theme = theme ,
subtitle = SubtitleCardPresenter . buildState (
subtitle = SubtitleCardPresenter . buildState (
@ -59,6 +80,11 @@ class ShowHabitGroupPresenter(
notes = NotesCardPresenter . buildState (
notes = NotesCardPresenter . buildState (
habitGroup = habitGroup
habitGroup = habitGroup
) ,
) ,
target = TargetCardPresenter . buildState (
habitGroup = habitGroup ,
firstWeekday = preferences . firstWeekdayInt ,
theme = theme
) ,
streaks = StreakCartPresenter . buildState (
streaks = StreakCartPresenter . buildState (
habitGroup = habitGroup ,
habitGroup = habitGroup ,
theme = theme
theme = theme
@ -68,11 +94,24 @@ class ShowHabitGroupPresenter(
habitGroup = habitGroup ,
habitGroup = habitGroup ,
firstWeekday = preferences . firstWeekdayInt ,
firstWeekday = preferences . firstWeekdayInt ,
theme = theme
theme = theme
) ,
frequency = FrequencyCardPresenter . buildState (
habitGroup = habitGroup ,
firstWeekday = preferences . firstWeekdayInt ,
theme = theme
) ,
bar = BarCardPresenter . buildState (
habitGroup = habitGroup ,
firstWeekday = preferences . firstWeekdayInt ,
boolSpinnerPosition = preferences . barCardBoolSpinnerPosition ,
numericalSpinnerPosition = preferences . barCardNumericalSpinnerPosition ,
theme = theme
)
)
)
)
}
}
}
}
interface Screen :
interface Screen :
BarCardPresenter . Screen ,
ScoreCardPresenter . Screen
ScoreCardPresenter . Screen
}
}