Code Monkey home page Code Monkey logo

viewpagerindicator's Introduction

Android ViewPagerIndicator

Paging indicator widgets that are compatible with the ViewPager from the Android Support Library to improve discoverability of content.

Try out the sample application on the Android Market.

ViewPagerIndicator Sample Screenshots

These widgets can also be used in conjunction with ActionBarSherlock!

Usage

For a working implementation of this project see the sample/ folder.

  1. Include one of the widgets in your view. This should usually be placed adjacent to the ViewPager it represents.

    <com.viewpagerindicator.TitlePageIndicator android:id="@+id/titles" android:layout_height="wrap_content" android:layout_width="fill_parent" />

  2. In your onCreate method (or onCreateView for a fragment), bind the indicator to the ViewPager.

    //Set the pager with an adapter
    ViewPager pager = (ViewPager)findViewById(R.id.pager);
    pager.setAdapter(new TestAdapter(getSupportFragmentManager()));
    
    //Bind the title indicator to the adapter
    TitlePageIndicator titleIndicator = (TitlePageIndicator)findViewById(R.id.titles);
    titleIndicator.setViewPager(pager);
    
  3. (Optional) If you use an OnPageChangeListener with your view pager you should set it in the indicator rather than on the pager directly.

    //continued from above
    titleIndicator.setOnPageChangeListener(mPageChangeListener);
    

Theming

There are three ways to style the look of the indicators.

  1. Theme XML. An attribute for each type of indicator is provided in which you can specify a custom style.
  2. Layout XML. Through the use of a custom namespace you can include any desired styles.
  3. Object methods. Both styles have getters and setters for each style attribute which can be changed at any point.

Each indicator has a demo which creates the same look using each of these methods.

Including In Your Project

Android-ViewPagerIndicator is presented as an Android library project. A standalone JAR is not possible due to the theming capabilities offered by the indicator widgets.

You can include this project by referencing it as a library project in Eclipse or ant.

If you are a Maven user you can easily include the library by specifying it as a dependency:

<dependency>
  <groupId>com.viewpagerindicator</groupId>
  <artifactId>library</artifactId>
  <version>2.4.1</version>
  <type>apklib</type>
</dependency>

This project depends on the ViewPager class which is available in the Android Support Library or ActionBarSherlock. Details for including one of those libraries is available on their respecitve web sites.

Developed By

Credits

License

Copyright 2012 Jake Wharton
Copyright 2011 Patrik Åkerfeldt
Copyright 2011 Francisco Figueiredo Jr.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

viewpagerindicator's People

Contributors

akurni avatar gabrielittner avatar imminent avatar jakewharton avatar jdamcd avatar kevinsawicki avatar meisteg avatar ohhorob avatar protyposis avatar rtyley avatar samueltardieu avatar scottanderson avatar simonvt avatar vdesmet93 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

viewpagerindicator's Issues

Changing Dataset Not Updating Titles

Adding a page to the bound adapter and calling notifyDataSetChanged() will properly notify the ViewPager but a TitlePageIndicator widget will not update. This should be due to not acting on the onPageSelected callback for the listener. However, ignoring this callback was a deliberate design decision--the reason for which unfortunately now escapes me.

Error in dual pane layout

I am using viewpagerindicator in a fragment. Everything is good unless I want to add two fragments in tablet layout.
Shortly, I can only use it when the fragment is full screen

how to add the view page indictor below the view pager?

Hi jake,

Thanks so much for the code .
I dont have an issue, but would like to have some clarifications.

I am using your library to swipe between the screens in my app ,it works perfect.
But I need to have the circles in the bottom of the screen like in the case of the android home screen.
Can u please help me with some example for implementing the same.

Implement better text rendering for the titles

As soon as I tried ViewPagerIndicator on my app, I noticed the title text rendering didn't look that great. I looked into the code to understand how the titles were being drawn and what could I do about it. They are being rendered on a Canvas using the Paint object.

There's nothing more it can be done about it, anti-aliasing is already enabled on the Paint object. The only thing it could be done is to change this:

mPaintText = new Paint();

Into this:

mPaintText = new Paint(Paint.LINEAR_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);

And also remove mPaintText.setAntiAlias(true);, but this does not give a better solution. Instead, we get a "different" solution. The rendering is just different. If it's better or worse, it really depends on the eye of the beholder.

If you don't know, the meaning of LINEAR_TEXT_FLAG, in the words of Android Developer Roman Guy, is this:

"Text rendering uses a font cache containing bitmap representations of each glyph the application needs. Linear text basically lets you skip the font cache."

So, my suggestion is this:

Get rid of the Paint object and use TextViews instead for each title. The TextView rendering is much better, here's an example on my app's implementation of the ViewPagerIndicator:

I understand that this requires a big rewrite to the code, but in the end, the rendering will look much better and more consistent with the rest of the UI.

Divide by zero exception and fragments not showing

Some info on my project:
-Using ActionBarSherlock 4.0 RC1
-Target Android version is 4.0.3
-Using latest ViewPagerIndicator

I'm getting the following error when swiping on the title page indicator bar:
02-26 13:49:53.117: E/AndroidRuntime(26049): FATAL EXCEPTION: main
02-26 13:49:53.117: E/AndroidRuntime(26049): java.lang.ArithmeticException: divide by zero
02-26 13:49:53.117: E/AndroidRuntime(26049): at android.support.v4.view.ViewPager.pageScrolled(ViewPager.java:1181)
02-26 13:49:53.117: E/AndroidRuntime(26049): at android.support.v4.view.ViewPager.fakeDragBy(ViewPager.java:1727)
02-26 13:49:53.117: E/AndroidRuntime(26049): at com.viewpagerindicator.TitlePageIndicator.onTouchEvent(TitlePageIndicator.java:503)
02-26 13:49:53.117: E/AndroidRuntime(26049): at android.view.View.dispatchTouchEvent(View.java:5486)
02-26 13:49:53.117: E/AndroidRuntime(26049): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1959)
02-26 13:49:53.117: E/AndroidRuntime(26049): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1728)
02-26 13:49:53.117: E/AndroidRuntime(26049): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1959)
02-26 13:49:53.117: E/AndroidRuntime(26049): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1728)
02-26 13:49:53.117: E/AndroidRuntime(26049): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1959)
02-26 13:49:53.117: E/AndroidRuntime(26049): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1728)
02-26 13:49:53.117: E/AndroidRuntime(26049): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1959)
02-26 13:49:53.117: E/AndroidRuntime(26049): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1728)
02-26 13:49:53.117: E/AndroidRuntime(26049): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1892)
02-26 13:49:53.117: E/AndroidRuntime(26049): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1371)
02-26 13:49:53.117: E/AndroidRuntime(26049): at android.app.Activity.dispatchTouchEvent(Activity.java:2364)
02-26 13:49:53.117: E/AndroidRuntime(26049): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1840)
02-26 13:49:53.117: E/AndroidRuntime(26049): at android.view.View.dispatchPointerEvent(View.java:5662)
02-26 13:49:53.117: E/AndroidRuntime(26049): at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:2863)
02-26 13:49:53.117: E/AndroidRuntime(26049): at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2442)
02-26 13:49:53.117: E/AndroidRuntime(26049): at android.os.Handler.dispatchMessage(Handler.java:99)
02-26 13:49:53.117: E/AndroidRuntime(26049): at android.os.Looper.loop(Looper.java:137)
02-26 13:49:53.117: E/AndroidRuntime(26049): at android.app.ActivityThread.main(ActivityThread.java:4340)
02-26 13:49:53.117: E/AndroidRuntime(26049): at java.lang.reflect.Method.invokeNative(Native Method)
02-26 13:49:53.117: E/AndroidRuntime(26049): at java.lang.reflect.Method.invoke(Method.java:511)
02-26 13:49:53.117: E/AndroidRuntime(26049): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
02-26 13:49:53.117: E/AndroidRuntime(26049): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
02-26 13:49:53.117: E/AndroidRuntime(26049): at dalvik.system.NativeStart.main(Native Method)

Another very strange problem I'm having is that when using the TitlePageIndicator of ViewPagerIndicator, my FragmentActivity that contains 3 fragments stops displaying the fragments. The fragments are all created and their OnCreateView is called, but they don't show up on the screen and I am unable to swipe between fragments. When I comment out the TitlePageIndicator code everything works perfectly. Here are some images to show what is happening:
With TitlePageIndicator:
http://imgur.com/RJaI9
Without TitlePageIndicator:
http://imgur.com/bboSd

My entire project is located here and all of my problems are occurring in the grocerylist package of the project.

It seems to me like this should be because of a simple error on my part, but I've looked at all of the samples and instructions and it seems like I'm doing everything correctly.

Disable theming in Eclise Edit Mode

Error in latest eclipse adt visual layout editor

 The following classes could not be instantiated:
 -  (Open Class, Show Error Log)
See the Error Log (Window > Show View) for more details.
Tip: Use View.isInEditMode() in your custom views to skip code when shown in Eclipse

Error log:

android.content.res.Resources$NotFoundException: Resource ID #0x7f060000 type #0x3 is not valid
    at android.content.res.Resources.getBoolean(Resources.java:679)
    at com.viewpagerindicator.CirclePageIndicator.<init>(CirclePageIndicator.java:85)
    at com.viewpagerindicator.CirclePageIndicator.<init>(CirclePageIndicator.java:71)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
    at com.android.ide.eclipse.adt.internal.editors.layout.ProjectCallback.instantiateClass(ProjectCallback.java:397)
    at com.android.ide.eclipse.adt.internal.editors.layout.ProjectCallback.loadView(ProjectCallback.java:165)

SampleTitlesWithListener crash

Hey Jake,

there's still an error in SampleTitlesWithListener activity name:

<activity
            android:name=".sample.sample.SampleTitlesWithListener

which causes the sample app to crash with class not found exception while trying to load it

Cheers

Come back to titlePageIndicator after orientation changed

I have fuond a bug. To reproduce do this steps:
1.Go to last page in titlePageIndicator
2. Leave the Activity (not close just open some other activity)
3. change the orientation of screen
4. go back to titlePageIndicator via Back button
5. Screen is totally random indiscriminate - either Title is in wron place or pager view is missing or showed on ly the half view

It can be fix via a small gesture ti right but its very strange and interesting

ViewPager Indicator not scrolling with ListFragment

I'm not quite sure if this is a problem with ViewPager Indicator with the ListFragment or the ScrollView, but it seems that when I used this component the Indicator does not change it hold staticlly any ideas on how can solved this?

¿ Is this a bug ?

TitleIndicator Rewrite

Rewrite title indicator for better usability and looks.

The control is entirely drawn on a canvas which severely limits its ability to provide accessible use as well as do cool things like provide touch state indication with the adjacent titles.

This should also come with the very nice fading edges that the Market and G+ use... I'm not against baksmali-ing their APKs...

This can probably be done progressively:

  • Rewrite movement to start instantly when the paging starts and end precisely when the page has completed scrolling.
  • Render current style with TextViews
  • Add touch-state indication
  • Enable edge fading

Change title textSize to 'dp' instead of 'sp'?

I'm not doing a pull request on this because a) it's really easy to change and b) you might not be interested...

I was playing with my app on ICS and noticed a "font setting" on ICS, which I picked "large". This had a lot of impact in my app and messed everything up. One of the things messed up was the ViewPagerIndicator titles, which must not be affected by a system property like this.

The fix is easy, the font size must be changed from sp to dp. One can easily adapt one's app without messing in the core library. I'm just posting this here in case you were not aware of this behavior. Feel free to close the issue whenever you want.

Left title jumps, the right title does not

This belongs to the TitlePagerIndicator:

When I swipe between screens and the middle title needs too much space to show all titles on screen, the left title is "jumping" when I swipe to the left, while the right title is moving smoothly when I swipe to the right until the middle title has enough space to be fully shown.

Little glitches when clicking in the tab

Hi!

I noticed that when you click in a tab, a little glich happens. For a fraction os seconds, the name of the clicked tab appears in the middle of the indicator and just later the animation of scrolling occurs.

I could notice that in the honeycomb emulator.

I think it may be the call to invalidate() inside setCurrentItem which is called by the OnTouch event.

Getting crash reports saying "NoSuchMethod for isFakeDragging"

java.lang.NoSuchMethodError: android.support.v4.view.ViewPager.isFakeDragging
at com.viewpagerindicator.TitlePageIndicator.onTouchEvent(TitlePageIndicator.java:480)
at android.view.View.dispatchTouchEvent(View.java:3932)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1015)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1015)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1015)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1015)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1015)
at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1784)
at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1157)
at android.app.Activity.dispatchTouchEvent(Activity.java:2228)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1759)
at android.view.ViewRoot.deliverPointerEvent(ViewRoot.java:2340)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1980)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:150)
at android.app.ActivityThread.main(ActivityThread.java:4293)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607)
at dalvik.system.NativeStart.main(Native Method)

Is there a minimum API version that may be causing this?

Attributes already defined error in vpi__attrs.xml

I am trying to convert my Android eclipse project to a Android Maven project. After I migrated to the maven version of this library I have been unable to compile the project. Maven gives me a compile error, output this information:

[project folder]\target\unpack\apklibs\com.viewpagerindicator_library_apklib_2.2.3\res\values\vpi__attrs.xml:78: error: Attribute "textColor" has already been defined [project folder]\target\unpack\apklibs\com.viewpagerindicator_library_apklib_2.2.3\res\values\vpi__attrs.xml:80: error: Attribute "textSize" has already been defined

I am using a custom style for the tab indicators like this:

<style name="Widget.TabPageIndicator.Custom" parent="Widget.TabPageIndicator">
        <item name="android:gravity">center_horizontal</item>
        <item name="android:background">@drawable/vpi__tab_indicator</item>
        <item name="android:paddingLeft">4dip</item>
        <item name="android:paddingRight">4dip</item>
        <item name="android:paddingTop">14dp</item>
        <item name="android:paddingBottom">14dp</item>
    </style>
    <style name="Widget.TabPageIndicator.Text.Custom" parent="Widget.TabPageIndicator.Text">
        <item name="android:textAppearance">@style/TextAppearance.TabPageIndicator</item>
        <item name="android:textColor">@color/vpi__dark_theme</item>
        <item name="android:textSize">13sp</item>
        <item name="android:textStyle">bold</item>
        <item name="android:maxLines">1</item>
    </style>
    <style name="TextAppearance.TabPageIndicator" parent="Widget"/>

My theme file looks like this:

    <style name="MainTheme" parent="android:Theme.Black.NoTitleBar">
        <item name="vpiTabPageIndicatorStyle">@style/Widget.TabPageIndicator.Custom</item>
        <item name="vpiTabTextStyle">@style/Widget.TabPageIndicator.Text.Custom</item>
         ....
   </style>

Sample application throws an exception on exit

If any view is selected (Default, for example), application crashes on exit (like pressing home button). Here's the log:

10-27 16:08:20.675: ERROR/AndroidRuntime(1398): FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: [Landroid.support.v4.app.FragmentState;
at android.support.v4.app.FragmentManagerImpl.saveAllState(FragmentManager.java:1537)
at android.support.v4.app.FragmentActivity.onSaveInstanceState(FragmentActivity.java:888)
at android.app.Activity.performSaveInstanceState(Activity.java:1037)
at android.app.Instrumentation.callActivityOnSaveInstanceState(Instrumentation.java:1181)
at android.app.ActivityThread.performPauseActivity(ActivityThread.java:2336)
at android.app.ActivityThread.performPauseActivity(ActivityThread.java:2311)
at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:2291)
at android.app.ActivityThread.access$1700(ActivityThread.java:117)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3683)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)

TitlePageIndicator throws Exception when in non-Exactly Measured view

TitlePageIndicator throws an IllegalStateException when it is used in a non-MeasureSpec.EXACTLY measured view.

Line 720-722:

if (specMode != MeasureSpec.EXACTLY) {
    throw new IllegalStateException(getClass().getSimpleName() + " can only be used in EXACTLY mode.");
}

I've commented out these lines and it works perfectly in a view measured using layout_weight. Infact, it's been working for the past 6/7 weeks and released in FriendCaster back then.

Are fragments required? PageAdapter not working

I've tried to use the pageadapter and it just shows blank views. I have the examples compiling fine, but switching to use a PagerAdapter to return the view for the position is creating a valid view, yet I get a blank page...

"compatibility-v4-r4.jar" is missing

Hi, Today I imported your Library in Eclipse but evertime I try to build the sample.
I got this error:

The container 'Maven Dependencies' references non existing library 'C:\Users\Cracksoldier.m2\repository\android\support\compatibility-v4\r4\compatibility-v4-r4.jar'

I already checked this folder and it only contains the two following files:

compatibility-v4-r4.jar.lastUpdated
compatibility-v4-r4.pom.lastUpdated

Maven and the plugin is installed and works right. This the output of the Eclipse Console during the import
of your git repo:

20.12.11 21:49:44 MEZ: [WARN] The POM for com.jayway.maven.plugins.android.generation2:android-maven-plugin:jar:3.0.0-alpha-10 is missing, no dependency information available
20.12.11 21:49:45 MEZ: [INFO] Using DEFAULT lifecycle mapping for MavenProject: com.viewpagerindicator:library:2.2.0 @ C:\Users\Cracksoldier\Workspace\parent\library\pom.xml.
20.12.11 21:49:45 MEZ: [WARN] The POM for android:android:jar:1.6_r3 is missing, no dependency information available
20.12.11 21:49:45 MEZ: [WARN] The POM for android.support:compatibility-v4:jar:r4 is missing, no dependency information available
20.12.11 21:49:45 MEZ: [WARN] The POM for com.jayway.maven.plugins.android.generation2:android-maven-plugin:jar:3.0.0-alpha-10 is missing, no dependency information available
20.12.11 21:49:45 MEZ: [WARN] The POM for com.jayway.maven.plugins.android.generation2:android-maven-plugin:jar:3.0.0-alpha-10 is missing, no dependency information available
20.12.11 21:49:45 MEZ: [INFO] Using NULL lifecycle mapping for MavenProject: com.viewpagerindicator:parent:2.2.0 @ C:\Users\Cracksoldier\Workspace\parent\pom.xml.
20.12.11 21:49:45 MEZ: [INFO] Using DEFAULT lifecycle mapping for MavenProject: com.viewpagerindicator:sample:2.2.0 @ C:\Users\Cracksoldier\Workspace\parent\sample\pom.xml.
20.12.11 21:49:45 MEZ: [WARN] The POM for android:android:jar:1.6_r3 is missing, no dependency information available
20.12.11 21:49:45 MEZ: [WARN] The POM for android.support:compatibility-v4:jar:r4 is missing, no dependency information available
20.12.11 21:49:45 MEZ: [INFO] Using DEFAULT lifecycle mapping for MavenProject: com.viewpagerindicator:library:2.2.0 @ C:\Users\Cracksoldier\Workspace\parent\library\pom.xml.
20.12.11 21:49:45 MEZ: [WARN] The POM for com.jayway.maven.plugins.android.generation2:android-maven-plugin:jar:3.0.0-alpha-10 is missing, no dependency information available
20.12.11 21:49:45 MEZ: [INFO] Using DEFAULT lifecycle mapping for MavenProject: com.viewpagerindicator:sample:2.2.0 @ C:\Users\Cracksoldier\Workspace\parent\sample\pom.xml.
20.12.11 21:49:45 MEZ: [WARN] The POM for android:android:jar:1.6_r3 is missing, no dependency information available
20.12.11 21:49:45 MEZ: [WARN] The POM for android.support:compatibility-v4:jar:r4 is missing, no dependency information available
20.12.11 21:49:45 MEZ: [INFO] Adding source folder /library/src
20.12.11 21:49:45 MEZ: [INFO] Adding source folder /sample/src
20.12.11 21:49:45 MEZ: [INFO] Adding source folder /sample/src
20.12.11 21:49:45 MEZ: [INFO] Project import completed 17 sec
20.12.11 21:49:47 MEZ: [WARN] The POM for com.jayway.maven.plugins.android.generation2:android-maven-plugin:jar:3.0.0-alpha-10 is missing, no dependency information available
20.12.11 21:49:47 MEZ: [INFO] Using DEFAULT lifecycle mapping for MavenProject: com.viewpagerindicator:library:2.2.0 @ C:\Users\Cracksoldier\Workspace\parent\library\pom.xml.
20.12.11 21:49:47 MEZ: [WARN] The POM for android:android:jar:1.6_r3 is missing, no dependency information available
20.12.11 21:49:47 MEZ: [WARN] The POM for android.support:compatibility-v4:jar:r4 is missing, no dependency information available
20.12.11 21:49:47 MEZ: [WARN] The POM for com.jayway.maven.plugins.android.generation2:android-maven-plugin:jar:3.0.0-alpha-10 is missing, no dependency information available
20.12.11 21:49:47 MEZ: [WARN] The POM for com.jayway.maven.plugins.android.generation2:android-maven-plugin:jar:3.0.0-alpha-10 is missing, no dependency information available
20.12.11 21:49:47 MEZ: [INFO] Using DEFAULT lifecycle mapping for MavenProject: com.viewpagerindicator:library:2.2.0 @ C:\Users\Cracksoldier\Workspace\parent\library\pom.xml.
20.12.11 21:49:47 MEZ: [WARN] The POM for android:android:jar:1.6_r3 is missing, no dependency information available
20.12.11 21:49:47 MEZ: [WARN] The POM for android.support:compatibility-v4:jar:r4 is missing, no dependency information available
20.12.11 21:49:47 MEZ: [INFO] Using DEFAULT lifecycle mapping for MavenProject: com.viewpagerindicator:sample:2.2.0 @ C:\Users\Cracksoldier\Workspace\parent\sample\pom.xml.
20.12.11 22:12:32 MEZ: [INFO] Updated index for repository: central|http://repo1.maven.org/maven2 in 1511023 ms
20.12.11 22:15:59 MEZ: [WARN] The POM for com.jayway.maven.plugins.android.generation2:android-maven-plugin:jar:3.0.0-alpha-10 is missing, no dependency information available
20.12.11 22:16:00 MEZ: [INFO] Using DEFAULT lifecycle mapping for MavenProject: com.viewpagerindicator:library:2.2.0 @ C:\Users\Cracksoldier\Workspace\parent\library\pom.xml.
20.12.11 22:16:00 MEZ: [WARN] The POM for android:android:jar:1.6_r3 is missing, no dependency information available
20.12.11 22:16:00 MEZ: [WARN] The POM for android.support:compatibility-v4:jar:r4 is missing, no dependency information available

Where can I get this file. I already googled it but I couldnt find it yet. I hope someone can help me.

Best Regards
Cracksoldier

Nested (and binded) TitlePageIndicator instances

Hi,
is there a simple way to accomplish the task described in the issue's title ?

I've figured out some ideas:

  • embed a TitlePageIndicator into each Fragment attached from the super FragmentActivity and its adapter
  • (try to) modify the behaviour of the super TitlePageIndicator listener

Are this 2 ideas right in your opinion ? Or simply to achieve this result is necessary to write the code from scratch ?

Thanks,
leo.

setCurrentItem doesn't change the titlePage & Scrolling to the first two items issue.

  1. Setcurrentitem doesn't change the titlepage. This happens when i do setcurrentitem in potrait mode. The titlePage doesn't seem to change. it works fine in landscape mode.

Solution: 1. Appears that the problem is due to manipulation of a field visibility inside the layout that host the viewpager.

  1. When Scrolled to the first two pages from the left to right, the last title doesn't move to the middle until further scrolled.
    inside of ViewPager i have two different views. Not sure if this is the cause.

Wrong:
title1--empty--title2

correct:
empty--title1 --- title2

Solution: this is the same as above.

Possible fix for orientation change problem?

Hi!

I'm seeing you are struggling the same way I was yesterday trying to fix the orientation change problem of the TitleViewIndicator.

I also tried everything but I always end up with a getWidth = 0 problem.

The solution I came up was one which I still don't know if it is a hack or not but it works very well.

Just add the following line:

currentScroll = currentPosition * result;

Inside the method

private int measureWidth(int measureSpec)

This single line does the trick :)

I hope it helps.

Problem when using linear layout weight and layout_width = 0

Hi!

I was testing my app on honeycomb and I used a different layout as per the documentation to contain may master list on the left and my details fragment on the right.

The problem is that if I use the weight property to specify a percentage of the screen to be used by my master list, the titlepageindicator gives a error saying:

"ViewFlow can only be used in EXACTLY mode."

btw, I think this error message should be changed too :)

The only possible ways I could make it work were:

  1. specifying a hardcoded value for the width ( not ideal )
  2. specifying the width as match_parent and specify a reversed value for the weight. I could get the layout the way I wanted, but it isn't using the documentation way of setting the width to 0 and specifying the weight value accordingly.

ViewPagerIndicator works only in fullscreen

I have a tablet app that use two fragments in a screen.
I am using ViewPager inside of the first fragment.
I want to add this viewpagerindicator on top of it. But it fails.
When I remove the second fragment, it works ok.
I guess the problem is it requires full screen.

Left/Right Indicators for Titles

  • adjacentIndicatorStyle - enum: 'none', 'fade', 'arrows', 'custom'
  • adjacentIndicatorLeft - drawable|reference, ignored unless 'custom' style
  • adjacentIndicatorRight - drawable|reference, ignored unless 'custom' style

Persistent Exception onResume

I implemented your library in my project. However now I am getting many bug reports, having to do with the TitlePageIndicator.java code. Specifically here is part of the exception

java.lang.IndexOutOfBoundsException: Invalid index 3, size is 1
at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:257)
at java.util.ArrayList.get(ArrayList.java:311)
at com.jakewharton.android.viewpagerindicator.TitlePageIndicator.onDraw(TitlePageIndicator.java:304)

This seems to be occurring onResume but not if the activity is resumed right away, only if some time passes. Hoping you could shed some light on this issue.

Support Alternate Title Indicators

To look like the new Android Market.

Change footerTriangleHieght to footerIndicatorHeight and add an attribute enum to choose between triangle, underline, or none.

drawing error in CirclePageIndicator

Hi

just pulled the 965055d changeset from the master branch.

When using the circlepageindicator, it seems to work if I the circle indicator goes from the left to the right (when flipping/dragging a page). Going back it seems to be drawing the left destination indicator-circle first, then draws the intermediate indicator-circles.

This behavior is visible in both direction when clicking left or right of the indicator.

I don't have the great overview of how the code should work, but If I apply the diff blow, that behavior goes away. The mCurrentPage also seem to be set correctly after the page has been scrolled/swipe, even if it is not set as per the patch below.

Cheers,
Lars

The auto formatting screwed up the diff I had pasted, so I instead committed it to my own fork:

https://github.com/larshesel/Android-ViewPagerIndicator/commit/c371b888dc41e9fa8dc00247d9c005479c9d370f

Lib Import Error

When i try to import the lib into Eclipse i get
Multiple markers at this line
- The type TitlePageIndicator must implement the inherited abstract method
PageIndicator.setViewPager(ViewPager)
- The hierarchy of the type TitlePageIndicator is inconsistent
- The type TitlePageIndicator must implement the inherited abstract method
PageIndicator.setViewPager(ViewPager, int)

I have posted more details here
http://stackoverflow.com/questions/8366133/android-importing-lib-project

Use theme from application

Hi,

I use your usefull library.
But it seems that the default values do not use the values of the theme applied on the application using Android Manifest.

Is it normal ?

Give Superclass chance to handle Touch Events

I would send a Pull Request for this but I've made another commit previously which you will not want (this one).

At the moment, TitlePageIndicator and CirclePageIndicator gobble up all Touch Events at the end, where as they should send them up to the superclass. That way, any click listeners will have a chance to work.

Here's my commit on my fork: https://github.com/chrisbanes/Android-ViewPagerIndicator/commit/6e43f79eccc55ff3ff2644986e478b2404366ff0

Title Padding Shows Other Adjacent Titles

Set a larger title padding to move the left/right titles off of the sides of the screen and you will see the titles for two pages to the left and right (if available).

TitlePageIndicator issue when calling onDraw method

Hi Jake,

I use Android-ViewPagerIndicator classes on my project and I have noticed an issue when calling onDraw method of TitlePageIndicator class.
This issue is specific to an Android target environment < Android 2.2 (API level 8).

Stack:

11-05 13:30:36.290: E/AndroidRuntime(209): Uncaught handler: thread main exiting due to uncaught exception
11-05 13:30:36.300: E/AndroidRuntime(209): java.lang.IndexOutOfBoundsException: Invalid location 0, size is 0
11-05 13:30:36.300: E/AndroidRuntime(209):  at java.util.ArrayList.get(ArrayList.java:353)
11-05 13:30:36.300: E/AndroidRuntime(209):  at com.hencky.discography.ui.widget.TitlePageIndicator.onDraw(TitlePageIndicator.java:314)
11-05 13:30:36.300: E/AndroidRuntime(209):  at android.view.View.draw(View.java:6274)
11-05 13:30:36.300: E/AndroidRuntime(209):  at android.view.ViewGroup.drawChild(ViewGroup.java:1526)
11-05 13:30:36.300: E/AndroidRuntime(209):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1256)
11-05 13:30:36.300: E/AndroidRuntime(209):  at android.view.View.draw(View.java:6277)
11-05 13:30:36.300: E/AndroidRuntime(209):  at android.view.ViewGroup.drawChild(ViewGroup.java:1526)
11-05 13:30:36.300: E/AndroidRuntime(209):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1256)
11-05 13:30:36.300: E/AndroidRuntime(209):  at android.view.ViewGroup.drawChild(ViewGroup.java:1524)
11-05 13:30:36.300: E/AndroidRuntime(209):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1256)
11-05 13:30:36.300: E/AndroidRuntime(209):  at android.view.View.draw(View.java:6277)
11-05 13:30:36.300: E/AndroidRuntime(209):  at android.widget.FrameLayout.draw(FrameLayout.java:352)
11-05 13:30:36.300: E/AndroidRuntime(209):  at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1883)
11-05 13:30:36.300: E/AndroidRuntime(209):  at android.view.ViewRoot.draw(ViewRoot.java:1332)
11-05 13:30:36.300: E/AndroidRuntime(209):  at android.view.ViewRoot.performTraversals(ViewRoot.java:1097)
11-05 13:30:36.300: E/AndroidRuntime(209):  at android.view.ViewRoot.handleMessage(ViewRoot.java:1613)
11-05 13:30:36.300: E/AndroidRuntime(209):  at android.os.Handler.dispatchMessage(Handler.java:99)
11-05 13:30:36.300: E/AndroidRuntime(209):  at android.os.Looper.loop(Looper.java:123)
11-05 13:30:36.300: E/AndroidRuntime(209):  at android.app.ActivityThread.main(ActivityThread.java:4203)
11-05 13:30:36.300: E/AndroidRuntime(209):  at java.lang.reflect.Method.invokeNative(Native Method)
11-05 13:30:36.300: E/AndroidRuntime(209):  at java.lang.reflect.Method.invoke(Method.java:521)
11-05 13:30:36.300: E/AndroidRuntime(209):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
11-05 13:30:36.300: E/AndroidRuntime(209):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
11-05 13:30:36.300: E/AndroidRuntime(209):  at dalvik.system.NativeStart.main(Native Method)

A simple fix could be a test on bounds size :

protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);

        // Calculate views bounds
        ArrayList<RectF> bounds = calculateAllBounds(mPaintText);

        if (bounds.size() > 0) {
            final int count = mViewPager.getAdapter().getCount();
            final int countMinusOne = count - 1;
            ...
            ...
}

TabPageIndicator doesn't work with any styles but Widget.TabPageIndicator

On the latest revision (f09acb0) simply changing

android:theme="@style/Theme.PageIndicatorDefaults"

to,

android:theme="@android:style/Theme.Light"

completely breaks any of the samples that use TabPageIndicator. This makes it unusable with ActionBarSherlock or any app that wants to use some custom theming.

Screenshot of the problem: http://imgur.com/wMlCC

The contents of Theme.PageIndicatorDefaults seems quite minimal, so it can be worked around by adding these lines to your own theme that extends Theme.Sherlock, or whatever else. This is likely the same problem as what was been described in issue #38.

Force close when removing page

This seems to only be a problem with the Titles samples, and not the Tabs or Circles samples. The "Remove Page" option removes the right-most page. When I'm on the right-most page and I chose the remove page menu option, the sample app will sometimes crash. However, sometimes the app behaves as expected and removes the tab and the new right-most page is selected. I wasn't able to determine what I was doing differently that sometimes causes the app to crash.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.