Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,741,305 Members 42,207 Now Online
XDA Developers Android and Mobile Development Forum

[Library] ViewPager

Tip us?
 
gade12
Old
(Last edited by gade12; 30th December 2013 at 05:11 PM.)
#1  
gade12's Avatar
Senior Member - OP
Thanks Meter 75
Posts: 190
Join Date: Mar 2009
Location: Salamanca
Default [Library] ViewPager

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:	1181
Size:	123.8 KB
ID:	2480122  
Attached Files
File Type: jar ViewPager.jar - [Click for QR Code] (126.3 KB, 64 views)
Devices:
  • Omnia i900 The Dark Sense WM 6.5.3/6.5.5 <<23699-23569-28244>>
  • HTC HD2 EU CM7/9/10 & MIUI (SD/NAND) & WP7 XBmod-Yuki 7720/pdaimatejam 8835 & Sense 3.0/3.5 (SD/NAND) & ICS (SD/NAND) & JB/PA & MokeeOS & LewaOS & QiSS
SD: Samsung microSDHC 16GB Class 10 (Read:24 MB/s | Write: 21 MB/s)
  • IpodTouch 1 gen whited00r v5.2.1(Apple policies...)
  • Galaxy Tab 10.1 OmniRom by kasper_h
I have ORD
The Following 4 Users Say Thank You to gade12 For This Useful Post: [ Click to Expand ]
 
gade12
Old
(Last edited by gade12; 30th December 2013 at 05:19 PM.)
#2  
gade12's Avatar
Senior Member - OP
Thanks Meter 75
Posts: 190
Join Date: Mar 2009
Location: Salamanca
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:	740
Size:	110.5 KB
ID:	2483786  
Attached Files
File Type: jar ViewPager.jar - [Click for QR Code] (113.4 KB, 26 views)
Devices:
  • Omnia i900 The Dark Sense WM 6.5.3/6.5.5 <<23699-23569-28244>>
  • HTC HD2 EU CM7/9/10 & MIUI (SD/NAND) & WP7 XBmod-Yuki 7720/pdaimatejam 8835 & Sense 3.0/3.5 (SD/NAND) & ICS (SD/NAND) & JB/PA & MokeeOS & LewaOS & QiSS
SD: Samsung microSDHC 16GB Class 10 (Read:24 MB/s | Write: 21 MB/s)
  • IpodTouch 1 gen whited00r v5.2.1(Apple policies...)
  • Galaxy Tab 10.1 OmniRom by kasper_h
I have ORD
The Following 2 Users Say Thank You to gade12 For This Useful Post: [ Click to Expand ]
 
EatHeat
Old
#3  
EatHeat's Avatar
Recognized Developer
Thanks Meter 1392
Posts: 911
Join Date: Jan 2013
Location: Calcutta
Nice, but source?
[3.0+]Crius.
Customize your clock.


[2.2+]SnowBowl HD.
Enjoy the vacations!


 
gade12
Old
#4  
gade12's Avatar
Senior Member - OP
Thanks Meter 75
Posts: 190
Join Date: Mar 2009
Location: Salamanca
Quote:
Originally Posted by EatHeat View Post
Nice, but source?
Source is support-v4 google code with some modifications by me.
But yes, i will create a github repository
Devices:
  • Omnia i900 The Dark Sense WM 6.5.3/6.5.5 <<23699-23569-28244>>
  • HTC HD2 EU CM7/9/10 & MIUI (SD/NAND) & WP7 XBmod-Yuki 7720/pdaimatejam 8835 & Sense 3.0/3.5 (SD/NAND) & ICS (SD/NAND) & JB/PA & MokeeOS & LewaOS & QiSS
SD: Samsung microSDHC 16GB Class 10 (Read:24 MB/s | Write: 21 MB/s)
  • IpodTouch 1 gen whited00r v5.2.1(Apple policies...)
  • Galaxy Tab 10.1 OmniRom by kasper_h
I have ORD
 
ssuukk
Old
#5  
ssuukk's Avatar
Senior Member
Thanks Meter 1612
Posts: 2,078
Join Date: Jan 2008
Location: Dirty, stinking and full of dog sh!t
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?
Mine's bigger: Xperia Z1


XenoAmp - not your average music player

Fund me a blotter: drop a Bitcoin or two here 19M1uZHCYfV7VxgTfSe7E8t2Vb1MMVoADs

Android strings.xml helper
 
gade12
Old
#6  
gade12's Avatar
Senior Member - OP
Thanks Meter 75
Posts: 190
Join Date: Mar 2009
Location: Salamanca
Quote:
Originally Posted by ssuukk View Post
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
Devices:
  • Omnia i900 The Dark Sense WM 6.5.3/6.5.5 <<23699-23569-28244>>
  • HTC HD2 EU CM7/9/10 & MIUI (SD/NAND) & WP7 XBmod-Yuki 7720/pdaimatejam 8835 & Sense 3.0/3.5 (SD/NAND) & ICS (SD/NAND) & JB/PA & MokeeOS & LewaOS & QiSS
SD: Samsung microSDHC 16GB Class 10 (Read:24 MB/s | Write: 21 MB/s)
  • IpodTouch 1 gen whited00r v5.2.1(Apple policies...)
  • Galaxy Tab 10.1 OmniRom by kasper_h
I have ORD
The Following User Says Thank You to gade12 For This Useful Post: [ Click to Expand ]
Tags
jar, library, viewpager
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


XDA PORTAL POSTS

Mod Lets You Have Stereo Speakers on Your Sony Xperia Z1 (Sort Of)

The stereo speakers onthe Sony Xperia Z2areprobably a relatively large … more

Give Your Screen Some Color with HexaTime Live Wallpaper

We don’t often cover very many live wallpapers here on the XDA Portal. You may … more

Android Wear App Review: Command Google Now with Commandr – XDA Developer TV

OK Google. Make Me a sandwich. How many times have you … more

Play Your Hits and Learn the Lyrics with NextGen Music Player

There are plenty of music players for Android available in Play Store. They … more