Github Tutorial App Shows You How to Use… Github

Github can get pretty complicated and using it can become quite daunting, especially … more

Google Glass-like Clip-On For Regular Glasses Developed by Sony

For the price of $2,000, a pair of glasses that can run apps, take pictures, … more

Micromax Takes OnePlus to Court! Android Wear Receives Lollipop – XDA TV

Android 5.0 Lollipop is available officially for the Moto 360! … more

Google Invites Selected Devs to Buy Project Tango Development Kit

Just about a month ago, the curious Project Tango development kit was … more

Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

[Library] ViewPager

OP gade12

28th December 2013, 11:44 PM   |  #1  
gade12's Avatar
OP Senior Member
Flag Salamanca
Thanks Meter: 76
 
190 posts
Join Date:Joined: Mar 2009
More
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
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):



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)
Attached Thumbnails
Click image for larger version

Name:	ViewPagerTree.jpg
Views:	1380
Size:	123.8 KB
ID:	2480122  
Attached Files
File Type: jar ViewPager.jar - [Click for QR Code] (126.3 KB, 84 views)
Last edited by gade12; 30th December 2013 at 06:11 PM.
The Following 4 Users Say Thank You to gade12 For This Useful Post: [ View ]
28th December 2013, 11:49 PM   |  #2  
gade12's Avatar
OP Senior Member
Flag Salamanca
Thanks Meter: 76
 
190 posts
Join Date:Joined: Mar 2009
More
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

Here is the complete tree:



It works from API 14 to API 19
Attached Thumbnails
Click image for larger version

Name:	viewpagernohc.jpg
Views:	928
Size:	110.5 KB
ID:	2483786  
Attached Files
File Type: jar ViewPager.jar - [Click for QR Code] (113.4 KB, 30 views)
Last edited by gade12; 30th December 2013 at 06:19 PM.
The Following 3 Users Say Thank You to gade12 For This Useful Post: [ View ]
30th December 2013, 01:47 PM   |  #3  
EatHeat's Avatar
Recognized Developer
Flag Calcutta
Thanks Meter: 1,433
 
914 posts
Join Date:Joined: Jan 2013
More
Nice, but source?
30th December 2013, 02:43 PM   |  #4  
gade12's Avatar
OP Senior Member
Flag Salamanca
Thanks Meter: 76
 
190 posts
Join Date:Joined: Mar 2009
More
Quote:
Originally Posted by EatHeat

Nice, but source?

Source is support-v4 google code with some modifications by me.
But yes, i will create a github repository
31st December 2013, 07:22 PM   |  #5  
ssuukk's Avatar
Senior Member
Dirty, stinking and full of dog sh!t
Thanks Meter: 1,696
 
2,152 posts
Join Date:Joined: Jan 2008
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?
1st January 2014, 03:10 AM   |  #6  
gade12's Avatar
OP Senior Member
Flag Salamanca
Thanks Meter: 76
 
190 posts
Join Date:Joined: Mar 2009
More
Quote:
Originally Posted by ssuukk

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
The Following User Says Thank You to gade12 For This Useful Post: [ View ]
Post Reply Subscribe to Thread

Tags
jar, library, viewpager
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes