├── .gitignore ├── .idea ├── .name ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── encodings.xml ├── gradle.xml ├── kotlinc.xml ├── markdown-exported-files.xml ├── markdown-navigator.xml ├── markdown-navigator │ └── profiles_settings.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml ├── runConfigurations │ └── All_Tests.xml └── vcs.xml ├── .travis.yml ├── CHANGELOG.md ├── LICENSE ├── NOTICE ├── README.md ├── app ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── assets │ └── fonts │ │ ├── GREAT-VIBES-LICENSE │ │ └── GreatVibes-Regular.otf │ ├── java │ └── com │ │ └── example │ │ └── bottombar │ │ └── sample │ │ ├── BadgeActivity.java │ │ ├── CustomColorAndFontActivity.java │ │ ├── FiveColorChangingTabsActivity.java │ │ ├── IconsOnlyActivity.java │ │ ├── MainActivity.java │ │ ├── SampleFragment.java │ │ ├── TabMessage.java │ │ ├── ThreeTabsActivity.java │ │ └── ThreeTabsQRActivity.java │ └── res │ ├── drawable-hdpi │ ├── ic_favorites.png │ ├── ic_friends.png │ ├── ic_nearby.png │ ├── ic_recents.png │ └── ic_restaurants.png │ ├── drawable-mdpi │ ├── ic_favorites.png │ ├── ic_friends.png │ ├── ic_nearby.png │ ├── ic_recents.png │ └── ic_restaurants.png │ ├── drawable-xhdpi │ ├── ic_favorites.png │ ├── ic_friends.png │ ├── ic_nearby.png │ ├── ic_recents.png │ └── ic_restaurants.png │ ├── drawable-xxhdpi │ ├── ic_favorites.png │ ├── ic_friends.png │ ├── ic_nearby.png │ ├── ic_recents.png │ └── ic_restaurants.png │ ├── drawable-xxxhdpi │ ├── ic_favorites.png │ ├── ic_friends.png │ ├── ic_nearby.png │ ├── ic_recents.png │ └── ic_restaurants.png │ ├── layout-sw600dp │ ├── activity_color_changing_tabs.xml │ └── activity_three_tabs.xml │ ├── layout │ ├── activity_color_changing_tabs.xml │ ├── activity_custom_color_and_font.xml │ ├── activity_icons_only.xml │ ├── activity_main.xml │ ├── activity_three_tabs.xml │ └── activity_three_tabs_quick_return.xml │ ├── mipmap-hdpi │ └── ic_launcher.png │ ├── mipmap-mdpi │ └── ic_launcher.png │ ├── mipmap-xhdpi │ └── ic_launcher.png │ ├── mipmap-xxhdpi │ └── ic_launcher.png │ ├── mipmap-xxxhdpi │ └── ic_launcher.png │ ├── values-land-v21 │ └── styles.xml │ ├── values-sw600dp │ └── styles.xml │ ├── values-v21 │ └── styles.xml │ ├── values-w820dp │ └── dimens.xml │ ├── values │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml │ └── xml │ ├── bottombar_tabs_color_changing.xml │ ├── bottombar_tabs_five.xml │ └── bottombar_tabs_three.xml ├── bottom-bar ├── build.gradle └── src │ ├── androidTest │ ├── assets │ │ └── fonts │ │ │ ├── GREAT-VIBES-LICENSE │ │ │ └── GreatVibes-Regular.otf │ ├── java │ │ └── com │ │ │ └── roughike │ │ │ └── bottombar │ │ │ ├── BadgeTest.java │ │ │ ├── BottomBarTabTest.java │ │ │ ├── BottomBarTest.java │ │ │ └── TabParserTest.java │ └── res │ │ ├── drawable-nodpi │ │ └── empty_icon.png │ │ ├── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ │ └── xml │ │ ├── dummy_tabs_five.xml │ │ └── dummy_tabs_three.xml │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── roughike │ │ │ └── bottombar │ │ │ ├── BadgeCircle.java │ │ │ ├── BadgeContainer.java │ │ │ ├── BatchTabPropertyApplier.java │ │ │ ├── BottomBar.java │ │ │ ├── BottomBarBadge.java │ │ │ ├── BottomBarTab.java │ │ │ ├── BottomNavigationBehavior.java │ │ │ ├── MiscUtils.java │ │ │ ├── NavbarUtils.java │ │ │ ├── OnTabReselectListener.java │ │ │ ├── OnTabSelectListener.java │ │ │ ├── ShySettings.java │ │ │ ├── TabParser.java │ │ │ ├── TabSelectionInterceptor.java │ │ │ └── VerticalScrollingBehavior.java │ └── res │ │ ├── drawable │ │ └── bb_bottom_bar_top_shadow.xml │ │ ├── layout-v21 │ │ └── bb_bottom_bar_item_container.xml │ │ ├── layout │ │ ├── bb_bottom_bar_item_container.xml │ │ ├── bb_bottom_bar_item_container_tablet.xml │ │ ├── bb_bottom_bar_item_fixed.xml │ │ ├── bb_bottom_bar_item_fixed_tablet.xml │ │ ├── bb_bottom_bar_item_shifting.xml │ │ └── bb_bottom_bar_item_titleless.xml │ │ ├── values-land │ │ └── bools.xml │ │ └── values │ │ ├── attrs.xml │ │ ├── bools.xml │ │ ├── colors.xml │ │ ├── dimensions.xml │ │ ├── ids.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── roughike │ └── bottombar │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── graphics ├── icons-howto.png ├── screenshot_tablet.png ├── shifting-demo.gif └── shy-demo.gif ├── projectFilesBackup └── .idea │ └── workspace.xml └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the ART/Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | out/ 15 | 16 | # Gradle files 17 | .gradle/ 18 | build/ 19 | 20 | # Local configuration file (sdk path, etc) 21 | local.properties 22 | 23 | # Proguard folder generated by Eclipse 24 | proguard/ 25 | 26 | # Log Files 27 | *.log 28 | 29 | # Android Studio Navigation editor temp files 30 | .navigation/ 31 | 32 | # Android Studio captures folder 33 | captures/ 34 | 35 | # Intellij 36 | *.iml 37 | .idea/workspace.xml 38 | .idea/libraries 39 | 40 | # Keystore files 41 | *.jks 42 | -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | BottomBar -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 19 | -------------------------------------------------------------------------------- /.idea/kotlinc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | -------------------------------------------------------------------------------- /.idea/markdown-exported-files.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/markdown-navigator.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 33 | 34 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /.idea/markdown-navigator/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 46 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/runConfigurations/All_Tests.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 46 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: android 2 | 3 | jdk: oraclejdk8 4 | 5 | android: 6 | components: 7 | - tools 8 | - platform-tools 9 | - build-tools-25.0.2 10 | - android-25 11 | - extra-android-m2repository 12 | 13 | before_script: 14 | - echo no | android create avd --force -n test -t android-18 --abi armeabi-v7a 15 | - emulator -avd test -no-audio -no-window & 16 | - android-wait-for-emulator 17 | - adb shell input keyevent 82 & 18 | 19 | script: 20 | - ./gradlew connectedAndroidTest coveralls -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## Changelog 2 | 3 | ### 2.3.1 4 | 5 | * [#749](https://github.com/roughike/BottomBar/pull/749): Quick fix for the issue where *bb_showShadow* set to false didn't have any effect. Thanks @yombunker! 6 | 7 | ### 2.3.0 8 | 9 | * [#713](https://github.com/roughike/BottomBar/pull/713): Ripple touch feedback for tabs! 10 | * [#716](https://github.com/roughike/BottomBar/pull/716): Bugfix for misbehaving shadow. No more weird white spaces above the bar! 11 | * [#717](https://github.com/roughike/BottomBar/pull/717): Support for tabs with icons only, without titles! 12 | * [#722](https://github.com/roughike/BottomBar/pull/722): Showing / hiding the BottomBar when on shy mode. 13 | * [#714](https://github.com/roughike/BottomBar/pull/714): Controlling whether Toasts of tab titles are shown when long pressing tabs. 14 | * [#719](https://github.com/roughike/BottomBar/pull/719): Fix for wrong size in tabs 15 | * [#712](https://github.com/roughike/BottomBar/pull/712): Data binding fixes. 16 | 17 | Thanks for @yombunker, @MarcRubio and @tushar-acharya for their contributions! 18 | 19 | ### 2.2.0 20 | 21 | * Ability to change icons when the tabs are selected, using drawable selectors 22 | * Overriding tab selections is now supported, by using [TabSelectionInterceptor](https://github.com/roughike/BottomBar/blob/master/bottom-bar/src/main/java/com/roughike/bottombar/TabSelectionInterceptor.java) 23 | * Internal code quality improvements and small changes 24 | 25 | ### 2.2.0 26 | 27 | * Ability to change icons when the tabs are selected, using drawable selectors 28 | * Overriding tab selections is now supported, by using [TabSelectionInterceptor](https://github.com/roughike/BottomBar/blob/master/bottom-bar/src/main/java/com/roughike/bottombar/TabSelectionInterceptor.java) 29 | * Internal code quality improvements and small changes 30 | 31 | ### 2.2.0 32 | 33 | * Ability to change icons when the tabs are selected, using drawable selectors 34 | * Overriding tab selections is now supported, by using [TabSelectionInterceptor](https://github.com/roughike/BottomBar/blob/master/bottom-bar/src/main/java/com/roughike/bottombar/TabSelectionInterceptor.java) 35 | * Internal code quality improvements and small changes 36 | 37 | ### 2.1.2 38 | 39 | * Merged [#703](https://github.com/roughike/BottomBar/pull/703) that allows controlling badge visibility for tabs that are active. 40 | 41 | ### 2.1.1 42 | 43 | * A quick fix for a really critical bug that could affect some devices. More specifically, [this one.](https://github.com/roughike/BottomBar/issues/625) 44 | 45 | ### 2.1.0 46 | 47 | * Fixed a bug in the Badge positioning, causing the Badges to clip when there was many tabs. 48 | * Fixed a bug where the lower portion of unselected titles were clipped off in fixed mode. 49 | * Made changes to Badge restoration logic to fix [445](https://github.com/roughike/BottomBar/issues/445). Credit goes to [@Kevinrob](https://github.com/Kevinrob) for reporting and helping to reproduce the issue. 50 | * Fixed [#448](https://github.com/roughike/BottomBar/issues/448), [#471](https://github.com/roughike/BottomBar/issues/471), [#436](https://github.com/roughike/BottomBar/issues/436) and [#591](https://github.com/roughike/BottomBar/issues/591) 51 | * Fixed a faulty behavior where the tabs' widths were calculated according to phone screen width, but should've been calculated according to the parent view's width by merging [#504](https://github.com/roughike/BottomBar/pull/504) 52 | * Optimized the tab resizing calculations; now the tabs aren't needlessly removed and readded, only the layout params get changed. 53 | * Merged [#468](https://github.com/roughike/BottomBar/pull/468) and [#457](https://github.com/roughike/BottomBar/pull/457) 54 | * Fixed [#554](https://github.com/roughike/BottomBar/issues/554) by merging [#512](https://github.com/roughike/BottomBar/pull/512). 55 | * Made most of the BottomBarTab methods public. 56 | 57 | ### 2.0.2 58 | 59 | * Now we're animating the color change on tab titles and icons. 60 | * Fixed a bug where the BottomBar wouldn't hide completely when it was both shy and drawing under navbar. 61 | * Made possible to inflate the BottomBar programmatically. 62 | * Made it possible to control whether the shadow is shown or not. 63 | * Made setItems to be public to allow writing tests without a designated Activity 64 | * Made setters for allowing setting tab colors, alphas, textappearances and typefaces programmatically. 65 | * Increased test coverage a little bit. 66 | 67 | ### 2.0.1 68 | 69 | * Fixed a bug where the tab selection listener is set and multiple tabs could be selected at once 70 | * Fixed a bug where the reselection listener was fired even it shouldn't have. 71 | 72 | ### 2.0 73 | 74 | * Cleaner code and better APIs 75 | * No more unnecessary stuff or spaghetti mess 76 | * Now the look, feel and behavior is defined in XML, as it should be 77 | * No more nasty regressions, thanks to the automated tests 78 | * **Everything is a little different compared to earlier, but it's for the greater good!** 79 | 80 | See the readme for how to use the new version. 81 | 82 | ### 1.4.0.1 83 | 84 | * Merged a [PR that fixes removing all tabs from BottomBar](https://github.com/roughike/BottomBar/pull/339) 85 | 86 | ### 1.4.0 87 | 88 | * Started writing some tests. **Contributions more than welcome**, as I'm still a noob when it comes to testing. 89 | * Merged a [PR that adds support for vector drawables](https://github.com/roughike/BottomBar/pull/280) 90 | * Merged a [PR that adds support for disabling text scale animation](https://github.com/roughike/BottomBar/pull/298) 91 | * Merged a [PR that adds support for custom background and tab icon colors, and also custom alpha](https://github.com/roughike/BottomBar/pull/302) 92 | * Merged a [PR that fixes wrong method name for message shown by an exception](https://github.com/roughike/BottomBar/pull/320) 93 | 94 | ### 1.3.9 95 | 96 | * Merged [another PR that should get rid of the infinite Badge loop for good](https://github.com/roughike/BottomBar/pull/289). 97 | 98 | ### 1.3.8 99 | 100 | * Merged a [PR that fixes infinite loop caused by a layout listener when adding Badges.](https://github.com/roughike/BottomBar/pull/286) 101 | 102 | ### 1.3.7 103 | 104 | * Merged a [PR that fixes elliptical Badges](https://github.com/roughike/BottomBar/pull/275). 105 | * Fixed issues [#276](https://github.com/roughike/BottomBar/issues/276) and [#277](https://github.com/roughike/BottomBar/issues/277) 106 | 107 | ### 1.3.6 108 | 109 | * Fixed a bug that would cause the navigation bar to not be transparent. 110 | * Flattened View hierarchy. 111 | * Throwing a nice little Exception if someone tries to call ```noResizeGoodness()``` improperly, instead of just failing silently. 112 | 113 | ### 1.3.5 114 | 115 | * [Merged](https://github.com/roughike/BottomBar/pull/260) [some](https://github.com/roughike/BottomBar/pull/268) [pull](https://github.com/roughike/BottomBar/pull/269) [requests.](https://github.com/roughike/BottomBar/pull/271) 116 | * Thanks to @henhal, now the unselection bug when using badges is fixed. 117 | * Deprecated the ```setItemsFromMenu(@MenuRes int resId, OnMenuTabClickListener listener)``` method in favor of two separate methods: ```mBottomBar.setItems(@MenuRes int resId)``` and ```mBottomBar.setOnMenuTabClickListener(OnMenuTabClickListener listener)```. Not only because deprecating stuff is so fun (it is), but because this actually makes more sense than the old approach. The old approach still works. 118 | 119 | ### 1.3.4 120 | 121 | * Now the BottomBar is 56dp tall, as it should be! Make sure your icons are 24dp and **trimmed**, meaning that the whole png size musn't be more than 24dp. So **don't use padding** around the icon. 122 | * Fixed a minor bug when programmatically selecting a tab. 123 | * Added a ```setAutoHideOnSelection(boolean autoHideOnSelection)``` method for the BottomBarBadge to control whether it is automatically hidden after the tab that contains it is selected or not. 124 | * Titles are now forced to be single line, make sure your title texts are short enough, or else they'll get truncated with a "..." ! 125 | * Updated some dependencies and Gradle. 126 | 127 | ### 1.3.3 128 | 129 | * The show / hide methods now behave nicely with CoordinatorLayout. 130 | * Added alpha animation for the tab titles when using the shifting tabs. 131 | 132 | ### 1.3.2 133 | 134 | * Now it's possible to use fixed mode (show titles on inactive tabs) even when there's more than three tabs. 135 | 136 | ### 1.3.1 137 | 138 | * Fixed a critical bug in OnLongClickListener behavior (why didn't I see that before?) when using badges. 139 | 140 | ### 1.3.0 141 | 142 | * Fixed a critical bug in OnClickListener behavior when using badges. 143 | 144 | ### 1.2.9 145 | 146 | * Fixed the issue when using badges and the tab resize animation is enabled. Now the badges automatically adjust their position when the tab's size (or position) updates. 147 | 148 | ### 1.2.8 149 | 150 | * Fixed the [ugly layout bug](https://github.com/roughike/BottomBar/issues/126) that happened when calling the ```setDefaultTabPosition()``` or ```selectTabAtPosition()``` methods. 151 | 152 | ### Versions 0.0.1 - 1.2.7 153 | 154 | * Sweating my ass off making this library and trying to compete with the other ones. 155 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | BottomBar library for Android 2 | Copyright 2016 Iiro Krankka 3 | 4 | This product includes software developed by 5 | Iiro Krankka (https://github.com/roughike). -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # BottomBar (Deprecated) 2 | 3 | I don't have time to maintain this anymore. I basically wrote the whole library in a rush, without tests, while being a serious expert beginner at the time. As a result, there's a lot of unpredictable moving parts and the tests probably aren't that great either. Don't really know, since I haven't touched this in ages. 4 | 5 | I'd recommend you to use the official BottomNavigationView from Google and urge them to implement the features you need. Or use another 3rd party library. 6 | 7 | [![Build Status](https://travis-ci.org/roughike/BottomBar.svg?branch=master)](https://travis-ci.org/roughike/BottomBar) [![Coverage Status](https://coveralls.io/repos/github/roughike/BottomBar/badge.svg?branch=development)](https://coveralls.io/github/roughike/BottomBar?branch=master) [![Download](https://api.bintray.com/packages/roughike/maven/bottom-bar/images/download.svg)](https://bintray.com/roughike/maven/bottom-bar/_latestVersion) 8 | 9 | 10 | 11 | ## Version 2.0 released! 12 | 13 | [The latest version before that can be found in the v1 branch](https://github.com/roughike/BottomBar/tree/v1) 14 | 15 | * Cleaner code and better APIs 16 | * No more unnecessary stuff or spaghetti mess 17 | * Now the look, feel and behavior is defined in XML, as it should be 18 | * No more nasty regressions, thanks to the automated tests 19 | * **Everything is a little different compared to earlier, but it's for the greater good!** 20 | 21 | [How to contribute](https://github.com/roughike/BottomBar/blob/master/README.md#contributions) 22 | 23 | [Changelog](https://github.com/roughike/BottomBar/blob/master/CHANGELOG.md) 24 | 25 | ## What? 26 | 27 | A custom view component that mimics the new [Material Design Bottom Navigation pattern](https://www.google.com/design/spec/components/bottom-navigation.html). 28 | 29 | ## Does it work on my Grandpa Gary's HTC Dream? 30 | 31 | Nope. The minSDK version is **API level 11 (Honeycomb).** 32 | 33 | ## Gimme that Gradle sweetness, pls? 34 | 35 | ```groovy 36 | compile 'com.roughike:bottom-bar:2.3.1' 37 | ``` 38 | 39 | **Maven:** 40 | ```xml 41 | 42 | com.roughike 43 | bottom-bar 44 | 2.3.1 45 | pom 46 | 47 | ``` 48 | 49 | ## How? 50 | 51 | You can add items by **writing a XML resource file**. 52 | 53 | ### Creating the icons 54 | 55 | The icons must be fully opaque, solid black color, 24dp and **with no padding**. For example, [with Android Asset Studio Generic Icon generator](https://romannurik.github.io/AndroidAssetStudio/icons-generic.html), select "TRIM" and make sure the padding is 0dp. Here's what your icons should look like: 56 | 57 | ![Sample icons](https://raw.githubusercontent.com/roughike/BottomBar/master/graphics/icons-howto.png) 58 | 59 | ### Adding items from XML resource 60 | 61 | Define your tabs in an XML resource file. 62 | 63 | **res/xml/bottombar_tabs.xml:** 64 | 65 | ```xml 66 | 67 | 71 | 75 | 79 | 80 | ``` 81 | 82 | Then, add the BottomBar to your layout and give it a resource id for your tabs xml file. 83 | 84 | **layout/activity_main.xml** 85 | 86 | ```xml 87 | 91 | 92 | 93 | 98 | 99 | 105 | 106 | 107 | ``` 108 | 109 | ### Setting up listeners 110 | 111 | By default, the tabs don't do anything unless you listen for selection events and do something when the tabs are selected. 112 | 113 | **MainActivity.java:** 114 | 115 | ```java 116 | public class MainActivity extends Activity { 117 | @Override 118 | protected void onCreate(@Nullable Bundle savedInstanceState) { 119 | super.onCreate(savedInstanceState); 120 | setContentView(R.layout.activity_main); 121 | 122 | BottomBar bottomBar = (BottomBar) findViewById(R.id.bottomBar); 123 | bottomBar.setOnTabSelectListener(new OnTabSelectListener() { 124 | @Override 125 | public void onTabSelected(@IdRes int tabId) { 126 | if (tabId == R.id.tab_favorites) { 127 | // The tab with id R.id.tab_favorites was selected, 128 | // change your content accordingly. 129 | } 130 | } 131 | }); 132 | } 133 | } 134 | ``` 135 | 136 | If you want to listen for reselection events, here's how you do it: 137 | 138 | ```java 139 | bottomBar.setOnTabReselectListener(new OnTabReselectListener() { 140 | @Override 141 | public void onTabReSelected(@IdRes int tabId) { 142 | if (tabId == R.id.tab_favorites) { 143 | // The tab with id R.id.tab_favorites was reselected, 144 | // change your content accordingly. 145 | } 146 | } 147 | }); 148 | ``` 149 | 150 | ### Intercepting tab selections 151 | 152 | If you want to conditionally cancel selection of any tab, you absolutely can. Just assign a ```TabSelectionInterceptor``` to the BottomBar, and return true from the ```shouldInterceptTabSelection()``` method. 153 | 154 | ```java 155 | bottomBar.setTabSelectionInterceptor(new TabSelectionInterceptor() { 156 | @Override 157 | public boolean shouldInterceptTabSelection(@IdRes int oldTabId, @IdRes int newTabId) { 158 | if (newTabId == R.id.tab_pro_feature && !userHasProVersion()) { 159 | startProVersionPurchaseFlow(); 160 | return true; 161 | } 162 | 163 | return false; 164 | } 165 | }); 166 | ``` 167 | 168 | ### Changing icons based on selection state 169 | 170 | If you want to have different icon when a specific tab is selected, just use state list drawables. 171 | 172 | **res/drawable/my_tab_icon.xml** 173 | 174 | ```xml 175 | 176 | 177 | 178 | 179 | ``` 180 | 181 | **res/xml/bottombar_tabs.xml** 182 | 183 | ```xml 184 | ... 185 | 189 | 190 | ... 191 | ``` 192 | 193 | ### Those color changing tabs look dope. Howdoidodat? 194 | 195 | Just add ```barColorWhenSelected``` to each tab. When that tab is selected, the whole BottomBar background color is changed with a nice animation. 196 | 197 | **res/xml/bottombar_tabs.xml** 198 | 199 | ```xml 200 | 201 | 206 | 207 | 208 | ``` 209 | 210 | ### How do I draw it under the navbar? 211 | 212 | First, define a style that is a child of your main application theme: 213 | 214 | **res/values-v21/styles.xml** 215 | 216 | ```xml 217 | 222 | ``` 223 | 224 | You'll also have to **make a stub version of the same theme** to avoid crashes in previous API levels than Lollipop: 225 | 226 | **res/values/styles.xml** 227 | 228 | ```xml 229 | 8 | 9 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 8dp 6 | 16dp 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed posuere interdum sem. Quisque ligula eros ullamcorper quis, lacinia quis facilisis sed sapien. Mauris varius diam vitae arcu. Sed arcu lectus auctor vitae, consectetuer et venenatis eget velit. Sed augue orci, lacinia eu tincidunt et eleifend nec lacus. Donec ultricies nisl ut felis, suspendisse potenti. Lorem ipsum ligula ut hendrerit mollis, ipsum erat vehicula risus, eu suscipit sem libero nec erat. Aliquam erat volutpat. Sed congue augue vitae neque. Nulla consectetuer porttitor pede. Fusce purus morbi tortor magna condimentum vel, placerat id blandit sit amet tortor. 4 | 5 | Mauris sed libero. Suspendisse facilisis nulla in lacinia laoreet, lorem velit accumsan velit vel mattis libero nisl et sem. Proin interdum maecenas massa turpis sagittis in, interdum non lobortis vitae massa. Quisque purus lectus, posuere eget imperdiet nec sodales id arcu. Vestibulum elit pede dictum eu, viverra non tincidunt eu ligula. 6 | 7 | Nam molestie nec tortor. Donec placerat leo sit amet velit. Vestibulum id justo ut vitae massa. Proin in dolor mauris consequat aliquam. Donec ipsum, vestibulum ullamcorper venenatis augue. Aliquam tempus nisi in auctor vulputate, erat felis pellentesque augue nec, pellentesque lectus justo nec erat. Aliquam et nisl. Quisque sit amet dolor in justo pretium condimentum. 8 | 9 | Vivamus placerat lacus vel vehicula scelerisque, dui enim adipiscing lacus sit amet sagittis, libero enim vitae mi. In neque magna posuere, euismod ac tincidunt tempor est. Ut suscipit nisi eu purus. Proin ut pede mauris eget ipsum. Integer vel quam nunc commodo consequat. Integer ac eros eu tellus dignissim viverra. Maecenas erat aliquam erat volutpat. Ut venenatis ipsum quis turpis. Integer cursus scelerisque lorem. Sed nec mauris id quam blandit consequat. Cras nibh mi hendrerit vitae, dapibus et aliquam et magna. Nulla vitae elit. Mauris consectetuer odio vitae augue. 10 | 11 | Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed posuere interdum sem. Quisque ligula eros ullamcorper quis, lacinia quis facilisis sed sapien. Mauris varius diam vitae arcu. Sed arcu lectus auctor vitae, consectetuer et venenatis eget velit. Sed augue orci, lacinia eu tincidunt et eleifend nec lacus. Donec ultricies nisl ut felis, suspendisse potenti. Lorem ipsum ligula ut hendrerit mollis, ipsum erat vehicula risus, eu suscipit sem libero nec erat. Aliquam erat volutpat. Sed congue augue vitae neque. Nulla consectetuer porttitor pede. Fusce purus morbi tortor magna condimentum vel, placerat id blandit sit amet tortor. 12 | 13 | Mauris sed libero. Suspendisse facilisis nulla in lacinia laoreet, lorem velit accumsan velit vel mattis libero nisl et sem. Proin interdum maecenas massa turpis sagittis in, interdum non lobortis vitae massa. Quisque purus lectus, posuere eget imperdiet nec sodales id arcu. Vestibulum elit pede dictum eu, viverra non tincidunt eu ligula. 14 | 15 | Nam molestie nec tortor. Donec placerat leo sit amet velit. Vestibulum id justo ut vitae massa. Proin in dolor mauris consequat aliquam. Donec ipsum, vestibulum ullamcorper venenatis augue. Aliquam tempus nisi in auctor vulputate, erat felis pellentesque augue nec, pellentesque lectus justo nec erat. Aliquam et nisl. Quisque sit amet dolor in justo pretium condimentum. 16 | 17 | Vivamus placerat lacus vel vehicula scelerisque, dui enim adipiscing lacus sit amet sagittis, libero enim vitae mi. In neque magna posuere, euismod ac tincidunt tempor est. Ut suscipit nisi eu purus. Proin ut pede mauris eget ipsum. Integer vel quam nunc commodo consequat. Integer ac eros eu tellus dignissim viverra. Maecenas erat aliquam erat volutpat. Ut venenatis ipsum quis turpis. Integer cursus scelerisque lorem. Sed nec mauris id quam blandit consequat. Cras nibh mi hendrerit vitae, dapibus et aliquam et magna. Nulla vitae elit. Mauris consectetuer odio vitae augue. 18 | CustomColorActivity 19 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/xml/bottombar_tabs_color_changing.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 13 | 18 | 23 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/xml/bottombar_tabs_five.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 11 | 15 | 19 | 23 | -------------------------------------------------------------------------------- /app/src/main/res/xml/bottombar_tabs_three.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 11 | 15 | -------------------------------------------------------------------------------- /bottom-bar/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'com.github.kt3k.coveralls' 3 | 4 | ext { 5 | bintrayRepo = 'maven' 6 | bintrayName = 'bottom-bar' 7 | 8 | publishedGroupId = 'com.roughike' 9 | libraryName = 'bottom-bar' 10 | artifact = 'bottom-bar' 11 | 12 | libraryDescription = 'A custom view component that mimics the Material Design "Bottom navigation" pattern.' 13 | 14 | siteUrl = 'https://github.com/roughike/BottomBar' 15 | gitUrl = 'https://github.com/roughike/BottomBar.git' 16 | 17 | libraryVersion = '2.3.1' 18 | 19 | developerId = 'roughike' 20 | developerName = 'Iiro Krankka' 21 | developerEmail = 'iiro.krankka@gmail.com' 22 | 23 | licenseName = 'The Apache Software License, Version 2.0' 24 | licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt' 25 | allLicenses = ["Apache-2.0"] 26 | } 27 | 28 | android { 29 | compileSdkVersion rootProject.ext.compileSdkVersion 30 | buildToolsVersion rootProject.ext.buildToolsVersion 31 | 32 | 33 | buildTypes { 34 | debug { 35 | testCoverageEnabled true 36 | } 37 | } 38 | 39 | defaultConfig { 40 | minSdkVersion rootProject.ext.minSdkVersion 41 | targetSdkVersion rootProject.ext.targetSdkVersion 42 | versionCode 1 43 | versionName "1.0" 44 | 45 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 46 | } 47 | } 48 | 49 | coveralls { 50 | jacocoReportPath = "${buildDir}/reports/coverage/debug/report.xml" 51 | } 52 | 53 | tasks.coveralls { 54 | dependsOn 'connectedAndroidTest' 55 | onlyIf { System.env.'CI' } 56 | } 57 | 58 | dependencies { 59 | compile fileTree(dir: 'libs', include: ['*.jar']) 60 | compile 'com.android.support:appcompat-v7:' + rootProject.ext.supportLibraryVersion 61 | compile 'com.android.support:design:' + rootProject.ext.supportLibraryVersion 62 | 63 | testCompile 'junit:junit:' + rootProject.ext.junitVersion 64 | 65 | androidTestCompile 'junit:junit:4.12' 66 | androidTestCompile 'com.android.support.test:runner:0.5' 67 | androidTestCompile 'com.android.support.test:rules:0.5' 68 | androidTestCompile 'org.mockito:mockito-core:1.+' 69 | androidTestCompile "com.google.dexmaker:dexmaker:1.2" 70 | androidTestCompile "com.google.dexmaker:dexmaker-mockito:1.2" 71 | } 72 | 73 | apply plugin: 'com.github.dcendents.android-maven' 74 | 75 | group = publishedGroupId // Maven Group ID for the artifact 76 | 77 | install { 78 | repositories.mavenInstaller { 79 | // This generates POM.xml with proper parameters 80 | pom { 81 | project { 82 | packaging 'aar' 83 | groupId publishedGroupId 84 | artifactId artifact 85 | 86 | // Add your description here 87 | name libraryName 88 | description libraryDescription 89 | url siteUrl 90 | 91 | // Set your license 92 | licenses { 93 | license { 94 | name licenseName 95 | url licenseUrl 96 | } 97 | } 98 | developers { 99 | developer { 100 | id developerId 101 | name developerName 102 | email developerEmail 103 | } 104 | } 105 | scm { 106 | connection gitUrl 107 | developerConnection gitUrl 108 | url siteUrl 109 | 110 | } 111 | } 112 | } 113 | } 114 | } 115 | 116 | apply plugin: 'com.jfrog.bintray' 117 | 118 | version = libraryVersion 119 | 120 | if (project.hasProperty("android")) { // Android libraries 121 | task sourcesJar(type: Jar) { 122 | classifier = 'sources' 123 | from android.sourceSets.main.java.srcDirs 124 | } 125 | 126 | task javadoc(type: Javadoc) { 127 | source = android.sourceSets.main.java.srcDirs 128 | classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) 129 | } 130 | } else { // Java libraries 131 | task sourcesJar(type: Jar, dependsOn: classes) { 132 | classifier = 'sources' 133 | from sourceSets.main.allSource 134 | } 135 | } 136 | 137 | task javadocJar(type: Jar, dependsOn: javadoc) { 138 | classifier = 'javadoc' 139 | from javadoc.destinationDir 140 | } 141 | 142 | artifacts { 143 | archives javadocJar 144 | archives sourcesJar 145 | } 146 | 147 | // Bintray 148 | File localProps = project.rootProject.file('local.properties') 149 | 150 | if (localProps.exists()) { 151 | Properties properties = new Properties() 152 | properties.load(localProps.newDataInputStream()) 153 | 154 | bintray { 155 | user = properties.getProperty("bintray.user") 156 | key = properties.getProperty("bintray.apikey") 157 | 158 | configurations = ['archives'] 159 | pkg { 160 | repo = bintrayRepo 161 | name = bintrayName 162 | desc = libraryDescription 163 | websiteUrl = siteUrl 164 | vcsUrl = gitUrl 165 | licenses = allLicenses 166 | publish = true 167 | publicDownloadNumbers = true 168 | version { 169 | desc = libraryDescription 170 | gpg { 171 | sign = true //Determines whether to GPG sign the files. The default is false 172 | passphrase = properties.getProperty("bintray.gpg.password") 173 | //Optional. The passphrase for GPG signing' 174 | } 175 | } 176 | } 177 | } 178 | } -------------------------------------------------------------------------------- /bottom-bar/src/androidTest/assets/fonts/GREAT-VIBES-LICENSE: -------------------------------------------------------------------------------- 1 | SIL Open Font License v1.10 2 | 3 | This license can also be found at this permalink: https://www.fontsquirrel.com/license/great-vibes 4 | 5 | Copyright (c) 2012, TypeSETit, LLC (typesetit@att.net), 6 | with Reserved Font Name "Great Vibes" 7 | 8 | This Font Software is licensed under the SIL Open Font License, Version 1.1. 9 | This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL 10 | 11 | —————————————————————————————- 12 | SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 13 | —————————————————————————————- 14 | 15 | PREAMBLE 16 | The goals of the Open Font License (OFL) are to stimulate worldwide development of collaborative font projects, to support the font creation efforts of academic and linguistic communities, and to provide a free and open framework in which fonts may be shared and improved in partnership with others. 17 | 18 | The OFL allows the licensed fonts to be used, studied, modified and redistributed freely as long as they are not sold by themselves. The fonts, including any derivative works, can be bundled, embedded, redistributed and/or sold with any software provided that any reserved names are not used by derivative works. The fonts and derivatives, however, cannot be released under any other type of license. The requirement for fonts to remain under this license does not apply to any document created using the fonts or their derivatives. 19 | 20 | DEFINITIONS 21 | “Font Software” refers to the set of files released by the Copyright Holder(s) under this license and clearly marked as such. This may include source files, build scripts and documentation. 22 | 23 | “Reserved Font Name” refers to any names specified as such after the copyright statement(s). 24 | 25 | “Original Version” refers to the collection of Font Software components as distributed by the Copyright Holder(s). 26 | 27 | “Modified Version” refers to any derivative made by adding to, deleting, or substituting—in part or in whole—any of the components of the Original Version, by changing formats or by porting the Font Software to a new environment. 28 | 29 | “Author” refers to any designer, engineer, programmer, technical writer or other person who contributed to the Font Software. 30 | 31 | PERMISSION & CONDITIONS 32 | Permission is hereby granted, free of charge, to any person obtaining a copy of the Font Software, to use, study, copy, merge, embed, modify, redistribute, and sell modified and unmodified copies of the Font Software, subject to the following conditions: 33 | 34 | 1) Neither the Font Software nor any of its individual components, in Original or Modified Versions, may be sold by itself. 35 | 36 | 2) Original or Modified Versions of the Font Software may be bundled, redistributed and/or sold with any software, provided that each copy contains the above copyright notice and this license. These can be included either as stand-alone text files, human-readable headers or in the appropriate machine-readable metadata fields within text or binary files as long as those fields can be easily viewed by the user. 37 | 38 | 3) No Modified Version of the Font Software may use the Reserved Font Name(s) unless explicit written permission is granted by the corresponding Copyright Holder. This restriction only applies to the primary font name as presented to the users. 39 | 40 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font Software shall not be used to promote, endorse or advertise any Modified Version, except to acknowledge the contribution(s) of the Copyright Holder(s) and the Author(s) or with their explicit written permission. 41 | 42 | 5) The Font Software, modified or unmodified, in part or in whole, must be distributed entirely under this license, and must not be distributed under any other license. The requirement for fonts to remain under this license does not apply to any document created using the Font Software. 43 | 44 | TERMINATION 45 | This license becomes null and void if any of the above conditions are not met. 46 | 47 | DISCLAIMER 48 | THE FONT SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE. -------------------------------------------------------------------------------- /bottom-bar/src/androidTest/assets/fonts/GreatVibes-Regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/roughike/BottomBar/885d70e62359d15ed17dfd77a28809702d6ae513/bottom-bar/src/androidTest/assets/fonts/GreatVibes-Regular.otf -------------------------------------------------------------------------------- /bottom-bar/src/androidTest/java/com/roughike/bottombar/BadgeTest.java: -------------------------------------------------------------------------------- 1 | package com.roughike.bottombar; 2 | 3 | import android.os.Bundle; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.annotation.UiThreadTest; 6 | import android.support.test.filters.LargeTest; 7 | import android.support.test.runner.AndroidJUnit4; 8 | 9 | import org.junit.Assert; 10 | import org.junit.Before; 11 | import org.junit.Test; 12 | import org.junit.runner.RunWith; 13 | 14 | import static junit.framework.Assert.assertEquals; 15 | import static junit.framework.Assert.assertFalse; 16 | import static junit.framework.Assert.assertNull; 17 | import static org.junit.Assert.assertNotEquals; 18 | import static org.junit.Assert.assertNotNull; 19 | import static org.junit.Assert.assertTrue; 20 | 21 | /** 22 | * Created by iiro on 8.8.2016. 23 | */ 24 | @RunWith(AndroidJUnit4.class) 25 | @LargeTest 26 | public class BadgeTest { 27 | private BottomBar bottomBar; 28 | private BottomBarTab nearby; 29 | 30 | @Before 31 | public void setUp() { 32 | bottomBar = new BottomBar(InstrumentationRegistry.getContext()); 33 | bottomBar.setItems(com.roughike.bottombar.test.R.xml.dummy_tabs_three); 34 | nearby = bottomBar.getTabWithId(com.roughike.bottombar.test.R.id.tab_nearby); 35 | nearby.setBadgeCount(5); 36 | } 37 | 38 | @Test 39 | public void hasNoBadges_ExceptNearby() { 40 | assertNull(bottomBar.getTabWithId(com.roughike.bottombar.test.R.id.tab_favorites).badge); 41 | assertNull(bottomBar.getTabWithId(com.roughike.bottombar.test.R.id.tab_friends).badge); 42 | 43 | assertNotNull(nearby.badge); 44 | } 45 | 46 | @Test 47 | @UiThreadTest 48 | public void whenTabWithBadgeClicked_BadgeIsHidden() { 49 | InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() { 50 | @Override 51 | public void run() { 52 | bottomBar.selectTabWithId(com.roughike.bottombar.test.R.id.tab_nearby); 53 | assertFalse(nearby.badge.isVisible()); 54 | } 55 | }); 56 | } 57 | 58 | @Test 59 | @UiThreadTest 60 | public void whenBadgeCountIsZero_BadgeIsRemoved() { 61 | nearby.setBadgeCount(0); 62 | assertNull(nearby.badge); 63 | } 64 | 65 | @Test 66 | @UiThreadTest 67 | public void whenBadgeCountIsNegative_BadgeIsRemoved() { 68 | nearby.setBadgeCount(-1); 69 | assertNull(nearby.badge); 70 | } 71 | 72 | @Test 73 | @UiThreadTest 74 | public void whenBadgeStateRestored_CountPersists() { 75 | nearby.setBadgeCount(1); 76 | assertEquals(1, nearby.badge.getCount()); 77 | 78 | 79 | int tabIndex = nearby.getIndexInTabContainer(); 80 | Bundle savedInstanceState = new Bundle(); 81 | savedInstanceState.putInt(BottomBarTab.STATE_BADGE_COUNT + tabIndex, 2); 82 | nearby.restoreState(savedInstanceState); 83 | 84 | assertEquals(2, nearby.badge.getCount()); 85 | } 86 | 87 | @Test 88 | @UiThreadTest 89 | public void badgeRemovedProperly() { 90 | assertNotEquals(bottomBar.findViewById(R.id.bb_bottom_bar_item_container), nearby.getOuterView()); 91 | assertEquals(2, nearby.getOuterView().getChildCount()); 92 | assertTrue(nearby.getOuterView().getChildAt(1) instanceof BottomBarBadge); 93 | 94 | nearby.removeBadge(); 95 | assertNull(nearby.badge); 96 | assertEquals(bottomBar.findViewById(R.id.bb_bottom_bar_item_container), nearby.getOuterView()); 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /bottom-bar/src/androidTest/java/com/roughike/bottombar/BottomBarTabTest.java: -------------------------------------------------------------------------------- 1 | package com.roughike.bottombar; 2 | 3 | import android.os.Bundle; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | import android.widget.FrameLayout; 7 | 8 | import org.junit.Before; 9 | import org.junit.Test; 10 | import org.junit.runner.RunWith; 11 | 12 | import static org.junit.Assert.assertEquals; 13 | 14 | @RunWith(AndroidJUnit4.class) 15 | public class BottomBarTabTest { 16 | private FrameLayout tabContainer; 17 | private BottomBarTab tab; 18 | 19 | @Before 20 | public void setUp() { 21 | tabContainer = new FrameLayout(InstrumentationRegistry.getContext()); 22 | tab = new BottomBarTab(InstrumentationRegistry.getContext()); 23 | 24 | tabContainer.addView(tab); 25 | } 26 | 27 | @Test 28 | public void correctLayoutReturnedForFixedTab() { 29 | tab.setType(BottomBarTab.Type.FIXED); 30 | assertEquals(R.layout.bb_bottom_bar_item_fixed, tab.getLayoutResource()); 31 | } 32 | 33 | @Test(expected = IllegalStateException.class) 34 | public void setIsTitleless_WhenTrueAndIconDoesNotExist_ThrowsException() { 35 | tab.setIsTitleless(true); 36 | assertEquals(R.layout.bb_bottom_bar_item_titleless, tab.getLayoutResource()); 37 | } 38 | 39 | @Test 40 | public void correctLayoutForShiftingTab() { 41 | tab.setType(BottomBarTab.Type.SHIFTING); 42 | assertEquals(R.layout.bb_bottom_bar_item_shifting, tab.getLayoutResource()); 43 | } 44 | 45 | @Test 46 | public void correctLayoutForTabletTab() { 47 | tab.setType(BottomBarTab.Type.TABLET); 48 | assertEquals(R.layout.bb_bottom_bar_item_fixed_tablet, tab.getLayoutResource()); 49 | } 50 | 51 | @Test 52 | public void testSavedStateWithBadge_StaysIntact() { 53 | tab.setBadgeCount(5); 54 | tab.setIndexInContainer(69); 55 | assertEquals(69, tab.getIndexInTabContainer()); 56 | 57 | Bundle savedState = (Bundle) tab.onSaveInstanceState(); 58 | assertEquals(5, savedState.getInt(BottomBarTab.STATE_BADGE_COUNT + 69)); 59 | 60 | tab.setBadgeCount(9); 61 | assertEquals(9, tab.badge.getCount()); 62 | 63 | tab.onRestoreInstanceState(savedState); 64 | assertEquals(5, tab.badge.getCount()); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /bottom-bar/src/androidTest/java/com/roughike/bottombar/TabParserTest.java: -------------------------------------------------------------------------------- 1 | package com.roughike.bottombar; 2 | 3 | import android.content.Context; 4 | import android.graphics.Color; 5 | import android.graphics.drawable.Drawable; 6 | import android.support.test.InstrumentationRegistry; 7 | import android.support.test.filters.LargeTest; 8 | import android.support.test.runner.AndroidJUnit4; 9 | import android.support.v4.content.ContextCompat; 10 | 11 | import org.junit.Before; 12 | import org.junit.Test; 13 | import org.junit.runner.RunWith; 14 | 15 | import java.util.List; 16 | 17 | import static org.junit.Assert.assertEquals; 18 | import static org.junit.Assert.assertFalse; 19 | import static org.junit.Assert.assertNotNull; 20 | import static org.junit.Assert.assertNotSame; 21 | import static org.junit.Assert.assertTrue; 22 | 23 | @RunWith(AndroidJUnit4.class) 24 | @LargeTest 25 | public class TabParserTest { 26 | private Context context; 27 | private List tabs; 28 | 29 | @Before 30 | public void setUp() throws Exception { 31 | context = InstrumentationRegistry.getContext(); 32 | tabs = new TabParser( 33 | context, 34 | new BottomBarTab.Config.Builder().build(), 35 | com.roughike.bottombar.test.R.xml.dummy_tabs_five 36 | ).parseTabs(); 37 | } 38 | 39 | @Test 40 | public void correctAmountOfTabs() { 41 | assertEquals(5, tabs.size()); 42 | } 43 | 44 | @Test 45 | public void idsNotEmpty() { 46 | assertNotSame(0, tabs.get(0).getId()); 47 | assertNotSame(0, tabs.get(1).getId()); 48 | assertNotSame(0, tabs.get(2).getId()); 49 | assertNotSame(0, tabs.get(3).getId()); 50 | assertNotSame(0, tabs.get(4).getId()); 51 | } 52 | 53 | @Test 54 | public void correctTabTitles() { 55 | assertEquals("Recents", tabs.get(0).getTitle()); 56 | assertEquals("Favorites", tabs.get(1).getTitle()); 57 | assertEquals("Nearby", tabs.get(2).getTitle()); 58 | assertEquals("Friends", tabs.get(3).getTitle()); 59 | assertEquals("Food", tabs.get(4).getTitle()); 60 | } 61 | 62 | @Test 63 | public void correctInActiveColors() { 64 | assertEquals(Color.parseColor("#00FF00"), tabs.get(0).getInActiveColor()); 65 | assertEquals(Color.parseColor("#0000FF"), tabs.get(1).getInActiveColor()); 66 | assertEquals(Color.parseColor("#FF0000"), tabs.get(2).getInActiveColor()); 67 | assertEquals(Color.parseColor("#F0F000"), tabs.get(3).getInActiveColor()); 68 | assertEquals(Color.parseColor("#F00F00"), tabs.get(4).getInActiveColor()); 69 | } 70 | 71 | @Test 72 | public void correctActiveColors() { 73 | assertEquals(Color.parseColor("#FF0000"), tabs.get(0).getActiveColor()); 74 | 75 | assertEquals( 76 | ContextCompat.getColor(context, com.roughike.bottombar.test.R.color.test_random_color), 77 | tabs.get(1).getActiveColor() 78 | ); 79 | 80 | assertEquals(Color.parseColor("#0000FF"), tabs.get(2).getActiveColor()); 81 | assertEquals(Color.parseColor("#DAD666"), tabs.get(3).getActiveColor()); 82 | assertEquals(Color.parseColor("#F00F00"), tabs.get(4).getActiveColor()); 83 | } 84 | 85 | @Test 86 | public void iconResourcesExist() { 87 | assertNotNull(getDrawableByResource(tabs.get(0).getIconResId())); 88 | assertNotNull(getDrawableByResource(tabs.get(1).getIconResId())); 89 | assertNotNull(getDrawableByResource(tabs.get(2).getIconResId())); 90 | assertNotNull(getDrawableByResource(tabs.get(3).getIconResId())); 91 | assertNotNull(getDrawableByResource(tabs.get(4).getIconResId())); 92 | } 93 | 94 | @Test 95 | public void iconResourceIdsAsExpected() { 96 | int expectedId = com.roughike.bottombar.test.R.drawable.empty_icon; 97 | 98 | assertEquals(expectedId, tabs.get(0).getIconResId()); 99 | assertEquals(expectedId, tabs.get(1).getIconResId()); 100 | assertEquals(expectedId, tabs.get(2).getIconResId()); 101 | assertEquals(expectedId, tabs.get(3).getIconResId()); 102 | assertEquals(expectedId, tabs.get(4).getIconResId()); 103 | } 104 | 105 | @Test 106 | public void barColorWhenSelectedAsExpected() { 107 | assertEquals(Color.parseColor("#FF0000"), tabs.get(0).getBarColorWhenSelected()); 108 | assertEquals(Color.parseColor("#00FF00"), tabs.get(1).getBarColorWhenSelected()); 109 | assertEquals(Color.parseColor("#F00000"), tabs.get(2).getBarColorWhenSelected()); 110 | assertEquals(Color.parseColor("#00F000"), tabs.get(3).getBarColorWhenSelected()); 111 | assertEquals(Color.parseColor("#00F0F0"), tabs.get(4).getBarColorWhenSelected()); 112 | } 113 | 114 | @Test 115 | public void badgeBackgroundColorAsExpected() { 116 | assertEquals(Color.parseColor("#FF0000"), tabs.get(0).getBadgeBackgroundColor()); 117 | assertEquals(Color.parseColor("#00FF00"), tabs.get(1).getBadgeBackgroundColor()); 118 | assertEquals(Color.parseColor("#F00000"), tabs.get(2).getBadgeBackgroundColor()); 119 | assertEquals(Color.parseColor("#00F000"), tabs.get(3).getBadgeBackgroundColor()); 120 | assertEquals(Color.parseColor("#00F0F0"), tabs.get(4).getBadgeBackgroundColor()); 121 | } 122 | 123 | @Test 124 | public void correctBadgeHidingPolicies() { 125 | assertFalse(tabs.get(0).getBadgeHidesWhenActive()); 126 | assertTrue(tabs.get(1).getBadgeHidesWhenActive()); 127 | assertFalse(tabs.get(2).getBadgeHidesWhenActive()); 128 | assertTrue(tabs.get(3).getBadgeHidesWhenActive()); 129 | assertTrue(tabs.get(4).getBadgeHidesWhenActive()); 130 | } 131 | 132 | @Test 133 | public void titlelessTabsAsExpected() { 134 | assertFalse(tabs.get(0).isTitleless()); 135 | assertFalse(tabs.get(1).isTitleless()); 136 | assertTrue(tabs.get(2).isTitleless()); 137 | assertFalse(tabs.get(3).isTitleless()); 138 | assertTrue(tabs.get(4).isTitleless()); 139 | } 140 | 141 | private Drawable getDrawableByResource(int iconResId) { 142 | return ContextCompat.getDrawable(context, iconResId); 143 | } 144 | } -------------------------------------------------------------------------------- /bottom-bar/src/androidTest/res/drawable-nodpi/empty_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/roughike/BottomBar/885d70e62359d15ed17dfd77a28809702d6ae513/bottom-bar/src/androidTest/res/drawable-nodpi/empty_icon.png -------------------------------------------------------------------------------- /bottom-bar/src/androidTest/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FAB123 4 | #DAD666 5 | -------------------------------------------------------------------------------- /bottom-bar/src/androidTest/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Favorites 3 | Friends 4 | 5 | -------------------------------------------------------------------------------- /bottom-bar/src/androidTest/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 17 | 18 | 21 | 22 | 25 | 26 | 30 | 31 | 34 | -------------------------------------------------------------------------------- /bottom-bar/src/test/java/com/roughike/bottombar/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.roughike.bottombar; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * To work on unit tests, switch the Test Artifact in the Build Variants view. 9 | */ 10 | public class ExampleUnitTest { 11 | @Test 12 | public void addition_isCorrect() throws Exception { 13 | assertEquals(4, 2 + 2); 14 | } 15 | } -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:2.3.1' 9 | classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6' 10 | classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1' 11 | classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.4.0' 12 | 13 | // NOTE: Do not place your application dependencies here; they belong 14 | // in the individual module build.gradle files 15 | } 16 | } 17 | 18 | allprojects { 19 | repositories { 20 | jcenter() 21 | } 22 | } 23 | 24 | task clean(type: Delete) { 25 | delete rootProject.buildDir 26 | } 27 | 28 | ext { 29 | compileSdkVersion = 25 30 | buildToolsVersion = "25.0.2" 31 | minSdkVersion = 11 32 | targetSdkVersion = 25 33 | supportLibraryVersion = "25.3.0" 34 | 35 | junitVersion = "4.12" 36 | } 37 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/roughike/BottomBar/885d70e62359d15ed17dfd77a28809702d6ae513/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sat Mar 25 00:47:49 IST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /graphics/icons-howto.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/roughike/BottomBar/885d70e62359d15ed17dfd77a28809702d6ae513/graphics/icons-howto.png -------------------------------------------------------------------------------- /graphics/screenshot_tablet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/roughike/BottomBar/885d70e62359d15ed17dfd77a28809702d6ae513/graphics/screenshot_tablet.png -------------------------------------------------------------------------------- /graphics/shifting-demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/roughike/BottomBar/885d70e62359d15ed17dfd77a28809702d6ae513/graphics/shifting-demo.gif -------------------------------------------------------------------------------- /graphics/shy-demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/roughike/BottomBar/885d70e62359d15ed17dfd77a28809702d6ae513/graphics/shy-demo.gif -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':bottom-bar' 2 | --------------------------------------------------------------------------------