Skip to content

Conversation

@magendich
Copy link

image

Copy link
Contributor

@makzimi makzimi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Спасибо за работу! Выглядит отлично, рисует всё как надо.

Одно, но важное замечание при отрисовки вьюшек - надо все создания объектов выносить из onDraw на пораньше. Для сдачи работы надо это поправить.

Comment on lines 111 to 113
val dailyExpenses = data.groupBy { it.time * 1000L }
.mapValues { it.value.sumOf { expense -> expense.amount } }
.toSortedMap()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Каждый вызов groupBy, mapValues и toSortedMap создаёт новые коллекции. Лучше выносить эту логику из onDraw в setData

for (i in 0..5) {
val time = dailyExpenses.firstKey() + dateStep * i
val x = paddingHorizontal + (time - dailyExpenses.firstKey()) * xScale
val date = Date(time)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Каждая итерация создаёт объект Date. Это тоже плохо. В onDraw нельзя создавать новые объекты.

Comment on lines 64 to 68
if (gradientColors.isEmpty() && colors.isNotEmpty()) {
colors.forEach {
gradientColors += SweepGradient(width, height, it.first, it.second)
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gradientColors += … создаёт новую коллекцию при каждом добавлении, а еще и создаем каждый раз SweepGradient

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Надо тоже это вынести из onDraw

textPaint.textSize = 60f
textPaint.typeface = Typeface.DEFAULT_BOLD
val sumText = "$dataSum ₽"
val sumBounds = Rect()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Даже Rect() не создаем

textPaint.textSize = 40f
textPaint.typeface = Typeface.DEFAULT
val labelText = "Потрачено в Июне"
val labelBounds = Rect()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

И здесь тоже

@@ -0,0 +1,21 @@
FROM eclipse-temurin:17-jdk-jammy

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

не будет ли контейнер больше, чем при openjdk?

@@ -0,0 +1,21 @@
FROM eclipse-temurin:17-jdk-jammy

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

пробовали его использовать? Мне кажется что будет ругаться на недостачу пакетов

@@ -0,0 +1,69 @@
pipeline {
agent {
dockerfile true

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

нужно указать название image и параметры

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants