[
  {
    "path": ".gitignore",
    "content": "#Android generated\nbin\ngen\n\n#Eclipse\n.project\n.classpath\n.settings\n\n#IntelliJ IDEA\n.idea\n*.iml\nclasses\n\n#Maven\ntarget\nrelease.properties\npom.xml.*\n\n#Command line\nlocal.properties\nbuild.xml\nproguard-project.txt\n"
  },
  {
    "path": "CHANGELOG.md",
    "content": "Change Log\n==========\n\nVersion 2.4.1 *(2012-09-11)*\n----------------------------\n\n * Fix: `TitlePageIndicator`, `LinePageIndicator`, and `UnderlinePageIndicator`\n   support of `android:background`.\n\n\nVersion 2.4.0 *(2012-09-06)*\n----------------------------\n\n * New `IconPageIndicator`! Uses state-list images to represent pages.\n * `TabPageIndicator` now supports icons via `IconPagerAdapter` interface.\n * Support `android:background` attribute on `Canvas`-based views.\n * Title indicator allows for drawing its line, underline, and/or triangle on\n   top of the titles for placement underneath a `ViewPager`.\n * Tab indicator now supports ICS-style dividers (see styled sample).\n * Fix: Do not attempt to change the `ViewPager` page when a motion is\n   cancelled.\n * Fix: Long titles no longer overlap when swiping to the right.\n\n\nVersion 2.3.1 *(2012-05-19)*\n----------------------------\n\n * Fix: Corrected filename with erroneous lowercase letter.\n\n\nVersion 2.3.0 *(2012-05-19)*\n----------------------------\n\n * New `LinePageIndicator`! Draws small indicators lines much like the circle\n   indicator but much more subtle.\n * New `UnderlinePageIndicator`! Acts like the indicator on the Ice Cream\n   Sandwich application launcher.\n * Circle indicator now uses `android:orientation` rather than custom attribute.\n * Title indicator adapter callback now uses the standard `getPageTitle(int)`\n   method introduced in the r6 version of the support library.\n * Title indicator now uses `android:textSize` and `android:textColor` in its\n   styles.\n * Fix: Do not create objects in drawing, layout, or measurement steps of each\n   indicator.\n * Fix: Improve offset detection when page margins are in use on the pager.\n * Maven: The dependency on the support library is now using an artifact from\n   central rather than requiring you to deploy your own locally\n\n\nVersion 2.2.3 *(2012-01-26)*\n----------------------------\n\n * Correctly handle removing the last page when it is selected.\n * Use antialiased text for the title indicators.\n * New circle fill color for circle indicators.\n\n\nVersion 2.2.2 *(2011-12-31)*\n----------------------------\n\n * Fix incorrect `R.java` imports in all of the sample activities.\n\n\nVersion 2.2.1 *(2011-12-31)*\n----------------------------\n\n * New `setTypeface(Typeface)` and `getTypeface()` methods for title indicator.\n   (Thanks Dimitri Fedorov)\n * Added styled tab indicator sample.\n * Support for widths other than those that could be measured exactly.\n\n\nVersion 2.2.0 *(2011-12-13)*\n----------------------------\n\n * Default title indicator style is now 'underline'.\n * Title indicator now allows specifying an `OnCenterItemClickListener` which\n   will give you callbacks when the current item title has been clicked.\n   (Thanks Chris Banes)\n\n\nVersion 2.1.0 *(2011-11-30)*\n----------------------------\n\n * Indicators now have a `notifyDataSetChanged` method which should be called\n   when changes are made to the adapter.\n * Fix: Avoid `NullPointerException`s when the `ViewPager` is not immediately\n   bound to the indicator.\n\n\nVersion 2.0.0 *(2011-11-20)*\n----------------------------\n\n * New `TabPageIndicator`! Uses the Ice Cream Sandwich-style action bar tabs\n   which fill the width of the view when there are only a few tabs or provide\n   horizontal animated scrolling when there are many.\n * Update to link against ACLv4r4. This will now be required in all implementing\n   applications.\n * Allow dragging the title and circle indicators to drag the pager.\n * Remove orientation example as the DirectionalViewPager library has not been\n   updated to ACLv4r4.\n\n\nVersion 1.2.1 *(2011-10-20)*\n----------------------------\n\nMaven 3 is now required when building from the command line.\n\n * Update to support ADT 14.\n\n\nVersion 1.2.0 *(2011-10-04)*\n----------------------------\n\n * Move to `com.viewpagerindicator` package.\n * Move maven group and artifact to `com.viewpagerindicator:library`.\n\n\nVersion 1.1.0 *(2011-10-02)*\n----------------------------\n\n * Package changed from `com.jakewharton.android.viewpagerindicator` to\n   `com.jakewharton.android.view`.\n * Add vertical orientation support to the circle indicator.\n * Fix: Corrected drawing bug where a single frame would be drawn as if the\n   pager had completed its scroll when in fact it was still scrolling.\n   (Thanks SimonVT!)\n\n\nVersion 1.0.1 *(2011-09-15)*\n----------------------------\n\n * Fade selected title color to normal text color during the swipe to and from\n   the center position.\n * Fix: Ensure both the indicator and footer line are updated when changing the\n   footer color via the `setFooterColor` method.\n\n\nVersion 1.0.0 *(2011-08-07)*\n----------------------------\n\nInitial release.\n"
  },
  {
    "path": "README.md",
    "content": "Android ViewPagerIndicator\n==========================\n\nPaging indicator widgets that are compatible with the `ViewPager` from the\n[Android Support Library][2] to improve discoverability of content.\n\nTry out the sample application [on the Android Market][10].\n\n![ViewPagerIndicator Sample Screenshots][9]\n\nThese widgets can also be used in conjunction with [ActionBarSherlock][3]!\n\n\n\nUsage\n=====\n\n*For a working implementation of this project see the `sample/` folder.*\n\n  1. Include one of the widgets in your view. This should usually be placed\n     adjacent to the `ViewPager` it represents.\n\n        <com.viewpagerindicator.TitlePageIndicator\n            android:id=\"@+id/titles\"\n            android:layout_height=\"wrap_content\"\n            android:layout_width=\"fill_parent\" />\n\n  2. In your `onCreate` method (or `onCreateView` for a fragment), bind the\n     indicator to the `ViewPager`.\n\n         //Set the pager with an adapter\n         ViewPager pager = (ViewPager)findViewById(R.id.pager);\n         pager.setAdapter(new TestAdapter(getSupportFragmentManager()));\n\n         //Bind the title indicator to the adapter\n         TitlePageIndicator titleIndicator = (TitlePageIndicator)findViewById(R.id.titles);\n         titleIndicator.setViewPager(pager);\n\n  3. *(Optional)* If you use an `OnPageChangeListener` with your view pager\n     you should set it in the indicator rather than on the pager directly.\n\n         //continued from above\n         titleIndicator.setOnPageChangeListener(mPageChangeListener);\n\n\nTheming\n-------\n\nThere are three ways to style the look of the indicators.\n\n 1. **Theme XML**. An attribute for each type of indicator is provided in which\n    you can specify a custom style.\n 2. **Layout XML**. Through the use of a custom namespace you can include any\n    desired styles.\n 3. **Object methods**. Both styles have getters and setters for each style\n    attribute which can be changed at any point.\n\nEach indicator has a demo which creates the same look using each of these\nmethods.\n\n\nIncluding In Your Project\n-------------------------\n\nAndroid-ViewPagerIndicator is presented as an [Android library project][7]. A\nstandalone JAR is not possible due to the theming capabilities offered by the\nindicator widgets.\n\nYou can include this project by [referencing it as a library project][8] in\nEclipse or ant.\n\nIf you are a Maven user you can easily include the library by specifying it as\na dependency:\n\n    <dependency>\n      <groupId>com.viewpagerindicator</groupId>\n      <artifactId>library</artifactId>\n      <version>2.4.1</version>\n      <type>apklib</type>\n    </dependency>\n\nThis project depends on the `ViewPager` class which is available in the\n[Android Support Library][2] or [ActionBarSherlock][3]. Details for\nincluding one of those libraries is available on their respecitve web sites.\n\n\n\n\nDeveloped By\n============\n\n * Jake Wharton - <jakewharton@gmail.com>\n\n\nCredits\n-------\n\n * [Patrik Åkerfeldt][1] - Author of [ViewFlow][4], a precursor to the ViewPager,\n   which supports paged views and is the original source of both the title\n   and circle indicators.\n * [Francisco Figueiredo Jr.][5] - Idea and [first implementation][6] for\n   fragment support via ViewPager.\n\n\n\n\nLicense\n=======\n\n    Copyright 2012 Jake Wharton\n    Copyright 2011 Patrik Åkerfeldt\n    Copyright 2011 Francisco Figueiredo Jr.\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n\n\n\n\n\n\n [1]: https://github.com/pakerfeldt\n [2]: http://developer.android.com/sdk/compatibility-library.html\n [3]: http://actionbarsherlock.com\n [4]: https://github.com/pakerfeldt/android-viewflow\n [5]: https://github.com/franciscojunior\n [6]: https://gist.github.com/1122947\n [7]: http://developer.android.com/guide/developing/projects/projects-eclipse.html\n [8]: http://developer.android.com/guide/developing/projects/projects-eclipse.html#ReferencingLibraryProject\n [9]: https://raw.github.com/JakeWharton/Android-ViewPagerIndicator/master/sample/screens.png\n [10]: https://play.google.com/store/apps/details?id=com.viewpagerindicator.sample\n"
  },
  {
    "path": "checkstyle.xml",
    "content": "<?xml version=\"1.0\"?>\r\n<!DOCTYPE module PUBLIC\r\n    \"-//Puppy Crawl//DTD Check Configuration 1.2//EN\"\r\n    \"http://www.puppycrawl.com/dtds/configuration_1_2.dtd\">\r\n\r\n<module name=\"Checker\">\r\n    <!--module name=\"NewlineAtEndOfFile\"/-->\r\n    <module name=\"FileLength\"/>\r\n    <module name=\"FileTabCharacter\"/>\r\n\r\n    <!-- Trailing spaces -->\r\n    <module name=\"RegexpSingleline\">\r\n        <property name=\"format\" value=\"\\s+$\"/>\r\n        <property name=\"message\" value=\"Line has trailing spaces.\"/>\r\n    </module>\r\n\r\n    <module name=\"TreeWalker\">\r\n        <property name=\"cacheFile\" value=\"${checkstyle.cache.file}\"/>\r\n\r\n        <!-- Checks for Javadoc comments.                     -->\r\n        <!-- See http://checkstyle.sf.net/config_javadoc.html -->\r\n        <!--module name=\"JavadocMethod\"/-->\r\n        <!--module name=\"JavadocType\"/-->\r\n        <!--module name=\"JavadocVariable\"/-->\r\n        <!--module name=\"JavadocStyle\"/-->\r\n\r\n\r\n        <!-- Checks for Naming Conventions.                  -->\r\n        <!-- See http://checkstyle.sf.net/config_naming.html -->\r\n        <module name=\"ConstantName\"/>\r\n        <module name=\"LocalFinalVariableName\"/>\r\n        <module name=\"LocalVariableName\"/>\r\n        <module name=\"MemberName\"/>\r\n        <module name=\"MethodName\"/>\r\n        <module name=\"PackageName\"/>\r\n        <module name=\"ParameterName\"/>\r\n        <module name=\"StaticVariableName\"/>\r\n        <module name=\"TypeName\"/>\r\n\r\n\r\n        <!-- Checks for imports                              -->\r\n        <!-- See http://checkstyle.sf.net/config_import.html -->\r\n        <module name=\"AvoidStarImport\"/>\r\n        <module name=\"IllegalImport\"/> <!-- defaults to sun.* packages -->\r\n        <module name=\"RedundantImport\"/>\r\n        <module name=\"UnusedImports\"/>\r\n\r\n\r\n        <!-- Checks for Size Violations.                    -->\r\n        <!-- See http://checkstyle.sf.net/config_sizes.html -->\r\n        <!--module name=\"LineLength\"/-->\r\n        <!--module name=\"MethodLength\"/-->\r\n        <!--module name=\"ParameterNumber\"/-->\r\n\r\n\r\n        <!-- Checks for whitespace                               -->\r\n        <!-- See http://checkstyle.sf.net/config_whitespace.html -->\r\n        <!--module name=\"EmptyForIteratorPad\"/-->\r\n        <!--module name=\"MethodParamPad\"/-->\r\n        <!--module name=\"NoWhitespaceAfter\"/-->\r\n        <!--module name=\"NoWhitespaceBefore\"/-->\r\n        <!--module name=\"OperatorWrap\"/-->\r\n        <!--module name=\"ParenPad\"/-->\r\n        <!--module name=\"TypecastParenPad\"/-->\r\n        <!--module name=\"WhitespaceAfter\"/-->\r\n        <!--module name=\"WhitespaceAround\"/-->\r\n\r\n\r\n        <!-- Modifier Checks                                    -->\r\n        <!-- See http://checkstyle.sf.net/config_modifiers.html -->\r\n        <!--module name=\"ModifierOrder\"/-->\r\n        <!--module name=\"RedundantModifier\"/-->\r\n\r\n\r\n        <!-- Checks for blocks. You know, those {}'s         -->\r\n        <!-- See http://checkstyle.sf.net/config_blocks.html -->\r\n        <!--module name=\"AvoidNestedBlocks\"/-->\r\n        <!--module name=\"EmptyBlock\"/-->\r\n        <!--module name=\"LeftCurly\"/-->\r\n        <!--module name=\"NeedBraces\"/-->\r\n        <!--module name=\"RightCurly\"/-->\r\n\r\n\r\n        <!-- Checks for common coding problems               -->\r\n        <!-- See http://checkstyle.sf.net/config_coding.html -->\r\n        <!--module name=\"AvoidInlineConditionals\"/-->\r\n        <!--module name=\"DoubleCheckedLocking\"/-->    <!-- MY FAVOURITE -->\r\n        <!--module name=\"EmptyStatement\"/-->\r\n        <!--module name=\"EqualsHashCode\"/-->\r\n        <!--module name=\"HiddenField\"/-->\r\n        <!--module name=\"IllegalInstantiation\"/-->\r\n        <!--module name=\"InnerAssignment\"/-->\r\n        <!--module name=\"MagicNumber\"/-->\r\n        <!--module name=\"MissingSwitchDefault\"/-->\r\n        <!--module name=\"RedundantThrows\"/-->\r\n        <!--module name=\"SimplifyBooleanExpression\"/-->\r\n        <!--module name=\"SimplifyBooleanReturn\"/-->\r\n\r\n        <!-- Checks for class design                         -->\r\n        <!-- See http://checkstyle.sf.net/config_design.html -->\r\n        <!--module name=\"DesignForExtension\"/-->\r\n        <!--module name=\"FinalClass\"/-->\r\n        <!--module name=\"HideUtilityClassConstructor\"/-->\r\n        <!--module name=\"InterfaceIsType\"/-->\r\n        <!--module name=\"VisibilityModifier\"/-->\r\n\r\n\r\n        <!-- Miscellaneous other checks.                   -->\r\n        <!-- See http://checkstyle.sf.net/config_misc.html -->\r\n        <!--module name=\"ArrayTypeStyle\"/-->\r\n        <!--module name=\"FinalParameters\"/-->\r\n        <!--module name=\"TodoComment\"/-->\r\n        <!--module name=\"UpperEll\"/-->\r\n    </module>\r\n</module>\r\n"
  },
  {
    "path": "library/AndroidManifest.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    package=\"com.viewpagerindicator\"\n    android:versionCode=\"65\"\n    android:versionName=\"2.4.1\">\n\n    <uses-sdk android:minSdkVersion=\"4\" />\n</manifest>\n"
  },
  {
    "path": "library/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\t<modelVersion>4.0.0</modelVersion>\n\n\t<artifactId>library</artifactId>\n\t<name>Android-ViewPagerIndicator</name>\n\t<packaging>apklib</packaging>\n\n\t<parent>\n\t\t<groupId>com.viewpagerindicator</groupId>\n\t\t<artifactId>parent</artifactId>\n\t\t<version>2.4.1</version>\n\t\t<relativePath>../pom.xml</relativePath>\n\t</parent>\n\t\n\t<dependencies>\n\t\t<dependency>\n\t\t\t<groupId>com.google.android</groupId>\n\t\t\t<artifactId>android</artifactId>\n\t\t\t<scope>provided</scope>\n\t\t</dependency>\n\n\t\t<dependency>\n\t\t\t<groupId>com.google.android</groupId>\n\t\t\t<artifactId>support-v4</artifactId>\n\t\t</dependency>\n\t</dependencies>\n\n\t<build>\n\t\t<sourceDirectory>src</sourceDirectory>\n\n\t\t<plugins>\n\t\t\t<plugin>\n\t\t\t\t<groupId>com.jayway.maven.plugins.android.generation2</groupId>\n\t\t\t\t<artifactId>android-maven-plugin</artifactId>\n\t\t\t\t<extensions>true</extensions>\n\t\t\t</plugin>\n\n\t\t\t<plugin>\n\t\t\t\t<groupId>org.apache.maven.plugins</groupId>\n\t\t\t\t<artifactId>maven-checkstyle-plugin</artifactId>\n\t\t\t\t<configuration>\n\t\t\t\t\t<configLocation>../checkstyle.xml</configLocation>\n\t\t\t\t</configuration>\n\t\t\t\t<executions>\n\t\t\t\t\t<execution>\n\t\t\t\t\t\t<phase>verify</phase>\n\t\t\t\t\t\t<goals>\n\t\t\t\t\t\t\t<goal>checkstyle</goal>\n\t\t\t\t\t\t</goals>\n\t\t\t\t\t</execution>\n\t\t\t\t</executions>\n\t\t\t</plugin>\n\t\t</plugins>\n\t</build>\n</project>\n"
  },
  {
    "path": "library/project.properties",
    "content": "# This file is automatically generated by Android Tools.\n# Do not modify this file -- YOUR CHANGES WILL BE ERASED!\n#\n# This file must be checked in Version Control Systems.\n#\n# To customize properties used by the Ant build system use,\n# \"ant.properties\", and override values to adapt the script to your\n# project structure.\n\nandroid.library=true\n# Project target.\ntarget=android-16\n"
  },
  {
    "path": "library/res/color/vpi__dark_theme.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Copyright (C) 2010 The Android Open Source Project\n\n     Licensed under the Apache License, Version 2.0 (the \"License\");\n     you may not use this file except in compliance with the License.\n     You may obtain a copy of the License at\n  \n          http://www.apache.org/licenses/LICENSE-2.0\n  \n     Unless required by applicable law or agreed to in writing, software\n     distributed under the License is distributed on an \"AS IS\" BASIS,\n     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n     See the License for the specific language governing permissions and\n     limitations under the License.\n-->\n\n<selector xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:state_enabled=\"false\" android:color=\"@color/vpi__bright_foreground_disabled_holo_dark\"/>\n    <item android:state_window_focused=\"false\" android:color=\"@color/vpi__bright_foreground_holo_dark\"/>\n    <item android:state_pressed=\"true\" android:color=\"@color/vpi__bright_foreground_holo_dark\"/>\n    <item android:state_selected=\"true\" android:color=\"@color/vpi__bright_foreground_holo_dark\"/>\n    <!--item android:state_activated=\"true\" android:color=\"@color/vpi__bright_foreground_holo_dark\"/-->\n    <item android:color=\"@color/vpi__bright_foreground_holo_dark\"/> <!-- not selected -->\n</selector>\n"
  },
  {
    "path": "library/res/color/vpi__light_theme.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Copyright (C) 2010 The Android Open Source Project\n\n     Licensed under the Apache License, Version 2.0 (the \"License\");\n     you may not use this file except in compliance with the License.\n     You may obtain a copy of the License at\n  \n          http://www.apache.org/licenses/LICENSE-2.0\n  \n     Unless required by applicable law or agreed to in writing, software\n     distributed under the License is distributed on an \"AS IS\" BASIS,\n     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n     See the License for the specific language governing permissions and\n     limitations under the License.\n-->\n\n<selector xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:state_enabled=\"false\" android:color=\"@color/vpi__bright_foreground_disabled_holo_light\"/>\n    <item android:state_window_focused=\"false\" android:color=\"@color/vpi__bright_foreground_holo_light\"/>\n    <item android:state_pressed=\"true\" android:color=\"@color/vpi__bright_foreground_holo_light\"/>\n    <item android:state_selected=\"true\" android:color=\"@color/vpi__bright_foreground_holo_light\"/>\n    <!--item android:state_activated=\"true\" android:color=\"@color/vpi__bright_foreground_holo_light\"/-->\n    <item android:color=\"@color/vpi__bright_foreground_holo_light\"/> <!-- not selected -->\n    \n</selector>\n\n"
  },
  {
    "path": "library/res/drawable/vpi__tab_indicator.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Copyright (C) 2008 The Android Open Source Project\n\n     Licensed under the Apache License, Version 2.0 (the \"License\");\n     you may not use this file except in compliance with the License.\n     You may obtain a copy of the License at\n  \n          http://www.apache.org/licenses/LICENSE-2.0\n  \n     Unless required by applicable law or agreed to in writing, software\n     distributed under the License is distributed on an \"AS IS\" BASIS,\n     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n     See the License for the specific language governing permissions and\n     limitations under the License.\n-->\n\n<selector xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <!-- Non focused states -->\n    <item android:state_focused=\"false\" android:state_selected=\"false\" android:state_pressed=\"false\" android:drawable=\"@drawable/vpi__tab_unselected_holo\" />\n    <item android:state_focused=\"false\" android:state_selected=\"true\"  android:state_pressed=\"false\" android:drawable=\"@drawable/vpi__tab_selected_holo\" />\n\n    <!-- Focused states -->\n    <item android:state_focused=\"true\" android:state_selected=\"false\" android:state_pressed=\"false\" android:drawable=\"@drawable/vpi__tab_unselected_focused_holo\" />\n    <item android:state_focused=\"true\" android:state_selected=\"true\"  android:state_pressed=\"false\" android:drawable=\"@drawable/vpi__tab_selected_focused_holo\" />\n\n    <!-- Pressed -->\n    <!--    Non focused states -->\n    <item android:state_focused=\"false\" android:state_selected=\"false\" android:state_pressed=\"true\" android:drawable=\"@drawable/vpi__tab_unselected_pressed_holo\" />\n    <item android:state_focused=\"false\" android:state_selected=\"true\"  android:state_pressed=\"true\" android:drawable=\"@drawable/vpi__tab_selected_pressed_holo\" />\n\n    <!--    Focused states -->\n    <item android:state_focused=\"true\" android:state_selected=\"false\" android:state_pressed=\"true\" android:drawable=\"@drawable/vpi__tab_unselected_pressed_holo\" />\n    <item android:state_focused=\"true\" android:state_selected=\"true\"  android:state_pressed=\"true\" android:drawable=\"@drawable/vpi__tab_selected_pressed_holo\" />\n</selector>\n"
  },
  {
    "path": "library/res/values/vpi__attrs.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Copyright (C) 2012 Jake Wharton\n     Copyright (C) 2011 Patrik Åkerfeldt\n\n     Licensed under the Apache License, Version 2.0 (the \"License\");\n     you may not use this file except in compliance with the License.\n     You may obtain a copy of the License at\n\n          http://www.apache.org/licenses/LICENSE-2.0\n\n     Unless required by applicable law or agreed to in writing, software\n     distributed under the License is distributed on an \"AS IS\" BASIS,\n     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n     See the License for the specific language governing permissions and\n     limitations under the License.\n-->\n\n<resources>\n    <declare-styleable name=\"ViewPagerIndicator\">\n        <!-- Style of the circle indicator. -->\n        <attr name=\"vpiCirclePageIndicatorStyle\" format=\"reference\"/>\n        <!-- Style of the icon indicator's views. -->\n        <attr name=\"vpiIconPageIndicatorStyle\" format=\"reference\"/>\n        <!-- Style of the line indicator. -->\n        <attr name=\"vpiLinePageIndicatorStyle\" format=\"reference\"/>\n        <!-- Style of the title indicator. -->\n        <attr name=\"vpiTitlePageIndicatorStyle\" format=\"reference\"/>\n        <!-- Style of the tab indicator's tabs. -->\n        <attr name=\"vpiTabPageIndicatorStyle\" format=\"reference\"/>\n        <!-- Style of the underline indicator. -->\n        <attr name=\"vpiUnderlinePageIndicatorStyle\" format=\"reference\"/>\n    </declare-styleable>\n\n    <attr name=\"centered\" format=\"boolean\" />\n    <attr name=\"selectedColor\" format=\"color\" />\n    <attr name=\"strokeWidth\" format=\"dimension\" />\n    <attr name=\"unselectedColor\" format=\"color\" />\n\n    <declare-styleable name=\"CirclePageIndicator\">\n        <!-- Whether or not the indicators should be centered. -->\n        <attr name=\"centered\" />\n        <!-- Color of the filled circle that represents the current page. -->\n        <attr name=\"fillColor\" format=\"color\" />\n        <!-- Color of the filled circles that represents pages. -->\n        <attr name=\"pageColor\" format=\"color\" />\n        <!-- Orientation of the indicator. -->\n        <attr name=\"android:orientation\"/>\n        <!-- Radius of the circles. This is also the spacing between circles. -->\n        <attr name=\"radius\" format=\"dimension\" />\n        <!-- Whether or not the selected indicator snaps to the circles. -->\n        <attr name=\"snap\" format=\"boolean\" />\n        <!-- Color of the open circles. -->\n        <attr name=\"strokeColor\" format=\"color\" />\n        <!-- Width of the stroke used to draw the circles. -->\n        <attr name=\"strokeWidth\" />\n        <!-- View background -->\n        <attr name=\"android:background\"/>\n    </declare-styleable>\n\n    <declare-styleable name=\"LinePageIndicator\">\n        <!-- Whether or not the indicators should be centered. -->\n        <attr name=\"centered\" />\n        <!-- Color of the unselected lines that represent the pages. -->\n        <attr name=\"unselectedColor\" />\n        <!-- Color of the selected line that represents the current page. -->\n        <attr name=\"selectedColor\" />\n        <!-- Width of each indicator line. -->\n        <attr name=\"lineWidth\" format=\"dimension\" />\n        <!-- Width of each indicator line's stroke. -->\n        <attr name=\"strokeWidth\" />\n        <!-- Width of the gap between each indicator line. -->\n        <attr name=\"gapWidth\" format=\"dimension\" />\n        <!-- View background -->\n        <attr name=\"android:background\"/>\n    </declare-styleable>\n\n    <declare-styleable name=\"TitlePageIndicator\">\n        <!-- Screen edge padding. -->\n        <attr name=\"clipPadding\" format=\"dimension\" />\n        <!-- Color of the footer line and indicator. -->\n        <attr name=\"footerColor\" format=\"color\" />\n        <!-- Height of the footer line. -->\n        <attr name=\"footerLineHeight\" format=\"dimension\" />\n        <!-- Style of the indicator. Default is triangle. -->\n        <attr name=\"footerIndicatorStyle\">\n            <enum name=\"none\" value=\"0\" />\n            <enum name=\"triangle\" value=\"1\" />\n            <enum name=\"underline\" value=\"2\" />\n        </attr>\n        <!-- Height of the indicator above the footer line. -->\n        <attr name=\"footerIndicatorHeight\" format=\"dimension\" />\n        <!-- Left and right padding of the underline indicator. -->\n        <attr name=\"footerIndicatorUnderlinePadding\" format=\"dimension\" />\n        <!-- Padding between the bottom of the title and the footer. -->\n        <attr name=\"footerPadding\" format=\"dimension\" />\n        <!-- Position of the line. -->\n        <attr name=\"linePosition\">\n            <enum name=\"bottom\" value=\"0\"/>\n            <enum name=\"top\" value=\"1\"/>\n        </attr>\n        <!-- Color of the selected title. -->\n        <attr name=\"selectedColor\" />\n        <!-- Whether or not the selected item is displayed as bold. -->\n        <attr name=\"selectedBold\" format=\"boolean\" />\n        <!-- Color of regular titles. -->\n        <attr name=\"android:textColor\" />\n        <!-- Size of title text. -->\n        <attr name=\"android:textSize\" />\n        <!-- Padding between titles when bumping into each other. -->\n        <attr name=\"titlePadding\" format=\"dimension\" />\n        <!-- Padding between titles and the top of the View. -->\n        <attr name=\"topPadding\" format=\"dimension\" />\n        <!-- View background -->\n        <attr name=\"android:background\"/>\n    </declare-styleable>\n\n    <declare-styleable name=\"UnderlinePageIndicator\">\n        <!-- Whether or not the selected indicator fades. -->\n        <attr name=\"fades\" format=\"boolean\" />\n        <!-- Length of the delay to fade the indicator. -->\n        <attr name=\"fadeDelay\" format=\"integer\" />\n        <!-- Length of the indicator fade to transparent. -->\n        <attr name=\"fadeLength\" format=\"integer\" />\n        <!-- Color of the selected line that represents the current page. -->\n        <attr name=\"selectedColor\" />\n        <!-- View background -->\n        <attr name=\"android:background\"/>\n    </declare-styleable>\n</resources>\n"
  },
  {
    "path": "library/res/values/vpi__colors.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Copyright (C) 2012 Jake Wharton\n\n     Licensed under the Apache License, Version 2.0 (the \"License\");\n     you may not use this file except in compliance with the License.\n     You may obtain a copy of the License at\n\n          http://www.apache.org/licenses/LICENSE-2.0\n\n     Unless required by applicable law or agreed to in writing, software\n     distributed under the License is distributed on an \"AS IS\" BASIS,\n     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n     See the License for the specific language governing permissions and\n     limitations under the License.\n-->\n\n<resources>\n    <color name=\"vpi__background_holo_dark\">#ff000000</color>\n    <color name=\"vpi__background_holo_light\">#fff3f3f3</color>\n    <color name=\"vpi__bright_foreground_holo_dark\">@color/vpi__background_holo_light</color>\n    <color name=\"vpi__bright_foreground_holo_light\">@color/vpi__background_holo_dark</color>\n    <color name=\"vpi__bright_foreground_disabled_holo_dark\">#ff4c4c4c</color>\n    <color name=\"vpi__bright_foreground_disabled_holo_light\">#ffb2b2b2</color>\n    <color name=\"vpi__bright_foreground_inverse_holo_dark\">@color/vpi__bright_foreground_holo_light</color>\n    <color name=\"vpi__bright_foreground_inverse_holo_light\">@color/vpi__bright_foreground_holo_dark</color>\n</resources>\n"
  },
  {
    "path": "library/res/values/vpi__defaults.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Copyright (C) 2012 Jake Wharton\n\n     Licensed under the Apache License, Version 2.0 (the \"License\");\n     you may not use this file except in compliance with the License.\n     You may obtain a copy of the License at\n\n          http://www.apache.org/licenses/LICENSE-2.0\n\n     Unless required by applicable law or agreed to in writing, software\n     distributed under the License is distributed on an \"AS IS\" BASIS,\n     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n     See the License for the specific language governing permissions and\n     limitations under the License.\n-->\n\n<resources>\n    <bool name=\"default_circle_indicator_centered\">true</bool>\n    <color name=\"default_circle_indicator_fill_color\">#FFFFFFFF</color>\n    <color name=\"default_circle_indicator_page_color\">#00000000</color>\n    <integer name=\"default_circle_indicator_orientation\">0</integer>\n    <dimen name=\"default_circle_indicator_radius\">3dp</dimen>\n    <bool name=\"default_circle_indicator_snap\">false</bool>\n    <color name=\"default_circle_indicator_stroke_color\">#FFDDDDDD</color>\n    <dimen name=\"default_circle_indicator_stroke_width\">1dp</dimen>\n\n    <dimen name=\"default_line_indicator_line_width\">12dp</dimen>\n    <dimen name=\"default_line_indicator_gap_width\">4dp</dimen>\n    <dimen name=\"default_line_indicator_stroke_width\">1dp</dimen>\n    <color name=\"default_line_indicator_selected_color\">#FF33B5E5</color>\n    <color name=\"default_line_indicator_unselected_color\">#FFBBBBBB</color>\n    <bool name=\"default_line_indicator_centered\">true</bool>\n\n    <dimen name=\"default_title_indicator_clip_padding\">4dp</dimen>\n    <color name=\"default_title_indicator_footer_color\">#FF33B5E5</color>\n    <dimen name=\"default_title_indicator_footer_line_height\">2dp</dimen>\n    <integer name=\"default_title_indicator_footer_indicator_style\">2</integer>\n    <dimen name=\"default_title_indicator_footer_indicator_height\">4dp</dimen>\n    <dimen name=\"default_title_indicator_footer_indicator_underline_padding\">20dp</dimen>\n    <dimen name=\"default_title_indicator_footer_padding\">7dp</dimen>\n    <integer name=\"default_title_indicator_line_position\">0</integer>\n    <color name=\"default_title_indicator_selected_color\">#FFFFFFFF</color>\n    <bool name=\"default_title_indicator_selected_bold\">true</bool>\n    <color name=\"default_title_indicator_text_color\">#BBFFFFFF</color>\n    <dimen name=\"default_title_indicator_text_size\">15dp</dimen>\n    <dimen name=\"default_title_indicator_title_padding\">5dp</dimen>\n    <dimen name=\"default_title_indicator_top_padding\">7dp</dimen>\n\n    <bool name=\"default_underline_indicator_fades\">true</bool>\n    <integer name=\"default_underline_indicator_fade_delay\">300</integer>\n    <integer name=\"default_underline_indicator_fade_length\">400</integer>\n    <color name=\"default_underline_indicator_selected_color\">#FF33B5E5</color>\n</resources>"
  },
  {
    "path": "library/res/values/vpi__styles.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Copyright (C) 2011 Jake Wharton\n\n     Licensed under the Apache License, Version 2.0 (the \"License\");\n     you may not use this file except in compliance with the License.\n     You may obtain a copy of the License at\n\n          http://www.apache.org/licenses/LICENSE-2.0\n\n     Unless required by applicable law or agreed to in writing, software\n     distributed under the License is distributed on an \"AS IS\" BASIS,\n     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n     See the License for the specific language governing permissions and\n     limitations under the License.\n-->\n\n<resources>\n    <style name=\"Theme.PageIndicatorDefaults\" parent=\"android:Theme\">\n        <item name=\"vpiIconPageIndicatorStyle\">@style/Widget.IconPageIndicator</item>\n        <item name=\"vpiTabPageIndicatorStyle\">@style/Widget.TabPageIndicator</item>\n    </style>\n\n    <style name=\"Widget\">\n    </style>\n\n    <style name=\"Widget.TabPageIndicator\" parent=\"Widget\">\n        <item name=\"android:gravity\">center</item>\n        <item name=\"android:background\">@drawable/vpi__tab_indicator</item>\n        <item name=\"android:paddingLeft\">22dip</item>\n        <item name=\"android:paddingRight\">22dip</item>\n        <item name=\"android:paddingTop\">12dp</item>\n        <item name=\"android:paddingBottom\">12dp</item>\n        <item name=\"android:textAppearance\">@style/TextAppearance.TabPageIndicator</item>\n        <item name=\"android:textSize\">12sp</item>\n        <item name=\"android:maxLines\">1</item>\n    </style>\n\n    <style name=\"TextAppearance.TabPageIndicator\" parent=\"Widget\">\n        <item name=\"android:textStyle\">bold</item>\n        <item name=\"android:textColor\">@color/vpi__dark_theme</item>\n    </style>\n\n    <style name=\"Widget.IconPageIndicator\" parent=\"Widget\">\n        <item name=\"android:layout_marginLeft\">6dp</item>\n        <item name=\"android:layout_marginRight\">6dp</item>\n    </style>\n</resources>\n"
  },
  {
    "path": "library/src/com/viewpagerindicator/CirclePageIndicator.java",
    "content": "/*\n * Copyright (C) 2011 Patrik Akerfeldt\n * Copyright (C) 2011 Jake Wharton\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage com.viewpagerindicator;\n\nimport android.content.Context;\nimport android.content.res.Resources;\nimport android.content.res.TypedArray;\nimport android.graphics.Canvas;\nimport android.graphics.Paint;\nimport android.graphics.Paint.Style;\nimport android.graphics.drawable.Drawable;\nimport android.os.Parcel;\nimport android.os.Parcelable;\nimport android.support.v4.view.MotionEventCompat;\nimport android.support.v4.view.ViewConfigurationCompat;\nimport android.support.v4.view.ViewPager;\nimport android.util.AttributeSet;\nimport android.view.MotionEvent;\nimport android.view.View;\nimport android.view.ViewConfiguration;\n\nimport static android.graphics.Paint.ANTI_ALIAS_FLAG;\nimport static android.widget.LinearLayout.HORIZONTAL;\nimport static android.widget.LinearLayout.VERTICAL;\n\n/**\n * Draws circles (one for each view). The current view position is filled and\n * others are only stroked.\n */\npublic class CirclePageIndicator extends View implements PageIndicator {\n    private static final int INVALID_POINTER = -1;\n\n    private float mRadius;\n    private final Paint mPaintPageFill = new Paint(ANTI_ALIAS_FLAG);\n    private final Paint mPaintStroke = new Paint(ANTI_ALIAS_FLAG);\n    private final Paint mPaintFill = new Paint(ANTI_ALIAS_FLAG);\n    private ViewPager mViewPager;\n    private ViewPager.OnPageChangeListener mListener;\n    private int mCurrentPage;\n    private int mSnapPage;\n    private float mPageOffset;\n    private int mScrollState;\n    private int mOrientation;\n    private boolean mCentered;\n    private boolean mSnap;\n\n    private int mTouchSlop;\n    private float mLastMotionX = -1;\n    private int mActivePointerId = INVALID_POINTER;\n    private boolean mIsDragging;\n\n\n    public CirclePageIndicator(Context context) {\n        this(context, null);\n    }\n\n    public CirclePageIndicator(Context context, AttributeSet attrs) {\n        this(context, attrs, R.attr.vpiCirclePageIndicatorStyle);\n    }\n\n    public CirclePageIndicator(Context context, AttributeSet attrs, int defStyle) {\n        super(context, attrs, defStyle);\n        if (isInEditMode()) return;\n\n        //Load defaults from resources\n        final Resources res = getResources();\n        final int defaultPageColor = res.getColor(R.color.default_circle_indicator_page_color);\n        final int defaultFillColor = res.getColor(R.color.default_circle_indicator_fill_color);\n        final int defaultOrientation = res.getInteger(R.integer.default_circle_indicator_orientation);\n        final int defaultStrokeColor = res.getColor(R.color.default_circle_indicator_stroke_color);\n        final float defaultStrokeWidth = res.getDimension(R.dimen.default_circle_indicator_stroke_width);\n        final float defaultRadius = res.getDimension(R.dimen.default_circle_indicator_radius);\n        final boolean defaultCentered = res.getBoolean(R.bool.default_circle_indicator_centered);\n        final boolean defaultSnap = res.getBoolean(R.bool.default_circle_indicator_snap);\n\n        //Retrieve styles attributes\n        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CirclePageIndicator, defStyle, 0);\n\n        mCentered = a.getBoolean(R.styleable.CirclePageIndicator_centered, defaultCentered);\n        mOrientation = a.getInt(R.styleable.CirclePageIndicator_android_orientation, defaultOrientation);\n        mPaintPageFill.setStyle(Style.FILL);\n        mPaintPageFill.setColor(a.getColor(R.styleable.CirclePageIndicator_pageColor, defaultPageColor));\n        mPaintStroke.setStyle(Style.STROKE);\n        mPaintStroke.setColor(a.getColor(R.styleable.CirclePageIndicator_strokeColor, defaultStrokeColor));\n        mPaintStroke.setStrokeWidth(a.getDimension(R.styleable.CirclePageIndicator_strokeWidth, defaultStrokeWidth));\n        mPaintFill.setStyle(Style.FILL);\n        mPaintFill.setColor(a.getColor(R.styleable.CirclePageIndicator_fillColor, defaultFillColor));\n        mRadius = a.getDimension(R.styleable.CirclePageIndicator_radius, defaultRadius);\n        mSnap = a.getBoolean(R.styleable.CirclePageIndicator_snap, defaultSnap);\n\n        Drawable background = a.getDrawable(R.styleable.CirclePageIndicator_android_background);\n        if (background != null) {\n          setBackgroundDrawable(background);\n        }\n\n        a.recycle();\n\n        final ViewConfiguration configuration = ViewConfiguration.get(context);\n        mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);\n    }\n\n\n    public void setCentered(boolean centered) {\n        mCentered = centered;\n        invalidate();\n    }\n\n    public boolean isCentered() {\n        return mCentered;\n    }\n\n    public void setPageColor(int pageColor) {\n        mPaintPageFill.setColor(pageColor);\n        invalidate();\n    }\n\n    public int getPageColor() {\n        return mPaintPageFill.getColor();\n    }\n\n    public void setFillColor(int fillColor) {\n        mPaintFill.setColor(fillColor);\n        invalidate();\n    }\n\n    public int getFillColor() {\n        return mPaintFill.getColor();\n    }\n\n    public void setOrientation(int orientation) {\n        switch (orientation) {\n            case HORIZONTAL:\n            case VERTICAL:\n                mOrientation = orientation;\n                requestLayout();\n                break;\n\n            default:\n                throw new IllegalArgumentException(\"Orientation must be either HORIZONTAL or VERTICAL.\");\n        }\n    }\n\n    public int getOrientation() {\n        return mOrientation;\n    }\n\n    public void setStrokeColor(int strokeColor) {\n        mPaintStroke.setColor(strokeColor);\n        invalidate();\n    }\n\n    public int getStrokeColor() {\n        return mPaintStroke.getColor();\n    }\n\n    public void setStrokeWidth(float strokeWidth) {\n        mPaintStroke.setStrokeWidth(strokeWidth);\n        invalidate();\n    }\n\n    public float getStrokeWidth() {\n        return mPaintStroke.getStrokeWidth();\n    }\n\n    public void setRadius(float radius) {\n        mRadius = radius;\n        invalidate();\n    }\n\n    public float getRadius() {\n        return mRadius;\n    }\n\n    public void setSnap(boolean snap) {\n        mSnap = snap;\n        invalidate();\n    }\n\n    public boolean isSnap() {\n        return mSnap;\n    }\n\n    @Override\n    protected void onDraw(Canvas canvas) {\n        super.onDraw(canvas);\n\n        if (mViewPager == null) {\n            return;\n        }\n        final int count = mViewPager.getAdapter().getCount();\n        if (count == 0) {\n            return;\n        }\n\n        if (mCurrentPage >= count) {\n            setCurrentItem(count - 1);\n            return;\n        }\n\n        int longSize;\n        int longPaddingBefore;\n        int longPaddingAfter;\n        int shortPaddingBefore;\n        if (mOrientation == HORIZONTAL) {\n            longSize = getWidth();\n            longPaddingBefore = getPaddingLeft();\n            longPaddingAfter = getPaddingRight();\n            shortPaddingBefore = getPaddingTop();\n        } else {\n            longSize = getHeight();\n            longPaddingBefore = getPaddingTop();\n            longPaddingAfter = getPaddingBottom();\n            shortPaddingBefore = getPaddingLeft();\n        }\n\n        final float threeRadius = mRadius * 3;\n        final float shortOffset = shortPaddingBefore + mRadius;\n        float longOffset = longPaddingBefore + mRadius;\n        if (mCentered) {\n            longOffset += ((longSize - longPaddingBefore - longPaddingAfter) / 2.0f) - ((count * threeRadius) / 2.0f);\n        }\n\n        float dX;\n        float dY;\n\n        float pageFillRadius = mRadius;\n        if (mPaintStroke.getStrokeWidth() > 0) {\n            pageFillRadius -= mPaintStroke.getStrokeWidth() / 2.0f;\n        }\n\n        //Draw stroked circles\n        for (int iLoop = 0; iLoop < count; iLoop++) {\n            float drawLong = longOffset + (iLoop * threeRadius);\n            if (mOrientation == HORIZONTAL) {\n                dX = drawLong;\n                dY = shortOffset;\n            } else {\n                dX = shortOffset;\n                dY = drawLong;\n            }\n            // Only paint fill if not completely transparent\n            if (mPaintPageFill.getAlpha() > 0) {\n                canvas.drawCircle(dX, dY, pageFillRadius, mPaintPageFill);\n            }\n\n            // Only paint stroke if a stroke width was non-zero\n            if (pageFillRadius != mRadius) {\n                canvas.drawCircle(dX, dY, mRadius, mPaintStroke);\n            }\n        }\n\n        //Draw the filled circle according to the current scroll\n        float cx = (mSnap ? mSnapPage : mCurrentPage) * threeRadius;\n        if (!mSnap) {\n            cx += mPageOffset * threeRadius;\n        }\n        if (mOrientation == HORIZONTAL) {\n            dX = longOffset + cx;\n            dY = shortOffset;\n        } else {\n            dX = shortOffset;\n            dY = longOffset + cx;\n        }\n        canvas.drawCircle(dX, dY, mRadius, mPaintFill);\n    }\n\n    public boolean onTouchEvent(android.view.MotionEvent ev) {\n        if (super.onTouchEvent(ev)) {\n            return true;\n        }\n        if ((mViewPager == null) || (mViewPager.getAdapter().getCount() == 0)) {\n            return false;\n        }\n\n        final int action = ev.getAction() & MotionEventCompat.ACTION_MASK;\n        switch (action) {\n            case MotionEvent.ACTION_DOWN:\n                mActivePointerId = MotionEventCompat.getPointerId(ev, 0);\n                mLastMotionX = ev.getX();\n                break;\n\n            case MotionEvent.ACTION_MOVE: {\n                final int activePointerIndex = MotionEventCompat.findPointerIndex(ev, mActivePointerId);\n                final float x = MotionEventCompat.getX(ev, activePointerIndex);\n                final float deltaX = x - mLastMotionX;\n\n                if (!mIsDragging) {\n                    if (Math.abs(deltaX) > mTouchSlop) {\n                        mIsDragging = true;\n                    }\n                }\n\n                if (mIsDragging) {\n                    mLastMotionX = x;\n                    if (mViewPager.isFakeDragging() || mViewPager.beginFakeDrag()) {\n                        mViewPager.fakeDragBy(deltaX);\n                    }\n                }\n\n                break;\n            }\n\n            case MotionEvent.ACTION_CANCEL:\n            case MotionEvent.ACTION_UP:\n                if (!mIsDragging) {\n                    final int count = mViewPager.getAdapter().getCount();\n                    final int width = getWidth();\n                    final float halfWidth = width / 2f;\n                    final float sixthWidth = width / 6f;\n\n                    if ((mCurrentPage > 0) && (ev.getX() < halfWidth - sixthWidth)) {\n                        if (action != MotionEvent.ACTION_CANCEL) {\n                            mViewPager.setCurrentItem(mCurrentPage - 1);\n                        }\n                        return true;\n                    } else if ((mCurrentPage < count - 1) && (ev.getX() > halfWidth + sixthWidth)) {\n                        if (action != MotionEvent.ACTION_CANCEL) {\n                            mViewPager.setCurrentItem(mCurrentPage + 1);\n                        }\n                        return true;\n                    }\n                }\n\n                mIsDragging = false;\n                mActivePointerId = INVALID_POINTER;\n                if (mViewPager.isFakeDragging()) mViewPager.endFakeDrag();\n                break;\n\n            case MotionEventCompat.ACTION_POINTER_DOWN: {\n                final int index = MotionEventCompat.getActionIndex(ev);\n                mLastMotionX = MotionEventCompat.getX(ev, index);\n                mActivePointerId = MotionEventCompat.getPointerId(ev, index);\n                break;\n            }\n\n            case MotionEventCompat.ACTION_POINTER_UP:\n                final int pointerIndex = MotionEventCompat.getActionIndex(ev);\n                final int pointerId = MotionEventCompat.getPointerId(ev, pointerIndex);\n                if (pointerId == mActivePointerId) {\n                    final int newPointerIndex = pointerIndex == 0 ? 1 : 0;\n                    mActivePointerId = MotionEventCompat.getPointerId(ev, newPointerIndex);\n                }\n                mLastMotionX = MotionEventCompat.getX(ev, MotionEventCompat.findPointerIndex(ev, mActivePointerId));\n                break;\n        }\n\n        return true;\n    }\n\n    @Override\n    public void setViewPager(ViewPager view) {\n        if (mViewPager == view) {\n            return;\n        }\n        if (mViewPager != null) {\n            mViewPager.setOnPageChangeListener(null);\n        }\n        if (view.getAdapter() == null) {\n            throw new IllegalStateException(\"ViewPager does not have adapter instance.\");\n        }\n        mViewPager = view;\n        mViewPager.setOnPageChangeListener(this);\n        invalidate();\n    }\n\n    @Override\n    public void setViewPager(ViewPager view, int initialPosition) {\n        setViewPager(view);\n        setCurrentItem(initialPosition);\n    }\n\n    @Override\n    public void setCurrentItem(int item) {\n        if (mViewPager == null) {\n            throw new IllegalStateException(\"ViewPager has not been bound.\");\n        }\n        mViewPager.setCurrentItem(item);\n        mCurrentPage = item;\n        invalidate();\n    }\n\n    @Override\n    public void notifyDataSetChanged() {\n        invalidate();\n    }\n\n    @Override\n    public void onPageScrollStateChanged(int state) {\n        mScrollState = state;\n\n        if (mListener != null) {\n            mListener.onPageScrollStateChanged(state);\n        }\n    }\n\n    @Override\n    public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {\n        mCurrentPage = position;\n        mPageOffset = positionOffset;\n        invalidate();\n\n        if (mListener != null) {\n            mListener.onPageScrolled(position, positionOffset, positionOffsetPixels);\n        }\n    }\n\n    @Override\n    public void onPageSelected(int position) {\n        if (mSnap || mScrollState == ViewPager.SCROLL_STATE_IDLE) {\n            mCurrentPage = position;\n            mSnapPage = position;\n            invalidate();\n        }\n\n        if (mListener != null) {\n            mListener.onPageSelected(position);\n        }\n    }\n\n    @Override\n    public void setOnPageChangeListener(ViewPager.OnPageChangeListener listener) {\n        mListener = listener;\n    }\n\n    /*\n     * (non-Javadoc)\n     *\n     * @see android.view.View#onMeasure(int, int)\n     */\n    @Override\n    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {\n        if (mOrientation == HORIZONTAL) {\n            setMeasuredDimension(measureLong(widthMeasureSpec), measureShort(heightMeasureSpec));\n        } else {\n            setMeasuredDimension(measureShort(widthMeasureSpec), measureLong(heightMeasureSpec));\n        }\n    }\n\n    /**\n     * Determines the width of this view\n     *\n     * @param measureSpec\n     *            A measureSpec packed into an int\n     * @return The width of the view, honoring constraints from measureSpec\n     */\n    private int measureLong(int measureSpec) {\n        int result;\n        int specMode = MeasureSpec.getMode(measureSpec);\n        int specSize = MeasureSpec.getSize(measureSpec);\n\n        if ((specMode == MeasureSpec.EXACTLY) || (mViewPager == null)) {\n            //We were told how big to be\n            result = specSize;\n        } else {\n            //Calculate the width according the views count\n            final int count = mViewPager.getAdapter().getCount();\n            result = (int)(getPaddingLeft() + getPaddingRight()\n                    + (count * 2 * mRadius) + (count - 1) * mRadius + 1);\n            //Respect AT_MOST value if that was what is called for by measureSpec\n            if (specMode == MeasureSpec.AT_MOST) {\n                result = Math.min(result, specSize);\n            }\n        }\n        return result;\n    }\n\n    /**\n     * Determines the height of this view\n     *\n     * @param measureSpec\n     *            A measureSpec packed into an int\n     * @return The height of the view, honoring constraints from measureSpec\n     */\n    private int measureShort(int measureSpec) {\n        int result;\n        int specMode = MeasureSpec.getMode(measureSpec);\n        int specSize = MeasureSpec.getSize(measureSpec);\n\n        if (specMode == MeasureSpec.EXACTLY) {\n            //We were told how big to be\n            result = specSize;\n        } else {\n            //Measure the height\n            result = (int)(2 * mRadius + getPaddingTop() + getPaddingBottom() + 1);\n            //Respect AT_MOST value if that was what is called for by measureSpec\n            if (specMode == MeasureSpec.AT_MOST) {\n                result = Math.min(result, specSize);\n            }\n        }\n        return result;\n    }\n\n    @Override\n    public void onRestoreInstanceState(Parcelable state) {\n        SavedState savedState = (SavedState)state;\n        super.onRestoreInstanceState(savedState.getSuperState());\n        mCurrentPage = savedState.currentPage;\n        mSnapPage = savedState.currentPage;\n        requestLayout();\n    }\n\n    @Override\n    public Parcelable onSaveInstanceState() {\n        Parcelable superState = super.onSaveInstanceState();\n        SavedState savedState = new SavedState(superState);\n        savedState.currentPage = mCurrentPage;\n        return savedState;\n    }\n\n    static class SavedState extends BaseSavedState {\n        int currentPage;\n\n        public SavedState(Parcelable superState) {\n            super(superState);\n        }\n\n        private SavedState(Parcel in) {\n            super(in);\n            currentPage = in.readInt();\n        }\n\n        @Override\n        public void writeToParcel(Parcel dest, int flags) {\n            super.writeToParcel(dest, flags);\n            dest.writeInt(currentPage);\n        }\n\n        @SuppressWarnings(\"UnusedDeclaration\")\n        public static final Parcelable.Creator<SavedState> CREATOR = new Parcelable.Creator<SavedState>() {\n            @Override\n            public SavedState createFromParcel(Parcel in) {\n                return new SavedState(in);\n            }\n\n            @Override\n            public SavedState[] newArray(int size) {\n                return new SavedState[size];\n            }\n        };\n    }\n}\n"
  },
  {
    "path": "library/src/com/viewpagerindicator/IconPageIndicator.java",
    "content": "/*\n * Copyright (C) 2011 The Android Open Source Project\n * Copyright (C) 2012 Jake Wharton\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage com.viewpagerindicator;\n\nimport android.content.Context;\nimport android.support.v4.view.PagerAdapter;\nimport android.support.v4.view.ViewPager;\nimport android.support.v4.view.ViewPager.OnPageChangeListener;\nimport android.util.AttributeSet;\nimport android.view.Gravity;\nimport android.view.View;\nimport android.widget.HorizontalScrollView;\nimport android.widget.ImageView;\n\nimport static android.view.ViewGroup.LayoutParams.FILL_PARENT;\nimport static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;\n\n/**\n * This widget implements the dynamic action bar tab behavior that can change\n * across different configurations or circumstances.\n */\npublic class IconPageIndicator extends HorizontalScrollView implements PageIndicator {\n    private final IcsLinearLayout mIconsLayout;\n\n    private ViewPager mViewPager;\n    private OnPageChangeListener mListener;\n    private Runnable mIconSelector;\n    private int mSelectedIndex;\n\n    public IconPageIndicator(Context context) {\n        this(context, null);\n    }\n\n    public IconPageIndicator(Context context, AttributeSet attrs) {\n        super(context, attrs);\n        setHorizontalScrollBarEnabled(false);\n\n        mIconsLayout = new IcsLinearLayout(context, R.attr.vpiIconPageIndicatorStyle);\n        addView(mIconsLayout, new LayoutParams(WRAP_CONTENT, FILL_PARENT, Gravity.CENTER));\n    }\n\n    private void animateToIcon(final int position) {\n        final View iconView = mIconsLayout.getChildAt(position);\n        if (mIconSelector != null) {\n            removeCallbacks(mIconSelector);\n        }\n        mIconSelector = new Runnable() {\n            public void run() {\n                final int scrollPos = iconView.getLeft() - (getWidth() - iconView.getWidth()) / 2;\n                smoothScrollTo(scrollPos, 0);\n                mIconSelector = null;\n            }\n        };\n        post(mIconSelector);\n    }\n\n    @Override\n    public void onAttachedToWindow() {\n        super.onAttachedToWindow();\n        if (mIconSelector != null) {\n            // Re-post the selector we saved\n            post(mIconSelector);\n        }\n    }\n\n    @Override\n    public void onDetachedFromWindow() {\n        super.onDetachedFromWindow();\n        if (mIconSelector != null) {\n            removeCallbacks(mIconSelector);\n        }\n    }\n\n    @Override\n    public void onPageScrollStateChanged(int arg0) {\n        if (mListener != null) {\n            mListener.onPageScrollStateChanged(arg0);\n        }\n    }\n\n    @Override\n    public void onPageScrolled(int arg0, float arg1, int arg2) {\n        if (mListener != null) {\n            mListener.onPageScrolled(arg0, arg1, arg2);\n        }\n    }\n\n    @Override\n    public void onPageSelected(int arg0) {\n        setCurrentItem(arg0);\n        if (mListener != null) {\n            mListener.onPageSelected(arg0);\n        }\n    }\n\n    @Override\n    public void setViewPager(ViewPager view) {\n        if (mViewPager == view) {\n            return;\n        }\n        if (mViewPager != null) {\n            mViewPager.setOnPageChangeListener(null);\n        }\n        PagerAdapter adapter = view.getAdapter();\n        if (adapter == null) {\n            throw new IllegalStateException(\"ViewPager does not have adapter instance.\");\n        }\n        mViewPager = view;\n        view.setOnPageChangeListener(this);\n        notifyDataSetChanged();\n    }\n\n    public void notifyDataSetChanged() {\n        mIconsLayout.removeAllViews();\n        IconPagerAdapter iconAdapter = (IconPagerAdapter) mViewPager.getAdapter();\n        int count = iconAdapter.getCount();\n        for (int i = 0; i < count; i++) {\n            ImageView view = new ImageView(getContext(), null, R.attr.vpiIconPageIndicatorStyle);\n            view.setImageResource(iconAdapter.getIconResId(i));\n            mIconsLayout.addView(view);\n        }\n        if (mSelectedIndex > count) {\n            mSelectedIndex = count - 1;\n        }\n        setCurrentItem(mSelectedIndex);\n        requestLayout();\n    }\n\n    @Override\n    public void setViewPager(ViewPager view, int initialPosition) {\n        setViewPager(view);\n        setCurrentItem(initialPosition);\n    }\n\n    @Override\n    public void setCurrentItem(int item) {\n        if (mViewPager == null) {\n            throw new IllegalStateException(\"ViewPager has not been bound.\");\n        }\n        mSelectedIndex = item;\n        mViewPager.setCurrentItem(item);\n\n        int tabCount = mIconsLayout.getChildCount();\n        for (int i = 0; i < tabCount; i++) {\n            View child = mIconsLayout.getChildAt(i);\n            boolean isSelected = (i == item);\n            child.setSelected(isSelected);\n            if (isSelected) {\n                animateToIcon(item);\n            }\n        }\n    }\n\n    @Override\n    public void setOnPageChangeListener(OnPageChangeListener listener) {\n        mListener = listener;\n    }\n}\n"
  },
  {
    "path": "library/src/com/viewpagerindicator/IconPagerAdapter.java",
    "content": "package com.viewpagerindicator;\n\npublic interface IconPagerAdapter {\n    /**\n     * Get icon representing the page at {@code index} in the adapter.\n     */\n    int getIconResId(int index);\n\n    // From PagerAdapter\n    int getCount();\n}\n"
  },
  {
    "path": "library/src/com/viewpagerindicator/IcsLinearLayout.java",
    "content": "package com.viewpagerindicator;\n\nimport android.content.Context;\nimport android.content.res.TypedArray;\nimport android.graphics.Canvas;\nimport android.graphics.drawable.Drawable;\nimport android.view.View;\nimport android.widget.LinearLayout;\n\n/**\n * A simple extension of a regular linear layout that supports the divider API\n * of Android 4.0+. The dividers are added adjacent to the children by changing\n * their layout params. If you need to rely on the margins which fall in the\n * same orientation as the layout you should wrap the child in a simple\n * {@link android.widget.FrameLayout} so it can receive the margin.\n */\nclass IcsLinearLayout extends LinearLayout {\n    private static final int[] LL = new int[] {\n        /* 0 */ android.R.attr.divider,\n        /* 1 */ android.R.attr.showDividers,\n        /* 2 */ android.R.attr.dividerPadding,\n    };\n    private static final int LL_DIVIDER = 0;\n    private static final int LL_SHOW_DIVIDER = 1;\n    private static final int LL_DIVIDER_PADDING = 2;\n\n    private Drawable mDivider;\n    private int mDividerWidth;\n    private int mDividerHeight;\n    private int mShowDividers;\n    private int mDividerPadding;\n\n\n    public IcsLinearLayout(Context context, int themeAttr) {\n        super(context);\n\n        TypedArray a = context.obtainStyledAttributes(null, LL, themeAttr, 0);\n        setDividerDrawable(a.getDrawable(IcsLinearLayout.LL_DIVIDER));\n        mDividerPadding = a.getDimensionPixelSize(LL_DIVIDER_PADDING, 0);\n        mShowDividers = a.getInteger(LL_SHOW_DIVIDER, SHOW_DIVIDER_NONE);\n        a.recycle();\n    }\n\n    public void setDividerDrawable(Drawable divider) {\n        if (divider == mDivider) {\n            return;\n        }\n        mDivider = divider;\n        if (divider != null) {\n            mDividerWidth = divider.getIntrinsicWidth();\n            mDividerHeight = divider.getIntrinsicHeight();\n        } else {\n            mDividerWidth = 0;\n            mDividerHeight = 0;\n        }\n        setWillNotDraw(divider == null);\n        requestLayout();\n    }\n\n    @Override\n    protected void measureChildWithMargins(View child, int parentWidthMeasureSpec, int widthUsed, int parentHeightMeasureSpec, int heightUsed) {\n        final int index = indexOfChild(child);\n        final int orientation = getOrientation();\n        final LayoutParams params = (LayoutParams) child.getLayoutParams();\n        if (hasDividerBeforeChildAt(index)) {\n            if (orientation == VERTICAL) {\n                //Account for the divider by pushing everything up\n                params.topMargin = mDividerHeight;\n            } else {\n                //Account for the divider by pushing everything left\n                params.leftMargin = mDividerWidth;\n            }\n        }\n\n        final int count = getChildCount();\n        if (index == count - 1) {\n            if (hasDividerBeforeChildAt(count)) {\n                if (orientation == VERTICAL) {\n                    params.bottomMargin = mDividerHeight;\n                } else {\n                    params.rightMargin = mDividerWidth;\n                }\n            }\n        }\n        super.measureChildWithMargins(child, parentWidthMeasureSpec, widthUsed, parentHeightMeasureSpec, heightUsed);\n    }\n\n    @Override\n    protected void onDraw(Canvas canvas) {\n        if (mDivider != null) {\n            if (getOrientation() == VERTICAL) {\n                drawDividersVertical(canvas);\n            } else {\n                drawDividersHorizontal(canvas);\n            }\n        }\n        super.onDraw(canvas);\n    }\n\n    private void drawDividersVertical(Canvas canvas) {\n        final int count = getChildCount();\n        for (int i = 0; i < count; i++) {\n            final View child = getChildAt(i);\n\n            if (child != null && child.getVisibility() != GONE) {\n                if (hasDividerBeforeChildAt(i)) {\n                    final android.widget.LinearLayout.LayoutParams lp = (android.widget.LinearLayout.LayoutParams) child.getLayoutParams();\n                    final int top = child.getTop() - lp.topMargin/* - mDividerHeight*/;\n                    drawHorizontalDivider(canvas, top);\n                }\n            }\n        }\n\n        if (hasDividerBeforeChildAt(count)) {\n            final View child = getChildAt(count - 1);\n            int bottom = 0;\n            if (child == null) {\n                bottom = getHeight() - getPaddingBottom() - mDividerHeight;\n            } else {\n                //final LayoutParams lp = (LayoutParams) child.getLayoutParams();\n                bottom = child.getBottom()/* + lp.bottomMargin*/;\n            }\n            drawHorizontalDivider(canvas, bottom);\n        }\n    }\n\n    private void drawDividersHorizontal(Canvas canvas) {\n        final int count = getChildCount();\n        for (int i = 0; i < count; i++) {\n            final View child = getChildAt(i);\n\n            if (child != null && child.getVisibility() != GONE) {\n                if (hasDividerBeforeChildAt(i)) {\n                    final android.widget.LinearLayout.LayoutParams lp = (android.widget.LinearLayout.LayoutParams) child.getLayoutParams();\n                    final int left = child.getLeft() - lp.leftMargin/* - mDividerWidth*/;\n                    drawVerticalDivider(canvas, left);\n                }\n            }\n        }\n\n        if (hasDividerBeforeChildAt(count)) {\n            final View child = getChildAt(count - 1);\n            int right = 0;\n            if (child == null) {\n                right = getWidth() - getPaddingRight() - mDividerWidth;\n            } else {\n                //final LayoutParams lp = (LayoutParams) child.getLayoutParams();\n                right = child.getRight()/* + lp.rightMargin*/;\n            }\n            drawVerticalDivider(canvas, right);\n        }\n    }\n\n    private void drawHorizontalDivider(Canvas canvas, int top) {\n        mDivider.setBounds(getPaddingLeft() + mDividerPadding, top,\n                getWidth() - getPaddingRight() - mDividerPadding, top + mDividerHeight);\n        mDivider.draw(canvas);\n    }\n\n    private void drawVerticalDivider(Canvas canvas, int left) {\n        mDivider.setBounds(left, getPaddingTop() + mDividerPadding,\n                left + mDividerWidth, getHeight() - getPaddingBottom() - mDividerPadding);\n        mDivider.draw(canvas);\n    }\n\n    private boolean hasDividerBeforeChildAt(int childIndex) {\n        if (childIndex == 0 || childIndex == getChildCount()) {\n          return false;\n        }\n        if ((mShowDividers & SHOW_DIVIDER_MIDDLE) != 0) {\n            boolean hasVisibleViewBefore = false;\n            for (int i = childIndex - 1; i >= 0; i--) {\n                if (getChildAt(i).getVisibility() != GONE) {\n                    hasVisibleViewBefore = true;\n                    break;\n                }\n            }\n            return hasVisibleViewBefore;\n        }\n        return false;\n    }\n}\n"
  },
  {
    "path": "library/src/com/viewpagerindicator/LinePageIndicator.java",
    "content": "/*\n * Copyright (C) 2012 Jake Wharton\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage com.viewpagerindicator;\n\nimport android.content.Context;\nimport android.content.res.Resources;\nimport android.content.res.TypedArray;\nimport android.graphics.Canvas;\nimport android.graphics.Paint;\nimport android.graphics.drawable.Drawable;\nimport android.os.Parcel;\nimport android.os.Parcelable;\nimport android.support.v4.view.MotionEventCompat;\nimport android.support.v4.view.ViewConfigurationCompat;\nimport android.support.v4.view.ViewPager;\nimport android.util.AttributeSet;\nimport android.util.FloatMath;\nimport android.view.MotionEvent;\nimport android.view.View;\nimport android.view.ViewConfiguration;\n\n/**\n * Draws a line for each page. The current page line is colored differently\n * than the unselected page lines.\n */\npublic class LinePageIndicator extends View implements PageIndicator {\n    private static final int INVALID_POINTER = -1;\n\n    private final Paint mPaintUnselected = new Paint(Paint.ANTI_ALIAS_FLAG);\n    private final Paint mPaintSelected = new Paint(Paint.ANTI_ALIAS_FLAG);\n    private ViewPager mViewPager;\n    private ViewPager.OnPageChangeListener mListener;\n    private int mCurrentPage;\n    private boolean mCentered;\n    private float mLineWidth;\n    private float mGapWidth;\n\n    private int mTouchSlop;\n    private float mLastMotionX = -1;\n    private int mActivePointerId = INVALID_POINTER;\n    private boolean mIsDragging;\n\n\n    public LinePageIndicator(Context context) {\n        this(context, null);\n    }\n\n    public LinePageIndicator(Context context, AttributeSet attrs) {\n        this(context, attrs, R.attr.vpiLinePageIndicatorStyle);\n    }\n\n    public LinePageIndicator(Context context, AttributeSet attrs, int defStyle) {\n        super(context, attrs, defStyle);\n        if (isInEditMode()) return;\n\n        final Resources res = getResources();\n\n        //Load defaults from resources\n        final int defaultSelectedColor = res.getColor(R.color.default_line_indicator_selected_color);\n        final int defaultUnselectedColor = res.getColor(R.color.default_line_indicator_unselected_color);\n        final float defaultLineWidth = res.getDimension(R.dimen.default_line_indicator_line_width);\n        final float defaultGapWidth = res.getDimension(R.dimen.default_line_indicator_gap_width);\n        final float defaultStrokeWidth = res.getDimension(R.dimen.default_line_indicator_stroke_width);\n        final boolean defaultCentered = res.getBoolean(R.bool.default_line_indicator_centered);\n\n        //Retrieve styles attributes\n        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.LinePageIndicator, defStyle, 0);\n\n        mCentered = a.getBoolean(R.styleable.LinePageIndicator_centered, defaultCentered);\n        mLineWidth = a.getDimension(R.styleable.LinePageIndicator_lineWidth, defaultLineWidth);\n        mGapWidth = a.getDimension(R.styleable.LinePageIndicator_gapWidth, defaultGapWidth);\n        setStrokeWidth(a.getDimension(R.styleable.LinePageIndicator_strokeWidth, defaultStrokeWidth));\n        mPaintUnselected.setColor(a.getColor(R.styleable.LinePageIndicator_unselectedColor, defaultUnselectedColor));\n        mPaintSelected.setColor(a.getColor(R.styleable.LinePageIndicator_selectedColor, defaultSelectedColor));\n\n        Drawable background = a.getDrawable(R.styleable.LinePageIndicator_android_background);\n        if (background != null) {\n          setBackgroundDrawable(background);\n        }\n\n        a.recycle();\n\n        final ViewConfiguration configuration = ViewConfiguration.get(context);\n        mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);\n    }\n\n\n    public void setCentered(boolean centered) {\n        mCentered = centered;\n        invalidate();\n    }\n\n    public boolean isCentered() {\n        return mCentered;\n    }\n\n    public void setUnselectedColor(int unselectedColor) {\n        mPaintUnselected.setColor(unselectedColor);\n        invalidate();\n    }\n\n    public int getUnselectedColor() {\n        return mPaintUnselected.getColor();\n    }\n\n    public void setSelectedColor(int selectedColor) {\n        mPaintSelected.setColor(selectedColor);\n        invalidate();\n    }\n\n    public int getSelectedColor() {\n        return mPaintSelected.getColor();\n    }\n\n    public void setLineWidth(float lineWidth) {\n        mLineWidth = lineWidth;\n        invalidate();\n    }\n\n    public float getLineWidth() {\n        return mLineWidth;\n    }\n\n    public void setStrokeWidth(float lineHeight) {\n        mPaintSelected.setStrokeWidth(lineHeight);\n        mPaintUnselected.setStrokeWidth(lineHeight);\n        invalidate();\n    }\n\n    public float getStrokeWidth() {\n        return mPaintSelected.getStrokeWidth();\n    }\n\n    public void setGapWidth(float gapWidth) {\n        mGapWidth = gapWidth;\n        invalidate();\n    }\n\n    public float getGapWidth() {\n        return mGapWidth;\n    }\n\n    @Override\n    protected void onDraw(Canvas canvas) {\n        super.onDraw(canvas);\n\n        if (mViewPager == null) {\n            return;\n        }\n        final int count = mViewPager.getAdapter().getCount();\n        if (count == 0) {\n            return;\n        }\n\n        if (mCurrentPage >= count) {\n            setCurrentItem(count - 1);\n            return;\n        }\n\n        final float lineWidthAndGap = mLineWidth + mGapWidth;\n        final float indicatorWidth = (count * lineWidthAndGap) - mGapWidth;\n        final float paddingTop = getPaddingTop();\n        final float paddingLeft = getPaddingLeft();\n        final float paddingRight = getPaddingRight();\n\n        float verticalOffset = paddingTop + ((getHeight() - paddingTop - getPaddingBottom()) / 2.0f);\n        float horizontalOffset = paddingLeft;\n        if (mCentered) {\n            horizontalOffset += ((getWidth() - paddingLeft - paddingRight) / 2.0f) - (indicatorWidth / 2.0f);\n        }\n\n        //Draw stroked circles\n        for (int i = 0; i < count; i++) {\n            float dx1 = horizontalOffset + (i * lineWidthAndGap);\n            float dx2 = dx1 + mLineWidth;\n            canvas.drawLine(dx1, verticalOffset, dx2, verticalOffset, (i == mCurrentPage) ? mPaintSelected : mPaintUnselected);\n        }\n    }\n\n    public boolean onTouchEvent(android.view.MotionEvent ev) {\n        if (super.onTouchEvent(ev)) {\n            return true;\n        }\n        if ((mViewPager == null) || (mViewPager.getAdapter().getCount() == 0)) {\n            return false;\n        }\n\n        final int action = ev.getAction() & MotionEventCompat.ACTION_MASK;\n        switch (action) {\n            case MotionEvent.ACTION_DOWN:\n                mActivePointerId = MotionEventCompat.getPointerId(ev, 0);\n                mLastMotionX = ev.getX();\n                break;\n\n            case MotionEvent.ACTION_MOVE: {\n                final int activePointerIndex = MotionEventCompat.findPointerIndex(ev, mActivePointerId);\n                final float x = MotionEventCompat.getX(ev, activePointerIndex);\n                final float deltaX = x - mLastMotionX;\n\n                if (!mIsDragging) {\n                    if (Math.abs(deltaX) > mTouchSlop) {\n                        mIsDragging = true;\n                    }\n                }\n\n                if (mIsDragging) {\n                    mLastMotionX = x;\n                    if (mViewPager.isFakeDragging() || mViewPager.beginFakeDrag()) {\n                        mViewPager.fakeDragBy(deltaX);\n                    }\n                }\n\n                break;\n            }\n\n            case MotionEvent.ACTION_CANCEL:\n            case MotionEvent.ACTION_UP:\n                if (!mIsDragging) {\n                    final int count = mViewPager.getAdapter().getCount();\n                    final int width = getWidth();\n                    final float halfWidth = width / 2f;\n                    final float sixthWidth = width / 6f;\n\n                    if ((mCurrentPage > 0) && (ev.getX() < halfWidth - sixthWidth)) {\n                        if (action != MotionEvent.ACTION_CANCEL) {\n                            mViewPager.setCurrentItem(mCurrentPage - 1);\n                        }\n                        return true;\n                    } else if ((mCurrentPage < count - 1) && (ev.getX() > halfWidth + sixthWidth)) {\n                        if (action != MotionEvent.ACTION_CANCEL) {\n                            mViewPager.setCurrentItem(mCurrentPage + 1);\n                        }\n                        return true;\n                    }\n                }\n\n                mIsDragging = false;\n                mActivePointerId = INVALID_POINTER;\n                if (mViewPager.isFakeDragging()) mViewPager.endFakeDrag();\n                break;\n\n            case MotionEventCompat.ACTION_POINTER_DOWN: {\n                final int index = MotionEventCompat.getActionIndex(ev);\n                mLastMotionX = MotionEventCompat.getX(ev, index);\n                mActivePointerId = MotionEventCompat.getPointerId(ev, index);\n                break;\n            }\n\n            case MotionEventCompat.ACTION_POINTER_UP:\n                final int pointerIndex = MotionEventCompat.getActionIndex(ev);\n                final int pointerId = MotionEventCompat.getPointerId(ev, pointerIndex);\n                if (pointerId == mActivePointerId) {\n                    final int newPointerIndex = pointerIndex == 0 ? 1 : 0;\n                    mActivePointerId = MotionEventCompat.getPointerId(ev, newPointerIndex);\n                }\n                mLastMotionX = MotionEventCompat.getX(ev, MotionEventCompat.findPointerIndex(ev, mActivePointerId));\n                break;\n        }\n\n        return true;\n    }\n\n    @Override\n    public void setViewPager(ViewPager viewPager) {\n        if (mViewPager == viewPager) {\n            return;\n        }\n        if (mViewPager != null) {\n            //Clear us from the old pager.\n            mViewPager.setOnPageChangeListener(null);\n        }\n        if (viewPager.getAdapter() == null) {\n            throw new IllegalStateException(\"ViewPager does not have adapter instance.\");\n        }\n        mViewPager = viewPager;\n        mViewPager.setOnPageChangeListener(this);\n        invalidate();\n    }\n\n    @Override\n    public void setViewPager(ViewPager view, int initialPosition) {\n        setViewPager(view);\n        setCurrentItem(initialPosition);\n    }\n\n    @Override\n    public void setCurrentItem(int item) {\n        if (mViewPager == null) {\n            throw new IllegalStateException(\"ViewPager has not been bound.\");\n        }\n        mViewPager.setCurrentItem(item);\n        mCurrentPage = item;\n        invalidate();\n    }\n\n    @Override\n    public void notifyDataSetChanged() {\n        invalidate();\n    }\n\n    @Override\n    public void onPageScrollStateChanged(int state) {\n        if (mListener != null) {\n            mListener.onPageScrollStateChanged(state);\n        }\n    }\n\n    @Override\n    public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {\n        if (mListener != null) {\n            mListener.onPageScrolled(position, positionOffset, positionOffsetPixels);\n        }\n    }\n\n    @Override\n    public void onPageSelected(int position) {\n        mCurrentPage = position;\n        invalidate();\n\n        if (mListener != null) {\n            mListener.onPageSelected(position);\n        }\n    }\n\n    @Override\n    public void setOnPageChangeListener(ViewPager.OnPageChangeListener listener) {\n        mListener = listener;\n    }\n\n    @Override\n    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {\n        setMeasuredDimension(measureWidth(widthMeasureSpec), measureHeight(heightMeasureSpec));\n    }\n\n    /**\n     * Determines the width of this view\n     *\n     * @param measureSpec\n     *            A measureSpec packed into an int\n     * @return The width of the view, honoring constraints from measureSpec\n     */\n    private int measureWidth(int measureSpec) {\n        float result;\n        int specMode = MeasureSpec.getMode(measureSpec);\n        int specSize = MeasureSpec.getSize(measureSpec);\n\n        if ((specMode == MeasureSpec.EXACTLY) || (mViewPager == null)) {\n            //We were told how big to be\n            result = specSize;\n        } else {\n            //Calculate the width according the views count\n            final int count = mViewPager.getAdapter().getCount();\n            result = getPaddingLeft() + getPaddingRight() + (count * mLineWidth) + ((count - 1) * mGapWidth);\n            //Respect AT_MOST value if that was what is called for by measureSpec\n            if (specMode == MeasureSpec.AT_MOST) {\n                result = Math.min(result, specSize);\n            }\n        }\n        return (int)FloatMath.ceil(result);\n    }\n\n    /**\n     * Determines the height of this view\n     *\n     * @param measureSpec\n     *            A measureSpec packed into an int\n     * @return The height of the view, honoring constraints from measureSpec\n     */\n    private int measureHeight(int measureSpec) {\n        float result;\n        int specMode = MeasureSpec.getMode(measureSpec);\n        int specSize = MeasureSpec.getSize(measureSpec);\n\n        if (specMode == MeasureSpec.EXACTLY) {\n            //We were told how big to be\n            result = specSize;\n        } else {\n            //Measure the height\n            result = mPaintSelected.getStrokeWidth() + getPaddingTop() + getPaddingBottom();\n            //Respect AT_MOST value if that was what is called for by measureSpec\n            if (specMode == MeasureSpec.AT_MOST) {\n                result = Math.min(result, specSize);\n            }\n        }\n        return (int)FloatMath.ceil(result);\n    }\n\n    @Override\n    public void onRestoreInstanceState(Parcelable state) {\n        SavedState savedState = (SavedState)state;\n        super.onRestoreInstanceState(savedState.getSuperState());\n        mCurrentPage = savedState.currentPage;\n        requestLayout();\n    }\n\n    @Override\n    public Parcelable onSaveInstanceState() {\n        Parcelable superState = super.onSaveInstanceState();\n        SavedState savedState = new SavedState(superState);\n        savedState.currentPage = mCurrentPage;\n        return savedState;\n    }\n\n    static class SavedState extends BaseSavedState {\n        int currentPage;\n\n        public SavedState(Parcelable superState) {\n            super(superState);\n        }\n\n        private SavedState(Parcel in) {\n            super(in);\n            currentPage = in.readInt();\n        }\n\n        @Override\n        public void writeToParcel(Parcel dest, int flags) {\n            super.writeToParcel(dest, flags);\n            dest.writeInt(currentPage);\n        }\n\n        @SuppressWarnings(\"UnusedDeclaration\")\n        public static final Parcelable.Creator<SavedState> CREATOR = new Parcelable.Creator<SavedState>() {\n            @Override\n            public SavedState createFromParcel(Parcel in) {\n                return new SavedState(in);\n            }\n\n            @Override\n            public SavedState[] newArray(int size) {\n                return new SavedState[size];\n            }\n        };\n    }\n}"
  },
  {
    "path": "library/src/com/viewpagerindicator/PageIndicator.java",
    "content": "/*\n * Copyright (C) 2011 Patrik Akerfeldt\n * Copyright (C) 2011 Jake Wharton\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage com.viewpagerindicator;\n\nimport android.support.v4.view.ViewPager;\n\n/**\n * A PageIndicator is responsible to show an visual indicator on the total views\n * number and the current visible view.\n */\npublic interface PageIndicator extends ViewPager.OnPageChangeListener {\n    /**\n     * Bind the indicator to a ViewPager.\n     *\n     * @param view\n     */\n    void setViewPager(ViewPager view);\n\n    /**\n     * Bind the indicator to a ViewPager.\n     *\n     * @param view\n     * @param initialPosition\n     */\n    void setViewPager(ViewPager view, int initialPosition);\n\n    /**\n     * <p>Set the current page of both the ViewPager and indicator.</p>\n     *\n     * <p>This <strong>must</strong> be used if you need to set the page before\n     * the views are drawn on screen (e.g., default start page).</p>\n     *\n     * @param item\n     */\n    void setCurrentItem(int item);\n\n    /**\n     * Set a page change listener which will receive forwarded events.\n     *\n     * @param listener\n     */\n    void setOnPageChangeListener(ViewPager.OnPageChangeListener listener);\n\n    /**\n     * Notify the indicator that the fragment list has changed.\n     */\n    void notifyDataSetChanged();\n}\n"
  },
  {
    "path": "library/src/com/viewpagerindicator/TabPageIndicator.java",
    "content": "/*\n * Copyright (C) 2011 The Android Open Source Project\n * Copyright (C) 2011 Jake Wharton\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage com.viewpagerindicator;\n\nimport android.content.Context;\nimport android.support.v4.view.PagerAdapter;\nimport android.support.v4.view.ViewPager;\nimport android.support.v4.view.ViewPager.OnPageChangeListener;\nimport android.util.AttributeSet;\nimport android.view.View;\nimport android.view.ViewGroup;\nimport android.widget.HorizontalScrollView;\nimport android.widget.LinearLayout;\nimport android.widget.TextView;\n\nimport static android.view.ViewGroup.LayoutParams.MATCH_PARENT;\nimport static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;\n\n/**\n * This widget implements the dynamic action bar tab behavior that can change\n * across different configurations or circumstances.\n */\npublic class TabPageIndicator extends HorizontalScrollView implements PageIndicator {\n    /** Title text used when no title is provided by the adapter. */\n    private static final CharSequence EMPTY_TITLE = \"\";\n\n    /**\n     * Interface for a callback when the selected tab has been reselected.\n     */\n    public interface OnTabReselectedListener {\n        /**\n         * Callback when the selected tab has been reselected.\n         *\n         * @param position Position of the current center item.\n         */\n        void onTabReselected(int position);\n    }\n\n    private Runnable mTabSelector;\n\n    private final OnClickListener mTabClickListener = new OnClickListener() {\n        public void onClick(View view) {\n            TabView tabView = (TabView)view;\n            final int oldSelected = mViewPager.getCurrentItem();\n            final int newSelected = tabView.getIndex();\n            mViewPager.setCurrentItem(newSelected);\n            if (oldSelected == newSelected && mTabReselectedListener != null) {\n                mTabReselectedListener.onTabReselected(newSelected);\n            }\n        }\n    };\n\n    private final IcsLinearLayout mTabLayout;\n\n    private ViewPager mViewPager;\n    private ViewPager.OnPageChangeListener mListener;\n\n    private int mMaxTabWidth;\n    private int mSelectedTabIndex;\n\n    private OnTabReselectedListener mTabReselectedListener;\n\n    public TabPageIndicator(Context context) {\n        this(context, null);\n    }\n\n    public TabPageIndicator(Context context, AttributeSet attrs) {\n        super(context, attrs);\n        setHorizontalScrollBarEnabled(false);\n\n        mTabLayout = new IcsLinearLayout(context, R.attr.vpiTabPageIndicatorStyle);\n        addView(mTabLayout, new ViewGroup.LayoutParams(WRAP_CONTENT, MATCH_PARENT));\n    }\n\n    public void setOnTabReselectedListener(OnTabReselectedListener listener) {\n        mTabReselectedListener = listener;\n    }\n\n    @Override\n    public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {\n        final int widthMode = MeasureSpec.getMode(widthMeasureSpec);\n        final boolean lockedExpanded = widthMode == MeasureSpec.EXACTLY;\n        setFillViewport(lockedExpanded);\n\n        final int childCount = mTabLayout.getChildCount();\n        if (childCount > 1 && (widthMode == MeasureSpec.EXACTLY || widthMode == MeasureSpec.AT_MOST)) {\n            if (childCount > 2) {\n                mMaxTabWidth = (int)(MeasureSpec.getSize(widthMeasureSpec) * 0.4f);\n            } else {\n                mMaxTabWidth = MeasureSpec.getSize(widthMeasureSpec) / 2;\n            }\n        } else {\n            mMaxTabWidth = -1;\n        }\n\n        final int oldWidth = getMeasuredWidth();\n        super.onMeasure(widthMeasureSpec, heightMeasureSpec);\n        final int newWidth = getMeasuredWidth();\n\n        if (lockedExpanded && oldWidth != newWidth) {\n            // Recenter the tab display if we're at a new (scrollable) size.\n            setCurrentItem(mSelectedTabIndex);\n        }\n    }\n\n    private void animateToTab(final int position) {\n        final View tabView = mTabLayout.getChildAt(position);\n        if (mTabSelector != null) {\n            removeCallbacks(mTabSelector);\n        }\n        mTabSelector = new Runnable() {\n            public void run() {\n                final int scrollPos = tabView.getLeft() - (getWidth() - tabView.getWidth()) / 2;\n                smoothScrollTo(scrollPos, 0);\n                mTabSelector = null;\n            }\n        };\n        post(mTabSelector);\n    }\n\n    @Override\n    public void onAttachedToWindow() {\n        super.onAttachedToWindow();\n        if (mTabSelector != null) {\n            // Re-post the selector we saved\n            post(mTabSelector);\n        }\n    }\n\n    @Override\n    public void onDetachedFromWindow() {\n        super.onDetachedFromWindow();\n        if (mTabSelector != null) {\n            removeCallbacks(mTabSelector);\n        }\n    }\n\n    private void addTab(int index, CharSequence text, int iconResId) {\n        final TabView tabView = new TabView(getContext());\n        tabView.mIndex = index;\n        tabView.setFocusable(true);\n        tabView.setOnClickListener(mTabClickListener);\n        tabView.setText(text);\n\n        if (iconResId != 0) {\n            tabView.setCompoundDrawablesWithIntrinsicBounds(iconResId, 0, 0, 0);\n        }\n\n        mTabLayout.addView(tabView, new LinearLayout.LayoutParams(0, MATCH_PARENT, 1));\n    }\n\n    @Override\n    public void onPageScrollStateChanged(int arg0) {\n        if (mListener != null) {\n            mListener.onPageScrollStateChanged(arg0);\n        }\n    }\n\n    @Override\n    public void onPageScrolled(int arg0, float arg1, int arg2) {\n        if (mListener != null) {\n            mListener.onPageScrolled(arg0, arg1, arg2);\n        }\n    }\n\n    @Override\n    public void onPageSelected(int arg0) {\n        setCurrentItem(arg0);\n        if (mListener != null) {\n            mListener.onPageSelected(arg0);\n        }\n    }\n\n    @Override\n    public void setViewPager(ViewPager view) {\n        if (mViewPager == view) {\n            return;\n        }\n        if (mViewPager != null) {\n            mViewPager.setOnPageChangeListener(null);\n        }\n        final PagerAdapter adapter = view.getAdapter();\n        if (adapter == null) {\n            throw new IllegalStateException(\"ViewPager does not have adapter instance.\");\n        }\n        mViewPager = view;\n        view.setOnPageChangeListener(this);\n        notifyDataSetChanged();\n    }\n\n    public void notifyDataSetChanged() {\n        mTabLayout.removeAllViews();\n        PagerAdapter adapter = mViewPager.getAdapter();\n        IconPagerAdapter iconAdapter = null;\n        if (adapter instanceof IconPagerAdapter) {\n            iconAdapter = (IconPagerAdapter)adapter;\n        }\n        final int count = adapter.getCount();\n        for (int i = 0; i < count; i++) {\n            CharSequence title = adapter.getPageTitle(i);\n            if (title == null) {\n                title = EMPTY_TITLE;\n            }\n            int iconResId = 0;\n            if (iconAdapter != null) {\n                iconResId = iconAdapter.getIconResId(i);\n            }\n            addTab(i, title, iconResId);\n        }\n        if (mSelectedTabIndex > count) {\n            mSelectedTabIndex = count - 1;\n        }\n        setCurrentItem(mSelectedTabIndex);\n        requestLayout();\n    }\n\n    @Override\n    public void setViewPager(ViewPager view, int initialPosition) {\n        setViewPager(view);\n        setCurrentItem(initialPosition);\n    }\n\n    @Override\n    public void setCurrentItem(int item) {\n        if (mViewPager == null) {\n            throw new IllegalStateException(\"ViewPager has not been bound.\");\n        }\n        mSelectedTabIndex = item;\n        mViewPager.setCurrentItem(item);\n\n        final int tabCount = mTabLayout.getChildCount();\n        for (int i = 0; i < tabCount; i++) {\n            final View child = mTabLayout.getChildAt(i);\n            final boolean isSelected = (i == item);\n            child.setSelected(isSelected);\n            if (isSelected) {\n                animateToTab(item);\n            }\n        }\n    }\n\n    @Override\n    public void setOnPageChangeListener(OnPageChangeListener listener) {\n        mListener = listener;\n    }\n\n    private class TabView extends TextView {\n        private int mIndex;\n\n        public TabView(Context context) {\n            super(context, null, R.attr.vpiTabPageIndicatorStyle);\n        }\n\n        @Override\n        public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {\n            super.onMeasure(widthMeasureSpec, heightMeasureSpec);\n\n            // Re-measure if we went beyond our maximum size.\n            if (mMaxTabWidth > 0 && getMeasuredWidth() > mMaxTabWidth) {\n                super.onMeasure(MeasureSpec.makeMeasureSpec(mMaxTabWidth, MeasureSpec.EXACTLY),\n                        heightMeasureSpec);\n            }\n        }\n\n        public int getIndex() {\n            return mIndex;\n        }\n    }\n}\n"
  },
  {
    "path": "library/src/com/viewpagerindicator/TitlePageIndicator.java",
    "content": "/*\n * Copyright (C) 2011 Jake Wharton\n * Copyright (C) 2011 Patrik Akerfeldt\n * Copyright (C) 2011 Francisco Figueiredo Jr.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage com.viewpagerindicator;\n\nimport android.content.Context;\nimport android.content.res.Resources;\nimport android.content.res.TypedArray;\nimport android.graphics.Canvas;\nimport android.graphics.Paint;\nimport android.graphics.Path;\nimport android.graphics.Rect;\nimport android.graphics.Typeface;\nimport android.graphics.drawable.Drawable;\nimport android.os.Parcel;\nimport android.os.Parcelable;\nimport android.support.v4.view.MotionEventCompat;\nimport android.support.v4.view.ViewConfigurationCompat;\nimport android.support.v4.view.ViewPager;\nimport android.util.AttributeSet;\nimport android.view.MotionEvent;\nimport android.view.View;\nimport android.view.ViewConfiguration;\n\nimport java.util.ArrayList;\n\n/**\n * A TitlePageIndicator is a PageIndicator which displays the title of left view\n * (if exist), the title of the current select view (centered) and the title of\n * the right view (if exist). When the user scrolls the ViewPager then titles are\n * also scrolled.\n */\npublic class TitlePageIndicator extends View implements PageIndicator {\n    /**\n     * Percentage indicating what percentage of the screen width away from\n     * center should the underline be fully faded. A value of 0.25 means that\n     * halfway between the center of the screen and an edge.\n     */\n    private static final float SELECTION_FADE_PERCENTAGE = 0.25f;\n\n    /**\n     * Percentage indicating what percentage of the screen width away from\n     * center should the selected text bold turn off. A value of 0.05 means\n     * that 10% between the center and an edge.\n     */\n    private static final float BOLD_FADE_PERCENTAGE = 0.05f;\n\n    /**\n     * Title text used when no title is provided by the adapter.\n     */\n    private static final String EMPTY_TITLE = \"\";\n\n    /**\n     * Interface for a callback when the center item has been clicked.\n     */\n    public interface OnCenterItemClickListener {\n        /**\n         * Callback when the center item has been clicked.\n         *\n         * @param position Position of the current center item.\n         */\n        void onCenterItemClick(int position);\n    }\n\n    public enum IndicatorStyle {\n        None(0), Triangle(1), Underline(2);\n\n        public final int value;\n\n        private IndicatorStyle(int value) {\n            this.value = value;\n        }\n\n        public static IndicatorStyle fromValue(int value) {\n            for (IndicatorStyle style : IndicatorStyle.values()) {\n                if (style.value == value) {\n                    return style;\n                }\n            }\n            return null;\n        }\n    }\n\n    public enum LinePosition {\n        Bottom(0), Top(1);\n\n        public final int value;\n\n        private LinePosition(int value) {\n            this.value = value;\n        }\n\n        public static LinePosition fromValue(int value) {\n            for (LinePosition position : LinePosition.values()) {\n                if (position.value == value) {\n                    return position;\n                }\n            }\n            return null;\n        }\n    }\n\n    private ViewPager mViewPager;\n    private ViewPager.OnPageChangeListener mListener;\n    private int mCurrentPage = -1;\n    private float mPageOffset;\n    private int mScrollState;\n    private final Paint mPaintText = new Paint();\n    private boolean mBoldText;\n    private int mColorText;\n    private int mColorSelected;\n    private Path mPath = new Path();\n    private final Rect mBounds = new Rect();\n    private final Paint mPaintFooterLine = new Paint();\n    private IndicatorStyle mFooterIndicatorStyle;\n    private LinePosition mLinePosition;\n    private final Paint mPaintFooterIndicator = new Paint();\n    private float mFooterIndicatorHeight;\n    private float mFooterIndicatorUnderlinePadding;\n    private float mFooterPadding;\n    private float mTitlePadding;\n    private float mTopPadding;\n    /** Left and right side padding for not active view titles. */\n    private float mClipPadding;\n    private float mFooterLineHeight;\n\n    private static final int INVALID_POINTER = -1;\n\n    private int mTouchSlop;\n    private float mLastMotionX = -1;\n    private int mActivePointerId = INVALID_POINTER;\n    private boolean mIsDragging;\n\n    private OnCenterItemClickListener mCenterItemClickListener;\n\n\n    public TitlePageIndicator(Context context) {\n        this(context, null);\n    }\n\n    public TitlePageIndicator(Context context, AttributeSet attrs) {\n        this(context, attrs, R.attr.vpiTitlePageIndicatorStyle);\n    }\n\n    public TitlePageIndicator(Context context, AttributeSet attrs, int defStyle) {\n        super(context, attrs, defStyle);\n        if (isInEditMode()) return;\n\n        //Load defaults from resources\n        final Resources res = getResources();\n        final int defaultFooterColor = res.getColor(R.color.default_title_indicator_footer_color);\n        final float defaultFooterLineHeight = res.getDimension(R.dimen.default_title_indicator_footer_line_height);\n        final int defaultFooterIndicatorStyle = res.getInteger(R.integer.default_title_indicator_footer_indicator_style);\n        final float defaultFooterIndicatorHeight = res.getDimension(R.dimen.default_title_indicator_footer_indicator_height);\n        final float defaultFooterIndicatorUnderlinePadding = res.getDimension(R.dimen.default_title_indicator_footer_indicator_underline_padding);\n        final float defaultFooterPadding = res.getDimension(R.dimen.default_title_indicator_footer_padding);\n        final int defaultLinePosition = res.getInteger(R.integer.default_title_indicator_line_position);\n        final int defaultSelectedColor = res.getColor(R.color.default_title_indicator_selected_color);\n        final boolean defaultSelectedBold = res.getBoolean(R.bool.default_title_indicator_selected_bold);\n        final int defaultTextColor = res.getColor(R.color.default_title_indicator_text_color);\n        final float defaultTextSize = res.getDimension(R.dimen.default_title_indicator_text_size);\n        final float defaultTitlePadding = res.getDimension(R.dimen.default_title_indicator_title_padding);\n        final float defaultClipPadding = res.getDimension(R.dimen.default_title_indicator_clip_padding);\n        final float defaultTopPadding = res.getDimension(R.dimen.default_title_indicator_top_padding);\n\n        //Retrieve styles attributes\n        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TitlePageIndicator, defStyle, 0);\n\n        //Retrieve the colors to be used for this view and apply them.\n        mFooterLineHeight = a.getDimension(R.styleable.TitlePageIndicator_footerLineHeight, defaultFooterLineHeight);\n        mFooterIndicatorStyle = IndicatorStyle.fromValue(a.getInteger(R.styleable.TitlePageIndicator_footerIndicatorStyle, defaultFooterIndicatorStyle));\n        mFooterIndicatorHeight = a.getDimension(R.styleable.TitlePageIndicator_footerIndicatorHeight, defaultFooterIndicatorHeight);\n        mFooterIndicatorUnderlinePadding = a.getDimension(R.styleable.TitlePageIndicator_footerIndicatorUnderlinePadding, defaultFooterIndicatorUnderlinePadding);\n        mFooterPadding = a.getDimension(R.styleable.TitlePageIndicator_footerPadding, defaultFooterPadding);\n        mLinePosition = LinePosition.fromValue(a.getInteger(R.styleable.TitlePageIndicator_linePosition, defaultLinePosition));\n        mTopPadding = a.getDimension(R.styleable.TitlePageIndicator_topPadding, defaultTopPadding);\n        mTitlePadding = a.getDimension(R.styleable.TitlePageIndicator_titlePadding, defaultTitlePadding);\n        mClipPadding = a.getDimension(R.styleable.TitlePageIndicator_clipPadding, defaultClipPadding);\n        mColorSelected = a.getColor(R.styleable.TitlePageIndicator_selectedColor, defaultSelectedColor);\n        mColorText = a.getColor(R.styleable.TitlePageIndicator_android_textColor, defaultTextColor);\n        mBoldText = a.getBoolean(R.styleable.TitlePageIndicator_selectedBold, defaultSelectedBold);\n\n        final float textSize = a.getDimension(R.styleable.TitlePageIndicator_android_textSize, defaultTextSize);\n        final int footerColor = a.getColor(R.styleable.TitlePageIndicator_footerColor, defaultFooterColor);\n        mPaintText.setTextSize(textSize);\n        mPaintText.setAntiAlias(true);\n        mPaintFooterLine.setStyle(Paint.Style.FILL_AND_STROKE);\n        mPaintFooterLine.setStrokeWidth(mFooterLineHeight);\n        mPaintFooterLine.setColor(footerColor);\n        mPaintFooterIndicator.setStyle(Paint.Style.FILL_AND_STROKE);\n        mPaintFooterIndicator.setColor(footerColor);\n\n        Drawable background = a.getDrawable(R.styleable.TitlePageIndicator_android_background);\n        if (background != null) {\n          setBackgroundDrawable(background);\n        }\n\n        a.recycle();\n\n        final ViewConfiguration configuration = ViewConfiguration.get(context);\n        mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);\n    }\n\n\n    public int getFooterColor() {\n        return mPaintFooterLine.getColor();\n    }\n\n    public void setFooterColor(int footerColor) {\n        mPaintFooterLine.setColor(footerColor);\n        mPaintFooterIndicator.setColor(footerColor);\n        invalidate();\n    }\n\n    public float getFooterLineHeight() {\n        return mFooterLineHeight;\n    }\n\n    public void setFooterLineHeight(float footerLineHeight) {\n        mFooterLineHeight = footerLineHeight;\n        mPaintFooterLine.setStrokeWidth(mFooterLineHeight);\n        invalidate();\n    }\n\n    public float getFooterIndicatorHeight() {\n        return mFooterIndicatorHeight;\n    }\n\n    public void setFooterIndicatorHeight(float footerTriangleHeight) {\n        mFooterIndicatorHeight = footerTriangleHeight;\n        invalidate();\n    }\n\n    public float getFooterIndicatorPadding() {\n        return mFooterPadding;\n    }\n\n    public void setFooterIndicatorPadding(float footerIndicatorPadding) {\n        mFooterPadding = footerIndicatorPadding;\n        invalidate();\n    }\n\n    public IndicatorStyle getFooterIndicatorStyle() {\n        return mFooterIndicatorStyle;\n    }\n\n    public void setFooterIndicatorStyle(IndicatorStyle indicatorStyle) {\n        mFooterIndicatorStyle = indicatorStyle;\n        invalidate();\n    }\n\n    public LinePosition getLinePosition() {\n        return mLinePosition;\n    }\n\n    public void setLinePosition(LinePosition linePosition) {\n        mLinePosition = linePosition;\n        invalidate();\n    }\n\n    public int getSelectedColor() {\n        return mColorSelected;\n    }\n\n    public void setSelectedColor(int selectedColor) {\n        mColorSelected = selectedColor;\n        invalidate();\n    }\n\n    public boolean isSelectedBold() {\n        return mBoldText;\n    }\n\n    public void setSelectedBold(boolean selectedBold) {\n        mBoldText = selectedBold;\n        invalidate();\n    }\n\n    public int getTextColor() {\n        return mColorText;\n    }\n\n    public void setTextColor(int textColor) {\n        mPaintText.setColor(textColor);\n        mColorText = textColor;\n        invalidate();\n    }\n\n    public float getTextSize() {\n        return mPaintText.getTextSize();\n    }\n\n    public void setTextSize(float textSize) {\n        mPaintText.setTextSize(textSize);\n        invalidate();\n    }\n\n    public float getTitlePadding() {\n        return this.mTitlePadding;\n    }\n\n    public void setTitlePadding(float titlePadding) {\n        mTitlePadding = titlePadding;\n        invalidate();\n    }\n\n    public float getTopPadding() {\n        return this.mTopPadding;\n    }\n\n    public void setTopPadding(float topPadding) {\n        mTopPadding = topPadding;\n        invalidate();\n    }\n\n    public float getClipPadding() {\n        return this.mClipPadding;\n    }\n\n    public void setClipPadding(float clipPadding) {\n        mClipPadding = clipPadding;\n        invalidate();\n    }\n\n    public void setTypeface(Typeface typeface) {\n        mPaintText.setTypeface(typeface);\n        invalidate();\n    }\n\n    public Typeface getTypeface() {\n        return mPaintText.getTypeface();\n    }\n\n    /*\n     * (non-Javadoc)\n     *\n     * @see android.view.View#onDraw(android.graphics.Canvas)\n     */\n    @Override\n    protected void onDraw(Canvas canvas) {\n        super.onDraw(canvas);\n\n        if (mViewPager == null) {\n            return;\n        }\n        final int count = mViewPager.getAdapter().getCount();\n        if (count == 0) {\n            return;\n        }\n\n        // mCurrentPage is -1 on first start and after orientation changed. If so, retrieve the correct index from viewpager.\n        if (mCurrentPage == -1 && mViewPager != null) {\n            mCurrentPage = mViewPager.getCurrentItem();\n        }\n\n        //Calculate views bounds\n        ArrayList<Rect> bounds = calculateAllBounds(mPaintText);\n        final int boundsSize = bounds.size();\n\n        //Make sure we're on a page that still exists\n        if (mCurrentPage >= boundsSize) {\n            setCurrentItem(boundsSize - 1);\n            return;\n        }\n\n        final int countMinusOne = count - 1;\n        final float halfWidth = getWidth() / 2f;\n        final int left = getLeft();\n        final float leftClip = left + mClipPadding;\n        final int width = getWidth();\n        int height = getHeight();\n        final int right = left + width;\n        final float rightClip = right - mClipPadding;\n\n        int page = mCurrentPage;\n        float offsetPercent;\n        if (mPageOffset <= 0.5) {\n            offsetPercent = mPageOffset;\n        } else {\n            page += 1;\n            offsetPercent = 1 - mPageOffset;\n        }\n        final boolean currentSelected = (offsetPercent <= SELECTION_FADE_PERCENTAGE);\n        final boolean currentBold = (offsetPercent <= BOLD_FADE_PERCENTAGE);\n        final float selectedPercent = (SELECTION_FADE_PERCENTAGE - offsetPercent) / SELECTION_FADE_PERCENTAGE;\n\n        //Verify if the current view must be clipped to the screen\n        Rect curPageBound = bounds.get(mCurrentPage);\n        float curPageWidth = curPageBound.right - curPageBound.left;\n        if (curPageBound.left < leftClip) {\n            //Try to clip to the screen (left side)\n            clipViewOnTheLeft(curPageBound, curPageWidth, left);\n        }\n        if (curPageBound.right > rightClip) {\n            //Try to clip to the screen (right side)\n            clipViewOnTheRight(curPageBound, curPageWidth, right);\n        }\n\n        //Left views starting from the current position\n        if (mCurrentPage > 0) {\n            for (int i = mCurrentPage - 1; i >= 0; i--) {\n                Rect bound = bounds.get(i);\n                //Is left side is outside the screen\n                if (bound.left < leftClip) {\n                    int w = bound.right - bound.left;\n                    //Try to clip to the screen (left side)\n                    clipViewOnTheLeft(bound, w, left);\n                    //Except if there's an intersection with the right view\n                    Rect rightBound = bounds.get(i + 1);\n                    //Intersection\n                    if (bound.right + mTitlePadding > rightBound.left) {\n                        bound.left = (int) (rightBound.left - w - mTitlePadding);\n                        bound.right = bound.left + w;\n                    }\n                }\n            }\n        }\n        //Right views starting from the current position\n        if (mCurrentPage < countMinusOne) {\n            for (int i = mCurrentPage + 1 ; i < count; i++) {\n                Rect bound = bounds.get(i);\n                //If right side is outside the screen\n                if (bound.right > rightClip) {\n                    int w = bound.right - bound.left;\n                    //Try to clip to the screen (right side)\n                    clipViewOnTheRight(bound, w, right);\n                    //Except if there's an intersection with the left view\n                    Rect leftBound = bounds.get(i - 1);\n                    //Intersection\n                    if (bound.left - mTitlePadding < leftBound.right) {\n                        bound.left = (int) (leftBound.right + mTitlePadding);\n                        bound.right = bound.left + w;\n                    }\n                }\n            }\n        }\n\n        //Now draw views\n        int colorTextAlpha = mColorText >>> 24;\n        for (int i = 0; i < count; i++) {\n            //Get the title\n            Rect bound = bounds.get(i);\n            //Only if one side is visible\n            if ((bound.left > left && bound.left < right) || (bound.right > left && bound.right < right)) {\n                final boolean currentPage = (i == page);\n                final CharSequence pageTitle = getTitle(i);\n\n                //Only set bold if we are within bounds\n                mPaintText.setFakeBoldText(currentPage && currentBold && mBoldText);\n\n                //Draw text as unselected\n                mPaintText.setColor(mColorText);\n                if(currentPage && currentSelected) {\n                    //Fade out/in unselected text as the selected text fades in/out\n                    mPaintText.setAlpha(colorTextAlpha - (int)(colorTextAlpha * selectedPercent));\n                }\n\n                //Except if there's an intersection with the right view\n                if (i < boundsSize - 1)  {\n                    Rect rightBound = bounds.get(i + 1);\n                    //Intersection\n                    if (bound.right + mTitlePadding > rightBound.left) {\n                        int w = bound.right - bound.left;\n                        bound.left = (int) (rightBound.left - w - mTitlePadding);\n                        bound.right = bound.left + w;\n                    }\n                }\n                canvas.drawText(pageTitle, 0, pageTitle.length(), bound.left, bound.bottom + mTopPadding, mPaintText);\n\n                //If we are within the selected bounds draw the selected text\n                if (currentPage && currentSelected) {\n                    mPaintText.setColor(mColorSelected);\n                    mPaintText.setAlpha((int)((mColorSelected >>> 24) * selectedPercent));\n                    canvas.drawText(pageTitle, 0, pageTitle.length(), bound.left, bound.bottom + mTopPadding, mPaintText);\n                }\n            }\n        }\n\n        //If we want the line on the top change height to zero and invert the line height to trick the drawing code\n        float footerLineHeight = mFooterLineHeight;\n        float footerIndicatorLineHeight = mFooterIndicatorHeight;\n        if (mLinePosition == LinePosition.Top) {\n            height = 0;\n            footerLineHeight = -footerLineHeight;\n            footerIndicatorLineHeight = -footerIndicatorLineHeight;\n        }\n\n        //Draw the footer line\n        mPath.reset();\n        mPath.moveTo(0, height - footerLineHeight / 2f);\n        mPath.lineTo(width, height - footerLineHeight / 2f);\n        mPath.close();\n        canvas.drawPath(mPath, mPaintFooterLine);\n\n        float heightMinusLine = height - footerLineHeight;\n        switch (mFooterIndicatorStyle) {\n            case Triangle:\n                mPath.reset();\n                mPath.moveTo(halfWidth, heightMinusLine - footerIndicatorLineHeight);\n                mPath.lineTo(halfWidth + footerIndicatorLineHeight, heightMinusLine);\n                mPath.lineTo(halfWidth - footerIndicatorLineHeight, heightMinusLine);\n                mPath.close();\n                canvas.drawPath(mPath, mPaintFooterIndicator);\n                break;\n\n            case Underline:\n                if (!currentSelected || page >= boundsSize) {\n                    break;\n                }\n\n                Rect underlineBounds = bounds.get(page);\n                final float rightPlusPadding = underlineBounds.right + mFooterIndicatorUnderlinePadding;\n                final float leftMinusPadding = underlineBounds.left - mFooterIndicatorUnderlinePadding;\n                final float heightMinusLineMinusIndicator = heightMinusLine - footerIndicatorLineHeight;\n\n                mPath.reset();\n                mPath.moveTo(leftMinusPadding, heightMinusLine);\n                mPath.lineTo(rightPlusPadding, heightMinusLine);\n                mPath.lineTo(rightPlusPadding, heightMinusLineMinusIndicator);\n                mPath.lineTo(leftMinusPadding, heightMinusLineMinusIndicator);\n                mPath.close();\n\n                mPaintFooterIndicator.setAlpha((int)(0xFF * selectedPercent));\n                canvas.drawPath(mPath, mPaintFooterIndicator);\n                mPaintFooterIndicator.setAlpha(0xFF);\n                break;\n        }\n    }\n\n    public boolean onTouchEvent(android.view.MotionEvent ev) {\n        if (super.onTouchEvent(ev)) {\n            return true;\n        }\n        if ((mViewPager == null) || (mViewPager.getAdapter().getCount() == 0)) {\n            return false;\n        }\n\n        final int action = ev.getAction() & MotionEventCompat.ACTION_MASK;\n        switch (action) {\n            case MotionEvent.ACTION_DOWN:\n                mActivePointerId = MotionEventCompat.getPointerId(ev, 0);\n                mLastMotionX = ev.getX();\n                break;\n\n            case MotionEvent.ACTION_MOVE: {\n                final int activePointerIndex = MotionEventCompat.findPointerIndex(ev, mActivePointerId);\n                final float x = MotionEventCompat.getX(ev, activePointerIndex);\n                final float deltaX = x - mLastMotionX;\n\n                if (!mIsDragging) {\n                    if (Math.abs(deltaX) > mTouchSlop) {\n                        mIsDragging = true;\n                    }\n                }\n\n                if (mIsDragging) {\n                    mLastMotionX = x;\n                    if (mViewPager.isFakeDragging() || mViewPager.beginFakeDrag()) {\n                        mViewPager.fakeDragBy(deltaX);\n                    }\n                }\n\n                break;\n            }\n\n            case MotionEvent.ACTION_CANCEL:\n            case MotionEvent.ACTION_UP:\n                if (!mIsDragging) {\n                    final int count = mViewPager.getAdapter().getCount();\n                    final int width = getWidth();\n                    final float halfWidth = width / 2f;\n                    final float sixthWidth = width / 6f;\n                    final float leftThird = halfWidth - sixthWidth;\n                    final float rightThird = halfWidth + sixthWidth;\n                    final float eventX = ev.getX();\n\n                    if (eventX < leftThird) {\n                        if (mCurrentPage > 0) {\n                            if (action != MotionEvent.ACTION_CANCEL) {\n                                mViewPager.setCurrentItem(mCurrentPage - 1);\n                            }\n                            return true;\n                        }\n                    } else if (eventX > rightThird) {\n                        if (mCurrentPage < count - 1) {\n                            if (action != MotionEvent.ACTION_CANCEL) {\n                                mViewPager.setCurrentItem(mCurrentPage + 1);\n                            }\n                            return true;\n                        }\n                    } else {\n                        //Middle third\n                        if (mCenterItemClickListener != null && action != MotionEvent.ACTION_CANCEL) {\n                            mCenterItemClickListener.onCenterItemClick(mCurrentPage);\n                        }\n                    }\n                }\n\n                mIsDragging = false;\n                mActivePointerId = INVALID_POINTER;\n                if (mViewPager.isFakeDragging()) mViewPager.endFakeDrag();\n                break;\n\n            case MotionEventCompat.ACTION_POINTER_DOWN: {\n                final int index = MotionEventCompat.getActionIndex(ev);\n                mLastMotionX = MotionEventCompat.getX(ev, index);\n                mActivePointerId = MotionEventCompat.getPointerId(ev, index);\n                break;\n            }\n\n            case MotionEventCompat.ACTION_POINTER_UP:\n                final int pointerIndex = MotionEventCompat.getActionIndex(ev);\n                final int pointerId = MotionEventCompat.getPointerId(ev, pointerIndex);\n                if (pointerId == mActivePointerId) {\n                    final int newPointerIndex = pointerIndex == 0 ? 1 : 0;\n                    mActivePointerId = MotionEventCompat.getPointerId(ev, newPointerIndex);\n                }\n                mLastMotionX = MotionEventCompat.getX(ev, MotionEventCompat.findPointerIndex(ev, mActivePointerId));\n                break;\n        }\n\n        return true;\n    }\n\n    /**\n     * Set bounds for the right textView including clip padding.\n     *\n     * @param curViewBound\n     *            current bounds.\n     * @param curViewWidth\n     *            width of the view.\n     */\n    private void clipViewOnTheRight(Rect curViewBound, float curViewWidth, int right) {\n        curViewBound.right = (int) (right - mClipPadding);\n        curViewBound.left = (int) (curViewBound.right - curViewWidth);\n    }\n\n    /**\n     * Set bounds for the left textView including clip padding.\n     *\n     * @param curViewBound\n     *            current bounds.\n     * @param curViewWidth\n     *            width of the view.\n     */\n    private void clipViewOnTheLeft(Rect curViewBound, float curViewWidth, int left) {\n        curViewBound.left = (int) (left + mClipPadding);\n        curViewBound.right = (int) (mClipPadding + curViewWidth);\n    }\n\n    /**\n     * Calculate views bounds and scroll them according to the current index\n     *\n     * @param paint\n     * @return\n     */\n    private ArrayList<Rect> calculateAllBounds(Paint paint) {\n        ArrayList<Rect> list = new ArrayList<Rect>();\n        //For each views (If no values then add a fake one)\n        final int count = mViewPager.getAdapter().getCount();\n        final int width = getWidth();\n        final int halfWidth = width / 2;\n        for (int i = 0; i < count; i++) {\n            Rect bounds = calcBounds(i, paint);\n            int w = bounds.right - bounds.left;\n            int h = bounds.bottom - bounds.top;\n            bounds.left = (int)(halfWidth - (w / 2f) + ((i - mCurrentPage - mPageOffset) * width));\n            bounds.right = bounds.left + w;\n            bounds.top = 0;\n            bounds.bottom = h;\n            list.add(bounds);\n        }\n\n        return list;\n    }\n\n    /**\n     * Calculate the bounds for a view's title\n     *\n     * @param index\n     * @param paint\n     * @return\n     */\n    private Rect calcBounds(int index, Paint paint) {\n        //Calculate the text bounds\n        Rect bounds = new Rect();\n        CharSequence title = getTitle(index);\n        bounds.right = (int) paint.measureText(title, 0, title.length());\n        bounds.bottom = (int) (paint.descent() - paint.ascent());\n        return bounds;\n    }\n\n    @Override\n    public void setViewPager(ViewPager view) {\n        if (mViewPager == view) {\n            return;\n        }\n        if (mViewPager != null) {\n            mViewPager.setOnPageChangeListener(null);\n        }\n        if (view.getAdapter() == null) {\n            throw new IllegalStateException(\"ViewPager does not have adapter instance.\");\n        }\n        mViewPager = view;\n        mViewPager.setOnPageChangeListener(this);\n        invalidate();\n    }\n\n    @Override\n    public void setViewPager(ViewPager view, int initialPosition) {\n        setViewPager(view);\n        setCurrentItem(initialPosition);\n    }\n\n    @Override\n    public void notifyDataSetChanged() {\n        invalidate();\n    }\n\n    /**\n     * Set a callback listener for the center item click.\n     *\n     * @param listener Callback instance.\n     */\n    public void setOnCenterItemClickListener(OnCenterItemClickListener listener) {\n        mCenterItemClickListener = listener;\n    }\n\n    @Override\n    public void setCurrentItem(int item) {\n        if (mViewPager == null) {\n            throw new IllegalStateException(\"ViewPager has not been bound.\");\n        }\n        mViewPager.setCurrentItem(item);\n        mCurrentPage = item;\n        invalidate();\n    }\n\n    @Override\n    public void onPageScrollStateChanged(int state) {\n        mScrollState = state;\n\n        if (mListener != null) {\n            mListener.onPageScrollStateChanged(state);\n        }\n    }\n\n    @Override\n    public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {\n        mCurrentPage = position;\n        mPageOffset = positionOffset;\n        invalidate();\n\n        if (mListener != null) {\n            mListener.onPageScrolled(position, positionOffset, positionOffsetPixels);\n        }\n    }\n\n    @Override\n    public void onPageSelected(int position) {\n        if (mScrollState == ViewPager.SCROLL_STATE_IDLE) {\n            mCurrentPage = position;\n            invalidate();\n        }\n\n        if (mListener != null) {\n            mListener.onPageSelected(position);\n        }\n    }\n\n    @Override\n    public void setOnPageChangeListener(ViewPager.OnPageChangeListener listener) {\n        mListener = listener;\n    }\n\n    @Override\n    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {\n        //Measure our width in whatever mode specified\n        final int measuredWidth = MeasureSpec.getSize(widthMeasureSpec);\n\n        //Determine our height\n        float height;\n        final int heightSpecMode = MeasureSpec.getMode(heightMeasureSpec);\n        if (heightSpecMode == MeasureSpec.EXACTLY) {\n            //We were told how big to be\n            height = MeasureSpec.getSize(heightMeasureSpec);\n        } else {\n            //Calculate the text bounds\n            mBounds.setEmpty();\n            mBounds.bottom = (int) (mPaintText.descent() - mPaintText.ascent());\n            height = mBounds.bottom - mBounds.top + mFooterLineHeight + mFooterPadding + mTopPadding;\n            if (mFooterIndicatorStyle != IndicatorStyle.None) {\n                height += mFooterIndicatorHeight;\n            }\n        }\n        final int measuredHeight = (int)height;\n\n        setMeasuredDimension(measuredWidth, measuredHeight);\n    }\n\n    @Override\n    public void onRestoreInstanceState(Parcelable state) {\n        SavedState savedState = (SavedState)state;\n        super.onRestoreInstanceState(savedState.getSuperState());\n        mCurrentPage = savedState.currentPage;\n        requestLayout();\n    }\n\n    @Override\n    public Parcelable onSaveInstanceState() {\n        Parcelable superState = super.onSaveInstanceState();\n        SavedState savedState = new SavedState(superState);\n        savedState.currentPage = mCurrentPage;\n        return savedState;\n    }\n\n    static class SavedState extends BaseSavedState {\n        int currentPage;\n\n        public SavedState(Parcelable superState) {\n            super(superState);\n        }\n\n        private SavedState(Parcel in) {\n            super(in);\n            currentPage = in.readInt();\n        }\n\n        @Override\n        public void writeToParcel(Parcel dest, int flags) {\n            super.writeToParcel(dest, flags);\n            dest.writeInt(currentPage);\n        }\n\n        @SuppressWarnings(\"UnusedDeclaration\")\n        public static final Parcelable.Creator<SavedState> CREATOR = new Parcelable.Creator<SavedState>() {\n            @Override\n            public SavedState createFromParcel(Parcel in) {\n                return new SavedState(in);\n            }\n\n            @Override\n            public SavedState[] newArray(int size) {\n                return new SavedState[size];\n            }\n        };\n    }\n\n    private CharSequence getTitle(int i) {\n        CharSequence title = mViewPager.getAdapter().getPageTitle(i);\n        if (title == null) {\n            title = EMPTY_TITLE;\n        }\n        return title;\n    }\n}\n"
  },
  {
    "path": "library/src/com/viewpagerindicator/UnderlinePageIndicator.java",
    "content": "/*\n * Copyright (C) 2012 Jake Wharton\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage com.viewpagerindicator;\n\nimport android.content.Context;\nimport android.content.res.Resources;\nimport android.content.res.TypedArray;\nimport android.graphics.Canvas;\nimport android.graphics.Paint;\nimport android.graphics.drawable.Drawable;\nimport android.os.Parcel;\nimport android.os.Parcelable;\nimport android.support.v4.view.MotionEventCompat;\nimport android.support.v4.view.ViewConfigurationCompat;\nimport android.support.v4.view.ViewPager;\nimport android.util.AttributeSet;\nimport android.view.MotionEvent;\nimport android.view.View;\nimport android.view.ViewConfiguration;\n\n/**\n * Draws a line for each page. The current page line is colored differently\n * than the unselected page lines.\n */\npublic class UnderlinePageIndicator extends View implements PageIndicator {\n    private static final int INVALID_POINTER = -1;\n    private static final int FADE_FRAME_MS = 30;\n\n    private final Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);\n\n    private boolean mFades;\n    private int mFadeDelay;\n    private int mFadeLength;\n    private int mFadeBy;\n\n    private ViewPager mViewPager;\n    private ViewPager.OnPageChangeListener mListener;\n    private int mScrollState;\n    private int mCurrentPage;\n    private float mPositionOffset;\n\n    private int mTouchSlop;\n    private float mLastMotionX = -1;\n    private int mActivePointerId = INVALID_POINTER;\n    private boolean mIsDragging;\n\n    private final Runnable mFadeRunnable = new Runnable() {\n      @Override public void run() {\n        if (!mFades) return;\n\n        final int alpha = Math.max(mPaint.getAlpha() - mFadeBy, 0);\n        mPaint.setAlpha(alpha);\n        invalidate();\n        if (alpha > 0) {\n          postDelayed(this, FADE_FRAME_MS);\n        }\n      }\n    };\n\n    public UnderlinePageIndicator(Context context) {\n        this(context, null);\n    }\n\n    public UnderlinePageIndicator(Context context, AttributeSet attrs) {\n        this(context, attrs, R.attr.vpiUnderlinePageIndicatorStyle);\n    }\n\n    public UnderlinePageIndicator(Context context, AttributeSet attrs, int defStyle) {\n        super(context, attrs, defStyle);\n        if (isInEditMode()) return;\n\n        final Resources res = getResources();\n\n        //Load defaults from resources\n        final boolean defaultFades = res.getBoolean(R.bool.default_underline_indicator_fades);\n        final int defaultFadeDelay = res.getInteger(R.integer.default_underline_indicator_fade_delay);\n        final int defaultFadeLength = res.getInteger(R.integer.default_underline_indicator_fade_length);\n        final int defaultSelectedColor = res.getColor(R.color.default_underline_indicator_selected_color);\n\n        //Retrieve styles attributes\n        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.UnderlinePageIndicator, defStyle, 0);\n\n        setFades(a.getBoolean(R.styleable.UnderlinePageIndicator_fades, defaultFades));\n        setSelectedColor(a.getColor(R.styleable.UnderlinePageIndicator_selectedColor, defaultSelectedColor));\n        setFadeDelay(a.getInteger(R.styleable.UnderlinePageIndicator_fadeDelay, defaultFadeDelay));\n        setFadeLength(a.getInteger(R.styleable.UnderlinePageIndicator_fadeLength, defaultFadeLength));\n\n        Drawable background = a.getDrawable(R.styleable.UnderlinePageIndicator_android_background);\n        if (background != null) {\n          setBackgroundDrawable(background);\n        }\n\n        a.recycle();\n\n        final ViewConfiguration configuration = ViewConfiguration.get(context);\n        mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);\n    }\n\n    public boolean getFades() {\n        return mFades;\n    }\n\n    public void setFades(boolean fades) {\n        if (fades != mFades) {\n            mFades = fades;\n            if (fades) {\n                post(mFadeRunnable);\n            } else {\n                removeCallbacks(mFadeRunnable);\n                mPaint.setAlpha(0xFF);\n                invalidate();\n            }\n        }\n    }\n\n    public int getFadeDelay() {\n        return mFadeDelay;\n    }\n\n    public void setFadeDelay(int fadeDelay) {\n        mFadeDelay = fadeDelay;\n    }\n\n    public int getFadeLength() {\n        return mFadeLength;\n    }\n\n    public void setFadeLength(int fadeLength) {\n        mFadeLength = fadeLength;\n        mFadeBy = 0xFF / (mFadeLength / FADE_FRAME_MS);\n    }\n\n    public int getSelectedColor() {\n        return mPaint.getColor();\n    }\n\n    public void setSelectedColor(int selectedColor) {\n        mPaint.setColor(selectedColor);\n        invalidate();\n    }\n\n    @Override\n    protected void onDraw(Canvas canvas) {\n        super.onDraw(canvas);\n\n        if (mViewPager == null) {\n            return;\n        }\n        final int count = mViewPager.getAdapter().getCount();\n        if (count == 0) {\n            return;\n        }\n\n        if (mCurrentPage >= count) {\n            setCurrentItem(count - 1);\n            return;\n        }\n\n        final int paddingLeft = getPaddingLeft();\n        final float pageWidth = (getWidth() - paddingLeft - getPaddingRight()) / (1f * count);\n        final float left = paddingLeft + pageWidth * (mCurrentPage + mPositionOffset);\n        final float right = left + pageWidth;\n        final float top = getPaddingTop();\n        final float bottom = getHeight() - getPaddingBottom();\n        canvas.drawRect(left, top, right, bottom, mPaint);\n    }\n\n    public boolean onTouchEvent(MotionEvent ev) {\n        if (super.onTouchEvent(ev)) {\n            return true;\n        }\n        if ((mViewPager == null) || (mViewPager.getAdapter().getCount() == 0)) {\n            return false;\n        }\n\n        final int action = ev.getAction() & MotionEventCompat.ACTION_MASK;\n        switch (action) {\n            case MotionEvent.ACTION_DOWN:\n                mActivePointerId = MotionEventCompat.getPointerId(ev, 0);\n                mLastMotionX = ev.getX();\n                break;\n\n            case MotionEvent.ACTION_MOVE: {\n                final int activePointerIndex = MotionEventCompat.findPointerIndex(ev, mActivePointerId);\n                final float x = MotionEventCompat.getX(ev, activePointerIndex);\n                final float deltaX = x - mLastMotionX;\n\n                if (!mIsDragging) {\n                    if (Math.abs(deltaX) > mTouchSlop) {\n                        mIsDragging = true;\n                    }\n                }\n\n                if (mIsDragging) {\n                    mLastMotionX = x;\n                    if (mViewPager.isFakeDragging() || mViewPager.beginFakeDrag()) {\n                        mViewPager.fakeDragBy(deltaX);\n                    }\n                }\n\n                break;\n            }\n\n            case MotionEvent.ACTION_CANCEL:\n            case MotionEvent.ACTION_UP:\n                if (!mIsDragging) {\n                    final int count = mViewPager.getAdapter().getCount();\n                    final int width = getWidth();\n                    final float halfWidth = width / 2f;\n                    final float sixthWidth = width / 6f;\n\n                    if ((mCurrentPage > 0) && (ev.getX() < halfWidth - sixthWidth)) {\n                        if (action != MotionEvent.ACTION_CANCEL) {\n                            mViewPager.setCurrentItem(mCurrentPage - 1);\n                        }\n                        return true;\n                    } else if ((mCurrentPage < count - 1) && (ev.getX() > halfWidth + sixthWidth)) {\n                        if (action != MotionEvent.ACTION_CANCEL) {\n                            mViewPager.setCurrentItem(mCurrentPage + 1);\n                        }\n                        return true;\n                    }\n                }\n\n                mIsDragging = false;\n                mActivePointerId = INVALID_POINTER;\n                if (mViewPager.isFakeDragging()) mViewPager.endFakeDrag();\n                break;\n\n            case MotionEventCompat.ACTION_POINTER_DOWN: {\n                final int index = MotionEventCompat.getActionIndex(ev);\n                mLastMotionX = MotionEventCompat.getX(ev, index);\n                mActivePointerId = MotionEventCompat.getPointerId(ev, index);\n                break;\n            }\n\n            case MotionEventCompat.ACTION_POINTER_UP:\n                final int pointerIndex = MotionEventCompat.getActionIndex(ev);\n                final int pointerId = MotionEventCompat.getPointerId(ev, pointerIndex);\n                if (pointerId == mActivePointerId) {\n                    final int newPointerIndex = pointerIndex == 0 ? 1 : 0;\n                    mActivePointerId = MotionEventCompat.getPointerId(ev, newPointerIndex);\n                }\n                mLastMotionX = MotionEventCompat.getX(ev, MotionEventCompat.findPointerIndex(ev, mActivePointerId));\n                break;\n        }\n\n        return true;\n    }\n\n    @Override\n    public void setViewPager(ViewPager viewPager) {\n        if (mViewPager == viewPager) {\n            return;\n        }\n        if (mViewPager != null) {\n            //Clear us from the old pager.\n            mViewPager.setOnPageChangeListener(null);\n        }\n        if (viewPager.getAdapter() == null) {\n            throw new IllegalStateException(\"ViewPager does not have adapter instance.\");\n        }\n        mViewPager = viewPager;\n        mViewPager.setOnPageChangeListener(this);\n        invalidate();\n        post(new Runnable() {\n            @Override public void run() {\n                if (mFades) {\n                    post(mFadeRunnable);\n                }\n            }\n        });\n    }\n\n    @Override\n    public void setViewPager(ViewPager view, int initialPosition) {\n        setViewPager(view);\n        setCurrentItem(initialPosition);\n    }\n\n    @Override\n    public void setCurrentItem(int item) {\n        if (mViewPager == null) {\n            throw new IllegalStateException(\"ViewPager has not been bound.\");\n        }\n        mViewPager.setCurrentItem(item);\n        mCurrentPage = item;\n        invalidate();\n    }\n\n    @Override\n    public void notifyDataSetChanged() {\n        invalidate();\n    }\n\n    @Override\n    public void onPageScrollStateChanged(int state) {\n        mScrollState = state;\n\n        if (mListener != null) {\n            mListener.onPageScrollStateChanged(state);\n        }\n    }\n\n    @Override\n    public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {\n        mCurrentPage = position;\n        mPositionOffset = positionOffset;\n        if (mFades) {\n            if (positionOffsetPixels > 0) {\n                removeCallbacks(mFadeRunnable);\n                mPaint.setAlpha(0xFF);\n            } else if (mScrollState != ViewPager.SCROLL_STATE_DRAGGING) {\n                postDelayed(mFadeRunnable, mFadeDelay);\n            }\n        }\n        invalidate();\n\n        if (mListener != null) {\n            mListener.onPageScrolled(position, positionOffset, positionOffsetPixels);\n        }\n    }\n\n    @Override\n    public void onPageSelected(int position) {\n        if (mScrollState == ViewPager.SCROLL_STATE_IDLE) {\n            mCurrentPage = position;\n            mPositionOffset = 0;\n            invalidate();\n            mFadeRunnable.run();\n        }\n        if (mListener != null) {\n            mListener.onPageSelected(position);\n        }\n    }\n\n    @Override\n    public void setOnPageChangeListener(ViewPager.OnPageChangeListener listener) {\n        mListener = listener;\n    }\n\n    @Override\n    public void onRestoreInstanceState(Parcelable state) {\n        SavedState savedState = (SavedState)state;\n        super.onRestoreInstanceState(savedState.getSuperState());\n        mCurrentPage = savedState.currentPage;\n        requestLayout();\n    }\n\n    @Override\n    public Parcelable onSaveInstanceState() {\n        Parcelable superState = super.onSaveInstanceState();\n        SavedState savedState = new SavedState(superState);\n        savedState.currentPage = mCurrentPage;\n        return savedState;\n    }\n\n    static class SavedState extends BaseSavedState {\n        int currentPage;\n\n        public SavedState(Parcelable superState) {\n            super(superState);\n        }\n\n        private SavedState(Parcel in) {\n            super(in);\n            currentPage = in.readInt();\n        }\n\n        @Override\n        public void writeToParcel(Parcel dest, int flags) {\n            super.writeToParcel(dest, flags);\n            dest.writeInt(currentPage);\n        }\n\n        @SuppressWarnings(\"UnusedDeclaration\")\n        public static final Creator<SavedState> CREATOR = new Creator<SavedState>() {\n            @Override\n            public SavedState createFromParcel(Parcel in) {\n                return new SavedState(in);\n            }\n\n            @Override\n            public SavedState[] newArray(int size) {\n                return new SavedState[size];\n            }\n        };\n    }\n}"
  },
  {
    "path": "pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.sonatype.oss</groupId>\n        <artifactId>oss-parent</artifactId>\n        <version>7</version>\n    </parent>\n\n    <groupId>com.viewpagerindicator</groupId>\n    <artifactId>parent</artifactId>\n    <packaging>pom</packaging>\n    <version>2.4.1</version>\n\n    <name>Android-ViewPagerIndicator (Parent)</name>\n    <description>Android library for.</description>\n    <url>https://github.com/JakeWharton/Android-ViewPagerIndicator</url>\n    <inceptionYear>2011</inceptionYear>\n\n    <modules>\n        <module>library</module>\n        <module>sample</module>\n    </modules>\n\n    <scm>\n        <url>http://github.com/JakeWharton/Android-ViewPagerIndicator/</url>\n        <connection>scm:git:git://github.com/JakeWharton/Android-ViewPagerIndicator.git</connection>\n        <developerConnection>scm:git:git@github.com:JakeWharton/Android-ViewPagerIndicator.git</developerConnection>\n    </scm>\n\n    <developers>\n        <developer>\n            <name>Jake Wharton</name>\n            <email>jakewharton@gmail.com</email>\n            <id>jakewharton</id>\n            <url>http://jakewharton.com</url>\n            <timezone>-5</timezone>\n            <roles>\n                <role>developer</role>\n            </roles>\n        </developer>\n    </developers>\n\n    <licenses>\n        <license>\n            <name>Apache License Version 2.0</name>\n            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>\n            <distribution>repo</distribution>\n        </license>\n    </licenses>\n\n    <organization>\n        <name>Jake Wharton</name>\n        <url>http://jakewharton.com</url>\n    </organization>\n\n    <issueManagement>\n        <system>GitHub Issues</system>\n        <url>https://github.com/JakeWharton/Android-ViewPagerIndicator/issues</url>\n    </issueManagement>\n\n    <properties>\n        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>\n        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>\n\n        <java.version>1.6</java.version>\n        <android.version>4.1.1.4</android.version>\n        <android.platform>16</android.platform>\n        <android.support.version>r7</android.support.version>\n\n        <android-maven.version>3.3.0</android-maven.version>\n    </properties>\n\n    <dependencyManagement>\n        <dependencies>\n            <dependency>\n                <groupId>com.google.android</groupId>\n                <artifactId>android</artifactId>\n                <version>${android.version}</version>\n            </dependency>\n\n            <dependency>\n                <groupId>com.google.android</groupId>\n                <artifactId>support-v4</artifactId>\n                <version>${android.support.version}</version>\n            </dependency>\n        </dependencies>\n    </dependencyManagement>\n\n    <build>\n        <pluginManagement>\n            <plugins>\n                <plugin>\n                    <groupId>org.apache.maven.plugins</groupId>\n                    <artifactId>maven-compiler-plugin</artifactId>\n                    <version>2.3.2</version>\n                    <configuration>\n                        <source>${java.version}</source>\n                        <target>${java.version}</target>\n                    </configuration>\n                </plugin>\n\n                <plugin>\n                    <groupId>com.jayway.maven.plugins.android.generation2</groupId>\n                    <artifactId>android-maven-plugin</artifactId>\n                    <version>${android-maven.version}</version>\n                    <configuration>\n                        <sdk>\n                            <platform>${android.platform}</platform>\n                        </sdk>\n                        <undeployBeforeDeploy>true</undeployBeforeDeploy>\n                    </configuration>\n                    <extensions>true</extensions>\n                </plugin>\n\n                <plugin>\n                    <groupId>org.apache.maven.plugins</groupId>\n                    <artifactId>maven-checkstyle-plugin</artifactId>\n                    <version>2.6</version>\n                    <configuration>\n                        <failsOnError>true</failsOnError>\n                    </configuration>\n                </plugin>\n            </plugins>\n        </pluginManagement>\n\n        <plugins>\n            <plugin>\n                <groupId>org.apache.maven.plugins</groupId>\n                <artifactId>maven-release-plugin</artifactId>\n                <version>2.1</version>\n                <configuration>\n                    <autoVersionSubmodules>true</autoVersionSubmodules>\n                </configuration>\n            </plugin>\n\n            <plugin>\n                <groupId>org.apache.maven.plugins</groupId>\n                <artifactId>maven-eclipse-plugin</artifactId>\n                <version>2.9</version>\n                <configuration>\n                    <excludes>\n                        <exclude>android:android</exclude>\n                        <exclude>com.google.android.maps:maps</exclude>\n                    </excludes>\n                    <buildOutputDirectory>bin</buildOutputDirectory>\n                    <classpathContainers>\n                        <classpathContainer>com.android.ide.eclipse.adt.ANDROID_FRAMEWORK</classpathContainer>\n                    </classpathContainers>\n                    <additionalProjectnatures>\n                        <projectnature>com.android.ide.eclipse.adt.AndroidNature</projectnature>\n                        <projectnature>org.eclipse.ajdt.ui.ajnature</projectnature>\n                    </additionalProjectnatures>\n                    <buildcommands>\n                        <buildcommand>com.android.ide.eclipse.adt.ResourceManagerBuilder</buildcommand>\n                        <buildcommand>com.android.ide.eclipse.adt.PreCompilerBuilder</buildcommand>\n                        <buildcommand>org.eclipse.jdt.core.javabuilder</buildcommand>\n                        <buildcommand>com.android.ide.eclipse.adt.ApkBuilder</buildcommand>\n                    </buildcommands>\n                    <useProjectReferences>false</useProjectReferences>\n                </configuration>\n            </plugin>\n        </plugins>\n    </build>\n</project>\n"
  },
  {
    "path": "sample/AndroidManifest.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    package=\"com.viewpagerindicator.sample\"\n    android:versionCode=\"65\"\n    android:versionName=\"2.4.1\">\n\n    <uses-sdk\n        android:minSdkVersion=\"4\"\n        android:targetSdkVersion=\"16\" />\n\n    <application\n        android:label=\"ViewPagerIndicator Sample\"\n        android:icon=\"@drawable/icon\">\n\n        <activity\n            android:name=\".ListSamples\"\n            android:label=\"ViewPager Indicator\">\n\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\" />\n                <category android:name=\"android.intent.category.LAUNCHER\" />\n            </intent-filter>\n        </activity>\n\n\n\n        <!-- CIRCLE INDICATOR -->\n        <activity\n            android:name=\".SampleCirclesDefault\"\n            android:label=\"Circles/Default\">\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\" />\n                <category android:name=\"com.jakewharton.android.viewpagerindicator.sample.SAMPLE\" />\n            </intent-filter>\n        </activity>\n        <activity\n            android:name=\".SampleCirclesInitialPage\"\n            android:label=\"Circles/Initial Page\">\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\" />\n                <category android:name=\"com.jakewharton.android.viewpagerindicator.sample.SAMPLE\" />\n            </intent-filter>\n        </activity>\n        <activity\n            android:name=\".SampleCirclesSnap\"\n            android:label=\"Circles/Snap\">\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\" />\n                <category android:name=\"com.jakewharton.android.viewpagerindicator.sample.SAMPLE\" />\n            </intent-filter>\n        </activity>\n        <activity\n            android:name=\".SampleCirclesStyledLayout\"\n            android:label=\"Circles/Styled (via layout)\"\n            android:theme=\"@android:style/Theme.Light\">\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\" />\n                <category android:name=\"com.jakewharton.android.viewpagerindicator.sample.SAMPLE\" />\n            </intent-filter>\n        </activity>\n        <activity\n            android:name=\".SampleCirclesStyledMethods\"\n            android:label=\"Circles/Styled (via methods)\"\n            android:theme=\"@android:style/Theme.Light\">\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\" />\n                <category android:name=\"com.jakewharton.android.viewpagerindicator.sample.SAMPLE\" />\n            </intent-filter>\n        </activity>\n        <activity\n            android:name=\".SampleCirclesStyledTheme\"\n            android:label=\"Circles/Styled (via theme)\"\n            android:theme=\"@style/StyledIndicators\">\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\" />\n                <category android:name=\"com.jakewharton.android.viewpagerindicator.sample.SAMPLE\" />\n            </intent-filter>\n        </activity>\n        <activity\n            android:name=\".SampleCirclesWithListener\"\n            android:label=\"Circles/With Listener\">\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\" />\n                <category android:name=\"com.jakewharton.android.viewpagerindicator.sample.SAMPLE\" />\n            </intent-filter>\n        </activity>\n\n\n\n        <!-- ICON INDICATOR -->\n        <activity\n            android:name=\".SampleIconsDefault\"\n            android:label=\"Icons/Default\">\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\" />\n                <category android:name=\"com.jakewharton.android.viewpagerindicator.sample.SAMPLE\" />\n            </intent-filter>\n        </activity>\n\n\n\n\n        <!-- LINE INDICATOR -->\n        <activity\n                android:name=\".SampleLinesDefault\"\n                android:label=\"Lines/Default\">\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\" />\n                <category android:name=\"com.jakewharton.android.viewpagerindicator.sample.SAMPLE\" />\n            </intent-filter>\n        </activity>\n        <activity\n                android:name=\".SampleLinesStyledLayout\"\n                android:label=\"Lines/Styled (via layout)\"\n                android:theme=\"@android:style/Theme.Light\">\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\" />\n                <category android:name=\"com.jakewharton.android.viewpagerindicator.sample.SAMPLE\" />\n            </intent-filter>\n        </activity>\n        <activity\n                android:name=\".SampleLinesStyledMethods\"\n                android:label=\"Lines/Styled (via methods)\"\n                android:theme=\"@android:style/Theme.Light\">\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\" />\n                <category android:name=\"com.jakewharton.android.viewpagerindicator.sample.SAMPLE\" />\n            </intent-filter>\n        </activity>\n        <activity\n                android:name=\".SampleLinesStyledTheme\"\n                android:label=\"Lines/Styled (via theme)\"\n                android:theme=\"@style/StyledIndicators\">\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\" />\n                <category android:name=\"com.jakewharton.android.viewpagerindicator.sample.SAMPLE\" />\n            </intent-filter>\n        </activity>\n\n\n\n        <!-- TITLE INDICATOR -->\n        <activity\n            android:name=\".SampleTitlesBottom\"\n            android:label=\"Titles/Default (Bottom)\">\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\" />\n                <category android:name=\"com.jakewharton.android.viewpagerindicator.sample.SAMPLE\" />\n            </intent-filter>\n        </activity>\n        <activity\n            android:name=\".SampleTitlesCenterClickListener\"\n            android:label=\"Titles/Center Click Listener\">\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\" />\n                <category android:name=\"com.jakewharton.android.viewpagerindicator.sample.SAMPLE\" />\n            </intent-filter>\n        </activity>\n        <activity\n            android:name=\".SampleTitlesDefault\"\n            android:label=\"Titles/Default\">\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\" />\n                <category android:name=\"com.jakewharton.android.viewpagerindicator.sample.SAMPLE\" />\n            </intent-filter>\n        </activity>\n        <activity\n            android:name=\".SampleTitlesInitialPage\"\n            android:label=\"Titles/Initial Page\">\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\" />\n                <category android:name=\"com.jakewharton.android.viewpagerindicator.sample.SAMPLE\" />\n            </intent-filter>\n        </activity>\n        <activity\n            android:name=\".SampleTitlesStyledLayout\"\n            android:label=\"Titles/Styled (via layout)\"\n            android:theme=\"@android:style/Theme.Light\">\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\" />\n                <category android:name=\"com.jakewharton.android.viewpagerindicator.sample.SAMPLE\" />\n            </intent-filter>\n        </activity>\n        <activity\n            android:name=\".SampleTitlesStyledMethods\"\n            android:label=\"Titles/Styled (via methods)\"\n            android:theme=\"@android:style/Theme.Light\">\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\" />\n                <category android:name=\"com.jakewharton.android.viewpagerindicator.sample.SAMPLE\" />\n            </intent-filter>\n        </activity>\n        <activity\n            android:name=\".SampleTitlesStyledTheme\"\n            android:label=\"Titles/Styled (via theme)\"\n            android:theme=\"@style/StyledIndicators\">\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\" />\n                <category android:name=\"com.jakewharton.android.viewpagerindicator.sample.SAMPLE\" />\n            </intent-filter>\n        </activity>\n        <activity\n            android:name=\".SampleTitlesTriangle\"\n            android:label=\"Titles/Triangle Style\">\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\" />\n                <category android:name=\"com.jakewharton.android.viewpagerindicator.sample.SAMPLE\" />\n            </intent-filter>\n        </activity>\n        <activity\n            android:name=\".SampleTitlesWithListener\"\n            android:label=\"Titles/With Listener\">\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\" />\n                <category android:name=\"com.jakewharton.android.viewpagerindicator.sample.SAMPLE\" />\n            </intent-filter>\n        </activity>\n\n\n\n        <!-- TAB INDICATOR -->\n        <activity\n            android:name=\".SampleTabsDefault\"\n            android:label=\"Tabs/Default\"\n            android:theme=\"@style/Theme.PageIndicatorDefaults\">\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\" />\n                <category android:name=\"com.jakewharton.android.viewpagerindicator.sample.SAMPLE\" />\n            </intent-filter>\n        </activity>\n        <activity\n            android:name=\".SampleTabsStyled\"\n            android:label=\"Tabs/Styled\"\n            android:theme=\"@style/StyledIndicators\">\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\" />\n                <category android:name=\"com.jakewharton.android.viewpagerindicator.sample.SAMPLE\" />\n            </intent-filter>\n        </activity>\n      <activity\n          android:name=\".SampleTabsWithIcons\"\n          android:label=\"Tabs/With Icons\"\n          android:theme=\"@style/StyledIndicators\">\n        <intent-filter>\n          <action android:name=\"android.intent.action.MAIN\" />\n          <category android:name=\"com.jakewharton.android.viewpagerindicator.sample.SAMPLE\" />\n        </intent-filter>\n      </activity>\n\n\n\n        <!-- UNDERLINE INDICATOR -->\n        <activity\n                android:name=\".SampleUnderlinesDefault\"\n                android:label=\"Underlines/Default\">\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\" />\n                <category android:name=\"com.jakewharton.android.viewpagerindicator.sample.SAMPLE\" />\n            </intent-filter>\n        </activity>\n        <activity\n                android:name=\".SampleUnderlinesNoFade\"\n                android:label=\"Underlines/No Fade\">\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\" />\n                <category android:name=\"com.jakewharton.android.viewpagerindicator.sample.SAMPLE\" />\n            </intent-filter>\n        </activity>\n        <activity\n                android:name=\".SampleUnderlinesStyledLayout\"\n                android:label=\"Underlines/Styled (via layout)\"\n                android:theme=\"@android:style/Theme.Light\">\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\" />\n                <category android:name=\"com.jakewharton.android.viewpagerindicator.sample.SAMPLE\" />\n            </intent-filter>\n        </activity>\n        <activity\n                android:name=\".SampleUnderlinesStyledMethods\"\n                android:label=\"Underlines/Styled (via methods)\"\n                android:theme=\"@android:style/Theme.Light\">\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\" />\n                <category android:name=\"com.jakewharton.android.viewpagerindicator.sample.SAMPLE\" />\n            </intent-filter>\n        </activity>\n        <activity\n                android:name=\".SampleUnderlinesStyledTheme\"\n                android:label=\"Underlines/Styled (via theme)\"\n                android:theme=\"@style/StyledIndicators\">\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\" />\n                <category android:name=\"com.jakewharton.android.viewpagerindicator.sample.SAMPLE\" />\n            </intent-filter>\n        </activity>\n\n    </application>\n</manifest>\n"
  },
  {
    "path": "sample/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\t<modelVersion>4.0.0</modelVersion>\n\n\t<artifactId>sample</artifactId>\n\t<name>Android-ViewPagerIndicator Sample</name>\n\t<packaging>apk</packaging>\n\n\t<parent>\n\t\t<groupId>com.viewpagerindicator</groupId>\n\t\t<artifactId>parent</artifactId>\n\t\t<version>2.4.1</version>\n\t\t<relativePath>../pom.xml</relativePath>\n\t</parent>\n\n\t<dependencies>\n\t\t<dependency>\n\t\t\t<groupId>com.google.android</groupId>\n\t\t\t<artifactId>android</artifactId>\n\t\t\t<scope>provided</scope>\n\t\t</dependency>\n\n\t\t<dependency>\n\t\t\t<groupId>com.google.android</groupId>\n\t\t\t<artifactId>support-v4</artifactId>\n\t\t</dependency>\n\n\t\t<dependency>\n\t\t\t<groupId>com.viewpagerindicator</groupId>\n\t\t\t<artifactId>library</artifactId>\n\t\t\t<version>${project.version}</version>\n\t\t\t<type>apklib</type>\n\t\t</dependency>\n\t</dependencies>\n\n\t<build>\n\t\t<sourceDirectory>src</sourceDirectory>\n\t\t<finalName>${project.artifactId}-unaligned</finalName>\n\n\t\t<plugins>\n\t\t\t<plugin>\n\t\t\t\t<groupId>com.jayway.maven.plugins.android.generation2</groupId>\n\t\t\t\t<artifactId>android-maven-plugin</artifactId>\n\t\t\t\t<extensions>true</extensions>\n\t\t\t</plugin>\n\n            <plugin>\n                <groupId>org.apache.maven.plugins</groupId>\n                <artifactId>maven-checkstyle-plugin</artifactId>\n                <configuration>\n                    <configLocation>../checkstyle.xml</configLocation>\n                </configuration>\n                <executions>\n                    <execution>\n                        <phase>verify</phase>\n                        <goals>\n                            <goal>checkstyle</goal>\n                        </goals>\n                    </execution>\n                </executions>\n            </plugin>\n\t\t</plugins>\n\t</build>\n\n\t<profiles>\n\t\t<profile>\n\t\t\t<id>release</id>\n\t\t\t<activation>\n\t\t\t\t<property>\n\t\t\t\t\t<name>performRelease</name>\n\t\t\t\t\t<value>true</value>\n\t\t\t\t</property>\n\t\t\t</activation>\n\t\t\t<build>\n\t\t\t\t<plugins>\n\t\t\t\t\t<plugin>\n\t\t\t\t\t\t<groupId>com.jayway.maven.plugins.android.generation2</groupId>\n\t\t\t\t\t\t<artifactId>android-maven-plugin</artifactId>\n\t\t\t\t\t\t<version>${android-maven.version}</version>\n\t\t\t\t\t\t<inherited>true</inherited>\n\t\t\t\t\t\t<configuration>\n\t\t\t\t\t\t\t<zipalign>\n\t\t\t\t\t\t\t\t<inputApk>${project.build.directory}/${project.build.finalName}.apk</inputApk>\n\t\t\t\t\t\t\t\t<outputApk>${project.build.directory}/${project.artifactId}.apk</outputApk>\n\t\t\t\t\t\t\t</zipalign>\n\t\t\t\t\t\t</configuration>\n\t\t\t\t\t\t<executions>\n\t\t\t\t\t\t\t<execution>\n\t\t\t\t\t\t\t\t<id>alignApk</id>\n\t\t\t\t\t\t\t\t<phase>package</phase>\n\t\t\t\t\t\t\t\t<goals>\n\t\t\t\t\t\t\t\t\t<goal>zipalign</goal>\n\t\t\t\t\t\t\t\t</goals>\n\t\t\t\t\t\t\t</execution>\n\t\t\t\t\t\t</executions>\n\t\t\t\t\t</plugin>\n\t\t\t\t</plugins>\n\t\t\t</build>\n\t\t</profile>\n\t</profiles>\n</project>\n"
  },
  {
    "path": "sample/project.properties",
    "content": "# This file is automatically generated by Android Tools.\n# Do not modify this file -- YOUR CHANGES WILL BE ERASED!\n#\n# This file must be checked in Version Control Systems.\n#\n# To customize properties used by the Ant build system use,\n# \"ant.properties\", and override values to adapt the script to your\n# project structure.\n\n# Project target.\ntarget=android-16\nandroid.library.reference.1=../library\n"
  },
  {
    "path": "sample/res/drawable/custom_tab_indicator.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Copyright (C) 2008 The Android Open Source Project\n\n     Licensed under the Apache License, Version 2.0 (the \"License\");\n     you may not use this file except in compliance with the License.\n     You may obtain a copy of the License at\n  \n          http://www.apache.org/licenses/LICENSE-2.0\n  \n     Unless required by applicable law or agreed to in writing, software\n     distributed under the License is distributed on an \"AS IS\" BASIS,\n     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n     See the License for the specific language governing permissions and\n     limitations under the License.\n-->\n\n<selector xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <!-- Non focused states -->\n    <item android:state_focused=\"false\" android:state_selected=\"false\" android:state_pressed=\"false\" android:drawable=\"@drawable/custom_tab_indicator_unselected\" />\n    <item android:state_focused=\"false\" android:state_selected=\"true\"  android:state_pressed=\"false\" android:drawable=\"@drawable/custom_tab_indicator_selected\" />\n\n    <!-- Focused states -->\n    <item android:state_focused=\"true\" android:state_selected=\"false\" android:state_pressed=\"false\" android:drawable=\"@drawable/custom_tab_indicator_unselected_focused\" />\n    <item android:state_focused=\"true\" android:state_selected=\"true\"  android:state_pressed=\"false\" android:drawable=\"@drawable/custom_tab_indicator_selected_focused\" />\n\n    <!-- Pressed -->\n    <!--    Non focused states -->\n    <item android:state_focused=\"false\" android:state_selected=\"false\" android:state_pressed=\"true\" android:drawable=\"@drawable/custom_tab_indicator_unselected_pressed\" />\n    <item android:state_focused=\"false\" android:state_selected=\"true\"  android:state_pressed=\"true\" android:drawable=\"@drawable/custom_tab_indicator_selected_pressed\" />\n\n    <!--    Focused states -->\n    <item android:state_focused=\"true\" android:state_selected=\"false\" android:state_pressed=\"true\" android:drawable=\"@drawable/custom_tab_indicator_unselected_pressed\" />\n    <item android:state_focused=\"true\" android:state_selected=\"true\"  android:state_pressed=\"true\" android:drawable=\"@drawable/custom_tab_indicator_selected_pressed\" />\n</selector>\n"
  },
  {
    "path": "sample/res/drawable/perm_group_calendar.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<selector xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:state_selected=\"true\" android:drawable=\"@drawable/perm_group_calendar_selected\" />\n    <item android:drawable=\"@drawable/perm_group_calendar_normal\" />\n</selector>\n"
  },
  {
    "path": "sample/res/drawable/perm_group_camera.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<selector xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:state_selected=\"true\" android:drawable=\"@drawable/perm_group_camera_selected\" />\n    <item android:drawable=\"@drawable/perm_group_camera_normal\" />\n</selector>\n"
  },
  {
    "path": "sample/res/drawable/perm_group_device_alarms.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<selector xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:state_selected=\"true\" android:drawable=\"@drawable/perm_group_device_alarms_selected\" />\n    <item android:drawable=\"@drawable/perm_group_device_alarms_normal\" />\n</selector>\n"
  },
  {
    "path": "sample/res/drawable/perm_group_location.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<selector xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:state_selected=\"true\" android:drawable=\"@drawable/perm_group_location_selected\" />\n    <item android:drawable=\"@drawable/perm_group_location_normal\" />\n</selector>\n"
  },
  {
    "path": "sample/res/layout/simple_circles.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Copyright (C) 2011 Jake Wharton\n\n     Licensed under the Apache License, Version 2.0 (the \"License\");\n     you may not use this file except in compliance with the License.\n     You may obtain a copy of the License at\n\n          http://www.apache.org/licenses/LICENSE-2.0\n\n     Unless required by applicable law or agreed to in writing, software\n     distributed under the License is distributed on an \"AS IS\" BASIS,\n     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n     See the License for the specific language governing permissions and\n     limitations under the License.\n-->\n\n<LinearLayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:orientation=\"vertical\"\n    android:layout_width=\"fill_parent\"\n    android:layout_height=\"fill_parent\">\n\n    <android.support.v4.view.ViewPager\n        android:id=\"@+id/pager\"\n        android:layout_width=\"fill_parent\"\n        android:layout_height=\"0dp\"\n        android:layout_weight=\"1\"\n        />\n    <com.viewpagerindicator.CirclePageIndicator\n        android:id=\"@+id/indicator\"\n        android:padding=\"10dip\"\n        android:layout_height=\"wrap_content\"\n        android:layout_width=\"fill_parent\"\n        />\n</LinearLayout>"
  },
  {
    "path": "sample/res/layout/simple_circles_vertical.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Copyright (C) 2011 Jake Wharton\n\n     Licensed under the Apache License, Version 2.0 (the \"License\");\n     you may not use this file except in compliance with the License.\n     You may obtain a copy of the License at\n\n          http://www.apache.org/licenses/LICENSE-2.0\n\n     Unless required by applicable law or agreed to in writing, software\n     distributed under the License is distributed on an \"AS IS\" BASIS,\n     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n     See the License for the specific language governing permissions and\n     limitations under the License.\n-->\n\n<LinearLayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:orientation=\"horizontal\"\n    android:layout_width=\"fill_parent\"\n    android:layout_height=\"fill_parent\">\n\n    <com.directionalviewpager.DirectionalViewPager\n        android:id=\"@+id/pager\"\n        android:layout_width=\"0dp\"\n        android:layout_height=\"fill_parent\"\n        android:layout_weight=\"1\"\n        />\n    <com.viewpagerindicator.CirclePageIndicator\n        android:id=\"@+id/indicator\"\n        android:padding=\"10dip\"\n        android:layout_height=\"fill_parent\"\n        android:layout_width=\"wrap_content\"\n        />\n</LinearLayout>"
  },
  {
    "path": "sample/res/layout/simple_icons.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Copyright (C) 2011 Jake Wharton\n\n     Licensed under the Apache License, Version 2.0 (the \"License\");\n     you may not use this file except in compliance with the License.\n     You may obtain a copy of the License at\n\n          http://www.apache.org/licenses/LICENSE-2.0\n\n     Unless required by applicable law or agreed to in writing, software\n     distributed under the License is distributed on an \"AS IS\" BASIS,\n     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n     See the License for the specific language governing permissions and\n     limitations under the License.\n-->\n\n<LinearLayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:orientation=\"vertical\"\n    android:layout_width=\"fill_parent\"\n    android:layout_height=\"fill_parent\">\n\n    <android.support.v4.view.ViewPager\n        android:id=\"@+id/pager\"\n        android:layout_width=\"fill_parent\"\n        android:layout_height=\"0dp\"\n        android:layout_weight=\"1\"\n        />\n    <com.viewpagerindicator.IconPageIndicator\n        android:id=\"@+id/indicator\"\n        android:layout_height=\"wrap_content\"\n        android:layout_width=\"fill_parent\"\n        />\n\n</LinearLayout>"
  },
  {
    "path": "sample/res/layout/simple_lines.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Copyright (C) 2012 Jake Wharton\n\n     Licensed under the Apache License, Version 2.0 (the \"License\");\n     you may not use this file except in compliance with the License.\n     You may obtain a copy of the License at\n\n          http://www.apache.org/licenses/LICENSE-2.0\n\n     Unless required by applicable law or agreed to in writing, software\n     distributed under the License is distributed on an \"AS IS\" BASIS,\n     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n     See the License for the specific language governing permissions and\n     limitations under the License.\n-->\n\n<LinearLayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:orientation=\"vertical\"\n    android:layout_width=\"fill_parent\"\n    android:layout_height=\"fill_parent\">\n\n    <android.support.v4.view.ViewPager\n        android:id=\"@+id/pager\"\n        android:layout_width=\"fill_parent\"\n        android:layout_height=\"0dp\"\n        android:layout_weight=\"1\"\n        />\n    <com.viewpagerindicator.LinePageIndicator\n        android:id=\"@+id/indicator\"\n        android:padding=\"5dip\"\n        android:layout_height=\"wrap_content\"\n        android:layout_width=\"fill_parent\"\n        />\n</LinearLayout>"
  },
  {
    "path": "sample/res/layout/simple_tabs.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Copyright (C) 2011 Jake Wharton\n\n     Licensed under the Apache License, Version 2.0 (the \"License\");\n     you may not use this file except in compliance with the License.\n     You may obtain a copy of the License at\n\n          http://www.apache.org/licenses/LICENSE-2.0\n\n     Unless required by applicable law or agreed to in writing, software\n     distributed under the License is distributed on an \"AS IS\" BASIS,\n     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n     See the License for the specific language governing permissions and\n     limitations under the License.\n-->\n\n<LinearLayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:orientation=\"vertical\"\n    android:layout_width=\"fill_parent\"\n    android:layout_height=\"fill_parent\">\n\n    <com.viewpagerindicator.TabPageIndicator\n        android:id=\"@+id/indicator\"\n        android:layout_height=\"wrap_content\"\n        android:layout_width=\"fill_parent\"\n        />\n    <android.support.v4.view.ViewPager\n        android:id=\"@+id/pager\"\n        android:layout_width=\"fill_parent\"\n        android:layout_height=\"0dp\"\n        android:layout_weight=\"1\"\n        />\n\n</LinearLayout>"
  },
  {
    "path": "sample/res/layout/simple_titles.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Copyright (C) 2011 Jake Wharton\n\n     Licensed under the Apache License, Version 2.0 (the \"License\");\n     you may not use this file except in compliance with the License.\n     You may obtain a copy of the License at\n\n          http://www.apache.org/licenses/LICENSE-2.0\n\n     Unless required by applicable law or agreed to in writing, software\n     distributed under the License is distributed on an \"AS IS\" BASIS,\n     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n     See the License for the specific language governing permissions and\n     limitations under the License.\n-->\n\n<LinearLayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:orientation=\"vertical\"\n    android:layout_width=\"fill_parent\"\n    android:layout_height=\"fill_parent\">\n\n    <com.viewpagerindicator.TitlePageIndicator\n        android:id=\"@+id/indicator\"\n        android:padding=\"10dip\"\n        android:layout_height=\"wrap_content\"\n        android:layout_width=\"fill_parent\"\n        />\n    <android.support.v4.view.ViewPager\n        android:id=\"@+id/pager\"\n        android:layout_width=\"fill_parent\"\n        android:layout_height=\"0dp\"\n        android:layout_weight=\"1\"\n        />\n\n</LinearLayout>"
  },
  {
    "path": "sample/res/layout/simple_titles_bottom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Copyright (C) 2011 Jake Wharton\n\n     Licensed under the Apache License, Version 2.0 (the \"License\");\n     you may not use this file except in compliance with the License.\n     You may obtain a copy of the License at\n\n          http://www.apache.org/licenses/LICENSE-2.0\n\n     Unless required by applicable law or agreed to in writing, software\n     distributed under the License is distributed on an \"AS IS\" BASIS,\n     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n     See the License for the specific language governing permissions and\n     limitations under the License.\n-->\n\n<LinearLayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    android:orientation=\"vertical\"\n    android:layout_width=\"fill_parent\"\n    android:layout_height=\"fill_parent\">\n\n    <android.support.v4.view.ViewPager\n        android:id=\"@+id/pager\"\n        android:layout_width=\"fill_parent\"\n        android:layout_height=\"0dp\"\n        android:layout_weight=\"1\"\n        />\n    <com.viewpagerindicator.TitlePageIndicator\n        android:id=\"@+id/indicator\"\n        android:padding=\"10dip\"\n        android:layout_height=\"wrap_content\"\n        android:layout_width=\"fill_parent\"\n        app:linePosition=\"top\"\n        />\n\n</LinearLayout>"
  },
  {
    "path": "sample/res/layout/simple_underlines.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Copyright (C) 2012 Jake Wharton\n\n     Licensed under the Apache License, Version 2.0 (the \"License\");\n     you may not use this file except in compliance with the License.\n     You may obtain a copy of the License at\n\n          http://www.apache.org/licenses/LICENSE-2.0\n\n     Unless required by applicable law or agreed to in writing, software\n     distributed under the License is distributed on an \"AS IS\" BASIS,\n     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n     See the License for the specific language governing permissions and\n     limitations under the License.\n-->\n\n<LinearLayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:orientation=\"vertical\"\n    android:layout_width=\"fill_parent\"\n    android:layout_height=\"fill_parent\">\n\n    <android.support.v4.view.ViewPager\n        android:id=\"@+id/pager\"\n        android:layout_width=\"fill_parent\"\n        android:layout_height=\"0dp\"\n        android:layout_weight=\"1\"\n        />\n    <com.viewpagerindicator.UnderlinePageIndicator\n        android:id=\"@+id/indicator\"\n        android:layout_height=\"2dp\"\n        android:layout_width=\"fill_parent\"\n        />\n</LinearLayout>"
  },
  {
    "path": "sample/res/layout/themed_circles.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Copyright (C) 2011 Jake Wharton\n\n     Licensed under the Apache License, Version 2.0 (the \"License\");\n     you may not use this file except in compliance with the License.\n     You may obtain a copy of the License at\n\n          http://www.apache.org/licenses/LICENSE-2.0\n\n     Unless required by applicable law or agreed to in writing, software\n     distributed under the License is distributed on an \"AS IS\" BASIS,\n     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n     See the License for the specific language governing permissions and\n     limitations under the License.\n-->\n\n<LinearLayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    android:orientation=\"vertical\"\n    android:layout_width=\"fill_parent\"\n    android:layout_height=\"fill_parent\">\n\n    <android.support.v4.view.ViewPager\n        android:id=\"@+id/pager\"\n        android:layout_width=\"fill_parent\"\n        android:layout_height=\"0dp\"\n        android:layout_weight=\"1\"\n        />\n    <com.viewpagerindicator.CirclePageIndicator\n        android:id=\"@+id/indicator\"\n        android:padding=\"10dip\"\n        android:layout_height=\"wrap_content\"\n        android:layout_width=\"fill_parent\"\n        android:background=\"#FFCCCCCC\"\n        app:radius=\"10dp\"\n        app:fillColor=\"#FF888888\"\n        app:pageColor=\"#88FF0000\"\n        app:strokeColor=\"#FF000000\"\n        app:strokeWidth=\"2dp\"\n        />\n\n</LinearLayout>"
  },
  {
    "path": "sample/res/layout/themed_lines.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Copyright (C) 2012 Jake Wharton\n\n     Licensed under the Apache License, Version 2.0 (the \"License\");\n     you may not use this file except in compliance with the License.\n     You may obtain a copy of the License at\n\n          http://www.apache.org/licenses/LICENSE-2.0\n\n     Unless required by applicable law or agreed to in writing, software\n     distributed under the License is distributed on an \"AS IS\" BASIS,\n     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n     See the License for the specific language governing permissions and\n     limitations under the License.\n-->\n\n<LinearLayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    android:orientation=\"vertical\"\n    android:layout_width=\"fill_parent\"\n    android:layout_height=\"fill_parent\">\n\n    <android.support.v4.view.ViewPager\n        android:id=\"@+id/pager\"\n        android:layout_width=\"fill_parent\"\n        android:layout_height=\"0dp\"\n        android:layout_weight=\"1\"\n        />\n    <com.viewpagerindicator.LinePageIndicator\n        android:id=\"@+id/indicator\"\n        android:padding=\"5dip\"\n        android:layout_height=\"wrap_content\"\n        android:layout_width=\"fill_parent\"\n        app:strokeWidth=\"4dp\"\n        app:lineWidth=\"30dp\"\n        app:unselectedColor=\"#FF888888\"\n        app:selectedColor=\"#FF880000\"\n        />\n\n</LinearLayout>"
  },
  {
    "path": "sample/res/layout/themed_titles.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Copyright (C) 2011 Jake Wharton\n\n     Licensed under the Apache License, Version 2.0 (the \"License\");\n     you may not use this file except in compliance with the License.\n     You may obtain a copy of the License at\n\n          http://www.apache.org/licenses/LICENSE-2.0\n\n     Unless required by applicable law or agreed to in writing, software\n     distributed under the License is distributed on an \"AS IS\" BASIS,\n     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n     See the License for the specific language governing permissions and\n     limitations under the License.\n-->\n\n<LinearLayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    android:orientation=\"vertical\"\n    android:layout_width=\"fill_parent\"\n    android:layout_height=\"fill_parent\">\n\n    <com.viewpagerindicator.TitlePageIndicator\n        android:id=\"@+id/indicator\"\n        android:padding=\"10dip\"\n        android:layout_height=\"wrap_content\"\n        android:layout_width=\"fill_parent\"\n        android:background=\"#18FF0000\"\n        android:textColor=\"#AA000000\"\n        app:footerColor=\"#FFAA2222\"\n        app:footerLineHeight=\"1dp\"\n        app:footerIndicatorHeight=\"3dp\"\n        app:footerIndicatorStyle=\"underline\"\n        app:selectedColor=\"#FF000000\"\n        app:selectedBold=\"true\"\n        />\n    <android.support.v4.view.ViewPager\n        android:id=\"@+id/pager\"\n        android:layout_width=\"fill_parent\"\n        android:layout_height=\"0dp\"\n        android:layout_weight=\"1\"\n        />\n\n</LinearLayout>\n"
  },
  {
    "path": "sample/res/layout/themed_underlines.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Copyright (C) 2012 Jake Wharton\n\n     Licensed under the Apache License, Version 2.0 (the \"License\");\n     you may not use this file except in compliance with the License.\n     You may obtain a copy of the License at\n\n          http://www.apache.org/licenses/LICENSE-2.0\n\n     Unless required by applicable law or agreed to in writing, software\n     distributed under the License is distributed on an \"AS IS\" BASIS,\n     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n     See the License for the specific language governing permissions and\n     limitations under the License.\n-->\n\n<LinearLayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    android:orientation=\"vertical\"\n    android:layout_width=\"fill_parent\"\n    android:layout_height=\"fill_parent\">\n\n    <android.support.v4.view.ViewPager\n        android:id=\"@+id/pager\"\n        android:layout_width=\"fill_parent\"\n        android:layout_height=\"0dp\"\n        android:layout_weight=\"1\"\n        />\n    <com.viewpagerindicator.UnderlinePageIndicator\n        android:id=\"@+id/indicator\"\n        android:layout_height=\"2dp\"\n        android:layout_width=\"fill_parent\"\n        android:background=\"#FFCCCCCC\"\n        app:selectedColor=\"#FFCC0000\"\n        app:fadeDelay=\"1000\"\n        app:fadeLength=\"1000\"\n        />\n\n</LinearLayout>"
  },
  {
    "path": "sample/res/menu/menu.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<menu xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:id=\"@+id/random\" android:title=\"Random\" />\n    <item android:id=\"@+id/add_page\" android:title=\"Add Page\" />\n    <item android:id=\"@+id/remove_page\" android:title=\"Remove Page\" />\n</menu>\n"
  },
  {
    "path": "sample/res/values/styles.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Copyright (C) 2012 Jake Wharton\n\n     Licensed under the Apache License, Version 2.0 (the \"License\");\n     you may not use this file except in compliance with the License.\n     You may obtain a copy of the License at\n\n          http://www.apache.org/licenses/LICENSE-2.0\n\n     Unless required by applicable law or agreed to in writing, software\n     distributed under the License is distributed on an \"AS IS\" BASIS,\n     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n     See the License for the specific language governing permissions and\n     limitations under the License.\n-->\n\n<resources>\n    <style name=\"StyledIndicators\" parent=\"@android:style/Theme.Light\">\n        <item name=\"vpiCirclePageIndicatorStyle\">@style/CustomCirclePageIndicator</item>\n        <item name=\"vpiLinePageIndicatorStyle\">@style/CustomLinePageIndicator</item>\n        <item name=\"vpiTitlePageIndicatorStyle\">@style/CustomTitlePageIndicator</item>\n        <item name=\"vpiTabPageIndicatorStyle\">@style/CustomTabPageIndicator</item>\n        <item name=\"vpiUnderlinePageIndicatorStyle\">@style/CustomUnderlinePageIndicator</item>\n    </style>\n\n    <style name=\"CustomTitlePageIndicator\">\n        <item name=\"android:background\">#18FF0000</item>\n        <item name=\"footerColor\">#FFAA2222</item>\n        <item name=\"footerLineHeight\">1dp</item>\n        <item name=\"footerIndicatorHeight\">3dp</item>\n        <item name=\"footerIndicatorStyle\">underline</item>\n        <item name=\"android:textColor\">#AA000000</item>\n        <item name=\"selectedColor\">#FF000000</item>\n        <item name=\"selectedBold\">true</item>\n    </style>\n\n    <style name=\"CustomLinePageIndicator\">\n        <item name=\"strokeWidth\">4dp</item>\n        <item name=\"lineWidth\">30dp</item>\n        <item name=\"unselectedColor\">#FF888888</item>\n        <item name=\"selectedColor\">#FF880000</item>\n    </style>\n\n    <style name=\"CustomCirclePageIndicator\">\n        <item name=\"fillColor\">#FF888888</item>\n        <item name=\"strokeColor\">#FF000000</item>\n        <item name=\"strokeWidth\">2dp</item>\n        <item name=\"radius\">10dp</item>\n        <item name=\"centered\">true</item>\n    </style>\n\n    <style name=\"CustomTabPageIndicator\" parent=\"Widget.TabPageIndicator\">\n        <item name=\"android:background\">@drawable/custom_tab_indicator</item>\n        <item name=\"android:textAppearance\">@style/CustomTabPageIndicator.Text</item>\n        <item name=\"android:textColor\">#FF555555</item>\n        <item name=\"android:textSize\">16sp</item>\n        <item name=\"android:divider\">@drawable/custom_tab_indicator_divider</item>\n        <item name=\"android:dividerPadding\">10dp</item>\n        <item name=\"android:showDividers\">middle</item>\n        <item name=\"android:paddingLeft\">8dp</item>\n        <item name=\"android:paddingRight\">8dp</item>\n        <item name=\"android:fadingEdge\">horizontal</item>\n        <item name=\"android:fadingEdgeLength\">8dp</item>\n    </style>\n\n    <style name=\"CustomTabPageIndicator.Text\" parent=\"android:TextAppearance.Medium\">\n        <item name=\"android:typeface\">monospace</item>\n    </style>\n\n    <style name=\"CustomUnderlinePageIndicator\">\n        <item name=\"selectedColor\">#FFCC0000</item>\n        <item name=\"android:background\">#FFCCCCCC</item>\n        <item name=\"fadeLength\">1000</item>\n        <item name=\"fadeDelay\">1000</item>\n    </style>\n</resources>\n"
  },
  {
    "path": "sample/src/com/viewpagerindicator/sample/BaseSampleActivity.java",
    "content": "package com.viewpagerindicator.sample;\n\nimport java.util.Random;\n\nimport com.viewpagerindicator.PageIndicator;\n\nimport android.support.v4.app.FragmentActivity;\nimport android.support.v4.view.ViewPager;\nimport android.view.Menu;\nimport android.view.MenuItem;\nimport android.widget.Toast;\n\npublic abstract class BaseSampleActivity extends FragmentActivity {\n    private static final Random RANDOM = new Random();\n\n    TestFragmentAdapter mAdapter;\n    ViewPager mPager;\n    PageIndicator mIndicator;\n\n    @Override\n    public boolean onCreateOptionsMenu(Menu menu) {\n        getMenuInflater().inflate(R.menu.menu, menu);\n        return true;\n    }\n\n    @Override\n    public boolean onOptionsItemSelected(MenuItem item) {\n        switch (item.getItemId()) {\n            case R.id.random:\n                final int page = RANDOM.nextInt(mAdapter.getCount());\n                Toast.makeText(this, \"Changing to page \" + page, Toast.LENGTH_SHORT);\n                mPager.setCurrentItem(page);\n                return true;\n\n            case R.id.add_page:\n                if (mAdapter.getCount() < 10) {\n                    mAdapter.setCount(mAdapter.getCount() + 1);\n                    mIndicator.notifyDataSetChanged();\n                }\n                return true;\n\n            case R.id.remove_page:\n                if (mAdapter.getCount() > 1) {\n                    mAdapter.setCount(mAdapter.getCount() - 1);\n                    mIndicator.notifyDataSetChanged();\n                }\n                return true;\n        }\n        return super.onOptionsItemSelected(item);\n    }\n}\n"
  },
  {
    "path": "sample/src/com/viewpagerindicator/sample/ListSamples.java",
    "content": "package com.viewpagerindicator.sample;\r\n\r\nimport java.text.Collator;\r\nimport java.util.ArrayList;\r\nimport java.util.Collections;\r\nimport java.util.Comparator;\r\nimport java.util.HashMap;\r\nimport java.util.List;\r\nimport java.util.Map;\r\nimport android.app.ListActivity;\r\nimport android.content.Intent;\r\nimport android.content.pm.PackageManager;\r\nimport android.content.pm.ResolveInfo;\r\nimport android.os.Bundle;\r\nimport android.view.View;\r\nimport android.widget.ListView;\r\nimport android.widget.SimpleAdapter;\r\n\r\npublic class ListSamples extends ListActivity {\r\n\r\n    @Override\r\n    public void onCreate(Bundle savedInstanceState) {\r\n        super.onCreate(savedInstanceState);\r\n\r\n        Intent intent = getIntent();\r\n        String path = intent.getStringExtra(\"com.jakewharton.android.viewpagerindicator.sample.Path\");\r\n\r\n        if (path == null) {\r\n            path = \"\";\r\n        }\r\n\r\n        setListAdapter(new SimpleAdapter(this, getData(path),\r\n                android.R.layout.simple_list_item_1, new String[] { \"title\" },\r\n                new int[] { android.R.id.text1 }));\r\n        getListView().setTextFilterEnabled(true);\r\n    }\r\n\r\n    protected List<Map<String, Object>> getData(String prefix) {\r\n        List<Map<String, Object>> myData = new ArrayList<Map<String, Object>>();\r\n\r\n        Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);\r\n        mainIntent.addCategory(\"com.jakewharton.android.viewpagerindicator.sample.SAMPLE\");\r\n\r\n        PackageManager pm = getPackageManager();\r\n        List<ResolveInfo> list = pm.queryIntentActivities(mainIntent, 0);\r\n\r\n        if (null == list)\r\n            return myData;\r\n\r\n        String[] prefixPath;\r\n        String prefixWithSlash = prefix;\r\n\r\n        if (prefix.equals(\"\")) {\r\n            prefixPath = null;\r\n        } else {\r\n            prefixPath = prefix.split(\"/\");\r\n            prefixWithSlash = prefix + \"/\";\r\n        }\r\n\r\n        int len = list.size();\r\n\r\n        Map<String, Boolean> entries = new HashMap<String, Boolean>();\r\n\r\n        for (int i = 0; i < len; i++) {\r\n            ResolveInfo info = list.get(i);\r\n            CharSequence labelSeq = info.loadLabel(pm);\r\n            String label = labelSeq != null\r\n                    ? labelSeq.toString()\r\n                    : info.activityInfo.name;\r\n\r\n            if (prefixWithSlash.length() == 0 || label.startsWith(prefixWithSlash)) {\r\n\r\n                String[] labelPath = label.split(\"/\");\r\n\r\n                String nextLabel = prefixPath == null ? labelPath[0] : labelPath[prefixPath.length];\r\n\r\n                if ((prefixPath != null ? prefixPath.length : 0) == labelPath.length - 1) {\r\n                    addItem(myData, nextLabel, activityIntent(\r\n                            info.activityInfo.applicationInfo.packageName,\r\n                            info.activityInfo.name));\r\n                } else {\r\n                    if (entries.get(nextLabel) == null) {\r\n                        addItem(myData, nextLabel, browseIntent(prefix.equals(\"\") ? nextLabel : prefix + \"/\" + nextLabel));\r\n                        entries.put(nextLabel, true);\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n        Collections.sort(myData, NAME_COMPARATOR);\r\n\r\n        return myData;\r\n    }\r\n\r\n    private final static Comparator<Map<String, Object>> NAME_COMPARATOR =\r\n        new Comparator<Map<String, Object>>() {\r\n        private final Collator   collator = Collator.getInstance();\r\n\r\n        public int compare(Map<String, Object> map1, Map<String, Object> map2) {\r\n            return collator.compare(map1.get(\"title\"), map2.get(\"title\"));\r\n        }\r\n    };\r\n\r\n    protected Intent activityIntent(String pkg, String componentName) {\r\n        Intent result = new Intent();\r\n        result.setClassName(pkg, componentName);\r\n        return result;\r\n    }\r\n\r\n    protected Intent browseIntent(String path) {\r\n        Intent result = new Intent();\r\n        result.setClass(this, ListSamples.class);\r\n        result.putExtra(\"com.jakewharton.android.viewpagerindicator.sample.Path\", path);\r\n        return result;\r\n    }\r\n\r\n    protected void addItem(List<Map<String, Object>> data, String name, Intent intent) {\r\n        Map<String, Object> temp = new HashMap<String, Object>();\r\n        temp.put(\"title\", name);\r\n        temp.put(\"intent\", intent);\r\n        data.add(temp);\r\n    }\r\n\r\n    @Override\r\n    @SuppressWarnings(\"unchecked\")\r\n    protected void onListItemClick(ListView l, View v, int position, long id) {\r\n        Map<String, Object> map = (Map<String, Object>)l.getItemAtPosition(position);\r\n\r\n        Intent intent = (Intent) map.get(\"intent\");\r\n        startActivity(intent);\r\n    }\r\n}\r\n"
  },
  {
    "path": "sample/src/com/viewpagerindicator/sample/SampleCirclesDefault.java",
    "content": "package com.viewpagerindicator.sample;\n\nimport android.os.Bundle;\nimport android.support.v4.view.ViewPager;\nimport com.viewpagerindicator.CirclePageIndicator;\n\npublic class SampleCirclesDefault extends BaseSampleActivity {\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.simple_circles);\n\n        mAdapter = new TestFragmentAdapter(getSupportFragmentManager());\n\n        mPager = (ViewPager)findViewById(R.id.pager);\n        mPager.setAdapter(mAdapter);\n\n        mIndicator = (CirclePageIndicator)findViewById(R.id.indicator);\n        mIndicator.setViewPager(mPager);\n    }\n}"
  },
  {
    "path": "sample/src/com/viewpagerindicator/sample/SampleCirclesInitialPage.java",
    "content": "package com.viewpagerindicator.sample;\n\nimport android.os.Bundle;\nimport android.support.v4.view.ViewPager;\nimport com.viewpagerindicator.CirclePageIndicator;\n\npublic class SampleCirclesInitialPage extends BaseSampleActivity {\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.simple_circles);\n\n        mAdapter = new TestFragmentAdapter(getSupportFragmentManager());\n\n        mPager = (ViewPager)findViewById(R.id.pager);\n        mPager.setAdapter(mAdapter);\n\n        mIndicator = (CirclePageIndicator)findViewById(R.id.indicator);\n        mIndicator.setViewPager(mPager);\n        mIndicator.setCurrentItem(mAdapter.getCount() - 1);\n\n        //You can also do: indicator.setViewPager(pager, initialPage);\n    }\n}"
  },
  {
    "path": "sample/src/com/viewpagerindicator/sample/SampleCirclesSnap.java",
    "content": "package com.viewpagerindicator.sample;\n\nimport android.os.Bundle;\nimport android.support.v4.view.ViewPager;\nimport com.viewpagerindicator.CirclePageIndicator;\n\npublic class SampleCirclesSnap extends BaseSampleActivity {\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.simple_circles);\n\n        mAdapter = new TestFragmentAdapter(getSupportFragmentManager());\n\n        mPager = (ViewPager)findViewById(R.id.pager);\n        mPager.setAdapter(mAdapter);\n\n        CirclePageIndicator indicator = (CirclePageIndicator)findViewById(R.id.indicator);\n        mIndicator = indicator;\n        indicator.setViewPager(mPager);\n        indicator.setSnap(true);\n    }\n}"
  },
  {
    "path": "sample/src/com/viewpagerindicator/sample/SampleCirclesStyledLayout.java",
    "content": "package com.viewpagerindicator.sample;\n\nimport android.os.Bundle;\nimport android.support.v4.view.ViewPager;\nimport com.viewpagerindicator.CirclePageIndicator;\n\npublic class SampleCirclesStyledLayout extends BaseSampleActivity {\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.themed_circles);\n\n        mAdapter = new TestFragmentAdapter(getSupportFragmentManager());\n\n        mPager = (ViewPager)findViewById(R.id.pager);\n        mPager.setAdapter(mAdapter);\n\n        mIndicator = (CirclePageIndicator)findViewById(R.id.indicator);\n        mIndicator.setViewPager(mPager);\n    }\n}"
  },
  {
    "path": "sample/src/com/viewpagerindicator/sample/SampleCirclesStyledMethods.java",
    "content": "package com.viewpagerindicator.sample;\n\nimport android.os.Bundle;\nimport android.support.v4.view.ViewPager;\nimport com.viewpagerindicator.CirclePageIndicator;\n\npublic class SampleCirclesStyledMethods extends BaseSampleActivity {\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.simple_circles);\n\n        mAdapter = new TestFragmentAdapter(getSupportFragmentManager());\n\n        mPager = (ViewPager)findViewById(R.id.pager);\n        mPager.setAdapter(mAdapter);\n\n        CirclePageIndicator indicator = (CirclePageIndicator)findViewById(R.id.indicator);\n        mIndicator = indicator;\n        indicator.setViewPager(mPager);\n\n        final float density = getResources().getDisplayMetrics().density;\n        indicator.setBackgroundColor(0xFFCCCCCC);\n        indicator.setRadius(10 * density);\n        indicator.setPageColor(0x880000FF);\n        indicator.setFillColor(0xFF888888);\n        indicator.setStrokeColor(0xFF000000);\n        indicator.setStrokeWidth(2 * density);\n    }\n}"
  },
  {
    "path": "sample/src/com/viewpagerindicator/sample/SampleCirclesStyledTheme.java",
    "content": "package com.viewpagerindicator.sample;\n\nimport android.os.Bundle;\nimport android.support.v4.view.ViewPager;\nimport com.viewpagerindicator.CirclePageIndicator;\n\npublic class SampleCirclesStyledTheme extends BaseSampleActivity {\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n\n        //The look of this sample is set via a style in the manifest\n        setContentView(R.layout.simple_circles);\n\n        mAdapter = new TestFragmentAdapter(getSupportFragmentManager());\n\n        mPager = (ViewPager)findViewById(R.id.pager);\n        mPager.setAdapter(mAdapter);\n\n        mIndicator = (CirclePageIndicator)findViewById(R.id.indicator);\n        mIndicator.setViewPager(mPager);\n    }\n}"
  },
  {
    "path": "sample/src/com/viewpagerindicator/sample/SampleCirclesWithListener.java",
    "content": "package com.viewpagerindicator.sample;\n\nimport android.os.Bundle;\nimport android.support.v4.view.ViewPager;\nimport android.widget.Toast;\nimport com.viewpagerindicator.CirclePageIndicator;\n\npublic class SampleCirclesWithListener extends BaseSampleActivity {\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.simple_circles);\n\n        mAdapter = new TestFragmentAdapter(getSupportFragmentManager());\n\n        mPager = (ViewPager)findViewById(R.id.pager);\n        mPager.setAdapter(mAdapter);\n\n        mIndicator = (CirclePageIndicator)findViewById(R.id.indicator);\n        mIndicator.setViewPager(mPager);\n\n        //We set this on the indicator, NOT the pager\n        mIndicator.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {\n            @Override\n            public void onPageSelected(int position) {\n                Toast.makeText(SampleCirclesWithListener.this, \"Changed to page \" + position, Toast.LENGTH_SHORT).show();\n            }\n\n            @Override\n            public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {\n            }\n\n            @Override\n            public void onPageScrollStateChanged(int state) {\n            }\n        });\n    }\n}"
  },
  {
    "path": "sample/src/com/viewpagerindicator/sample/SampleIconsDefault.java",
    "content": "package com.viewpagerindicator.sample;\n\nimport android.os.Bundle;\nimport android.support.v4.view.ViewPager;\nimport com.viewpagerindicator.IconPageIndicator;\n\npublic class SampleIconsDefault extends BaseSampleActivity {\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.simple_icons);\n\n        mAdapter = new TestFragmentAdapter(getSupportFragmentManager());\n\n        mPager = (ViewPager)findViewById(R.id.pager);\n        mPager.setAdapter(mAdapter);\n\n        mIndicator = (IconPageIndicator)findViewById(R.id.indicator);\n        mIndicator.setViewPager(mPager);\n    }\n}\n"
  },
  {
    "path": "sample/src/com/viewpagerindicator/sample/SampleLinesDefault.java",
    "content": "package com.viewpagerindicator.sample;\n\nimport android.os.Bundle;\nimport android.support.v4.view.ViewPager;\nimport com.viewpagerindicator.LinePageIndicator;\n\npublic class SampleLinesDefault extends BaseSampleActivity {\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.simple_lines);\n\n        mAdapter = new TestFragmentAdapter(getSupportFragmentManager());\n\n        mPager = (ViewPager)findViewById(R.id.pager);\n        mPager.setAdapter(mAdapter);\n\n        mIndicator = (LinePageIndicator)findViewById(R.id.indicator);\n        mIndicator.setViewPager(mPager);\n    }\n}"
  },
  {
    "path": "sample/src/com/viewpagerindicator/sample/SampleLinesStyledLayout.java",
    "content": "package com.viewpagerindicator.sample;\n\nimport android.os.Bundle;\nimport android.support.v4.view.ViewPager;\nimport com.viewpagerindicator.LinePageIndicator;\n\npublic class SampleLinesStyledLayout extends BaseSampleActivity {\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.themed_lines);\n\n        mAdapter = new TestFragmentAdapter(getSupportFragmentManager());\n\n        mPager = (ViewPager)findViewById(R.id.pager);\n        mPager.setAdapter(mAdapter);\n\n        mIndicator = (LinePageIndicator)findViewById(R.id.indicator);\n        mIndicator.setViewPager(mPager);\n    }\n}"
  },
  {
    "path": "sample/src/com/viewpagerindicator/sample/SampleLinesStyledMethods.java",
    "content": "package com.viewpagerindicator.sample;\n\nimport android.os.Bundle;\nimport android.support.v4.view.ViewPager;\nimport com.viewpagerindicator.LinePageIndicator;\n\npublic class SampleLinesStyledMethods extends BaseSampleActivity {\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.simple_lines);\n\n        mAdapter = new TestFragmentAdapter(getSupportFragmentManager());\n\n        mPager = (ViewPager)findViewById(R.id.pager);\n        mPager.setAdapter(mAdapter);\n\n        LinePageIndicator indicator = (LinePageIndicator)findViewById(R.id.indicator);\n        mIndicator = indicator;\n        indicator.setViewPager(mPager);\n\n        final float density = getResources().getDisplayMetrics().density;\n        indicator.setSelectedColor(0x88FF0000);\n        indicator.setUnselectedColor(0xFF888888);\n        indicator.setStrokeWidth(4 * density);\n        indicator.setLineWidth(30 * density);\n    }\n}"
  },
  {
    "path": "sample/src/com/viewpagerindicator/sample/SampleLinesStyledTheme.java",
    "content": "package com.viewpagerindicator.sample;\n\nimport android.os.Bundle;\nimport android.support.v4.view.ViewPager;\nimport com.viewpagerindicator.LinePageIndicator;\n\npublic class SampleLinesStyledTheme extends BaseSampleActivity {\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n\n        //The look of this sample is set via a style in the manifest\n        setContentView(R.layout.simple_lines);\n\n        mAdapter = new TestFragmentAdapter(getSupportFragmentManager());\n\n        mPager = (ViewPager)findViewById(R.id.pager);\n        mPager.setAdapter(mAdapter);\n\n        mIndicator = (LinePageIndicator)findViewById(R.id.indicator);\n        mIndicator.setViewPager(mPager);\n    }\n}"
  },
  {
    "path": "sample/src/com/viewpagerindicator/sample/SampleTabsDefault.java",
    "content": "package com.viewpagerindicator.sample;\n\nimport android.os.Bundle;\nimport android.support.v4.app.Fragment;\nimport android.support.v4.app.FragmentActivity;\nimport android.support.v4.app.FragmentManager;\nimport android.support.v4.app.FragmentPagerAdapter;\nimport android.support.v4.view.ViewPager;\nimport com.viewpagerindicator.TabPageIndicator;\n\npublic class SampleTabsDefault extends FragmentActivity {\n    private static final String[] CONTENT = new String[] { \"Recent\", \"Artists\", \"Albums\", \"Songs\", \"Playlists\", \"Genres\" };\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.simple_tabs);\n\n        FragmentPagerAdapter adapter = new GoogleMusicAdapter(getSupportFragmentManager());\n\n        ViewPager pager = (ViewPager)findViewById(R.id.pager);\n        pager.setAdapter(adapter);\n\n        TabPageIndicator indicator = (TabPageIndicator)findViewById(R.id.indicator);\n        indicator.setViewPager(pager);\n    }\n\n    class GoogleMusicAdapter extends FragmentPagerAdapter {\n        public GoogleMusicAdapter(FragmentManager fm) {\n            super(fm);\n        }\n\n        @Override\n        public Fragment getItem(int position) {\n            return TestFragment.newInstance(CONTENT[position % CONTENT.length]);\n        }\n\n        @Override\n        public CharSequence getPageTitle(int position) {\n            return CONTENT[position % CONTENT.length].toUpperCase();\n        }\n\n        @Override\n        public int getCount() {\n          return CONTENT.length;\n        }\n    }\n}\n"
  },
  {
    "path": "sample/src/com/viewpagerindicator/sample/SampleTabsStyled.java",
    "content": "package com.viewpagerindicator.sample;\n\nimport android.os.Bundle;\nimport android.support.v4.app.Fragment;\nimport android.support.v4.app.FragmentActivity;\nimport android.support.v4.app.FragmentManager;\nimport android.support.v4.app.FragmentPagerAdapter;\nimport android.support.v4.view.ViewPager;\nimport com.viewpagerindicator.TabPageIndicator;\n\npublic class SampleTabsStyled extends FragmentActivity {\n    private static final String[] CONTENT = new String[] { \"Recent\", \"Artists\", \"Albums\", \"Songs\", \"Playlists\", \"Genres\" };\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.simple_tabs);\n\n        FragmentPagerAdapter adapter = new GoogleMusicAdapter(getSupportFragmentManager());\n\n        ViewPager pager = (ViewPager)findViewById(R.id.pager);\n        pager.setAdapter(adapter);\n\n        TabPageIndicator indicator = (TabPageIndicator)findViewById(R.id.indicator);\n        indicator.setViewPager(pager);\n    }\n\n    class GoogleMusicAdapter extends FragmentPagerAdapter {\n        public GoogleMusicAdapter(FragmentManager fm) {\n            super(fm);\n        }\n\n        @Override\n        public Fragment getItem(int position) {\n            return TestFragment.newInstance(CONTENT[position % CONTENT.length]);\n        }\n\n        @Override\n        public CharSequence getPageTitle(int position) {\n            return CONTENT[position % CONTENT.length].toUpperCase();\n        }\n\n        @Override\n        public int getCount() {\n            return CONTENT.length;\n        }\n    }\n}\n"
  },
  {
    "path": "sample/src/com/viewpagerindicator/sample/SampleTabsWithIcons.java",
    "content": "package com.viewpagerindicator.sample;\n\nimport android.os.Bundle;\nimport android.support.v4.app.Fragment;\nimport android.support.v4.app.FragmentActivity;\nimport android.support.v4.app.FragmentManager;\nimport android.support.v4.app.FragmentPagerAdapter;\nimport android.support.v4.view.ViewPager;\nimport com.viewpagerindicator.IconPagerAdapter;\nimport com.viewpagerindicator.TabPageIndicator;\n\npublic class SampleTabsWithIcons extends FragmentActivity {\n    private static final String[] CONTENT = new String[] { \"Calendar\", \"Camera\", \"Alarms\", \"Location\" };\n    private static final int[] ICONS = new int[] {\n            R.drawable.perm_group_calendar,\n            R.drawable.perm_group_camera,\n            R.drawable.perm_group_device_alarms,\n            R.drawable.perm_group_location,\n    };\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.simple_tabs);\n\n        FragmentPagerAdapter adapter = new GoogleMusicAdapter(getSupportFragmentManager());\n\n        ViewPager pager = (ViewPager)findViewById(R.id.pager);\n        pager.setAdapter(adapter);\n\n        TabPageIndicator indicator = (TabPageIndicator)findViewById(R.id.indicator);\n        indicator.setViewPager(pager);\n    }\n\n    class GoogleMusicAdapter extends FragmentPagerAdapter implements IconPagerAdapter {\n        public GoogleMusicAdapter(FragmentManager fm) {\n            super(fm);\n        }\n\n        @Override\n        public Fragment getItem(int position) {\n            return TestFragment.newInstance(CONTENT[position % CONTENT.length]);\n        }\n\n        @Override\n        public CharSequence getPageTitle(int position) {\n            return CONTENT[position % CONTENT.length].toUpperCase();\n        }\n\n        @Override public int getIconResId(int index) {\n          return ICONS[index];\n        }\n\n      @Override\n        public int getCount() {\n          return CONTENT.length;\n        }\n    }\n}\n"
  },
  {
    "path": "sample/src/com/viewpagerindicator/sample/SampleTitlesBottom.java",
    "content": "package com.viewpagerindicator.sample;\n\nimport android.os.Bundle;\nimport android.support.v4.view.ViewPager;\nimport com.viewpagerindicator.TitlePageIndicator;\n\npublic class SampleTitlesBottom extends BaseSampleActivity {\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.simple_titles_bottom);\n\n        mAdapter = new TestFragmentAdapter(getSupportFragmentManager());\n\n        mPager = (ViewPager)findViewById(R.id.pager);\n        mPager.setAdapter(mAdapter);\n\n        mIndicator = (TitlePageIndicator)findViewById(R.id.indicator);\n        mIndicator.setViewPager(mPager);\n    }\n}"
  },
  {
    "path": "sample/src/com/viewpagerindicator/sample/SampleTitlesCenterClickListener.java",
    "content": "package com.viewpagerindicator.sample;\n\nimport android.os.Bundle;\nimport android.support.v4.view.ViewPager;\nimport android.widget.Toast;\n\nimport com.viewpagerindicator.TitlePageIndicator;\nimport com.viewpagerindicator.TitlePageIndicator.IndicatorStyle;\nimport com.viewpagerindicator.TitlePageIndicator.OnCenterItemClickListener;\n\npublic class SampleTitlesCenterClickListener extends BaseSampleActivity implements OnCenterItemClickListener {\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.simple_titles);\n\n        mAdapter = new TestFragmentAdapter(getSupportFragmentManager());\n\n        mPager = (ViewPager)findViewById(R.id.pager);\n        mPager.setAdapter(mAdapter);\n\n        TitlePageIndicator indicator = (TitlePageIndicator)findViewById(R.id.indicator);\n        indicator.setViewPager(mPager);\n        indicator.setFooterIndicatorStyle(IndicatorStyle.Underline);\n        indicator.setOnCenterItemClickListener(this);\n        mIndicator = indicator;\n    }\n\n    @Override\n    public void onCenterItemClick(int position) {\n        Toast.makeText(this, \"You clicked the center title!\", Toast.LENGTH_SHORT).show();\n    }\n}"
  },
  {
    "path": "sample/src/com/viewpagerindicator/sample/SampleTitlesDefault.java",
    "content": "package com.viewpagerindicator.sample;\n\nimport android.os.Bundle;\nimport android.support.v4.view.ViewPager;\n\nimport com.viewpagerindicator.TitlePageIndicator;\n\npublic class SampleTitlesDefault extends BaseSampleActivity {\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.simple_titles);\n\n        mAdapter = new TestFragmentAdapter(getSupportFragmentManager());\n\n        mPager = (ViewPager)findViewById(R.id.pager);\n        mPager.setAdapter(mAdapter);\n\n        mIndicator = (TitlePageIndicator)findViewById(R.id.indicator);\n        mIndicator.setViewPager(mPager);\n    }\n}"
  },
  {
    "path": "sample/src/com/viewpagerindicator/sample/SampleTitlesInitialPage.java",
    "content": "package com.viewpagerindicator.sample;\n\nimport android.os.Bundle;\nimport android.support.v4.view.ViewPager;\n\nimport com.viewpagerindicator.TitlePageIndicator;\n\npublic class SampleTitlesInitialPage extends BaseSampleActivity {\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.simple_titles);\n\n        mAdapter = new TestFragmentAdapter(getSupportFragmentManager());\n\n        mPager = (ViewPager)findViewById(R.id.pager);\n        mPager.setAdapter(mAdapter);\n\n        mIndicator = (TitlePageIndicator)findViewById(R.id.indicator);\n        mIndicator.setViewPager(mPager);\n        mIndicator.setCurrentItem(mAdapter.getCount() - 1);\n\n        //You can also do: indicator.setViewPager(pager, initialPage);\n    }\n}"
  },
  {
    "path": "sample/src/com/viewpagerindicator/sample/SampleTitlesStyledLayout.java",
    "content": "package com.viewpagerindicator.sample;\n\nimport android.os.Bundle;\nimport android.support.v4.view.ViewPager;\n\nimport com.viewpagerindicator.TitlePageIndicator;\n\npublic class SampleTitlesStyledLayout extends BaseSampleActivity {\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.themed_titles);\n\n        mAdapter = new TestFragmentAdapter(getSupportFragmentManager());\n\n        mPager = (ViewPager)findViewById(R.id.pager);\n        mPager.setAdapter(mAdapter);\n\n        mIndicator = (TitlePageIndicator)findViewById(R.id.indicator);\n        mIndicator.setViewPager(mPager);\n    }\n}"
  },
  {
    "path": "sample/src/com/viewpagerindicator/sample/SampleTitlesStyledMethods.java",
    "content": "package com.viewpagerindicator.sample;\n\nimport android.os.Bundle;\nimport android.support.v4.view.ViewPager;\n\nimport com.viewpagerindicator.TitlePageIndicator;\nimport com.viewpagerindicator.TitlePageIndicator.IndicatorStyle;\n\npublic class SampleTitlesStyledMethods extends BaseSampleActivity {\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.simple_titles);\n\n        mAdapter = new TestFragmentAdapter(getSupportFragmentManager());\n\n        mPager = (ViewPager)findViewById(R.id.pager);\n        mPager.setAdapter(mAdapter);\n\n        TitlePageIndicator indicator = (TitlePageIndicator)findViewById(R.id.indicator);\n        mIndicator = indicator;\n        indicator.setViewPager(mPager);\n\n        final float density = getResources().getDisplayMetrics().density;\n        indicator.setBackgroundColor(0x18FF0000);\n        indicator.setFooterColor(0xFFAA2222);\n        indicator.setFooterLineHeight(1 * density); //1dp\n        indicator.setFooterIndicatorHeight(3 * density); //3dp\n        indicator.setFooterIndicatorStyle(IndicatorStyle.Underline);\n        indicator.setTextColor(0xAA000000);\n        indicator.setSelectedColor(0xFF000000);\n        indicator.setSelectedBold(true);\n    }\n}"
  },
  {
    "path": "sample/src/com/viewpagerindicator/sample/SampleTitlesStyledTheme.java",
    "content": "package com.viewpagerindicator.sample;\n\nimport android.os.Bundle;\nimport android.support.v4.view.ViewPager;\n\nimport com.viewpagerindicator.TitlePageIndicator;\n\npublic class SampleTitlesStyledTheme extends BaseSampleActivity {\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n\n        //The look of this sample is set via a style in the manifest\n        setContentView(R.layout.simple_titles);\n\n        mAdapter = new TestFragmentAdapter(getSupportFragmentManager());\n\n        mPager = (ViewPager)findViewById(R.id.pager);\n        mPager.setAdapter(mAdapter);\n\n        mIndicator = (TitlePageIndicator)findViewById(R.id.indicator);\n        mIndicator.setViewPager(mPager);\n    }\n}"
  },
  {
    "path": "sample/src/com/viewpagerindicator/sample/SampleTitlesTriangle.java",
    "content": "package com.viewpagerindicator.sample;\n\nimport android.os.Bundle;\nimport android.support.v4.view.ViewPager;\n\nimport com.viewpagerindicator.TitlePageIndicator;\nimport com.viewpagerindicator.TitlePageIndicator.IndicatorStyle;\n\npublic class SampleTitlesTriangle extends BaseSampleActivity {\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.simple_titles);\n\n        mAdapter = new TestFragmentAdapter(getSupportFragmentManager());\n\n        mPager = (ViewPager)findViewById(R.id.pager);\n        mPager.setAdapter(mAdapter);\n\n        TitlePageIndicator indicator = (TitlePageIndicator)findViewById(R.id.indicator);\n        indicator.setViewPager(mPager);\n        indicator.setFooterIndicatorStyle(IndicatorStyle.Triangle);\n        mIndicator = indicator;\n    }\n}"
  },
  {
    "path": "sample/src/com/viewpagerindicator/sample/SampleTitlesWithListener.java",
    "content": "package com.viewpagerindicator.sample;\n\nimport android.os.Bundle;\nimport android.support.v4.view.ViewPager;\nimport android.widget.Toast;\n\nimport com.viewpagerindicator.TitlePageIndicator;\n\npublic class SampleTitlesWithListener extends BaseSampleActivity {\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.simple_titles);\n\n        mAdapter = new TestFragmentAdapter(getSupportFragmentManager());\n\n        mPager = (ViewPager)findViewById(R.id.pager);\n        mPager.setAdapter(mAdapter);\n\n        mIndicator = (TitlePageIndicator)findViewById(R.id.indicator);\n        mIndicator.setViewPager(mPager);\n\n        //We set this on the indicator, NOT the pager\n        mIndicator.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {\n            @Override\n            public void onPageSelected(int position) {\n                Toast.makeText(SampleTitlesWithListener.this, \"Changed to page \" + position, Toast.LENGTH_SHORT).show();\n            }\n\n            @Override\n            public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {\n            }\n\n            @Override\n            public void onPageScrollStateChanged(int state) {\n            }\n        });\n    }\n}"
  },
  {
    "path": "sample/src/com/viewpagerindicator/sample/SampleUnderlinesDefault.java",
    "content": "package com.viewpagerindicator.sample;\n\nimport android.os.Bundle;\nimport android.support.v4.view.ViewPager;\nimport com.viewpagerindicator.UnderlinePageIndicator;\n\npublic class SampleUnderlinesDefault extends BaseSampleActivity {\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.simple_underlines);\n\n        mAdapter = new TestFragmentAdapter(getSupportFragmentManager());\n\n        mPager = (ViewPager)findViewById(R.id.pager);\n        mPager.setAdapter(mAdapter);\n\n        mIndicator = (UnderlinePageIndicator)findViewById(R.id.indicator);\n        mIndicator.setViewPager(mPager);\n    }\n}"
  },
  {
    "path": "sample/src/com/viewpagerindicator/sample/SampleUnderlinesNoFade.java",
    "content": "package com.viewpagerindicator.sample;\n\nimport android.os.Bundle;\nimport android.support.v4.view.ViewPager;\nimport com.viewpagerindicator.UnderlinePageIndicator;\n\npublic class SampleUnderlinesNoFade extends BaseSampleActivity {\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.simple_underlines);\n\n        mAdapter = new TestFragmentAdapter(getSupportFragmentManager());\n\n        mPager = (ViewPager)findViewById(R.id.pager);\n        mPager.setAdapter(mAdapter);\n\n        UnderlinePageIndicator indicator = (UnderlinePageIndicator)findViewById(R.id.indicator);\n        indicator.setViewPager(mPager);\n        indicator.setFades(false);\n        mIndicator = indicator;\n    }\n}"
  },
  {
    "path": "sample/src/com/viewpagerindicator/sample/SampleUnderlinesStyledLayout.java",
    "content": "package com.viewpagerindicator.sample;\n\nimport android.os.Bundle;\nimport android.support.v4.view.ViewPager;\nimport com.viewpagerindicator.UnderlinePageIndicator;\n\npublic class SampleUnderlinesStyledLayout extends BaseSampleActivity {\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.themed_underlines);\n\n        mAdapter = new TestFragmentAdapter(getSupportFragmentManager());\n\n        mPager = (ViewPager)findViewById(R.id.pager);\n        mPager.setAdapter(mAdapter);\n\n        mIndicator = (UnderlinePageIndicator)findViewById(R.id.indicator);\n        mIndicator.setViewPager(mPager);\n    }\n}"
  },
  {
    "path": "sample/src/com/viewpagerindicator/sample/SampleUnderlinesStyledMethods.java",
    "content": "package com.viewpagerindicator.sample;\n\nimport android.os.Bundle;\nimport android.support.v4.view.ViewPager;\nimport com.viewpagerindicator.UnderlinePageIndicator;\n\npublic class SampleUnderlinesStyledMethods extends BaseSampleActivity {\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.simple_underlines);\n\n        mAdapter = new TestFragmentAdapter(getSupportFragmentManager());\n\n        mPager = (ViewPager)findViewById(R.id.pager);\n        mPager.setAdapter(mAdapter);\n\n        UnderlinePageIndicator indicator = (UnderlinePageIndicator)findViewById(R.id.indicator);\n        mIndicator = indicator;\n        indicator.setViewPager(mPager);\n        indicator.setSelectedColor(0xFFCC0000);\n        indicator.setBackgroundColor(0xFFCCCCCC);\n        indicator.setFadeDelay(1000);\n        indicator.setFadeLength(1000);\n    }\n}"
  },
  {
    "path": "sample/src/com/viewpagerindicator/sample/SampleUnderlinesStyledTheme.java",
    "content": "package com.viewpagerindicator.sample;\n\nimport android.os.Bundle;\nimport android.support.v4.view.ViewPager;\nimport com.viewpagerindicator.UnderlinePageIndicator;\n\npublic class SampleUnderlinesStyledTheme extends BaseSampleActivity {\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n\n        //The look of this sample is set via a style in the manifest\n        setContentView(R.layout.simple_underlines);\n\n        mAdapter = new TestFragmentAdapter(getSupportFragmentManager());\n\n        mPager = (ViewPager)findViewById(R.id.pager);\n        mPager.setAdapter(mAdapter);\n\n        mIndicator = (UnderlinePageIndicator)findViewById(R.id.indicator);\n        mIndicator.setViewPager(mPager);\n    }\n}"
  },
  {
    "path": "sample/src/com/viewpagerindicator/sample/TestFragment.java",
    "content": "package com.viewpagerindicator.sample;\r\n\r\nimport android.os.Bundle;\r\nimport android.support.v4.app.Fragment;\r\nimport android.view.Gravity;\r\nimport android.view.LayoutInflater;\r\nimport android.view.View;\r\nimport android.view.ViewGroup;\r\nimport android.widget.LinearLayout;\r\nimport android.widget.LinearLayout.LayoutParams;\r\nimport android.widget.TextView;\r\n\r\npublic final class TestFragment extends Fragment {\r\n    private static final String KEY_CONTENT = \"TestFragment:Content\";\r\n\r\n    public static TestFragment newInstance(String content) {\r\n        TestFragment fragment = new TestFragment();\r\n\r\n        StringBuilder builder = new StringBuilder();\r\n        for (int i = 0; i < 20; i++) {\r\n            builder.append(content).append(\" \");\r\n        }\r\n        builder.deleteCharAt(builder.length() - 1);\r\n        fragment.mContent = builder.toString();\r\n\r\n        return fragment;\r\n    }\r\n\r\n    private String mContent = \"???\";\r\n\r\n    @Override\r\n    public void onCreate(Bundle savedInstanceState) {\r\n        super.onCreate(savedInstanceState);\r\n\r\n        if ((savedInstanceState != null) && savedInstanceState.containsKey(KEY_CONTENT)) {\r\n            mContent = savedInstanceState.getString(KEY_CONTENT);\r\n        }\r\n    }\r\n\r\n    @Override\r\n    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {\r\n        TextView text = new TextView(getActivity());\r\n        text.setGravity(Gravity.CENTER);\r\n        text.setText(mContent);\r\n        text.setTextSize(20 * getResources().getDisplayMetrics().density);\r\n        text.setPadding(20, 20, 20, 20);\r\n\r\n        LinearLayout layout = new LinearLayout(getActivity());\r\n        layout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));\r\n        layout.setGravity(Gravity.CENTER);\r\n        layout.addView(text);\r\n\r\n        return layout;\r\n    }\r\n\r\n    @Override\r\n    public void onSaveInstanceState(Bundle outState) {\r\n        super.onSaveInstanceState(outState);\r\n        outState.putString(KEY_CONTENT, mContent);\r\n    }\r\n}\r\n"
  },
  {
    "path": "sample/src/com/viewpagerindicator/sample/TestFragmentAdapter.java",
    "content": "package com.viewpagerindicator.sample;\r\n\r\nimport android.support.v4.app.Fragment;\r\nimport android.support.v4.app.FragmentManager;\r\nimport android.support.v4.app.FragmentPagerAdapter;\r\nimport com.viewpagerindicator.IconPagerAdapter;\r\n\r\nclass TestFragmentAdapter extends FragmentPagerAdapter implements IconPagerAdapter {\r\n    protected static final String[] CONTENT = new String[] { \"This\", \"Is\", \"A\", \"Test\", };\r\n    protected static final int[] ICONS = new int[] {\r\n            R.drawable.perm_group_calendar,\r\n            R.drawable.perm_group_camera,\r\n            R.drawable.perm_group_device_alarms,\r\n            R.drawable.perm_group_location\r\n    };\r\n\r\n    private int mCount = CONTENT.length;\r\n\r\n    public TestFragmentAdapter(FragmentManager fm) {\r\n        super(fm);\r\n    }\r\n\r\n    @Override\r\n    public Fragment getItem(int position) {\r\n        return TestFragment.newInstance(CONTENT[position % CONTENT.length]);\r\n    }\r\n\r\n    @Override\r\n    public int getCount() {\r\n        return mCount;\r\n    }\r\n\r\n    @Override\r\n    public CharSequence getPageTitle(int position) {\r\n      return TestFragmentAdapter.CONTENT[position % CONTENT.length];\r\n    }\r\n\r\n    @Override\r\n    public int getIconResId(int index) {\r\n      return ICONS[index % ICONS.length];\r\n    }\r\n\r\n    public void setCount(int count) {\r\n        if (count > 0 && count <= 10) {\r\n            mCount = count;\r\n            notifyDataSetChanged();\r\n        }\r\n    }\r\n}"
  }
]