[CHANGE] reduce nesting of layouts in main.xml
[SPLIT] onMeasure and onLayout functions.