Fix bugs in contact card tab carousel

- Fix NPE in scroll length calculation. I was calculating
the allowed scroll length on the fly when it was requested, but
apparently it was being requested before the data was
being loaded in. Anyhow, move the measure code to its
proper place in onMeasure().

- Programatically determine tab width instead of hardcoding it to
240dip

- Move findViewById calls to the onFinishInflate() method
so it only happens once instead of every time loadData() is called

- Fix the bug where if you vertically fling the contact details
too fast, the pinned headers get stuck in some odd state (b/c the scroll
listener missed a frame, we need to always make sure the tab
carousel is in the correct place at all times)

Bug: 4965089

Change-Id: I9ee3261dfff86d7df6f3eb27ec464eea26a900db
7 files changed