├── .gitignore
├── .project
├── AndroidManifest.xml
├── LICENSE
├── default.properties
├── proguard.cfg
├── res
├── drawable-hdpi
│ └── icon.png
├── drawable-ldpi
│ └── icon.png
├── drawable-mdpi
│ └── icon.png
├── layout
│ └── main.xml
└── values
│ ├── strings.xml
│ └── styles.xml
└── src
└── com
└── stylingandroid
└── viewpager
├── ScrollState.java
├── ViewPagerActivity.java
└── ViewPagerAdapter.java
/.gitignore:
--------------------------------------------------------------------------------
1 | /gen
2 | /android-viewpagerindicator_src
3 | /libs
4 | /assets
5 | /android-viewpagerindicator_src
6 |
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | ViewPager
4 |
5 |
6 |
7 |
8 |
9 | com.android.ide.eclipse.adt.ResourceManagerBuilder
10 |
11 |
12 |
13 |
14 | com.android.ide.eclipse.adt.PreCompilerBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.jdt.core.javabuilder
20 |
21 |
22 |
23 |
24 | com.android.ide.eclipse.adt.ApkBuilder
25 |
26 |
27 |
28 |
29 |
30 | com.android.ide.eclipse.adt.AndroidNature
31 | org.eclipse.jdt.core.javanature
32 |
33 |
34 |
35 | android-viewpagerindicator_src
36 | 2
37 | _android_android_viewpagerindicator_35ca3baf/src
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | This project contains code which is released under the
2 | following Apache V2.0 license:
3 |
4 | Copyright 2011 Patrik Åkerfeldt
5 | Copyright 2011 Francisco Figueiredo Jr.
6 | Copyright 2011 Jake Wharton
7 |
8 | Licensed under the Apache License, Version 2.0 (the "License");
9 | you may not use this file except in compliance with the License.
10 | You may obtain a copy of the License at
11 |
12 | http://www.apache.org/licenses/LICENSE-2.0
13 |
14 | Unless required by applicable law or agreed to in writing, software
15 | distributed under the License is distributed on an "AS IS" BASIS,
16 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | See the License for the specific language governing permissions and
18 | limitations under the License.
--------------------------------------------------------------------------------
/default.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system use,
7 | # "build.properties", and override values to adapt the script to your
8 | # project structure.
9 |
10 | # Project target.
11 | target=android-10
12 | android.library.reference.1=../android-viewpagerindicator-parent/library
13 |
--------------------------------------------------------------------------------
/proguard.cfg:
--------------------------------------------------------------------------------
1 | -optimizationpasses 5
2 | -dontusemixedcaseclassnames
3 | -dontskipnonpubliclibraryclasses
4 | -dontpreverify
5 | -verbose
6 | -optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
7 |
8 | -keep public class * extends android.app.Activity
9 | -keep public class * extends android.app.Application
10 | -keep public class * extends android.app.Service
11 | -keep public class * extends android.content.BroadcastReceiver
12 | -keep public class * extends android.content.ContentProvider
13 | -keep public class * extends android.app.backup.BackupAgentHelper
14 | -keep public class * extends android.preference.Preference
15 | -keep public class com.android.vending.licensing.ILicensingService
16 |
17 | -keepclasseswithmembernames class * {
18 | native ;
19 | }
20 |
21 | -keepclasseswithmembers class * {
22 | public (android.content.Context, android.util.AttributeSet);
23 | }
24 |
25 | -keepclasseswithmembers class * {
26 | public (android.content.Context, android.util.AttributeSet, int);
27 | }
28 |
29 | -keepclassmembers class * extends android.app.Activity {
30 | public void *(android.view.View);
31 | }
32 |
33 | -keepclassmembers enum * {
34 | public static **[] values();
35 | public static ** valueOf(java.lang.String);
36 | }
37 |
38 | -keep class * implements android.os.Parcelable {
39 | public static final android.os.Parcelable$Creator *;
40 | }
41 |
--------------------------------------------------------------------------------
/res/drawable-hdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/StylingAndroid/ViewPager/7d517618ad69a31b0b66f4604930bdd05e465aff/res/drawable-hdpi/icon.png
--------------------------------------------------------------------------------
/res/drawable-ldpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/StylingAndroid/ViewPager/7d517618ad69a31b0b66f4604930bdd05e465aff/res/drawable-ldpi/icon.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/StylingAndroid/ViewPager/7d517618ad69a31b0b66f4604930bdd05e465aff/res/drawable-mdpi/icon.png
--------------------------------------------------------------------------------
/res/layout/main.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
11 |
16 |
--------------------------------------------------------------------------------
/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Hello World, ViewPagerActivity!
4 | ViewPager
5 |
6 |
--------------------------------------------------------------------------------
/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
12 |
--------------------------------------------------------------------------------
/src/com/stylingandroid/viewpager/ScrollState.java:
--------------------------------------------------------------------------------
1 | package com.stylingandroid.viewpager;
2 |
3 |
4 | import android.os.Parcel;
5 | import android.os.Parcelable;
6 |
7 | public class ScrollState implements Parcelable
8 | {
9 | private int[] scrollPos;
10 |
11 | public static Parcelable.Creator CREATOR = new Parcelable.Creator()
12 | {
13 |
14 | @Override
15 | public ScrollState createFromParcel( Parcel source )
16 | {
17 | int size = source.readInt();
18 | int[] scrollPos = new int[ size ];
19 | source.readIntArray( scrollPos );
20 | return new ScrollState( scrollPos );
21 | }
22 |
23 | @Override
24 | public ScrollState[] newArray( int size )
25 | {
26 | return new ScrollState[ size ];
27 | }
28 | };
29 | public ScrollState( int[] scrollPos )
30 | {
31 | this.scrollPos = scrollPos;
32 | }
33 |
34 | @Override
35 | public int describeContents()
36 | {
37 | return 0;
38 | }
39 |
40 | @Override
41 | public void writeToParcel( Parcel dest, int flags )
42 | {
43 | dest.writeInt( scrollPos.length );
44 | dest.writeIntArray( scrollPos );
45 | }
46 |
47 | public int[] getScrollPos()
48 | {
49 | return scrollPos;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/com/stylingandroid/viewpager/ViewPagerActivity.java:
--------------------------------------------------------------------------------
1 | package com.stylingandroid.viewpager;
2 |
3 | import com.jakewharton.android.viewpagerindicator.TitlePageIndicator;
4 |
5 | import android.app.Activity;
6 | import android.os.Bundle;
7 | import android.support.v4.view.ViewPager;
8 |
9 | public class ViewPagerActivity extends Activity
10 | {
11 | @Override
12 | public void onCreate( Bundle savedInstanceState )
13 | {
14 | super.onCreate( savedInstanceState );
15 | setContentView( R.layout.main );
16 |
17 | ViewPagerAdapter adapter = new ViewPagerAdapter( this );
18 | ViewPager pager =
19 | (ViewPager)findViewById( R.id.viewpager );
20 | TitlePageIndicator indicator =
21 | (TitlePageIndicator)findViewById( R.id.indicator );
22 | pager.setAdapter( adapter );
23 | indicator.setViewPager( pager );
24 | }
25 | }
--------------------------------------------------------------------------------
/src/com/stylingandroid/viewpager/ViewPagerAdapter.java:
--------------------------------------------------------------------------------
1 | package com.stylingandroid.viewpager;
2 |
3 | import java.util.ArrayList;
4 | import java.util.HashMap;
5 | import java.util.List;
6 | import java.util.Map;
7 |
8 | import android.content.Context;
9 | import android.os.Parcelable;
10 | import android.support.v4.view.PagerAdapter;
11 | import android.support.v4.view.ViewPager;
12 | import android.view.View;
13 | import android.widget.AbsListView;
14 | import android.widget.AbsListView.OnScrollListener;
15 | import android.widget.ListView;
16 | import android.widget.SimpleAdapter;
17 |
18 | import com.jakewharton.android.viewpagerindicator.TitleProvider;
19 |
20 | public class ViewPagerAdapter extends PagerAdapter implements TitleProvider
21 | {
22 | private static String[] titles = new String[] { "Page 1", "Page 2",
23 | "Page 3" };
24 | private final Context context;
25 | private int[] scrollPosition = new int[titles.length];
26 |
27 | public ViewPagerAdapter( Context context )
28 | {
29 | this.context = context;
30 | for ( int i = 0; i < titles.length; i++ )
31 | {
32 | scrollPosition[i] = 0;
33 | }
34 | }
35 |
36 | @Override
37 | public String getTitle( int position )
38 | {
39 | return titles[position];
40 | }
41 |
42 | @Override
43 | public int getCount()
44 | {
45 | return titles.length;
46 | }
47 |
48 | @Override
49 | public Object instantiateItem( View pager, final int position )
50 | {
51 | ListView v = new ListView( context );
52 | String[] from = new String[] { "str" };
53 | int[] to = new int[] { android.R.id.text1 };
54 | List