mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 01:08:50 -06:00
Change variable name
This commit is contained in:
@@ -63,7 +63,7 @@ class HistoryEditorDialog : AppCompatDialogFragment(), CommandRunner.Listener {
|
|||||||
paletteColor = habit.color,
|
paletteColor = habit.color,
|
||||||
series = emptyList(),
|
series = emptyList(),
|
||||||
defaultSquare = HistoryChart.Square.OFF,
|
defaultSquare = HistoryChart.Square.OFF,
|
||||||
hasNotes = emptyList(),
|
notesIndicators = emptyList(),
|
||||||
theme = themeSwitcher.currentTheme,
|
theme = themeSwitcher.currentTheme,
|
||||||
today = DateUtils.getTodayWithOffset().toLocalDate(),
|
today = DateUtils.getTodayWithOffset().toLocalDate(),
|
||||||
onDateClickedListener = onDateClickedListener ?: object : OnDateClickedListener {},
|
onDateClickedListener = onDateClickedListener ?: object : OnDateClickedListener {},
|
||||||
@@ -104,7 +104,7 @@ class HistoryEditorDialog : AppCompatDialogFragment(), CommandRunner.Listener {
|
|||||||
)
|
)
|
||||||
chart?.series = model.series
|
chart?.series = model.series
|
||||||
chart?.defaultSquare = model.defaultSquare
|
chart?.defaultSquare = model.defaultSquare
|
||||||
chart?.hasNotes = model.hasNotes
|
chart?.notesIndicators = model.notesIndicators
|
||||||
dataView.postInvalidate()
|
dataView.postInvalidate()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ class HistoryCardView(context: Context, attrs: AttributeSet) : LinearLayout(cont
|
|||||||
dateFormatter = JavaLocalDateFormatter(Locale.getDefault()),
|
dateFormatter = JavaLocalDateFormatter(Locale.getDefault()),
|
||||||
series = state.series,
|
series = state.series,
|
||||||
defaultSquare = state.defaultSquare,
|
defaultSquare = state.defaultSquare,
|
||||||
hasNotes = state.hasNotes,
|
notesIndicators = state.notesIndicators,
|
||||||
firstWeekday = state.firstWeekday,
|
firstWeekday = state.firstWeekday,
|
||||||
)
|
)
|
||||||
binding.chart.postInvalidate()
|
binding.chart.postInvalidate()
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ class HistoryWidget(
|
|||||||
val historyChart = (this.view as HistoryChart)
|
val historyChart = (this.view as HistoryChart)
|
||||||
historyChart.series = model.series
|
historyChart.series = model.series
|
||||||
historyChart.defaultSquare = model.defaultSquare
|
historyChart.defaultSquare = model.defaultSquare
|
||||||
historyChart.hasNotes = model.hasNotes
|
historyChart.notesIndicators = model.notesIndicators
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@ class HistoryWidget(
|
|||||||
firstWeekday = prefs.firstWeekday,
|
firstWeekday = prefs.firstWeekday,
|
||||||
series = listOf(),
|
series = listOf(),
|
||||||
defaultSquare = HistoryChart.Square.OFF,
|
defaultSquare = HistoryChart.Square.OFF,
|
||||||
hasNotes = listOf(),
|
notesIndicators = listOf(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
).apply {
|
).apply {
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ data class HistoryCardState(
|
|||||||
val firstWeekday: DayOfWeek,
|
val firstWeekday: DayOfWeek,
|
||||||
val series: List<HistoryChart.Square>,
|
val series: List<HistoryChart.Square>,
|
||||||
val defaultSquare: HistoryChart.Square,
|
val defaultSquare: HistoryChart.Square,
|
||||||
val hasNotes: List<Boolean>,
|
val notesIndicators: List<Boolean>,
|
||||||
val theme: Theme,
|
val theme: Theme,
|
||||||
val today: LocalDate,
|
val today: LocalDate,
|
||||||
)
|
)
|
||||||
@@ -169,7 +169,7 @@ class HistoryCardPresenter(
|
|||||||
else
|
else
|
||||||
HistoryChart.Square.OFF
|
HistoryChart.Square.OFF
|
||||||
|
|
||||||
val hasNotes = entries.map {
|
val notesIndicators = entries.map {
|
||||||
when (it.notes) {
|
when (it.notes) {
|
||||||
"" -> false
|
"" -> false
|
||||||
else -> true
|
else -> true
|
||||||
@@ -183,7 +183,7 @@ class HistoryCardPresenter(
|
|||||||
theme = theme,
|
theme = theme,
|
||||||
series = series,
|
series = series,
|
||||||
defaultSquare = defaultSquare,
|
defaultSquare = defaultSquare,
|
||||||
hasNotes = hasNotes,
|
notesIndicators = notesIndicators,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class HistoryChart(
|
|||||||
var paletteColor: PaletteColor,
|
var paletteColor: PaletteColor,
|
||||||
var series: List<Square>,
|
var series: List<Square>,
|
||||||
var defaultSquare: Square,
|
var defaultSquare: Square,
|
||||||
var hasNotes: List<Boolean>,
|
var notesIndicators: List<Boolean>,
|
||||||
var theme: Theme,
|
var theme: Theme,
|
||||||
var today: LocalDate,
|
var today: LocalDate,
|
||||||
var onDateClickedListener: OnDateClickedListener = object : OnDateClickedListener {},
|
var onDateClickedListener: OnDateClickedListener = object : OnDateClickedListener {},
|
||||||
@@ -205,7 +205,7 @@ class HistoryChart(
|
|||||||
) {
|
) {
|
||||||
|
|
||||||
val value = if (offset >= series.size) defaultSquare else series[offset]
|
val value = if (offset >= series.size) defaultSquare else series[offset]
|
||||||
val notes = if (offset >= hasNotes.size) false else hasNotes[offset]
|
val hasNotes = if (offset >= notesIndicators.size) false else notesIndicators[offset]
|
||||||
val squareColor: Color
|
val squareColor: Color
|
||||||
val circleColor: Color
|
val circleColor: Color
|
||||||
val color = theme.color(paletteColor.paletteIndex)
|
val color = theme.color(paletteColor.paletteIndex)
|
||||||
@@ -252,7 +252,7 @@ class HistoryChart(
|
|||||||
canvas.setTextAlign(TextAlign.CENTER)
|
canvas.setTextAlign(TextAlign.CENTER)
|
||||||
canvas.drawText(date.day.toString(), x + width / 2, y + width / 2)
|
canvas.drawText(date.day.toString(), x + width / 2, y + width / 2)
|
||||||
|
|
||||||
if (notes) {
|
if (hasNotes) {
|
||||||
circleColor = when (value) {
|
circleColor = when (value) {
|
||||||
Square.ON -> theme.lowContrastTextColor
|
Square.ON -> theme.lowContrastTextColor
|
||||||
else -> color
|
else -> color
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ class HistoryChartTest {
|
|||||||
else -> OFF
|
else -> OFF
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
hasNotes = MutableList(85) {
|
notesIndicators = MutableList(85) {
|
||||||
index: Int ->
|
index: Int ->
|
||||||
index % 3 == 0
|
index % 3 == 0
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user