Fixed zero division exception in case no data in adapter. Added gradle support.

Zero division exception is thrown when viewpager and adapter are created, and there is no data in adapter (it appears later, e.g. loaded from internet). Viewpager adapter's wrapper tries to determine realPosition but fails.
Also added gradle support