Yes, you are on the right way.
Probably what confuse you in the code style is the use of inner classes. I will not explain that concept here (is full of docs out there), just know that in java you can implement classes inside other classes (so inner classes).
In our adapter we have:
HTH
Bye!