Change variable name

pull/1103/head
Bindu 4 years ago
parent af7f60fc4d
commit 79e302f922

@ -63,7 +63,7 @@ class HistoryEditorDialog : AppCompatDialogFragment(), CommandRunner.Listener {
paletteColor = habit.color,
series = emptyList(),
defaultSquare = HistoryChart.Square.OFF,
hasNotes = emptyList(),
notesIndicators = emptyList(),
theme = themeSwitcher.currentTheme,
today = DateUtils.getTodayWithOffset().toLocalDate(),
onDateClickedListener = onDateClickedListener ?: object : OnDateClickedListener {},
@ -104,7 +104,7 @@ class HistoryEditorDialog : AppCompatDialogFragment(), CommandRunner.Listener {
)
chart?.series = model.series
chart?.defaultSquare = model.defaultSquare
chart?.hasNotes = model.hasNotes
chart?.notesIndicators = model.notesIndicators
dataView.postInvalidate()
}

@ -44,7 +44,7 @@ class HistoryCardView(context: Context, attrs: AttributeSet) : LinearLayout(cont
dateFormatter = JavaLocalDateFormatter(Locale.getDefault()),
series = state.series,
defaultSquare = state.defaultSquare,
hasNotes = state.hasNotes,
notesIndicators = state.notesIndicators,
firstWeekday = state.firstWeekday,
)
binding.chart.postInvalidate()

@ -59,7 +59,7 @@ class HistoryWidget(
val historyChart = (this.view as HistoryChart)
historyChart.series = model.series
historyChart.defaultSquare = model.defaultSquare
historyChart.hasNotes = model.hasNotes
historyChart.notesIndicators = model.notesIndicators
}
}
@ -75,7 +75,7 @@ class HistoryWidget(
firstWeekday = prefs.firstWeekday,
series = listOf(),
defaultSquare = HistoryChart.Square.OFF,
hasNotes = listOf(),
notesIndicators = listOf(),
)
}
).apply {

@ -46,7 +46,7 @@ data class HistoryCardState(
val firstWeekday: DayOfWeek,
val series: List<HistoryChart.Square>,
val defaultSquare: HistoryChart.Square,
val hasNotes: List<Boolean>,
val notesIndicators: List<Boolean>,
val theme: Theme,
val today: LocalDate,
)
@ -169,7 +169,7 @@ class HistoryCardPresenter(
else
HistoryChart.Square.OFF
val hasNotes = entries.map {
val notesIndicators = entries.map {
when (it.notes) {
"" -> false
else -> true
@ -183,7 +183,7 @@ class HistoryCardPresenter(
theme = theme,
series = series,
defaultSquare = defaultSquare,
hasNotes = hasNotes,
notesIndicators = notesIndicators,
)
}
}

@ -43,7 +43,7 @@ class HistoryChart(
var paletteColor: PaletteColor,
var series: List<Square>,
var defaultSquare: Square,
var hasNotes: List<Boolean>,
var notesIndicators: List<Boolean>,
var theme: Theme,
var today: LocalDate,
var onDateClickedListener: OnDateClickedListener = object : OnDateClickedListener {},
@ -205,7 +205,7 @@ class HistoryChart(
) {
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 circleColor: Color
val color = theme.color(paletteColor.paletteIndex)
@ -252,7 +252,7 @@ class HistoryChart(
canvas.setTextAlign(TextAlign.CENTER)
canvas.drawText(date.day.toString(), x + width / 2, y + width / 2)
if (notes) {
if (hasNotes) {
circleColor = when (value) {
Square.ON -> theme.lowContrastTextColor
else -> color

@ -73,7 +73,7 @@ class HistoryChartTest {
else -> OFF
}
},
hasNotes = MutableList(85) {
notesIndicators = MutableList(85) {
index: Int ->
index % 3 == 0
}

Loading…
Cancel
Save