I am going to try to explain the scene of this library.
HC/ICS and above are android versions that are in more than 75% of all android smartphones...
This can cause one scene, you want to develop an application to HC/ICS or above...
Your application need to use ViewPager, this is awesome feature and looks greats...But Android only support this through Support-v4 (actually r19)
And you think...why do i have to use "non native library" (Fragments, FragmentManager, FragmentTransiction...) import all from support-v4 if my application is for ics or above
This force, for example, SO to use fragments from support-v4 when SO have his implementation of Fragments...Cause redundant code, apks more heavy, maybe worse performance...
I will not enter in discussion about native bugs, android version of smartphones, performance, support of old devices...
I found a lot of comments of people asking for native Viewpgaer and answer is always same, not exits or create your own implementation...So i decided to create ViewPager only library...But why new one if ViewPager from support-v4 works great?
So i have created a library ViewPager from support-v4 code
For now it support from API 11 to API 19 I have deleted all code non related with ViewPager and viewpager before API 11. In API 11,HC 3.0, force close when trying to close fragments (some methods related with FragmentManager and FragmentTransaction are implemented in API 13 or above).
All this provide us a 126Kb of ViewPager library and remove support-v4 from our applications (if we only use ViewPager) that i want to share with all us. Now we have a 113Kb of library without supporting HC (See second post for more info)
If people like this and use it, i will remove support for HC (only 0.1% of Android devices), making more small library.(Done)
All credits are for Google and Android, i dont use this to make money. Code continue with same license.
The use of this library is the same as Support-V4
- Copy ViewPager.jar in libs folder and see that it dependency appear as "Android Private Library"
- import com.google.android.view.PagerAdapter; for class
- <com.google.android.view.ViewPager /> for xml
Other importants imports are:
Here is the complete tree (See second post for version without HC support):
Enjoy it and advise me with possible bug in differents versions. I have tested 3.0,4.0,4.0.3,4.2.2,4.3 (3.0 not work in version that dont support HC)