[Library] ViewPager

Search This thread

gade12

Senior Member
Mar 21, 2009
199
76
32
Madrid
Hi guys.
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 :silly:
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:

import com.google.android.app.FragmentPagerAdapter;
import com.google.android.app.FragmentStatePagerAdapter;
import com.google.android.view.PagerAdapter;

Here is the complete tree (See second post for version without HC support):

attachment.php


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)
 

Attachments

  • ViewPager.jar
    126.3 KB · Views: 112
  • ViewPagerTree.jpg
    ViewPagerTree.jpg
    123.8 KB · Views: 1,880
Last edited:

gade12

Senior Member
Mar 21, 2009
199
76
32
Madrid
ViewPager Library without support HC

This jar is more small size and without bugs (Honeycomb dont support native FragmentManager and FragmentTransiction (or at least some functionalities) and it forceclose due to this)

To donwload this library get this attachment :victory:

Here is the complete tree:

attachment.php


It works from API 14 to API 19
 

Attachments

  • ViewPager.jar
    113.4 KB · Views: 48
  • viewpagernohc.jpg
    viewpagernohc.jpg
    110.5 KB · Views: 1,417
Last edited:

gade12

Senior Member
Mar 21, 2009
199
76
32
Madrid
Sorry for slight offtopic, but maybe you can help me with creating "patched" Android Support Library. I had to correct one bug there, but was unable to repack it into usable and working support lib. If you know how to do it maybe you can PM me?

No problem, you have a PM :good:
 
  • Like
Reactions: doomedez

Top Liked Posts

  • There are no posts matching your filters.
  • 4
    Hi guys.
    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 :silly:
    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:

    import com.google.android.app.FragmentPagerAdapter;
    import com.google.android.app.FragmentStatePagerAdapter;
    import com.google.android.view.PagerAdapter;

    Here is the complete tree (See second post for version without HC support):

    attachment.php


    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)
    3
    ViewPager Library without support HC

    This jar is more small size and without bugs (Honeycomb dont support native FragmentManager and FragmentTransiction (or at least some functionalities) and it forceclose due to this)

    To donwload this library get this attachment :victory:

    Here is the complete tree:

    attachment.php


    It works from API 14 to API 19
    1
    Sorry for slight offtopic, but maybe you can help me with creating "patched" Android Support Library. I had to correct one bug there, but was unable to repack it into usable and working support lib. If you know how to do it maybe you can PM me?

    No problem, you have a PM :good: