Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make statistics menu less sad - decorations and colour #4203

Merged
merged 43 commits into from
Oct 26, 2022

Conversation

matkoniecz
Copy link
Member

fixes #3414

screen05


example with extra placeholder to demonstrate styling

screen01
screen02
screen03
screen04

@westnordost
Copy link
Member

westnordost commented Jul 12, 2022

  1. Could you put the laurel wreath class into an own file in /view?
  2. The drawing of the stalk is needlessly complicated (and looks a bit odd because there are so many corners). To draw an arc is actually really simple, see https://developer.android.com/reference/android/graphics/Canvas#drawArc(float,%20float,%20float,%20float,%20float,%20float,%20boolean,%20android.graphics.Paint). But actually, better than that would be if you just skipped the stalk and used a different drawable for the leaf, for example something like this: https://commons.wikimedia.org/wiki/File:Olivenkranz.png (or this or this or this)

@matkoniecz
Copy link
Member Author

For now I applied drawArc

screen07

val canvasHeight: Int = bounds.height()
val circleRadius: Float = Math.min(canvasWidth, canvasHeight).toFloat() / 2f

val niceSubtleGreen: Paint = Paint().apply { setARGB(255, 152, 184, 126) }
Copy link
Member

Choose a reason for hiding this comment

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

should be a private field

Copy link
Member Author

Choose a reason for hiding this comment

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

Are you sure that it should be moved out of that function?

Copy link
Member

@westnordost westnordost Oct 22, 2022

Choose a reason for hiding this comment

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

I am just parroting what the IDE warns about. Android Studio warns about creation of objects in the draw function for performance reasons. Since this paint is always the same, it also makes sense.

It's weird that your Android studio didn't display a warning there? Did you switch off warnings?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's weird that your Android studio didn't display a warning there? Did you switch off warnings?

I switched off some that were consistently annoying and useless. I can enable them again, and triage them again - maybe they improved something.

}

// right side
val flippedBitmap = bitmap.flipHorizontally()
Copy link
Member

Choose a reason for hiding this comment

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

FYI you can also apply a matrix transformation (to flip the bitmap) on drawing on the canvas, might be easier.

https://developer.android.com/reference/android/graphics/Canvas#drawBitmap(android.graphics.Bitmap,%20android.graphics.Matrix,%20android.graphics.Paint)

(But you are not exactly drawing thousands of wreaths each frame, so perfomance of creating dozens of intermediate bitmaps is no issue)

Copy link
Member

@westnordost westnordost left a comment

Choose a reason for hiding this comment

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

Looks good, one small remark

@westnordost westnordost merged commit e11eea6 into streetcomplete:master Oct 26, 2022
@matkoniecz matkoniecz deleted the laureat branch October 26, 2022 11:08
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.

Make statistics menu less sad - more interesting display of data (colours? patterns?)
2 participants