Saturday, November 9, 2019

ImageCounterTileSkin...

Aloha,

This morning I could not sleep and was skimming the web for new ideas where I stumbled upon a social media dashboard.
And on that dashboard I've found widgets that simply shows a social media icon with a counting number.
Well...that's an easy one I thought and quickly created a new skin for TilesFX which is the ImageCounterTileSkin.
So here is a screenshot of a little demo I quickly put together to give you an idea on what it will look like...


As you can see this tile does not show a lot but simply an image with a number and some text. Of course you can enable the title and the bottom text in the skin too but without it also looks ok.
It doesn't take a lot of code to create such a tile, here is what you need:

Tile tile = TileBuilder.create()
                       .skinType(SkinType.IMAGE_COUNTER)
               .prefSize(WIDTH, HEIGHT)
               .value(0) // START VALUE
               .description("TEXT")
               .image(new Image("file:PATH_TO_IMAGE"))
               .imageMask(ImageMask.ROUND)

               .build();

And to make it even easier to handle it, I've added two new convenience methods to TilesFX to increase or decrease the value by a given amount.

So to increase the tiles value you simply can call

tile.increaseValue(1) 

and that's it.

And because I had some time this morning I directly created a new version of TilesFX which is now 11.27 and is available here...

github

bintray

maven central

And with this I wish all of you a nice weekend and...keep coding...

No comments:

Post a Comment