orac/android-viewflow — pull request #1 by orac (2013-07-17 10:10:45+00:00)
Title: Implement measure and layout so that non-fixed sizes can be used

In my use case, the control is completely useless unless I can match_parent it up, so I've rewritten onMeasure and onLayout to handle this. The idea is very similar to ListView's measure: it getView()s the first child and passes the requested measure spec onto that. This is significantly slower, but you only pay that cost if you use the feature: measuring with a fixed size doesn't getView(). On the subject of measuring, I also made it handle padding correctly. As well as letting you specify paddingLeft and friends in the XML file, this also lets you use a background drawable.

Because of the padding change, CircleFlowIndicator also needs to change how it measures the maximum scroll. For now I've made it call getChildWidth() instead of getWidth(), but I'm not convinced this is the best solution: I think it would be better encapsulation if ViewFlow implemented computeHorizontalScroll{Offset,Range}. For efficiency it should pass those two values to the callback, but I didn't want to change the callback interface without checking.

I've also fixed two existing problems: 1) If you do a new drag while an old one is 'settling', it shows the wrong view for one frame. The log message of eb9984b explains why/how. 2) For a stroked circle, Android draws the stroke centred around the radius, so it's half inside, half outside. This makes stroked circles slightly too big, which causes the ends to get cut off. I've fixed it in 092deac by adjusting the radius in this case.