Or how to present items on one card in a recycler view

Photo by Thomas Schweighofer on Unsplash

The Material Design introduced many good ideas into the Android UI world. One it’s fundamental component is card view. Basically, it’s a rectangle layer with rounded corners and smooth shadow around, making it looking elevated a bit. In some cases, the use of the CardView may not be sufficient or even unnecessary. For example, placing many rows inside one card with recycler view can be tricky.

As is often the case, sometimes you need to enhance the functionality in the application using 3rd party libraries.

Of course, there’s nothing wrong with it:

  • often such code has good quality,
  • you can save some time,
  • in general, reinventing the wheel is not a good idea.

There is also the other side of the coin:

  • open source is cool, but when you find a bug in the library, you need to fix it by yourself,
  • customisation might be cumbersome,
  • you have to accept library’s dependencies, even if you’re not using them,

Last but not least, in my opinion, using…

Just another awesome test framework…

Super simple

It uses Groovy language which tries to be as natural as possible for Java developers. It means it’s very expressive, easy to learn, has no explicit types, no semicolons… and it works with Java and Kotlin :)

Test names

Creating names for tests to describe correctly what we’re testing is really hard. Writing it as very long camel case string doesn’t look nice. In Spock, we can use strings as tests names.

def "Creates message with content and submission date"() {}

Given When Then

Spock provides: given, when, then sections by default…

Marcin Kitowicz

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store