├── .gitignore ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE.txt ├── README.md ├── art ├── demo1.gif ├── demo2.gif ├── demo3.gif ├── demo4.gif ├── demo5.gif ├── demo6.gif ├── demo7.gif └── icon.png ├── build.gradle ├── demo ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── ogaclejapan │ │ └── smarttablayout │ │ └── demo │ │ ├── Demo.java │ │ ├── DemoActivity.java │ │ ├── DemoFragment.java │ │ ├── DemoLikeMediumActivity.java │ │ ├── DemoRtlActivity.java │ │ ├── DemoTabWithNotificationMarkActivity.java │ │ ├── MainActivity.java │ │ └── TintableImageView.java │ └── res │ ├── color │ ├── custom_tab.xml │ ├── custom_tab_icon.xml │ └── custom_tab_like_a_medium.xml │ ├── drawable-hdpi │ ├── ic_flash_on_white_24dp.png │ ├── ic_home_white_24dp.png │ ├── ic_launcher.png │ ├── ic_person_white_24dp.png │ └── ic_search_white_24dp.png │ ├── drawable-mdpi │ ├── ic_flash_on_white_24dp.png │ ├── ic_home_white_24dp.png │ ├── ic_launcher.png │ ├── ic_person_white_24dp.png │ └── ic_search_white_24dp.png │ ├── drawable-xhdpi │ ├── ic_flash_on_white_24dp.png │ ├── ic_home_white_24dp.png │ ├── ic_launcher.png │ ├── ic_person_white_24dp.png │ └── ic_search_white_24dp.png │ ├── drawable-xxhdpi │ ├── ic_flash_on_white_24dp.png │ ├── ic_home_white_24dp.png │ ├── ic_launcher.png │ ├── ic_person_white_24dp.png │ └── ic_search_white_24dp.png │ ├── drawable-xxxhdpi │ ├── ic_flash_on_white_24dp.png │ ├── ic_home_white_24dp.png │ ├── ic_launcher.png │ ├── ic_person_white_24dp.png │ └── ic_search_white_24dp.png │ ├── drawable │ ├── custom_circle.xml │ ├── custom_icon.xml │ ├── custom_tab.xml │ └── shape_notification_mark.xml │ ├── layout │ ├── activity_demo.xml │ ├── activity_demo_tab_with_notification_mark.xml │ ├── activity_like_a_medium.xml │ ├── activity_main.xml │ ├── activity_rtl.xml │ ├── custom_tab.xml │ ├── custom_tab_circle.xml │ ├── custom_tab_icon1.xml │ ├── custom_tab_icon2.xml │ ├── custom_tab_icon_and_notification_mark.xml │ ├── custom_tab_icon_and_text.xml │ ├── custom_tab_like_a_medium.xml │ ├── custom_tab_margin.xml │ ├── demo_always_in_center.xml │ ├── demo_basic.xml │ ├── demo_basic_title_offset_auto_center.xml │ ├── demo_custom_tab_colors.xml │ ├── demo_custom_tab_icon_and_notification_mark.xml │ ├── demo_custom_tab_icon_and_text.xml │ ├── demo_custom_tab_icons1.xml │ ├── demo_custom_tab_icons2.xml │ ├── demo_custom_tab_margin.xml │ ├── demo_custom_tab_text.xml │ ├── demo_distribute_evenly.xml │ ├── demo_indicator_trick1.xml │ ├── demo_indicator_trick2.xml │ ├── demo_like_a_medium_tag.xml │ ├── demo_rtl.xml │ ├── demo_smart_indicator.xml │ └── fragment_demo.xml │ ├── menu │ ├── menu_demo.xml │ └── menu_main.xml │ └── values │ ├── attrs.xml │ ├── colors.xml │ ├── dimens.xml │ ├── ids.xml │ ├── strings.xml │ └── styles.xml ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── library ├── .gitignore ├── LICENSE ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── ogaclejapan │ │ └── smarttablayout │ │ ├── SmartTabIndicationInterpolator.java │ │ ├── SmartTabLayout.java │ │ ├── SmartTabStrip.java │ │ └── Utils.java │ └── res │ └── values │ └── attrs.xml ├── publish.gradle ├── settings.gradle └── utils-v4 ├── .gitignore ├── LICENSE ├── build.gradle ├── proguard-rules.pro └── src └── main ├── AndroidManifest.xml └── java └── com └── ogaclejapan └── smarttablayout └── utils ├── PagerItem.java ├── PagerItems.java ├── ViewPagerItem.java ├── ViewPagerItemAdapter.java ├── ViewPagerItems.java └── v4 ├── Bundler.java ├── FragmentPagerItem.java ├── FragmentPagerItemAdapter.java ├── FragmentPagerItems.java └── FragmentStatePagerItemAdapter.java /.gitignore: -------------------------------------------------------------------------------- 1 | # https://github.com/github/gitignore 2 | # https://github.com/hsz/idea-gitignore 3 | 4 | 5 | ### JetBrains template 6 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm 7 | 8 | *.iml 9 | 10 | ## Directory-based project format: 11 | .idea/ 12 | # if you remove the above rule, at least ignore the following: 13 | 14 | # User-specific stuff: 15 | # .idea/workspace.xml 16 | # .idea/tasks.xml 17 | # .idea/dictionaries 18 | 19 | # Sensitive or high-churn files: 20 | # .idea/dataSources.ids 21 | # .idea/dataSources.xml 22 | # .idea/sqlDataSources.xml 23 | # .idea/dynamic.xml 24 | # .idea/uiDesigner.xml 25 | 26 | # Gradle: 27 | # .idea/gradle.xml 28 | # .idea/libraries 29 | 30 | # Mongo Explorer plugin: 31 | # .idea/mongoSettings.xml 32 | 33 | ## File-based project format: 34 | *.ipr 35 | *.iws 36 | 37 | ## Plugin-specific files: 38 | 39 | # IntelliJ 40 | /out/ 41 | 42 | # mpeltonen/sbt-idea plugin 43 | .idea_modules/ 44 | 45 | # JIRA plugin 46 | atlassian-ide-plugin.xml 47 | 48 | # Crashlytics plugin (for Android Studio and IntelliJ) 49 | com_crashlytics_export_strings.xml 50 | crashlytics.properties 51 | crashlytics-build.properties 52 | 53 | 54 | ### Android template 55 | # Built application files 56 | *.apk 57 | *.ap_ 58 | 59 | # Files for the Dalvik VM 60 | *.dex 61 | 62 | # Java class files 63 | *.class 64 | 65 | # Generated files 66 | bin/ 67 | gen/ 68 | 69 | # Gradle files 70 | .gradle/ 71 | build/ 72 | /*/build/ 73 | 74 | # Local configuration file (sdk path, etc) 75 | local.properties 76 | 77 | # Proguard folder generated by Eclipse 78 | proguard/ 79 | 80 | # Log Files 81 | *.log 82 | 83 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Version 2.0.0 2 | 3 | * Migrate to androidx 1.0.0 4 | * Remove util-v13 library 5 | 6 | # Version 1.7.0 7 | 8 | * Update support library version to 28.0.0 9 | * Change target sdk version to 28 10 | * Change min sdk version to 14 11 | * Deprecated util-v13 library 12 | 13 | # Version 1.6.1 14 | 15 | * Fixed issue with center last item in always in center tablayout #160 16 | 17 | # Version 1.6.0 18 | 19 | * Add `stl_indicatorWidth` to custom indicator's width #106 20 | 21 | # Version 1.5.1 22 | 23 | * Fixed indicator position of auto_center #100 24 | 25 | # Version 1.5.0 26 | 27 | * Add `stl_drawDecorationAfterTab` attribute for change the drawing order #58 28 | * Add `stl_titleOffset` attribute for adjust the slide position #89 29 | * Fixed a condition code of onSizeChanged for always in center 30 | 31 | # Version 1.4.2 32 | 33 | * Change the call order of OnTabClickListener when press the tab #74 34 | 35 | # Version 1.4.1 36 | 37 | * Update android support library version to 22.2.1 38 | 39 | # Version 1.4.0 40 | 41 | * Add TabClickListener interface #68 42 | 43 | # Version 1.3.0 44 | 45 | * RTL support #48 46 | * Add `stl_clickable` attribute. 47 | 48 | # Version 1.2.3 49 | 50 | * Modify to ensure the first scroll #54 51 | 52 | # Version 1.2.2 53 | 54 | * Fix bug when indicatorAlwaysInCenter is true and tabHost has only two tabs #50 55 | 56 | # Version 1.2.1 57 | 58 | * Add custom ScrollListener interface #46 59 | 60 | # Version 1.2.0 61 | 62 | * Support the margin of each tab. 63 | * Add `stl_indicatorWithoutPadding` and `stl_indicatorGravity` attributes. 64 | * Add `stl_overlineColor` and `stl_overlineThickness` attributes. 65 | 66 | # Version 1.1.3 67 | 68 | * Allow to set the background on default tab #13 69 | 70 | # Version 1.1.2 71 | 72 | * Added setter for tab text colors #10 73 | * Allow to set a String title dynamically on PagerItems. #7 74 | 75 | # Version 1.1.1 76 | 77 | * Enable the format of ‘reference’ for defaultTextColor to support ColorStateList #3 78 | 79 | # Version 1.1.0 80 | 81 | * Supported Icon Tab. #1 82 | 83 | 84 | # Version 1.0.0 85 | 86 | * Initial release. 87 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | If you would like to contribute code to SmartTabLayout you can do so through GitHub by 4 | forking the repository and sending a pull request. 5 | 6 | When submitting code, please make every effort to follow existing conventions 7 | and style in order to keep the code as readable as possible. 8 | 9 | ## Coding Style 10 | 11 | * Use the AndroidModernStyle of [Android Code Styles](https://github.com/ogaclejapan/android-code-styles) repository 12 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright (C) 2015 ogaclejapan 191 | Copyright (C) 2013 The Android Open Source Project 192 | 193 | Licensed under the Apache License, Version 2.0 (the "License"); 194 | you may not use this file except in compliance with the License. 195 | You may obtain a copy of the License at 196 | 197 | http://www.apache.org/licenses/LICENSE-2.0 198 | 199 | Unless required by applicable law or agreed to in writing, software 200 | distributed under the License is distributed on an "AS IS" BASIS, 201 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 202 | See the License for the specific language governing permissions and 203 | limitations under the License. 204 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SmartTabLayout 2 | [![Maven Central][maven_central_badge_svg]][maven_central_badge_app] [![Android Arsenal][android_arsenal_badge_svg]][android_arsenal_badge_link] [![Android Weekly][android_weekly_badge_svg]][android_weekly_badge_link] 3 | 4 | ![icon][demo_icon] 5 | 6 | A custom ViewPager title strip which gives continuous feedback to the user when scrolling. 7 | 8 | This library has been added some features and utilities based on [android-SlidingTabBasic][google_slidingtabbasic] project of Google Samples. 9 | 10 | 11 | ![SmartTabLayout Demo1][demo1_gif] ![SmartTabLayout Demo2][demo2_gif] 12 | ![SmartTabLayout Demo3][demo3_gif] ![SmartTabLayout Demo4][demo4_gif] 13 | ![SmartTabLayout Demo5][demo5_gif] ![SmartTabLayout Demo6][demo6_gif] 14 | ![SmartTabLayout Demo7][demo7_gif] 15 | 16 | 17 | Try out the sample application on the Play Store. 18 | 19 | [![Get it on Google Play][googleplay_store_badge]][demo_app] 20 | 21 | 22 | # Usage 23 | 24 | _(For a working implementation of this project see the demo/ folder.)_ 25 | 26 | Add the dependency to your build.gradle. 27 | 28 | ``` 29 | // For androidx (1.0.0) 30 | dependencies { 31 | compile 'com.ogaclejapan.smarttablayout:library:2.0.0@aar' 32 | 33 | //Optional: see how to use the utility. 34 | compile 'com.ogaclejapan.smarttablayout:utils-v4:2.0.0@aar' 35 | } 36 | 37 | // For legacy android support library (28.0.0) 38 | dependencies { 39 | compile 'com.ogaclejapan.smarttablayout:library:1.7.0@aar' 40 | 41 | //Optional: see how to use the utility. 42 | compile 'com.ogaclejapan.smarttablayout:utils-v4:1.7.0@aar' 43 | 44 | //Deprecated since 1.7.0 45 | compile 'com.ogaclejapan.smarttablayout:utils-v13:1.7.0@aar' 46 | } 47 | ``` 48 | 49 | Include the SmartTabLayout widget in your layout. 50 | This should usually be placed above the ViewPager it represents. 51 | 52 | ```xml 53 | 54 | 84 | 85 | 91 | 92 | ``` 93 | 94 | In your onCreate method (or onCreateView for a fragment), bind the widget to the ViewPager. 95 | (If you use a utility together, you can easily add items to PagerAdapter) 96 | 97 | e.g. ViewPager of v4.Fragment 98 | 99 | ```java 100 | 101 | FragmentPagerItemAdapter adapter = new FragmentPagerItemAdapter( 102 | getSupportFragmentManager(), FragmentPagerItems.with(this) 103 | .add(R.string.titleA, PageFragment.class) 104 | .add(R.string.titleB, PageFragment.class) 105 | .create()); 106 | 107 | ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager); 108 | viewPager.setAdapter(adapter); 109 | 110 | SmartTabLayout viewPagerTab = (SmartTabLayout) findViewById(R.id.viewpagertab); 111 | viewPagerTab.setViewPager(viewPager); 112 | 113 | ``` 114 | 115 | (Optional) If you use an OnPageChangeListener with your view pager you should set it in the widget rather than on the pager directly. 116 | 117 | 118 | ```java 119 | 120 | viewPagerTab.setOnPageChangeListener(mPageChangeListener); 121 | 122 | ``` 123 | 124 | (Optional) Using the FragmentPagerItemAdapter of utility, you will be able to get a position in the Fragment side. 125 | 126 | ```java 127 | 128 | int position = FragmentPagerItem.getPosition(getArguments()); 129 | 130 | ``` 131 | 132 | This position will help to implement the parallax scrolling header that contains the ViewPager :P 133 | 134 | # Attributes 135 | 136 | There are several attributes you can set: 137 | 138 | | attr | description | 139 | |:---|:---| 140 | | stl_indicatorAlwaysInCenter | If set to true, active tab is always displayed in center (Like Newsstand google app), default false | 141 | | stl_indicatorWithoutPadding | If set to true, draw the indicator without padding of tab, default false | 142 | | stl_indicatorInFront | Draw the indicator in front of the underline, default false | 143 | | stl_indicatorInterpolation | Behavior of the indicator: 'linear' or 'smart' | 144 | | stl_indicatorGravity | Drawing position of the indicator: 'bottom' or 'top' or 'center', default 'bottom' | 145 | | stl_indicatorColor | Color of the indicator | 146 | | stl_indicatorColors | Multiple colors of the indicator, can set the color for each tab | 147 | | stl_indicatorThickness | Thickness of the indicator | 148 | | stl_indicatorWidth | Width of the indicator, default 'auto' | 149 | | stl_indicatorCornerRadius | Radius of rounded corner the indicator | 150 | | stl_overlineColor | Color of the top line | 151 | | stl_overlineThickness | Thickness of the top line | 152 | | stl_underlineColor | Color of the bottom line | 153 | | stl_underlineThickness | Thickness of the bottom line | 154 | | stl_dividerColor | Color of the dividers between tabs | 155 | | stl_dividerColors | Multiple colors of the dividers between tabs, can set the color for each tab | 156 | | stl_dividerThickness | Thickness of the divider | 157 | | stl_defaultTabBackground | Background drawable of each tab. In general it set the StateListDrawable | 158 | | stl_defaultTabTextAllCaps | If set to true, all tab titles will be upper case, default true | 159 | | stl_defaultTabTextColor | Text color of the tab that was included by default | 160 | | stl_defaultTabTextSize | Text size of the tab that was included by default | 161 | | stl_defaultTabTextHorizontalPadding | Text layout padding of the tab that was included by default | 162 | | stl_defaultTabTextMinWidth | Minimum width of tab | 163 | | stl_customTabTextLayoutId | Layout ID defined custom tab. If you do not specify a layout, use the default tab | 164 | | stl_customTabTextViewId | Text view ID in a custom tab layout. If you do not define with customTabTextLayoutId, does not work | 165 | | stl_distributeEvenly | If set to true, each tab is given the same weight, default false | 166 | | stl_clickable | If set to false, disable the selection of a tab click, default true | 167 | | stl_titleOffset | If set to 'auto_center', the slide position of the tab in the middle it will keep to the center. If specify a dimension it will be offset from the left edge, default 24dp | 168 | | stl_drawDecorationAfterTab | Draw the decoration(indicator and lines) after drawing of tab, default false | 169 | 170 | *__Notes:__ Both 'stl_indicatorAlwaysInCenter' and 'stl_distributeEvenly' if it is set to true, it will throw UnsupportedOperationException.* 171 | 172 | # How to customize the tab 173 | 174 | The customization of tab There are three ways. 175 | 176 | * Customize the attribute 177 | * SmartTabLayout#setCustomTabView(int layoutResId, int textViewId) 178 | * SmartTabLayout#setCustomTabView(TabProvider provider) 179 | 180 | If set the TabProvider, can build a view for each tab. 181 | 182 | ```java 183 | 184 | public class SmartTabLayout extends HorizontalScrollView { 185 | 186 | //... 187 | 188 | /** 189 | * Create the custom tabs in the tab layout. Set with 190 | * {@link #setCustomTabView(com.ogaclejapan.smarttablayout.SmartTabLayout.TabProvider)} 191 | */ 192 | public interface TabProvider { 193 | 194 | /** 195 | * @return Return the View of {@code position} for the Tabs 196 | */ 197 | View createTabView(ViewGroup container, int position, PagerAdapter adapter); 198 | 199 | } 200 | 201 | //... 202 | } 203 | 204 | ``` 205 | 206 | # How to use the utility 207 | 208 | Utility has two types available to suit the Android support library. 209 | 210 | * utils-v4 library contains the PagerAdapter implementation class for _androidx.fragment.app.Fragment_ 211 | * (Deprecated) utils-v13 library contains the PagerAdapter implementation class for _android.app.Fragment_ 212 | 213 | The two libraries have different Android support libraries that depend, 214 | but implemented functionality is the same. 215 | 216 | ## PagerAdapter for View-based Page 217 | 218 | ```java 219 | 220 | ViewPagerItemAdapter adapter = new ViewPagerItemAdapter(ViewPagerItems.with(this) 221 | .add(R.string.title, R.layout.page) 222 | .add("title", R.layout.page) 223 | .create()); 224 | 225 | viewPager.setAdapter(adapter); 226 | 227 | //... 228 | 229 | public void onPageSelected(int position) { 230 | 231 | //.instantiateItem() from until .destroyItem() is called it will be able to get the View of page. 232 | View page = adapter.getPage(position); 233 | 234 | } 235 | 236 | 237 | ``` 238 | 239 | ## PagerAdapter for Fragment-based Page 240 | 241 | Fragment-based PagerAdapter There are two implementations. 242 | Please differences refer to the library documentation for Android. 243 | 244 | * FragmentPagerItemAdapter extends FragmentPagerAdapter 245 | * FragmentStatePagerItemAdapter extends FragmentStatePagerAdapter 246 | 247 | ```java 248 | 249 | FragmentPagerItemAdapter adapter = new FragmentPagerItemAdapter( 250 | getSupportFragmentManager(), FragmentPagerItems.with(this) 251 | .add(R.string.title, PageFragment.class), 252 | .add(R.string.title, WithArgumentsPageFragment.class, new Bundler().putString("key", "value").get()), 253 | .add("title", PageFragment.class) 254 | .create()); 255 | 256 | viewPager.setAdapter(adapter); 257 | 258 | //... 259 | 260 | public void onPageSelected(int position) { 261 | 262 | //.instantiateItem() from until .destoryItem() is called it will be able to get the Fragment of page. 263 | Fragment page = adapter.getPage(position); 264 | 265 | } 266 | 267 | ``` 268 | 269 | *__Notes:__ If using fragment inside a ViewPager, Must be use [Fragment#getChildFragmentManager()](https://developer.android.com/reference/androidx/fragment/app/Fragment.html#getChildFragmentManager).* 270 | 271 | 272 | # Looking for iOS ? 273 | Check [WormTabStrip](https://github.com/EzimetYusup/WormTabStrip) out. 274 | 275 | # LICENSE 276 | 277 | ``` 278 | Copyright (C) 2015 ogaclejapan 279 | Copyright (C) 2013 The Android Open Source Project 280 | 281 | Licensed under the Apache License, Version 2.0 (the "License"); 282 | you may not use this file except in compliance with the License. 283 | You may obtain a copy of the License at 284 | 285 | http://www.apache.org/licenses/LICENSE-2.0 286 | 287 | Unless required by applicable law or agreed to in writing, software 288 | distributed under the License is distributed on an "AS IS" BASIS, 289 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 290 | See the License for the specific language governing permissions and 291 | limitations under the License. 292 | ``` 293 | 294 | [demo1_gif]: https://raw.githubusercontent.com/ogaclejapan/SmartTabLayout/master/art/demo1.gif 295 | [demo2_gif]: https://raw.githubusercontent.com/ogaclejapan/SmartTabLayout/master/art/demo2.gif 296 | [demo3_gif]: https://raw.githubusercontent.com/ogaclejapan/SmartTabLayout/master/art/demo3.gif 297 | [demo4_gif]: https://raw.githubusercontent.com/ogaclejapan/SmartTabLayout/master/art/demo4.gif 298 | [demo5_gif]: https://raw.githubusercontent.com/ogaclejapan/SmartTabLayout/master/art/demo5.gif 299 | [demo6_gif]: https://raw.githubusercontent.com/ogaclejapan/SmartTabLayout/master/art/demo6.gif 300 | [demo7_gif]: https://raw.githubusercontent.com/ogaclejapan/SmartTabLayout/master/art/demo7.gif 301 | [demo_app]: https://play.google.com/store/apps/details?id=com.ogaclejapan.smarttablayout.demo&referrer=utm_source%3Dgithub 302 | [demo_icon]: https://raw.githubusercontent.com/ogaclejapan/SmartTabLayout/master/art/icon.png 303 | [googleplay_store_badge]: http://www.android.com/images/brand/get_it_on_play_logo_large.png 304 | [maven_central_badge_svg]: https://maven-badges.herokuapp.com/maven-central/com.ogaclejapan.smarttablayout/library/badge.svg?style=flat 305 | [maven_central_badge_app]: https://maven-badges.herokuapp.com/maven-central/com.ogaclejapan.smarttablayout/library 306 | [android_arsenal_badge_svg]: https://img.shields.io/badge/Android%20Arsenal-SmartTabLayout-brightgreen.svg?style=flat 307 | [android_arsenal_badge_link]: http://android-arsenal.com/details/1/1683 308 | [android_weekly_badge_svg]: https://img.shields.io/badge/AndroidWeekly-%23148-blue.svg 309 | [android_weekly_badge_link]: http://androidweekly.net/issues/issue-148 310 | [qiitanium]: https://github.com/ogaclejapan/Qiitanium 311 | [google_slidingtabbasic]: https://github.com/googlesamples/android-SlidingTabsBasic 312 | -------------------------------------------------------------------------------- /art/demo1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogaclejapan/SmartTabLayout/712e81a92f1e12a3c33dcbda03d813e0162e8589/art/demo1.gif -------------------------------------------------------------------------------- /art/demo2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogaclejapan/SmartTabLayout/712e81a92f1e12a3c33dcbda03d813e0162e8589/art/demo2.gif -------------------------------------------------------------------------------- /art/demo3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogaclejapan/SmartTabLayout/712e81a92f1e12a3c33dcbda03d813e0162e8589/art/demo3.gif -------------------------------------------------------------------------------- /art/demo4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogaclejapan/SmartTabLayout/712e81a92f1e12a3c33dcbda03d813e0162e8589/art/demo4.gif -------------------------------------------------------------------------------- /art/demo5.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogaclejapan/SmartTabLayout/712e81a92f1e12a3c33dcbda03d813e0162e8589/art/demo5.gif -------------------------------------------------------------------------------- /art/demo6.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogaclejapan/SmartTabLayout/712e81a92f1e12a3c33dcbda03d813e0162e8589/art/demo6.gif -------------------------------------------------------------------------------- /art/demo7.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogaclejapan/SmartTabLayout/712e81a92f1e12a3c33dcbda03d813e0162e8589/art/demo7.gif -------------------------------------------------------------------------------- /art/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogaclejapan/SmartTabLayout/712e81a92f1e12a3c33dcbda03d813e0162e8589/art/icon.png -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | ext { 3 | // Package information for bintray 4 | pkginfo = [name : ARTIFACT_NAME, 5 | description: ARTIFACT_DESCRIPTION, 6 | site : SITE_URL, 7 | issue : ISSUE_URL, 8 | vcs : SCM_URL] 9 | } 10 | 11 | buildscript { 12 | repositories { 13 | google() 14 | mavenCentral() 15 | maven { 16 | url "https://plugins.gradle.org/m2/" 17 | } 18 | jcenter() 19 | } 20 | dependencies { 21 | classpath 'com.android.tools.build:gradle:3.3.1' 22 | classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4' 23 | classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' 24 | classpath 'com.github.ben-manes:gradle-versions-plugin:0.21.0' 25 | classpath 'gradle.plugin.com.hierynomus.gradle.plugins:license-gradle-plugin:0.15.0' 26 | 27 | // NOTE: Do not place your application dependencies here; they belong 28 | // in the individual module build.gradle files 29 | } 30 | } 31 | 32 | allprojects { 33 | 34 | version = VERSION_NAME 35 | group = GROUP 36 | 37 | repositories { 38 | google() 39 | mavenCentral() 40 | jcenter() 41 | } 42 | } 43 | 44 | task clean(type: Delete) { 45 | delete rootProject.buildDir 46 | } 47 | -------------------------------------------------------------------------------- /demo/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /demo/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion COMPILE_SDK_VERSION as int 5 | 6 | defaultConfig { 7 | minSdkVersion 14 8 | targetSdkVersion COMPILE_SDK_VERSION as int 9 | versionCode VERSION_CODE as int 10 | versionName VERSION_NAME 11 | } 12 | 13 | def secretFile = file("${rootDir}/secret.gradle") 14 | if (secretFile.exists()) { 15 | apply from: secretFile.absolutePath 16 | signingConfigs { 17 | release { 18 | storeFile project.ext.storeFile 19 | storePassword project.ext.storePassword 20 | keyAlias project.ext.keyAlias 21 | keyPassword project.ext.keyPassword 22 | } 23 | } 24 | } 25 | 26 | buildTypes { 27 | release { 28 | if (secretFile.exists()) { 29 | signingConfig signingConfigs.release 30 | } 31 | minifyEnabled false 32 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 33 | } 34 | } 35 | } 36 | 37 | dependencies { 38 | implementation project(':library') 39 | implementation project(':utils-v4') 40 | implementation "androidx.appcompat:appcompat:${ANDROIDX_APPCOMPAT_VERSION}" 41 | } 42 | -------------------------------------------------------------------------------- /demo/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/msk/Library/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /demo/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 14 | 15 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 38 | 39 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /demo/src/main/java/com/ogaclejapan/smarttablayout/demo/Demo.java: -------------------------------------------------------------------------------- 1 | package com.ogaclejapan.smarttablayout.demo; 2 | 3 | import android.content.Context; 4 | import android.content.res.Resources; 5 | import android.view.LayoutInflater; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | import android.widget.ImageView; 9 | 10 | import com.ogaclejapan.smarttablayout.SmartTabLayout; 11 | 12 | import androidx.viewpager.widget.PagerAdapter; 13 | 14 | public enum Demo { 15 | 16 | BASIC(R.string.demo_title_basic, R.layout.demo_basic), 17 | 18 | BASIC2(R.string.demo_title_basic2, R.layout.demo_basic_title_offset_auto_center), 19 | 20 | SMART_INDICATOR(R.string.demo_title_smart_indicator, R.layout.demo_smart_indicator), 21 | 22 | DISTRIBUTE_EVENLY(R.string.demo_title_distribute_evenly, R.layout.demo_distribute_evenly) { 23 | @Override 24 | public int[] tabs() { 25 | return tab3(); 26 | } 27 | }, 28 | 29 | ALWAYS_IN_CENTER(R.string.demo_title_always_in_center, R.layout.demo_always_in_center), 30 | 31 | CUSTOM_TAB(R.string.demo_title_custom_tab_text, R.layout.demo_custom_tab_text), 32 | 33 | CUSTOM_TAB_COLORS(R.string.demo_title_custom_tab_colors, R.layout.demo_custom_tab_colors), 34 | 35 | CUSTOM_TAB_ICONS1(R.string.demo_title_custom_tab_icons1, R.layout.demo_custom_tab_icons1) { 36 | @Override 37 | public int[] tabs() { 38 | return new int[] { 39 | R.string.demo_tab_no_title, 40 | R.string.demo_tab_no_title, 41 | R.string.demo_tab_no_title, 42 | R.string.demo_tab_no_title 43 | }; 44 | } 45 | 46 | @Override 47 | public void setup(SmartTabLayout layout) { 48 | super.setup(layout); 49 | 50 | final LayoutInflater inflater = LayoutInflater.from(layout.getContext()); 51 | final Resources res = layout.getContext().getResources(); 52 | 53 | layout.setCustomTabView(new SmartTabLayout.TabProvider() { 54 | @Override 55 | public View createTabView(ViewGroup container, int position, PagerAdapter adapter) { 56 | ImageView icon = (ImageView) inflater.inflate(R.layout.custom_tab_icon1, container, 57 | false); 58 | switch (position) { 59 | case 0: 60 | icon.setImageDrawable(res.getDrawable(R.drawable.ic_home_white_24dp)); 61 | break; 62 | case 1: 63 | icon.setImageDrawable(res.getDrawable(R.drawable.ic_search_white_24dp)); 64 | break; 65 | case 2: 66 | icon.setImageDrawable(res.getDrawable(R.drawable.ic_person_white_24dp)); 67 | break; 68 | case 3: 69 | icon.setImageDrawable(res.getDrawable(R.drawable.ic_flash_on_white_24dp)); 70 | break; 71 | default: 72 | throw new IllegalStateException("Invalid position: " + position); 73 | } 74 | return icon; 75 | } 76 | }); 77 | } 78 | }, 79 | 80 | CUSTOM_TAB_ICONS2(R.string.demo_title_custom_tab_icons2, R.layout.demo_custom_tab_icons2) { 81 | @Override 82 | public int[] tabs() { 83 | return new int[] { 84 | R.string.demo_tab_no_title, 85 | R.string.demo_tab_no_title, 86 | R.string.demo_tab_no_title, 87 | R.string.demo_tab_no_title 88 | }; 89 | } 90 | 91 | @Override 92 | public void setup(SmartTabLayout layout) { 93 | super.setup(layout); 94 | 95 | final LayoutInflater inflater = LayoutInflater.from(layout.getContext()); 96 | final Resources res = layout.getContext().getResources(); 97 | 98 | layout.setCustomTabView(new SmartTabLayout.TabProvider() { 99 | @Override 100 | public View createTabView(ViewGroup container, int position, PagerAdapter adapter) { 101 | ImageView icon = (ImageView) inflater.inflate(R.layout.custom_tab_icon2, container, 102 | false); 103 | switch (position) { 104 | case 0: 105 | icon.setImageDrawable(res.getDrawable(R.drawable.ic_home_white_24dp)); 106 | break; 107 | case 1: 108 | icon.setImageDrawable(res.getDrawable(R.drawable.ic_search_white_24dp)); 109 | break; 110 | case 2: 111 | icon.setImageDrawable(res.getDrawable(R.drawable.ic_person_white_24dp)); 112 | break; 113 | case 3: 114 | icon.setImageDrawable(res.getDrawable(R.drawable.ic_flash_on_white_24dp)); 115 | break; 116 | default: 117 | throw new IllegalStateException("Invalid position: " + position); 118 | } 119 | return icon; 120 | } 121 | }); 122 | } 123 | }, 124 | 125 | CUSTOM_TAB_ICON_AND_TEXT(R.string.demo_title_custom_tab_icon_and_text, 126 | R.layout.demo_custom_tab_icon_and_text) { 127 | @Override 128 | public int[] tabs() { 129 | return tab3(); 130 | } 131 | }, 132 | 133 | CUSTOM_TAB_ICON_AND_NOTIFICATION_MARK(R.string.demo_title_custom_tab_icon_and_notification_mark, 134 | R.layout.demo_custom_tab_icon_and_notification_mark) { 135 | @Override 136 | public int[] tabs() { 137 | return tab3(); 138 | } 139 | 140 | @Override 141 | public void startActivity(Context context) { 142 | DemoTabWithNotificationMarkActivity.startActivity(context, this); 143 | } 144 | }, 145 | 146 | CUSTOM_TAB_MARGIN(R.string.demo_title_custom_tab_margin, R.layout.demo_custom_tab_margin), 147 | 148 | INDICATOR_TRICK1(R.string.demo_title_indicator_trick1, R.layout.demo_indicator_trick1), 149 | 150 | INDICATOR_TRICK2(R.string.demo_title_indicator_trick2, R.layout.demo_indicator_trick2), 151 | 152 | RIGHT_TO_LEFT(R.string.demo_title_right_to_left, R.layout.demo_rtl) { 153 | @Override 154 | public void startActivity(Context context) { 155 | DemoRtlActivity.startActivity(context, this); 156 | } 157 | }, 158 | 159 | LIKE_MEDIUM_TAG(R.string.demo_title_advanced_medium, R.layout.demo_like_a_medium_tag) { 160 | @Override 161 | public int[] tabs() { 162 | return new int[] { 163 | R.string.demo_tab_like_a_medium_top, 164 | R.string.demo_tab_like_a_medium_latest 165 | }; 166 | } 167 | 168 | @Override 169 | public void startActivity(Context context) { 170 | DemoLikeMediumActivity.startActivity(context, this); 171 | } 172 | }; 173 | 174 | public final int titleResId; 175 | public final int layoutResId; 176 | 177 | Demo(int titleResId, int layoutResId) { 178 | this.titleResId = titleResId; 179 | this.layoutResId = layoutResId; 180 | } 181 | 182 | public static int[] tab10() { 183 | return new int[] { 184 | R.string.demo_tab_1, 185 | R.string.demo_tab_2, 186 | R.string.demo_tab_3, 187 | R.string.demo_tab_4, 188 | R.string.demo_tab_5, 189 | R.string.demo_tab_6, 190 | R.string.demo_tab_7, 191 | R.string.demo_tab_8, 192 | R.string.demo_tab_9, 193 | R.string.demo_tab_10 194 | }; 195 | } 196 | 197 | public static int[] tab3() { 198 | return new int[] { 199 | R.string.demo_tab_8, 200 | R.string.demo_tab_9, 201 | R.string.demo_tab_10 202 | }; 203 | } 204 | 205 | public void startActivity(Context context) { 206 | DemoActivity.startActivity(context, this); 207 | } 208 | 209 | public void setup(final SmartTabLayout layout) { 210 | //Do nothing. 211 | } 212 | 213 | public int[] tabs() { 214 | return tab10(); 215 | } 216 | 217 | } 218 | -------------------------------------------------------------------------------- /demo/src/main/java/com/ogaclejapan/smarttablayout/demo/DemoActivity.java: -------------------------------------------------------------------------------- 1 | package com.ogaclejapan.smarttablayout.demo; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.os.Bundle; 6 | import android.view.LayoutInflater; 7 | import android.view.ViewGroup; 8 | 9 | import com.ogaclejapan.smarttablayout.SmartTabLayout; 10 | import com.ogaclejapan.smarttablayout.utils.v4.FragmentPagerItem; 11 | import com.ogaclejapan.smarttablayout.utils.v4.FragmentPagerItemAdapter; 12 | import com.ogaclejapan.smarttablayout.utils.v4.FragmentPagerItems; 13 | 14 | import androidx.appcompat.app.AppCompatActivity; 15 | import androidx.appcompat.widget.Toolbar; 16 | import androidx.viewpager.widget.ViewPager; 17 | 18 | public class DemoActivity extends AppCompatActivity { 19 | 20 | private static final String KEY_DEMO = "demo"; 21 | 22 | public static void startActivity(Context context, Demo demo) { 23 | Intent intent = new Intent(context, DemoActivity.class); 24 | intent.putExtra(KEY_DEMO, demo.name()); 25 | context.startActivity(intent); 26 | } 27 | 28 | @Override 29 | protected void onCreate(Bundle savedInstanceState) { 30 | super.onCreate(savedInstanceState); 31 | setContentView(R.layout.activity_demo); 32 | 33 | Demo demo = getDemo(); 34 | 35 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); 36 | toolbar.setTitle(demo.titleResId); 37 | setSupportActionBar(toolbar); 38 | getSupportActionBar().setDisplayHomeAsUpEnabled(true); 39 | 40 | ViewGroup tab = (ViewGroup) findViewById(R.id.tab); 41 | tab.addView(LayoutInflater.from(this).inflate(demo.layoutResId, tab, false)); 42 | 43 | ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager); 44 | SmartTabLayout viewPagerTab = (SmartTabLayout) findViewById(R.id.viewpagertab); 45 | demo.setup(viewPagerTab); 46 | 47 | FragmentPagerItems pages = new FragmentPagerItems(this); 48 | for (int titleResId : demo.tabs()) { 49 | pages.add(FragmentPagerItem.of(getString(titleResId), DemoFragment.class)); 50 | } 51 | 52 | FragmentPagerItemAdapter adapter = new FragmentPagerItemAdapter( 53 | getSupportFragmentManager(), pages); 54 | 55 | viewPager.setAdapter(adapter); 56 | viewPagerTab.setViewPager(viewPager); 57 | 58 | } 59 | 60 | private Demo getDemo() { 61 | return Demo.valueOf(getIntent().getStringExtra(KEY_DEMO)); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /demo/src/main/java/com/ogaclejapan/smarttablayout/demo/DemoFragment.java: -------------------------------------------------------------------------------- 1 | package com.ogaclejapan.smarttablayout.demo; 2 | 3 | import android.os.Bundle; 4 | import android.view.LayoutInflater; 5 | import android.view.View; 6 | import android.view.ViewGroup; 7 | import android.widget.TextView; 8 | 9 | import com.ogaclejapan.smarttablayout.utils.v4.FragmentPagerItem; 10 | 11 | import androidx.annotation.Nullable; 12 | import androidx.fragment.app.Fragment; 13 | 14 | public class DemoFragment extends Fragment { 15 | 16 | @Override 17 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, 18 | @Nullable Bundle savedInstanceState) { 19 | return inflater.inflate(R.layout.fragment_demo, container, false); 20 | } 21 | 22 | @Override 23 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { 24 | super.onViewCreated(view, savedInstanceState); 25 | int position = FragmentPagerItem.getPosition(getArguments()); 26 | TextView title = (TextView) view.findViewById(R.id.item_title); 27 | title.setText(String.valueOf(position)); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /demo/src/main/java/com/ogaclejapan/smarttablayout/demo/DemoLikeMediumActivity.java: -------------------------------------------------------------------------------- 1 | package com.ogaclejapan.smarttablayout.demo; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.os.Bundle; 6 | import android.view.LayoutInflater; 7 | import android.view.ViewGroup; 8 | 9 | import com.ogaclejapan.smarttablayout.SmartTabLayout; 10 | import com.ogaclejapan.smarttablayout.utils.v4.FragmentPagerItem; 11 | import com.ogaclejapan.smarttablayout.utils.v4.FragmentPagerItemAdapter; 12 | import com.ogaclejapan.smarttablayout.utils.v4.FragmentPagerItems; 13 | 14 | import androidx.appcompat.app.AppCompatActivity; 15 | import androidx.appcompat.widget.Toolbar; 16 | import androidx.viewpager.widget.ViewPager; 17 | 18 | public class DemoLikeMediumActivity extends AppCompatActivity { 19 | 20 | private static final String KEY_DEMO = "demo"; 21 | 22 | public static void startActivity(Context context, Demo demo) { 23 | Intent intent = new Intent(context, DemoLikeMediumActivity.class); 24 | intent.putExtra(KEY_DEMO, demo.name()); 25 | context.startActivity(intent); 26 | } 27 | 28 | @Override 29 | protected void onCreate(Bundle savedInstanceState) { 30 | super.onCreate(savedInstanceState); 31 | setContentView(R.layout.activity_like_a_medium); 32 | 33 | Demo demo = getDemo(); 34 | 35 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); 36 | toolbar.setTitle(demo.titleResId); 37 | setSupportActionBar(toolbar); 38 | getSupportActionBar().setDisplayHomeAsUpEnabled(true); 39 | 40 | ViewGroup tab = (ViewGroup) findViewById(R.id.tab); 41 | tab.addView(LayoutInflater.from(this).inflate(demo.layoutResId, tab, false)); 42 | 43 | ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager); 44 | SmartTabLayout viewPagerTab = (SmartTabLayout) findViewById(R.id.viewpagertab); 45 | demo.setup(viewPagerTab); 46 | 47 | FragmentPagerItems pages = new FragmentPagerItems(this); 48 | for (int titleResId : demo.tabs()) { 49 | pages.add(FragmentPagerItem.of(getString(titleResId), DemoFragment.class)); 50 | } 51 | 52 | FragmentPagerItemAdapter adapter = new FragmentPagerItemAdapter( 53 | getSupportFragmentManager(), pages); 54 | 55 | viewPager.setAdapter(adapter); 56 | viewPagerTab.setViewPager(viewPager); 57 | 58 | } 59 | 60 | private Demo getDemo() { 61 | return Demo.valueOf(getIntent().getStringExtra(KEY_DEMO)); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /demo/src/main/java/com/ogaclejapan/smarttablayout/demo/DemoRtlActivity.java: -------------------------------------------------------------------------------- 1 | package com.ogaclejapan.smarttablayout.demo; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.os.Bundle; 6 | import android.view.LayoutInflater; 7 | import android.view.ViewGroup; 8 | 9 | import com.ogaclejapan.smarttablayout.SmartTabLayout; 10 | import com.ogaclejapan.smarttablayout.utils.v4.FragmentPagerItem; 11 | import com.ogaclejapan.smarttablayout.utils.v4.FragmentPagerItemAdapter; 12 | import com.ogaclejapan.smarttablayout.utils.v4.FragmentPagerItems; 13 | 14 | import androidx.appcompat.app.AppCompatActivity; 15 | import androidx.appcompat.widget.Toolbar; 16 | import androidx.viewpager.widget.ViewPager; 17 | 18 | public class DemoRtlActivity extends AppCompatActivity { 19 | 20 | private static final String KEY_DEMO = "demo"; 21 | 22 | public static void startActivity(Context context, Demo demo) { 23 | Intent intent = new Intent(context, DemoRtlActivity.class); 24 | intent.putExtra(KEY_DEMO, demo.name()); 25 | context.startActivity(intent); 26 | } 27 | 28 | @Override 29 | protected void onCreate(Bundle savedInstanceState) { 30 | super.onCreate(savedInstanceState); 31 | setContentView(R.layout.activity_rtl); 32 | 33 | Demo demo = getDemo(); 34 | 35 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); 36 | toolbar.setTitle(demo.titleResId); 37 | setSupportActionBar(toolbar); 38 | getSupportActionBar().setDisplayHomeAsUpEnabled(true); 39 | 40 | ViewGroup tab = (ViewGroup) findViewById(R.id.tab); 41 | tab.addView(LayoutInflater.from(this).inflate(demo.layoutResId, tab, false)); 42 | 43 | ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager); 44 | final SmartTabLayout viewPagerTab = (SmartTabLayout) findViewById(R.id.viewpagertab); 45 | demo.setup(viewPagerTab); 46 | 47 | FragmentPagerItems pages = new FragmentPagerItems(this); 48 | for (int titleResId : demo.tabs()) { 49 | pages.add(FragmentPagerItem.of(getString(titleResId), DemoFragment.class)); 50 | } 51 | 52 | FragmentPagerItemAdapter adapter = new FragmentPagerItemAdapter( 53 | getSupportFragmentManager(), pages); 54 | 55 | viewPager.setAdapter(adapter); 56 | viewPagerTab.setViewPager(viewPager); 57 | 58 | } 59 | 60 | private Demo getDemo() { 61 | return Demo.valueOf(getIntent().getStringExtra(KEY_DEMO)); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /demo/src/main/java/com/ogaclejapan/smarttablayout/demo/DemoTabWithNotificationMarkActivity.java: -------------------------------------------------------------------------------- 1 | package com.ogaclejapan.smarttablayout.demo; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.content.res.Resources; 6 | import android.os.Bundle; 7 | import android.view.LayoutInflater; 8 | import android.view.View; 9 | import android.view.ViewGroup; 10 | import android.widget.ImageView; 11 | 12 | import com.ogaclejapan.smarttablayout.SmartTabLayout; 13 | import com.ogaclejapan.smarttablayout.utils.v4.FragmentPagerItem; 14 | import com.ogaclejapan.smarttablayout.utils.v4.FragmentPagerItemAdapter; 15 | import com.ogaclejapan.smarttablayout.utils.v4.FragmentPagerItems; 16 | 17 | import java.util.Random; 18 | 19 | import androidx.appcompat.app.AppCompatActivity; 20 | import androidx.appcompat.widget.Toolbar; 21 | import androidx.viewpager.widget.PagerAdapter; 22 | import androidx.viewpager.widget.ViewPager; 23 | 24 | public class DemoTabWithNotificationMarkActivity extends AppCompatActivity implements 25 | SmartTabLayout.TabProvider { 26 | 27 | private static final String KEY_DEMO = "demo"; 28 | 29 | public static void startActivity(Context context, Demo demo) { 30 | Intent intent = new Intent(context, DemoTabWithNotificationMarkActivity.class); 31 | intent.putExtra(KEY_DEMO, demo.name()); 32 | context.startActivity(intent); 33 | } 34 | 35 | private Random random = new Random(System.currentTimeMillis()); 36 | 37 | @Override 38 | protected void onCreate(Bundle savedInstanceState) { 39 | super.onCreate(savedInstanceState); 40 | setContentView(R.layout.activity_demo_tab_with_notification_mark); 41 | 42 | final Demo demo = getDemo(); 43 | 44 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); 45 | toolbar.setTitle(demo.titleResId); 46 | setSupportActionBar(toolbar); 47 | getSupportActionBar().setDisplayHomeAsUpEnabled(true); 48 | 49 | ViewGroup tab = (ViewGroup) findViewById(R.id.tab); 50 | tab.addView(LayoutInflater.from(this).inflate(demo.layoutResId, tab, false)); 51 | 52 | ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager); 53 | final SmartTabLayout viewPagerTab = (SmartTabLayout) findViewById(R.id.viewpagertab); 54 | viewPagerTab.setCustomTabView(this); 55 | 56 | FragmentPagerItems pages = new FragmentPagerItems(this); 57 | for (int titleResId : demo.tabs()) { 58 | pages.add(FragmentPagerItem.of(getString(titleResId), DemoFragment.class)); 59 | } 60 | 61 | FragmentPagerItemAdapter adapter = new FragmentPagerItemAdapter( 62 | getSupportFragmentManager(), pages); 63 | 64 | viewPager.setAdapter(adapter); 65 | viewPagerTab.setViewPager(viewPager); 66 | 67 | viewPagerTab.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { 68 | @Override 69 | public void onPageSelected(int position) { 70 | super.onPageSelected(position); 71 | View tab = viewPagerTab.getTabAt(position); 72 | View mark = tab.findViewById(R.id.custom_tab_notification_mark); 73 | mark.setVisibility(View.GONE); 74 | } 75 | }); 76 | 77 | findViewById(R.id.test).setOnClickListener(new View.OnClickListener() { 78 | @Override 79 | public void onClick(View v) { 80 | int position = Math.abs(random.nextInt()) % demo.tabs().length; 81 | View tab = viewPagerTab.getTabAt(position); 82 | View mark = tab.findViewById(R.id.custom_tab_notification_mark); 83 | mark.setVisibility(View.VISIBLE); 84 | } 85 | }); 86 | 87 | } 88 | 89 | @Override 90 | public View createTabView(ViewGroup container, int position, PagerAdapter adapter) { 91 | LayoutInflater inflater = LayoutInflater.from(container.getContext()); 92 | Resources res = container.getContext().getResources(); 93 | View tab = inflater.inflate(R.layout.custom_tab_icon_and_notification_mark, container, false); 94 | View mark = tab.findViewById(R.id.custom_tab_notification_mark); 95 | mark.setVisibility(View.GONE); 96 | ImageView icon = (ImageView) tab.findViewById(R.id.custom_tab_icon); 97 | switch (position) { 98 | case 0: 99 | icon.setImageDrawable(res.getDrawable(R.drawable.ic_home_white_24dp)); 100 | break; 101 | case 1: 102 | icon.setImageDrawable(res.getDrawable(R.drawable.ic_search_white_24dp)); 103 | break; 104 | case 2: 105 | icon.setImageDrawable(res.getDrawable(R.drawable.ic_person_white_24dp)); 106 | break; 107 | default: 108 | throw new IllegalStateException("Invalid position: " + position); 109 | } 110 | return tab; 111 | } 112 | 113 | private Demo getDemo() { 114 | return Demo.valueOf(getIntent().getStringExtra(KEY_DEMO)); 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /demo/src/main/java/com/ogaclejapan/smarttablayout/demo/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.ogaclejapan.smarttablayout.demo; 2 | 3 | import android.content.Intent; 4 | import android.net.Uri; 5 | import android.os.Bundle; 6 | import android.view.Menu; 7 | import android.view.MenuItem; 8 | import android.view.View; 9 | import android.widget.AbsListView; 10 | import android.widget.AdapterView; 11 | import android.widget.ArrayAdapter; 12 | import android.widget.ListView; 13 | 14 | import androidx.appcompat.app.AppCompatActivity; 15 | 16 | public class MainActivity extends AppCompatActivity implements AbsListView.OnItemClickListener { 17 | 18 | @Override 19 | protected void onCreate(Bundle savedInstanceState) { 20 | super.onCreate(savedInstanceState); 21 | setContentView(R.layout.activity_main); 22 | ListView listView = (ListView) findViewById(R.id.list); 23 | listView.setOnItemClickListener(this); 24 | 25 | ArrayAdapter demoAdapter = new ArrayAdapter(this, 26 | android.R.layout.simple_list_item_1); 27 | 28 | for (Demo demo : Demo.values()) { 29 | demoAdapter.add(getString(demo.titleResId)); 30 | } 31 | 32 | listView.setAdapter(demoAdapter); 33 | } 34 | 35 | @Override 36 | public boolean onCreateOptionsMenu(Menu menu) { 37 | getMenuInflater().inflate(R.menu.menu_main, menu); 38 | return super.onCreateOptionsMenu(menu); 39 | } 40 | 41 | @Override 42 | public boolean onOptionsItemSelected(MenuItem item) { 43 | switch (item.getItemId()) { 44 | case R.id.menu_github: 45 | openGitHub(); 46 | return true; 47 | default: 48 | return super.onOptionsItemSelected(item); 49 | } 50 | } 51 | 52 | @Override 53 | public void onItemClick(AdapterView parent, View view, int position, long id) { 54 | Demo demo = Demo.values()[position]; 55 | demo.startActivity(this); 56 | } 57 | 58 | private void openGitHub() { 59 | Uri uri = Uri.parse(getString(R.string.app_github_url)); 60 | Intent intent = new Intent(Intent.ACTION_VIEW, uri); 61 | startActivity(intent); 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /demo/src/main/java/com/ogaclejapan/smarttablayout/demo/TintableImageView.java: -------------------------------------------------------------------------------- 1 | package com.ogaclejapan.smarttablayout.demo; 2 | 3 | import android.content.Context; 4 | import android.content.res.ColorStateList; 5 | import android.content.res.TypedArray; 6 | import android.util.AttributeSet; 7 | 8 | import androidx.appcompat.widget.AppCompatImageView; 9 | 10 | /** 11 | * https://gist.github.com/tylerchesley/5d15d859be4f3ce31213 12 | */ 13 | public class TintableImageView extends AppCompatImageView { 14 | 15 | private ColorStateList tint; 16 | 17 | public TintableImageView(Context context) { 18 | super(context); 19 | } 20 | 21 | public TintableImageView(Context context, AttributeSet attrs) { 22 | super(context, attrs); 23 | init(context, attrs, 0); 24 | } 25 | 26 | public TintableImageView(Context context, AttributeSet attrs, int defStyle) { 27 | super(context, attrs, defStyle); 28 | init(context, attrs, defStyle); 29 | } 30 | 31 | private void init(Context context, AttributeSet attrs, int defStyle) { 32 | TypedArray a = context.obtainStyledAttributes( 33 | attrs, R.styleable.TintableImageView, defStyle, 0); 34 | tint = a.getColorStateList( 35 | R.styleable.TintableImageView_tint); 36 | a.recycle(); 37 | } 38 | 39 | @Override 40 | protected void drawableStateChanged() { 41 | super.drawableStateChanged(); 42 | if (tint != null && tint.isStateful()) { 43 | updateTintColor(); 44 | } 45 | } 46 | 47 | public void setColorFilter(ColorStateList tint) { 48 | this.tint = tint; 49 | super.setColorFilter(tint.getColorForState(getDrawableState(), 0)); 50 | } 51 | 52 | private void updateTintColor() { 53 | int color = tint.getColorForState(getDrawableState(), 0); 54 | setColorFilter(color); 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /demo/src/main/res/color/custom_tab.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /demo/src/main/res/color/custom_tab_icon.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /demo/src/main/res/color/custom_tab_like_a_medium.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /demo/src/main/res/drawable-hdpi/ic_flash_on_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogaclejapan/SmartTabLayout/712e81a92f1e12a3c33dcbda03d813e0162e8589/demo/src/main/res/drawable-hdpi/ic_flash_on_white_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-hdpi/ic_home_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogaclejapan/SmartTabLayout/712e81a92f1e12a3c33dcbda03d813e0162e8589/demo/src/main/res/drawable-hdpi/ic_home_white_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogaclejapan/SmartTabLayout/712e81a92f1e12a3c33dcbda03d813e0162e8589/demo/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-hdpi/ic_person_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogaclejapan/SmartTabLayout/712e81a92f1e12a3c33dcbda03d813e0162e8589/demo/src/main/res/drawable-hdpi/ic_person_white_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-hdpi/ic_search_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogaclejapan/SmartTabLayout/712e81a92f1e12a3c33dcbda03d813e0162e8589/demo/src/main/res/drawable-hdpi/ic_search_white_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-mdpi/ic_flash_on_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogaclejapan/SmartTabLayout/712e81a92f1e12a3c33dcbda03d813e0162e8589/demo/src/main/res/drawable-mdpi/ic_flash_on_white_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-mdpi/ic_home_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogaclejapan/SmartTabLayout/712e81a92f1e12a3c33dcbda03d813e0162e8589/demo/src/main/res/drawable-mdpi/ic_home_white_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogaclejapan/SmartTabLayout/712e81a92f1e12a3c33dcbda03d813e0162e8589/demo/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-mdpi/ic_person_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogaclejapan/SmartTabLayout/712e81a92f1e12a3c33dcbda03d813e0162e8589/demo/src/main/res/drawable-mdpi/ic_person_white_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-mdpi/ic_search_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogaclejapan/SmartTabLayout/712e81a92f1e12a3c33dcbda03d813e0162e8589/demo/src/main/res/drawable-mdpi/ic_search_white_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xhdpi/ic_flash_on_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogaclejapan/SmartTabLayout/712e81a92f1e12a3c33dcbda03d813e0162e8589/demo/src/main/res/drawable-xhdpi/ic_flash_on_white_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xhdpi/ic_home_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogaclejapan/SmartTabLayout/712e81a92f1e12a3c33dcbda03d813e0162e8589/demo/src/main/res/drawable-xhdpi/ic_home_white_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogaclejapan/SmartTabLayout/712e81a92f1e12a3c33dcbda03d813e0162e8589/demo/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xhdpi/ic_person_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogaclejapan/SmartTabLayout/712e81a92f1e12a3c33dcbda03d813e0162e8589/demo/src/main/res/drawable-xhdpi/ic_person_white_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xhdpi/ic_search_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogaclejapan/SmartTabLayout/712e81a92f1e12a3c33dcbda03d813e0162e8589/demo/src/main/res/drawable-xhdpi/ic_search_white_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxhdpi/ic_flash_on_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogaclejapan/SmartTabLayout/712e81a92f1e12a3c33dcbda03d813e0162e8589/demo/src/main/res/drawable-xxhdpi/ic_flash_on_white_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxhdpi/ic_home_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogaclejapan/SmartTabLayout/712e81a92f1e12a3c33dcbda03d813e0162e8589/demo/src/main/res/drawable-xxhdpi/ic_home_white_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogaclejapan/SmartTabLayout/712e81a92f1e12a3c33dcbda03d813e0162e8589/demo/src/main/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxhdpi/ic_person_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogaclejapan/SmartTabLayout/712e81a92f1e12a3c33dcbda03d813e0162e8589/demo/src/main/res/drawable-xxhdpi/ic_person_white_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxhdpi/ic_search_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogaclejapan/SmartTabLayout/712e81a92f1e12a3c33dcbda03d813e0162e8589/demo/src/main/res/drawable-xxhdpi/ic_search_white_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxxhdpi/ic_flash_on_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogaclejapan/SmartTabLayout/712e81a92f1e12a3c33dcbda03d813e0162e8589/demo/src/main/res/drawable-xxxhdpi/ic_flash_on_white_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxxhdpi/ic_home_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogaclejapan/SmartTabLayout/712e81a92f1e12a3c33dcbda03d813e0162e8589/demo/src/main/res/drawable-xxxhdpi/ic_home_white_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogaclejapan/SmartTabLayout/712e81a92f1e12a3c33dcbda03d813e0162e8589/demo/src/main/res/drawable-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxxhdpi/ic_person_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogaclejapan/SmartTabLayout/712e81a92f1e12a3c33dcbda03d813e0162e8589/demo/src/main/res/drawable-xxxhdpi/ic_person_white_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxxhdpi/ic_search_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogaclejapan/SmartTabLayout/712e81a92f1e12a3c33dcbda03d813e0162e8589/demo/src/main/res/drawable-xxxhdpi/ic_search_white_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable/custom_circle.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 13 | -------------------------------------------------------------------------------- /demo/src/main/res/drawable/custom_icon.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /demo/src/main/res/drawable/custom_tab.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /demo/src/main/res/drawable/shape_notification_mark.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /demo/src/main/res/layout/activity_demo.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 15 | 16 | 24 | 25 | 26 | 27 | 32 | 33 | 34 | 35 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /demo/src/main/res/layout/activity_demo_tab_with_notification_mark.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 15 | 16 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 |