├── .DS_Store ├── LICENSE ├── MaterialBottomBar ├── .gitignore ├── .idea │ ├── caches │ │ ├── build_file_checksums.ser │ │ └── gradle_models.ser │ ├── dictionaries │ │ └── moos.xml │ ├── encodings.xml │ ├── gradle.xml │ ├── misc.xml │ ├── modules.xml │ ├── runConfigurations.xml │ └── vcs.xml ├── art │ ├── bottom_bar.gif │ └── md_bottom_tab.gif ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── library │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ ├── androidTest │ │ └── java │ │ │ └── com │ │ │ └── moos │ │ │ └── navigation │ │ │ └── ExampleInstrumentedTest.java │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── moos │ │ │ │ └── navigation │ │ │ │ ├── BottomBarLayout.java │ │ │ │ └── BottomTabView.java │ │ └── res │ │ │ ├── drawable │ │ │ └── tab_unread_default_bg.xml │ │ │ └── values │ │ │ ├── attrs.xml │ │ │ └── strings.xml │ │ └── test │ │ └── java │ │ └── com │ │ └── moos │ │ └── navigation │ │ └── ExampleUnitTest.java ├── sample │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ ├── androidTest │ │ └── java │ │ │ └── com │ │ │ └── github │ │ │ └── moos │ │ │ └── ExampleInstrumentedTest.java │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── github │ │ │ │ └── moos │ │ │ │ ├── MainActivity.java │ │ │ │ ├── adapter │ │ │ │ └── CardViewPagerAdapter.java │ │ │ │ ├── bean │ │ │ │ └── CardBean.java │ │ │ │ └── fragment │ │ │ │ ├── ContentFragment.java │ │ │ │ ├── HorizontalSampleFragment.java │ │ │ │ └── VerticalSampleFragment.java │ │ └── res │ │ │ ├── drawable-hdpi │ │ │ ├── activity.png │ │ │ ├── eyebrows.png │ │ │ ├── home.png │ │ │ ├── user.png │ │ │ └── user_selected.png │ │ │ ├── drawable-mdpi │ │ │ ├── activity.png │ │ │ ├── eyebrows.png │ │ │ ├── home.png │ │ │ ├── user.png │ │ │ └── user_selected.png │ │ │ ├── drawable-v24 │ │ │ └── ic_launcher_foreground.xml │ │ │ ├── drawable-xhdpi │ │ │ ├── activity.png │ │ │ ├── eyebrows.png │ │ │ ├── home.png │ │ │ ├── user.png │ │ │ └── user_selected.png │ │ │ ├── drawable-xxhdpi │ │ │ ├── activity.png │ │ │ ├── eyebrows.png │ │ │ ├── home.png │ │ │ ├── user.png │ │ │ ├── user_selected.png │ │ │ ├── work_edit_music_selected_state.png │ │ │ ├── work_edit_music_unselected_state.png │ │ │ ├── work_edit_sticker_selected_state.png │ │ │ ├── work_edit_sticker_unselected_state.png │ │ │ ├── work_edit_words_selected_state.png │ │ │ └── work_edit_words_unselected_state.png │ │ │ ├── drawable-xxxhdpi │ │ │ ├── activity.png │ │ │ ├── eyebrows.png │ │ │ ├── home.png │ │ │ ├── user.png │ │ │ └── user_selected.png │ │ │ ├── drawable │ │ │ ├── ic_launcher_background.xml │ │ │ ├── icon1.png │ │ │ ├── icon2.png │ │ │ ├── icon3.png │ │ │ ├── icon_book.png │ │ │ ├── icon_film.png │ │ │ ├── icon_music.png │ │ │ ├── image1.jpg │ │ │ ├── image2.jpg │ │ │ ├── image3.jpg │ │ │ ├── msg_bg.png │ │ │ └── tab_unread_default_bg.xml │ │ │ ├── layout │ │ │ ├── activity_main.xml │ │ │ ├── card_item_layout.xml │ │ │ ├── fm_content.xml │ │ │ ├── fm_sample_horizontal.xml │ │ │ └── fm_sample_vertical.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ └── values │ │ │ ├── attrs.xml │ │ │ ├── colors.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ │ └── test │ │ └── java │ │ └── com │ │ └── github │ │ └── moos │ │ └── ExampleUnitTest.java └── settings.gradle └── README.md /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/.DS_Store -------------------------------------------------------------------------------- /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 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /MaterialBottomBar/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | -------------------------------------------------------------------------------- /MaterialBottomBar/.idea/caches/build_file_checksums.ser: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/.idea/caches/build_file_checksums.ser -------------------------------------------------------------------------------- /MaterialBottomBar/.idea/caches/gradle_models.ser: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/.idea/caches/gradle_models.ser -------------------------------------------------------------------------------- /MaterialBottomBar/.idea/dictionaries/moos.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /MaterialBottomBar/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /MaterialBottomBar/.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 19 | -------------------------------------------------------------------------------- /MaterialBottomBar/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | Android 47 | 48 | 49 | CorrectnessLintAndroid 50 | 51 | 52 | Java 53 | 54 | 55 | LintAndroid 56 | 57 | 58 | Probable bugsJava 59 | 60 | 61 | RELAX NG 62 | 63 | 64 | 65 | 66 | Android 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 78 | 79 | 80 | 81 | 82 | 83 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 99 | 100 | 101 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /MaterialBottomBar/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /MaterialBottomBar/.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /MaterialBottomBar/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /MaterialBottomBar/art/bottom_bar.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/art/bottom_bar.gif -------------------------------------------------------------------------------- /MaterialBottomBar/art/md_bottom_tab.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/art/md_bottom_tab.gif -------------------------------------------------------------------------------- /MaterialBottomBar/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | 5 | repositories { 6 | google() 7 | jcenter() 8 | } 9 | dependencies { 10 | classpath 'com.android.tools.build:gradle:3.0.0' 11 | classpath 'com.novoda:bintray-release:0.8.0' 12 | 13 | 14 | // NOTE: Do not place your application dependencies here; they belong 15 | // in the individual module build.gradle files 16 | } 17 | } 18 | 19 | allprojects { 20 | tasks.withType(Javadoc) { 21 | options{ 22 | encoding "UTF-8" 23 | charSet 'UTF-8' 24 | links "http://docs.oracle.com/javase/7/docs/api" 25 | } 26 | } 27 | 28 | repositories { 29 | google() 30 | jcenter() 31 | } 32 | } 33 | 34 | task clean(type: Delete) { 35 | delete rootProject.buildDir 36 | } 37 | -------------------------------------------------------------------------------- /MaterialBottomBar/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 | org.gradle.jvmargs=-Xmx1536m 13 | android.injected.testOnly=false 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 19 | -------------------------------------------------------------------------------- /MaterialBottomBar/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /MaterialBottomBar/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu Apr 12 09:08:39 CST 2018 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-4.1-all.zip 7 | -------------------------------------------------------------------------------- /MaterialBottomBar/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 | -------------------------------------------------------------------------------- /MaterialBottomBar/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /MaterialBottomBar/library/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /MaterialBottomBar/library/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 26 5 | 6 | 7 | 8 | defaultConfig { 9 | minSdkVersion 16 10 | targetSdkVersion 26 11 | versionCode 1 12 | versionName "1.0" 13 | 14 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 15 | 16 | } 17 | 18 | buildTypes { 19 | release { 20 | minifyEnabled false 21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 22 | } 23 | } 24 | 25 | } 26 | 27 | dependencies { 28 | implementation fileTree(dir: 'libs', include: ['*.jar']) 29 | 30 | implementation 'com.android.support:appcompat-v7:26.1.0' 31 | testImplementation 'junit:junit:4.12' 32 | } 33 | 34 | apply plugin: 'com.novoda.bintray-release' 35 | 36 | 37 | publish { 38 | userOrg = 'moosphon'//bintray-username 39 | groupId = 'com.moos'//group name 40 | artifactId = 'Material-BottomBarLayout'//项目名称 41 | publishVersion = '1.0.7'//version 42 | desc = 'This is a pretty and simple used library for navigation pages on android' 43 | website = 'https://github.com/Moosphan/Material-BottomBarLayout'//website 44 | } 45 | 46 | // v1.0.7:fix the problem that unselected icons still have color filter effect. -------------------------------------------------------------------------------- /MaterialBottomBar/library/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /MaterialBottomBar/library/src/androidTest/java/com/moos/navigation/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.moos.navigation; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.moos.library.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /MaterialBottomBar/library/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /MaterialBottomBar/library/src/main/java/com/moos/navigation/BottomBarLayout.java: -------------------------------------------------------------------------------- 1 | package com.moos.navigation; 2 | 3 | import android.content.Context; 4 | import android.content.res.TypedArray; 5 | import android.graphics.Color; 6 | import android.os.Parcel; 7 | import android.os.Parcelable; 8 | import android.support.annotation.Nullable; 9 | import android.support.v4.view.ViewPager; 10 | import android.util.AttributeSet; 11 | import android.view.View; 12 | import android.view.ViewGroup; 13 | import android.view.animation.AccelerateDecelerateInterpolator; 14 | import android.widget.LinearLayout; 15 | 16 | import java.lang.ref.WeakReference; 17 | import java.util.ArrayList; 18 | import java.util.List; 19 | 20 | import static android.support.v4.view.ViewPager.SCROLL_STATE_DRAGGING; 21 | import static android.support.v4.view.ViewPager.SCROLL_STATE_IDLE; 22 | import static android.support.v4.view.ViewPager.SCROLL_STATE_SETTLING; 23 | 24 | /** 25 | * Created by moos on 2018/4/27. 26 | *

the layout to contain the tabs, it support the mixed views

27 | * GitHub: https://github.com/Moosphan 28 | * Updated on 2019/07/19 29 | */ 30 | 31 | public class BottomBarLayout extends LinearLayout { 32 | public static final String TAG = "BottomBarLayout"; 33 | 34 | /** 35 | * the tabs added in bottomBarLayout 36 | */ 37 | private List mTabs = new ArrayList<>(); 38 | /** 39 | * the container of the added tabs 40 | */ 41 | private LinearLayout mBottomBarLayout; 42 | /** 43 | * the current position of selected tab 44 | */ 45 | private int mCurrentPosition = 0; 46 | /** 47 | * the arrange way of tabs in container 48 | */ 49 | private int mArrangeType = 1; 50 | /** 51 | * the background of tabs container 52 | */ 53 | private int mTabsBackground; 54 | /** 55 | * the params of each tab 56 | */ 57 | private LayoutParams mTabParams; 58 | /** 59 | * the listener of tab when select 60 | */ 61 | private OnTabSelectedListener mListener; 62 | /** 63 | * arrangement way of tabs 64 | */ 65 | private ArrangeType arrangeType; 66 | /** 67 | * the viewPager to bind 68 | */ 69 | private ViewPager mViewPager; 70 | /** 71 | * apply animation of {@link BottomTabView} or not. 72 | */ 73 | private Boolean animationEnable = true; 74 | 75 | private BottomBarLayoutOnPageChangeListener mPageChangeListener; 76 | 77 | private ViewPagerOnTabSelectedListener mCurrentVpSelectedListener; 78 | 79 | public BottomBarLayout(Context context) { 80 | super(context); 81 | init(context, null); 82 | } 83 | 84 | public BottomBarLayout(Context context, @Nullable AttributeSet attrs) { 85 | super(context, attrs); 86 | init(context, attrs); 87 | } 88 | 89 | public BottomBarLayout(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { 90 | super(context, attrs, defStyleAttr); 91 | init(context, attrs); 92 | } 93 | 94 | private void init(Context context, AttributeSet attrs){ 95 | TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.BottomBarLayout); 96 | mArrangeType = typedArray.getInt(R.styleable.BottomBarLayout_tabs_arrange_way, 1); 97 | mTabsBackground = typedArray.getResourceId(R.styleable.BottomBarLayout_tabs_background, Color.parseColor("#ffffff")); 98 | typedArray.recycle(); 99 | 100 | setOrientation(VERTICAL); 101 | mBottomBarLayout = new LinearLayout(context); 102 | mBottomBarLayout.setBackgroundColor(mTabsBackground); 103 | 104 | 105 | 106 | initTab(); 107 | } 108 | 109 | private void initTab(){ 110 | if(mArrangeType == 1){ 111 | arrangeType = ArrangeType.HORIZONTAL; 112 | mBottomBarLayout.setOrientation(HORIZONTAL); 113 | 114 | mTabParams = new LayoutParams(0, ViewGroup.LayoutParams.MATCH_PARENT); 115 | }else { 116 | arrangeType = ArrangeType.VERTICAL; 117 | mBottomBarLayout.setOrientation(VERTICAL); 118 | 119 | mTabParams = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0); 120 | } 121 | addView(mBottomBarLayout, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); 122 | 123 | mTabParams.weight = 1; 124 | } 125 | 126 | /** 127 | * add the tab for container 128 | * @param tab {@link BottomTabView}each tab 129 | * @return current container 130 | */ 131 | public BottomBarLayout addTab(final BottomTabView tab){ 132 | tab.setOnClickListener(new OnClickListener() { 133 | @Override 134 | public void onClick(View view) { 135 | 136 | if(mListener == null) 137 | return; 138 | int position = tab.getTabPosition(); 139 | if(position == mCurrentPosition){ 140 | mListener.onTabReselected(tab); 141 | }else { 142 | mListener.onTabSelected(tab); 143 | tab.setSelected(true); 144 | // apply the animation, now just support default animation -> Scale Animation 145 | if(animationEnable) { 146 | // start animation of current selected tab. 147 | startTabJumpAnimation(tab.getTabContainer(), 300); 148 | // start animation of previous selected tab to restore it. 149 | recoverToOrigin(mTabs.get(mCurrentPosition).getTabContainer(), 300); 150 | } 151 | if(mViewPager!=null){ 152 | mViewPager.setCurrentItem(position); 153 | } 154 | mListener.onTabUnselected(mTabs.get(mCurrentPosition)); 155 | mTabs.get(mCurrentPosition).setSelected(false); 156 | mCurrentPosition = position; 157 | } 158 | 159 | } 160 | }); 161 | 162 | tab.setTabPosition(mBottomBarLayout.getChildCount()); 163 | tab.setLayoutParams(mTabParams); 164 | mBottomBarLayout.addView(tab); 165 | mTabs.add(tab); 166 | 167 | return this; 168 | } 169 | 170 | /** 171 | * batch add the tabs into container 172 | * @param tabs {@link BottomTabView} many tabs 173 | */ 174 | public void addTabs(List tabs){ 175 | for(BottomTabView tab : tabs){ 176 | addTab(tab); 177 | } 178 | 179 | } 180 | 181 | /*** 182 | * set current tab in your self 183 | * @param position position you want 184 | */ 185 | public void setCurrentTab(final int position) { 186 | mBottomBarLayout.post(new Runnable() { 187 | @Override 188 | public void run() { 189 | mBottomBarLayout.getChildAt(position).performClick(); 190 | } 191 | }); 192 | } 193 | 194 | /** 195 | * get current selected tab's position 196 | * @return position 197 | */ 198 | public int getCurrentTabPosition() { 199 | return mCurrentPosition; 200 | } 201 | 202 | /** 203 | * get the count of tabs 204 | * @return tab counts in {@link BottomBarLayout} 205 | */ 206 | public int getTabCount(){ 207 | return mTabs!=null ? mTabs.size() : 0; 208 | } 209 | 210 | /** 211 | * set call back of tab's selected operation 212 | * @param onTabSelectedListener call back 213 | * @return this 214 | */ 215 | public BottomBarLayout create(OnTabSelectedListener onTabSelectedListener) { 216 | mListener = onTabSelectedListener; 217 | return this; 218 | } 219 | 220 | /** 221 | * apply the animation of {@link BottomTabView} or not. 222 | * @param isSupport whether support animation of tabs. 223 | */ 224 | public void animationEnable(Boolean isSupport) { 225 | this.animationEnable = isSupport; 226 | } 227 | 228 | private void startTabJumpAnimation(LinearLayout tab, int duration){ 229 | tab.animate().scaleX(1.1f).scaleY(1.1f) 230 | .setDuration(duration) 231 | .setInterpolator(new AccelerateDecelerateInterpolator()) 232 | .start(); 233 | } 234 | 235 | private void recoverToOrigin(LinearLayout tab, int duration){ 236 | tab.animate().scaleX(1f).scaleY(1f) 237 | .setDuration(duration) 238 | .setInterpolator(new AccelerateDecelerateInterpolator()) 239 | .start(); 240 | } 241 | 242 | 243 | /** 244 | * bind the viewPager and scroll with it 245 | * @param viewPager mViewPager 246 | */ 247 | public void bindViewPager(ViewPager viewPager){ 248 | if (mViewPager != null) { 249 | // If we've already been setup with a ViewPager, remove us from it 250 | if (mPageChangeListener != null) { 251 | mViewPager.removeOnPageChangeListener(mPageChangeListener); 252 | } 253 | } 254 | 255 | if (mCurrentVpSelectedListener != null) { 256 | // If we already have a tab selected listener for the ViewPager, remove it 257 | mCurrentVpSelectedListener = null; 258 | } 259 | 260 | if (viewPager != null) { 261 | mViewPager = viewPager; 262 | 263 | // Add our custom OnPageChangeListener to the ViewPager 264 | if (mPageChangeListener == null) { 265 | mPageChangeListener = new BottomBarLayoutOnPageChangeListener(this); 266 | } 267 | mPageChangeListener.reset(); 268 | viewPager.addOnPageChangeListener(mPageChangeListener); 269 | 270 | // Now we'll add a tab selected listener to set ViewPager's current item 271 | mCurrentVpSelectedListener = new BottomBarLayout.ViewPagerOnTabSelectedListener(viewPager); 272 | setScrollPosition(viewPager.getCurrentItem(), 0f, true); 273 | } else { 274 | // We've been given a null ViewPager so we need to clear out the internal state, 275 | // listeners and observers 276 | mViewPager = null; 277 | } 278 | } 279 | 280 | /** 281 | * the way of tabs arranges 282 | * @param arrangeType type 283 | */ 284 | public void setArrangeType(ArrangeType arrangeType){ 285 | this.arrangeType = arrangeType; 286 | 287 | } 288 | 289 | private void setScrollPosition(int position, float positionOffset, boolean updateSelectedText){ 290 | final int roundedPosition = Math.round(position + positionOffset); 291 | if (roundedPosition < 0 ) { 292 | return; 293 | } 294 | // Update the 'selected state' view as we scroll, if enabled 295 | if (updateSelectedText) { 296 | setCurrentTab(roundedPosition); 297 | } 298 | } 299 | 300 | /** 301 | * the way tabs arranges 302 | */ 303 | public enum ArrangeType{ 304 | HORIZONTAL, 305 | VERTICAL 306 | } 307 | 308 | 309 | 310 | 311 | public interface OnTabSelectedListener { 312 | void onTabSelected(BottomTabView tab); 313 | 314 | void onTabUnselected(BottomTabView tab); 315 | 316 | void onTabReselected(BottomTabView tab); 317 | } 318 | 319 | @Override 320 | protected Parcelable onSaveInstanceState() { 321 | Parcelable superState = super.onSaveInstanceState(); 322 | return new TabSavedState(superState, mCurrentPosition); 323 | } 324 | 325 | @Override 326 | protected void onRestoreInstanceState(Parcelable state) { 327 | TabSavedState ss = (TabSavedState) state; 328 | super.onRestoreInstanceState(ss.getSuperState()); 329 | 330 | if (mCurrentPosition != ss.position) { 331 | mBottomBarLayout.getChildAt(mCurrentPosition).setSelected(false); 332 | mBottomBarLayout.getChildAt(ss.position).setSelected(true); 333 | } 334 | mCurrentPosition = ss.position; 335 | } 336 | 337 | /** 338 | * Save the tab position for viewGroup 339 | */ 340 | static class TabSavedState extends BaseSavedState { 341 | private int position; 342 | 343 | public TabSavedState(Parcel source) { 344 | super(source); 345 | position = source.readInt(); 346 | } 347 | 348 | public TabSavedState(Parcelable superState, int position) { 349 | super(superState); 350 | this.position = position; 351 | } 352 | 353 | @Override 354 | public void writeToParcel(Parcel out, int flags) { 355 | super.writeToParcel(out, flags); 356 | out.writeInt(position); 357 | } 358 | 359 | public static final Creator CREATOR = new Creator() { 360 | public TabSavedState createFromParcel(Parcel in) { 361 | return new TabSavedState(in); 362 | } 363 | 364 | public TabSavedState[] newArray(int size) { 365 | return new TabSavedState[size]; 366 | } 367 | }; 368 | } 369 | 370 | public static class BottomBarLayoutOnPageChangeListener implements ViewPager.OnPageChangeListener { 371 | private final WeakReference mTabLayoutRef; 372 | private int mPreviousScrollState; 373 | private int mScrollState; 374 | 375 | public BottomBarLayoutOnPageChangeListener(BottomBarLayout tabLayout) { 376 | mTabLayoutRef = new WeakReference<>(tabLayout); 377 | } 378 | 379 | @Override 380 | public void onPageScrollStateChanged(final int state) { 381 | mPreviousScrollState = mScrollState; 382 | mScrollState = state; 383 | } 384 | 385 | @Override 386 | public void onPageScrolled(final int position, final float positionOffset, 387 | final int positionOffsetPixels) { 388 | final BottomBarLayout bottomBarLayout = mTabLayoutRef.get(); 389 | if (bottomBarLayout != null) { 390 | // Only update the text selection if we're not settling, or we are settling after 391 | // being dragged 392 | final boolean updateText = mScrollState != SCROLL_STATE_SETTLING || 393 | mPreviousScrollState == SCROLL_STATE_DRAGGING; 394 | 395 | bottomBarLayout.setScrollPosition(position, positionOffset, updateText); 396 | } 397 | } 398 | 399 | @Override 400 | public void onPageSelected(final int position) { 401 | final BottomBarLayout bottomBarLayout = mTabLayoutRef.get(); 402 | if (bottomBarLayout != null && bottomBarLayout.getCurrentTabPosition() != position 403 | && position < bottomBarLayout.getTabCount()) { 404 | // Select the tab, only updating the indicator if we're not being dragged/settled 405 | bottomBarLayout.setCurrentTab(position); 406 | } 407 | } 408 | 409 | void reset() { 410 | mPreviousScrollState = mScrollState = SCROLL_STATE_IDLE; 411 | } 412 | } 413 | 414 | /** 415 | * A {@link BottomBarLayout.OnTabSelectedListener} class which contains the necessary calls back 416 | * to the provided {@link ViewPager} so that the tab position is kept in sync. 417 | */ 418 | public static class ViewPagerOnTabSelectedListener implements BottomBarLayout.OnTabSelectedListener { 419 | private final ViewPager mViewPager; 420 | 421 | public ViewPagerOnTabSelectedListener(ViewPager viewPager) { 422 | mViewPager = viewPager; 423 | } 424 | 425 | 426 | @Override 427 | public void onTabSelected(BottomTabView tab) { 428 | mViewPager.setCurrentItem(tab.getTabPosition()); 429 | } 430 | 431 | @Override 432 | public void onTabUnselected(BottomTabView tab) { 433 | 434 | } 435 | 436 | @Override 437 | public void onTabReselected(BottomTabView tab) { 438 | 439 | } 440 | } 441 | 442 | 443 | 444 | 445 | } 446 | -------------------------------------------------------------------------------- /MaterialBottomBar/library/src/main/java/com/moos/navigation/BottomTabView.java: -------------------------------------------------------------------------------- 1 | package com.moos.navigation; 2 | 3 | import android.content.Context; 4 | import android.content.res.TypedArray; 5 | import android.graphics.Color; 6 | import android.graphics.drawable.Drawable; 7 | import android.support.annotation.ColorInt; 8 | import android.support.annotation.DrawableRes; 9 | import android.support.annotation.NonNull; 10 | import android.support.annotation.Nullable; 11 | import android.util.AttributeSet; 12 | import android.util.Log; 13 | import android.util.TypedValue; 14 | import android.view.Gravity; 15 | import android.view.View; 16 | import android.view.ViewGroup; 17 | import android.widget.FrameLayout; 18 | import android.widget.ImageView; 19 | import android.widget.LinearLayout; 20 | import android.widget.TextView; 21 | 22 | /** 23 | * GitHub: https://github.com/Moosphan 24 | * Created by moosphon on 2018/4/26. 25 | *

the tab in bottom bar layout

26 | * 27 | * Updated by moosphon on 2019/7/19 28 | * 29 | * todo:使用建造者模式创建tab,并将setLayoutParams放在最后的create方法里调用 30 | */ 31 | 32 | public class BottomTabView extends FrameLayout { 33 | public static final String TAG = "BottomTabView"; 34 | 35 | /** 36 | * the icon view of tab 37 | */ 38 | private ImageView mTabIcon; 39 | /** 40 | * the title view of tab 41 | */ 42 | private TextView mTabTitle; 43 | /** 44 | * the context 45 | */ 46 | private Context mContext; 47 | /** 48 | * the current tab's position 49 | */ 50 | private int mTabPosition = -1; 51 | /** 52 | * the icon res of tab (normal state) 53 | */ 54 | private @DrawableRes int tabIcon; 55 | /** 56 | * the selected state icon res of tab 57 | */ 58 | private @DrawableRes int selectedTabIcon; 59 | /** 60 | * the size of inner icon 61 | */ 62 | private float mTabIconSize = 20; 63 | /** 64 | * the title of tab 65 | */ 66 | private String tabText; 67 | /** 68 | * the color when select the tab 69 | */ 70 | private int mSelectedColor = Color.parseColor("#000000"); 71 | /** 72 | * the color of normal state 73 | */ 74 | private int mUnSelectedColor = Color.parseColor("#a5a5a5"); 75 | /** 76 | * the counts of unread msg 77 | */ 78 | private TextView mTabUnreadCount; 79 | 80 | /** 81 | * the size of tab text 82 | */ 83 | private int mTabTextSize = 12; 84 | /** 85 | * the padding of tab 86 | */ 87 | private int mTabPadding = 5; 88 | /** 89 | * unread msg text background 90 | */ 91 | private @DrawableRes int mBubbleBackground = R.drawable.tab_unread_default_bg; 92 | /** 93 | * the color of unread msg 94 | */ 95 | private int mUnreadTextColor = Color.parseColor("#ffffff"); 96 | /** 97 | * the size of unread text 98 | */ 99 | private int mUnreadTextSize = 10; 100 | /** 101 | * the size of bubble(unread msg) 102 | */ 103 | private int mBubbleSize = 18; 104 | /** 105 | * the padding of unread text 106 | */ 107 | private int mUnreadTextPadding = 3; 108 | /** 109 | * the margin top value of unread bubble 110 | */ 111 | private int mUnreadTextMarginTop = 3; 112 | /** 113 | * the margin right value of unread bubble 114 | */ 115 | private int mUnreadTextMarginRight = 32; 116 | /** 117 | * the counts of unread msg fot tab 118 | */ 119 | private int mUnreadMsgCount = 0; 120 | /** 121 | * weather show the tab title 122 | */ 123 | private boolean isIconOnly = false; 124 | /** 125 | * weather show the tab icon 126 | */ 127 | private boolean isTitleOnly = false; 128 | 129 | /** 130 | * the LayoutParams of icon view 131 | */ 132 | private LinearLayout.LayoutParams iconParams; 133 | /** 134 | * the LayoutParams of title view 135 | */ 136 | private LinearLayout.LayoutParams titleParams; 137 | /** 138 | * the container of tab 139 | */ 140 | private LinearLayout tabContainer; 141 | /** 142 | * the LayoutParams of bubble view 143 | */ 144 | private LayoutParams unreadParams; 145 | 146 | /** 147 | * whether has different icon res for different states on tabs 148 | */ 149 | private boolean isMultiIcon = false; 150 | 151 | 152 | public BottomTabView(@NonNull Context context) { 153 | super(context); 154 | initAttrs(context, null); 155 | 156 | } 157 | 158 | public BottomTabView(@NonNull Context context, @Nullable AttributeSet attrs) { 159 | super(context, attrs); 160 | initAttrs(context, attrs); 161 | } 162 | 163 | public BottomTabView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { 164 | super(context, attrs, defStyleAttr); 165 | initAttrs(context, attrs); 166 | } 167 | 168 | private void initAttrs(Context context, AttributeSet attrs){ 169 | this.mContext = context; 170 | TypedArray rippleTypeArray = context.obtainStyledAttributes(new int[]{R.attr.selectableItemBackgroundBorderless}); 171 | Drawable rippleDrawable = rippleTypeArray.getDrawable(0); 172 | setBackground(rippleDrawable); 173 | rippleTypeArray.recycle(); 174 | 175 | /*TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.BottomTabView); 176 | tabIcon = typedArray.getResourceId(R.styleable.BottomTabView_tab_icon, R.mipmap.ic_launcher); 177 | tabText = typedArray.getString(R.styleable.BottomTabView_tab_text); 178 | mTabIconSize = typedArray.getDimensionPixelSize(R.styleable.BottomTabView_tab_icon_size, getResources().getDimensionPixelSize(R.dimen.tab_icon_default_size)); 179 | mSelectedColor = typedArray.getColor(R.styleable.BottomTabView_tab_selected_color, Color.parseColor("#000000")); 180 | mUnSelectedColor = typedArray.getColor(R.styleable.BottomTabView_tab_unSelect_color, Color.parseColor("#a5a5a5")); 181 | //isTabAnimated = typedArray.getBoolean(R.styleable.BottomTabView_tab_is_animated, false); 182 | mTabTextSize = typedArray.getDimensionPixelSize(R.styleable.BottomTabView_tab_text_size, getResources().getDimensionPixelSize(R.dimen.tab_text_default_size)); 183 | mTabPadding = typedArray.getDimensionPixelSize(R.styleable.BottomTabView_tab_padding, getResources().getDimensionPixelSize(R.dimen.tab_default_padding)); 184 | mBubbleBackground = typedArray.getResourceId(R.styleable.BottomTabView_tab_unread_background, R.drawable.tab_unread_default_bg); 185 | mUnreadTextColor = typedArray.getColor(R.styleable.BottomTabView_tab_unread_text_color, Color.parseColor("#ffffff")); 186 | mBubbleSize = typedArray.getDimensionPixelSize(R.styleable.BottomTabView_tab_bubble_size, getResources().getDimensionPixelSize(R.dimen.tab_bubble_default_size)); 187 | mUnreadTextSize = typedArray.getDimensionPixelSize(R.styleable.BottomTabView_tab_unread_text_size, getResources().getDimensionPixelSize(R.dimen.tab_unread_text_size)); 188 | mUnreadTextPadding = typedArray.getDimensionPixelSize(R.styleable.BottomTabView_tab_unread_text_padding, getResources().getDimensionPixelSize(R.dimen.tab_default_padding)); 189 | isIconOnly = typedArray.getBoolean(R.styleable.BottomTabView_tab_icon_only, false); 190 | isTitleOnly = typedArray.getBoolean(R.styleable.BottomTabView_tab_text_only, false); 191 | typedArray.recycle(); 192 | */ 193 | 194 | initView(context); 195 | } 196 | 197 | private void initView(Context context){ 198 | 199 | 200 | // init the tab container 201 | tabContainer = new LinearLayout(context); 202 | tabContainer.setOrientation(LinearLayout.VERTICAL); 203 | tabContainer.setGravity(Gravity.CENTER); 204 | LayoutParams containerParams = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); 205 | containerParams.gravity = Gravity.CENTER; 206 | tabContainer.setPadding(0, mTabPadding, 0, mTabPadding); 207 | tabContainer.setLayoutParams(containerParams); 208 | // init and add the tab icon into container 209 | mTabIcon = new ImageView(context); 210 | iconParams = new LinearLayout.LayoutParams(dp2px(context, mTabIconSize), dp2px(context, mTabIconSize)); 211 | mTabIcon.setImageResource(tabIcon); 212 | mTabIcon.setLayoutParams(iconParams); 213 | // if apply this, the `isMultiIcon` still can't work. 214 | mTabIcon.setColorFilter(mUnSelectedColor); 215 | tabContainer.addView(mTabIcon); 216 | if(isTitleOnly){ 217 | mTabIcon.setVisibility(View.GONE); 218 | } 219 | 220 | // init and add the tab text into container 221 | mTabTitle = new TextView(context); 222 | titleParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); 223 | titleParams.topMargin = dp2px(context, 2); 224 | mTabTitle.setText(tabText); 225 | mTabTitle.setTextSize(mTabTextSize); 226 | mTabTitle.setTextColor(mUnSelectedColor); 227 | mTabTitle.setLayoutParams(titleParams); 228 | tabContainer.addView(mTabTitle); 229 | if(isIconOnly){ 230 | mTabTitle.setVisibility(View.GONE); 231 | } 232 | 233 | addView(tabContainer); 234 | // init and add the unread text into container 235 | mTabUnreadCount = new TextView(context); 236 | mTabUnreadCount.setTextSize( mUnreadTextSize); 237 | mTabUnreadCount.setTextColor(mUnreadTextColor); 238 | mTabUnreadCount.setGravity(Gravity.CENTER); 239 | mTabUnreadCount.setPadding(dp2px(context, mUnreadTextPadding), 0, dp2px(context, mUnreadTextPadding), 0); 240 | mTabUnreadCount.setBackgroundResource(mBubbleBackground); 241 | unreadParams = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, dp2px(context, mBubbleSize)); 242 | unreadParams.gravity = Gravity.RIGHT; 243 | unreadParams.topMargin = dp2px(context,mUnreadTextMarginTop); 244 | unreadParams.rightMargin = dp2px(context, mUnreadTextMarginRight); 245 | mTabUnreadCount.setLayoutParams(unreadParams); 246 | mTabUnreadCount.setVisibility(View.GONE); 247 | addView(mTabUnreadCount); 248 | 249 | 250 | 251 | } 252 | 253 | 254 | @Override 255 | public void setSelected(boolean selected) { 256 | super.setSelected(selected); 257 | if(selected){ 258 | 259 | Log.e(TAG, "setSelected: 选中了"); 260 | mTabTitle.setTextColor(mSelectedColor); 261 | // different icon res for different states 262 | if(isMultiIcon) { 263 | // if we have provide both `selected` and `unselected` icons, 264 | // we should close the icon #setColorFilter. 265 | // To prevent changing the color of icons we don't want. 266 | mTabIcon.setImageResource(selectedTabIcon); 267 | }else { 268 | mTabIcon.setColorFilter(mSelectedColor); 269 | } 270 | 271 | 272 | }else { 273 | mTabTitle.setTextColor(mUnSelectedColor); 274 | mTabIcon.setImageResource(tabIcon); 275 | if(!isMultiIcon) { 276 | mTabIcon.setColorFilter(mUnSelectedColor); 277 | } 278 | 279 | } 280 | } 281 | 282 | /** 283 | * set unread msg count for tab 284 | * @param count unread msg count 285 | * [pass-test] 286 | */ 287 | public void setUnreadCount(int count){ 288 | this.mUnreadMsgCount = count; 289 | if(count > 0){ 290 | mTabUnreadCount.setVisibility(View.VISIBLE); 291 | if(count > 99){ 292 | mTabUnreadCount.setText(getResources().getString(R.string.unread_count_99_more)); 293 | }else { 294 | mTabUnreadCount.setText(String.valueOf(count)); 295 | } 296 | 297 | }else { 298 | mTabUnreadCount.setText(String.valueOf(0)); 299 | mTabUnreadCount.setVisibility(View.GONE); 300 | } 301 | } 302 | 303 | /** 304 | * set the position for tab 305 | * @param position pos 306 | */ 307 | public void setTabPosition(int position) { 308 | this.mTabPosition = position; 309 | if (position == 0) { 310 | setSelected(true); 311 | } 312 | } 313 | 314 | public int getTabPosition() { 315 | return this.mTabPosition; 316 | } 317 | 318 | /** 319 | * set the icon (unselected state) res for tab. 320 | * @param icon res 321 | * [pass-test] 322 | */ 323 | public void setTabIcon(@DrawableRes int icon){ 324 | this.tabIcon = icon; 325 | mTabIcon.setImageResource(tabIcon); 326 | } 327 | 328 | /** 329 | * set the selected state icon res for tab 330 | * @param selectedIcon res 331 | * [pass-test] 332 | */ 333 | public void setSelectedTabIcon(@DrawableRes int selectedIcon){ 334 | this.selectedTabIcon = selectedIcon; 335 | //mTabIcon.setImageResource(tabIcon); 336 | this.isMultiIcon = true; 337 | // fix the problem that unselected icons still have color filter effect. 338 | // So use this to remove color filter effect. 339 | mTabIcon.setColorFilter(0); 340 | } 341 | 342 | /** 343 | * set the title for tab 344 | * @param title tab text 345 | * [pass-test] 346 | */ 347 | public void setTabTitle(String title){ 348 | this.tabText = title; 349 | mTabTitle.setText(tabText); 350 | } 351 | 352 | /** 353 | * set the icon size for tab 354 | * @param size icon size 355 | * [pass-test] 356 | */ 357 | public void setTabIconSize(int size){ 358 | this.mTabIconSize = size; 359 | // refresh the view 360 | iconParams.width = dp2px(mContext, size); 361 | iconParams.height = dp2px(mContext, size); 362 | 363 | } 364 | 365 | /** 366 | * set title text size for tab 367 | * @param titleSize text size 368 | * [pass-test] 369 | */ 370 | public void setTabTitleSize(int titleSize){ 371 | this.mTabTextSize = titleSize; 372 | mTabTitle.setTextSize(mTabTextSize); 373 | } 374 | 375 | /** 376 | * set padding for each tab 377 | * @param tabPadding padding value 378 | * [pass-test] 379 | */ 380 | public void setTabPadding(int tabPadding){ 381 | this.mTabPadding = tabPadding; 382 | tabContainer.setPadding(0, dp2px(mContext,mTabPadding), 0, dp2px(mContext,mTabPadding)); 383 | 384 | } 385 | 386 | /** 387 | * todo:developer can choose weather customize color or use the default color of icons. 388 | */ 389 | 390 | 391 | /** 392 | * set selected color for tab 393 | * @param selectColor selected state color 394 | * [pass-test] 395 | */ 396 | public void setSelectedColor(@ColorInt int selectColor){ 397 | this.mSelectedColor = selectColor; 398 | } 399 | 400 | /** 401 | * set unselected color for tab 402 | * @param unSelectColor unSelected state color 403 | * [pass-test] 404 | */ 405 | public void setUnselectedColor(@ColorInt int unSelectColor){ 406 | this.mUnSelectedColor = unSelectColor; 407 | if(!isSelected() && !isMultiIcon){ 408 | mTabIcon.setColorFilter(mUnSelectedColor); 409 | } 410 | } 411 | 412 | /** 413 | * set bg for unread bubble view 414 | * @param bubbleDrawable drawable res 415 | * [pass-test] 416 | */ 417 | public void setBubbleBackground(@DrawableRes int bubbleDrawable){ 418 | this.mBubbleBackground = bubbleDrawable; 419 | mTabUnreadCount.setBackgroundResource(mBubbleBackground); 420 | } 421 | 422 | /** 423 | * set size for bubble, only update the 'vertical size' 424 | * @param bubbleSize size 425 | * [pass-test] 426 | */ 427 | public void setBubbleSize(int bubbleSize){ 428 | this.mBubbleSize = dp2px(mContext, bubbleSize); 429 | unreadParams.height = mBubbleSize; 430 | } 431 | 432 | /** 433 | * set size for unread text 434 | * @param textSize size of text 435 | * [pass-test] 436 | */ 437 | public void setUnreadTextSize(int textSize){ 438 | this.mUnreadTextSize = textSize; 439 | mTabUnreadCount.setTextSize(mUnreadTextSize); 440 | } 441 | 442 | /** 443 | * set color for unread text 444 | * @param textColor color of text 445 | * [pass-test] 446 | */ 447 | public void setUnreadTextColor(@ColorInt int textColor){ 448 | this.mUnreadTextColor = textColor; 449 | mTabUnreadCount.setTextColor(mUnreadTextColor); 450 | } 451 | 452 | /** 453 | * set padding of unread text, only for padding left and right 454 | * @param textPadding padding 455 | * [pass-test] 456 | */ 457 | public void setUnreadTextPadding(int textPadding){ 458 | this.mUnreadTextPadding = textPadding; 459 | mTabUnreadCount.setPadding(mUnreadTextPadding, 0, mUnreadTextPadding, 0); 460 | } 461 | 462 | /** 463 | * weather show the tab title 464 | * @param iconOnly only show the icon? 465 | * [pass-test] 466 | */ 467 | public void setTabIconOnly(boolean iconOnly){ 468 | this.isIconOnly = iconOnly; 469 | if(isIconOnly){ 470 | mTabTitle.setVisibility(View.GONE); 471 | }else { 472 | mTabTitle.setVisibility(View.VISIBLE); 473 | } 474 | } 475 | 476 | /** 477 | * weather show the tab icon 478 | * @param textOnly only show the text? 479 | * [pass-test] 480 | */ 481 | public void setTabTitleOnly(boolean textOnly){ 482 | this.isTitleOnly = textOnly; 483 | if(isTitleOnly){ 484 | mTabIcon.setVisibility(View.GONE); 485 | }else { 486 | mTabIcon.setVisibility(View.VISIBLE); 487 | } 488 | } 489 | 490 | /** 491 | * set margin top to unreadText 492 | * @param marginTop margin value 493 | * [pass-test] 494 | * 495 | */ 496 | public void setUnreadTextMarginTop(int marginTop){ 497 | this.mUnreadTextMarginTop = marginTop; 498 | unreadParams.topMargin = dp2px(mContext, marginTop); 499 | } 500 | 501 | /** 502 | * set margin right to unreadText 503 | * @param marginRight margin value 504 | * [pass-test] 505 | */ 506 | public void setUnreadTextMarginRight(int marginRight){ 507 | this.mUnreadTextMarginRight = marginRight; 508 | unreadParams.rightMargin = dp2px(mContext, marginRight); 509 | } 510 | 511 | /** 512 | * get the tab icon, you can use it to realize more animations 513 | * @return icon 514 | */ 515 | public ImageView getTabIconView(){ 516 | return mTabIcon; 517 | } 518 | 519 | /** 520 | * get the tab title view 521 | * @return title 522 | */ 523 | public TextView getTabTextView(){ 524 | return mTabTitle; 525 | } 526 | 527 | /** 528 | * get the container of tab 529 | * @return container 530 | */ 531 | public LinearLayout getTabContainer(){ 532 | return tabContainer; 533 | } 534 | 535 | 536 | /** 537 | * transform dip to px 538 | * @param context mContext 539 | * @param dp dip 540 | * @return px 541 | */ 542 | private int dp2px(Context context, float dp) { 543 | return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, context.getResources().getDisplayMetrics()); 544 | } 545 | } 546 | -------------------------------------------------------------------------------- /MaterialBottomBar/library/src/main/res/drawable/tab_unread_default_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /MaterialBottomBar/library/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 22dp 38 | 12sp 39 | 3dp 40 | 16dp 41 | 10sp 42 | 43 | -------------------------------------------------------------------------------- /MaterialBottomBar/library/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Material-BottomBar 3 | 99+ 4 | 5 | -------------------------------------------------------------------------------- /MaterialBottomBar/library/src/test/java/com/moos/navigation/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.moos.navigation; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /MaterialBottomBar/sample/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /MaterialBottomBar/sample/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 26 5 | defaultConfig { 6 | applicationId "com.github.moos" 7 | minSdkVersion 19 8 | targetSdkVersion 26 9 | versionCode 1 10 | versionName "1.0" 11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | } 20 | 21 | dependencies { 22 | implementation fileTree(dir: 'libs', include: ['*.jar']) 23 | implementation project(':library') 24 | implementation 'com.android.support:appcompat-v7:26.1.0' 25 | implementation 'com.android.support.constraint:constraint-layout:1.0.2' 26 | implementation 'com.android.support:design:26.1.0' 27 | implementation 'com.android.support:cardview-v7:26.1.0' 28 | implementation 'com.github.bumptech.glide:glide:3.7.0' 29 | testImplementation 'junit:junit:4.12' 30 | } 31 | -------------------------------------------------------------------------------- /MaterialBottomBar/sample/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/androidTest/java/com/github/moos/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.github.moos; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.github.moos", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 14 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/java/com/github/moos/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.github.moos; 2 | import android.support.v4.app.Fragment; 3 | import android.support.v4.app.FragmentManager; 4 | import android.support.v4.app.FragmentTransaction; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.os.Bundle; 7 | import android.support.v7.widget.SwitchCompat; 8 | import android.widget.CompoundButton; 9 | 10 | import com.github.moos.fragment.HorizontalSampleFragment; 11 | import com.github.moos.fragment.VerticalSampleFragment; 12 | 13 | public class MainActivity extends AppCompatActivity { 14 | public static final String TAG = "MainActivity"; 15 | 16 | private SwitchCompat switcher; 17 | 18 | 19 | @Override 20 | protected void onCreate(Bundle savedInstanceState) { 21 | super.onCreate(savedInstanceState); 22 | setContentView(R.layout.activity_main); 23 | 24 | switcher = findViewById(R.id.fragment_switcher); 25 | replaceFragment(new HorizontalSampleFragment()); 26 | switcher.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { 27 | @Override 28 | public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) { 29 | if(isChecked){ 30 | replaceFragment(new VerticalSampleFragment()); 31 | }else { 32 | replaceFragment(new HorizontalSampleFragment()); 33 | } 34 | } 35 | }); 36 | 37 | 38 | 39 | 40 | } 41 | 42 | private void replaceFragment(Fragment fragment){ 43 | FragmentManager manager = getSupportFragmentManager(); 44 | FragmentTransaction transaction = manager.beginTransaction(); 45 | transaction.replace(R.id.fragment_container, fragment); 46 | transaction.commit(); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/java/com/github/moos/adapter/CardViewPagerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.github.moos.adapter; 2 | 3 | import android.content.Context; 4 | import android.support.v4.view.PagerAdapter; 5 | import android.support.v4.view.ViewPager; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | import android.view.animation.AlphaAnimation; 9 | import android.widget.ImageView; 10 | import android.widget.TextView; 11 | 12 | import com.bumptech.glide.Glide; 13 | import com.github.moos.R; 14 | import com.github.moos.bean.CardBean; 15 | 16 | import java.util.List; 17 | 18 | /** 19 | * Created by moos on 2018/5/7. 20 | */ 21 | 22 | public class CardViewPagerAdapter extends PagerAdapter { 23 | private List list; 24 | private Context context; 25 | 26 | public CardViewPagerAdapter(Context context, List list) { 27 | this.list = list; 28 | this.context = context; 29 | } 30 | 31 | @Override 32 | public int getCount() { 33 | 34 | if (list != null && list.size() > 0) { 35 | return list.size(); 36 | } else { 37 | return 0; 38 | } 39 | } 40 | 41 | @Override 42 | public boolean isViewFromObject(View arg0, Object arg1) { 43 | return arg0 == arg1; 44 | } 45 | 46 | @Override 47 | public void destroyItem(ViewGroup container, int position, Object object) { 48 | ((ViewPager)container).removeView((View) object); 49 | } 50 | 51 | @Override 52 | public Object instantiateItem(ViewGroup container, int position) { 53 | View view = View.inflate(context, R.layout.card_item_layout, null); 54 | ImageView imageView = view.findViewById(R.id.item_image); 55 | TextView textView = view.findViewById(R.id.item_title); 56 | Glide.with(context) 57 | .load(list.get(position).getImageRes()) 58 | .animate(new AlphaAnimation(0.3f, 1f)) 59 | .into(imageView); 60 | textView.setText(list.get(position).getTitleRes()); 61 | ((ViewPager)container).addView(view); 62 | return view; 63 | } 64 | 65 | 66 | } 67 | -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/java/com/github/moos/bean/CardBean.java: -------------------------------------------------------------------------------- 1 | package com.github.moos.bean; 2 | 3 | import android.support.annotation.DrawableRes; 4 | 5 | /** 6 | * Created by moos on 2018/4/29. 7 | * the example of data 8 | */ 9 | 10 | public class CardBean { 11 | private @DrawableRes int imageRes; 12 | private String titleRes; 13 | 14 | public CardBean(int imageRes, String titleRes) { 15 | this.imageRes = imageRes; 16 | this.titleRes = titleRes; 17 | } 18 | 19 | public int getImageRes() { 20 | return imageRes; 21 | } 22 | 23 | public void setImageRes(int imageRes) { 24 | this.imageRes = imageRes; 25 | } 26 | 27 | public String getTitleRes() { 28 | return titleRes; 29 | } 30 | 31 | public void setTitleRes(String titleRes) { 32 | this.titleRes = titleRes; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/java/com/github/moos/fragment/ContentFragment.java: -------------------------------------------------------------------------------- 1 | package com.github.moos.fragment; 2 | 3 | import android.annotation.SuppressLint; 4 | import android.os.Bundle; 5 | import android.support.v4.app.Fragment; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.TextView; 10 | 11 | import com.github.moos.R; 12 | 13 | /** 14 | * Created by moos on 2018/5/7. 15 | */ 16 | 17 | public class ContentFragment extends Fragment{ 18 | 19 | private String content; 20 | private TextView textView; 21 | 22 | public ContentFragment() { 23 | // Required empty public constructor 24 | } 25 | 26 | @SuppressLint("ValidFragment") 27 | public ContentFragment(String content) { 28 | this.content = content; 29 | } 30 | 31 | @Override 32 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 33 | Bundle savedInstanceState) { 34 | // Inflate the layout for this fragment 35 | View view = inflater.inflate(R.layout.fm_content, container, false); 36 | initView(view); 37 | return view; 38 | } 39 | 40 | private void initView(View view){ 41 | textView = view.findViewById(R.id.fm_content_text); 42 | textView.setText(content); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/java/com/github/moos/fragment/HorizontalSampleFragment.java: -------------------------------------------------------------------------------- 1 | package com.github.moos.fragment; 2 | import android.os.Bundle; 3 | import android.support.v4.app.Fragment; 4 | import android.support.v4.view.ViewPager; 5 | import android.util.Log; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | 10 | import com.github.moos.adapter.CardViewPagerAdapter; 11 | import com.github.moos.R; 12 | import com.github.moos.bean.CardBean; 13 | import com.moos.navigation.BottomBarLayout; 14 | import com.moos.navigation.BottomTabView; 15 | 16 | import java.util.ArrayList; 17 | import java.util.List; 18 | 19 | /** 20 | * A sample of Horizontal style navigation bottom bar. 21 | */ 22 | public class HorizontalSampleFragment extends Fragment{ 23 | 24 | private List data = new ArrayList<>(); 25 | public static final String TAG = "HorizontalStyle"; 26 | 27 | public HorizontalSampleFragment() { 28 | // Required empty public constructor 29 | } 30 | 31 | 32 | @Override 33 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 34 | Bundle savedInstanceState) { 35 | // Inflate the layout for this fragment 36 | View view = inflater.inflate(R.layout.fm_sample_horizontal, container, false); 37 | initView(view); 38 | return view; 39 | } 40 | 41 | private void initView(View view){ 42 | BottomBarLayout bottomBarLayout = view.findViewById(R.id.bottom_bar_horizontal); 43 | ViewPager viewPager = view.findViewById(R.id.viewPager); 44 | bottomBarLayout.animationEnable(false); 45 | 46 | BottomTabView tab_home = new BottomTabView(getContext()); 47 | tab_home.setTabIcon(R.drawable.work_edit_sticker_unselected_state); 48 | tab_home.setSelectedTabIcon(R.drawable.work_edit_sticker_selected_state); 49 | tab_home.setTabTitle("Home"); 50 | //tab_home.setUnselectedColor(Color.parseColor("#f65656")); 51 | 52 | BottomTabView tab_look = new BottomTabView(getContext()); 53 | tab_look.setTabIcon(R.drawable.work_edit_words_unselected_state); 54 | tab_look.setSelectedTabIcon(R.drawable.work_edit_words_selected_state); 55 | tab_look.setTabTitle("Discover"); 56 | //tab_look.setUnselectedColor(Color.parseColor("#f65656")); 57 | 58 | 59 | BottomTabView tab_mine = new BottomTabView(getContext()); 60 | tab_mine.setTabIcon(R.drawable.work_edit_music_unselected_state); 61 | tab_mine.setSelectedTabIcon(R.drawable.work_edit_music_selected_state); 62 | //tab_mine.setTabIconSize(29); // efficient 63 | //tab_mine.setTabPadding(12); 64 | //tab_mine.setTabTitleSize(16); 65 | //tab_home.setSelectedColor(Color.parseColor("#f3566a")); 66 | //tab_mine.setBubbleBackground(R.drawable.msg_bg); 67 | //tab_mine.setBubbleSize(28); 68 | tab_mine.setUnreadTextSize(12); 69 | //tab_mine.setUnreadTextColor(Color.parseColor("#f345f5")); 70 | //tab_mine.setTabIconOnly(true); 71 | //tab_home.setTabIconOnly(true); 72 | //tab_look.setTabIconOnly(true); 73 | //tab_mine.setTabTitleOnly(true); 74 | //tab_home.setTabTitleOnly(true); 75 | //tab_look.setTabTitleOnly(true); 76 | tab_mine.setTabTitle("Mine"); 77 | tab_mine.setUnreadCount(100); 78 | //tab_mine.setSelectedTabIcon(R.drawable.user_selected); 79 | 80 | 81 | bottomBarLayout 82 | .addTab(tab_home) 83 | .addTab(tab_look) 84 | .addTab(tab_mine) 85 | .create(new BottomBarLayout.OnTabSelectedListener() { 86 | @Override 87 | public void onTabSelected(BottomTabView tab) { 88 | Log.e(TAG, "onTabSelected: =="+tab.getTabPosition() ); 89 | } 90 | 91 | @Override 92 | public void onTabUnselected(BottomTabView tab) { 93 | 94 | } 95 | 96 | @Override 97 | public void onTabReselected(BottomTabView tab) { 98 | 99 | } 100 | }); 101 | data.add(new CardBean(R.drawable.image1, "A beautiful design for rooms.")); 102 | data.add(new CardBean(R.drawable.image2, "This will make you comfortable.")); 103 | data.add(new CardBean(R.drawable.image3, "Let's see the tartan design.")); 104 | viewPager.setAdapter(new CardViewPagerAdapter(getContext(), data)); 105 | bottomBarLayout.bindViewPager(viewPager); 106 | } 107 | 108 | 109 | 110 | 111 | } 112 | -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/java/com/github/moos/fragment/VerticalSampleFragment.java: -------------------------------------------------------------------------------- 1 | package com.github.moos.fragment; 2 | import android.os.Bundle; 3 | import android.support.v4.app.Fragment; 4 | import android.support.v4.app.FragmentManager; 5 | import android.support.v4.app.FragmentTransaction; 6 | import android.util.Log; 7 | import android.view.LayoutInflater; 8 | import android.view.View; 9 | import android.view.ViewGroup; 10 | 11 | import com.github.moos.R; 12 | import com.moos.navigation.BottomBarLayout; 13 | import com.moos.navigation.BottomTabView; 14 | 15 | /** 16 | * A sample of Vertical style navigation bar. 17 | * todo: 18 | * 1. add the message bubble 19 | * 2. add the bg changing 20 | */ 21 | public class VerticalSampleFragment extends Fragment{ 22 | 23 | public static final String TAG = "VerticalStyle"; 24 | private BottomTabView tab_book, tab_music, tab_film; 25 | 26 | 27 | 28 | public VerticalSampleFragment() { 29 | // Required empty public constructor 30 | } 31 | 32 | 33 | @Override 34 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 35 | Bundle savedInstanceState) { 36 | // Inflate the layout for this fragment 37 | View view = inflater.inflate(R.layout.fm_sample_vertical, container, false); 38 | initView(view); 39 | return view; 40 | } 41 | 42 | private void initView(View view){ 43 | BottomBarLayout bottomBarLayout = view.findViewById(R.id.navigation_bar_vertical); 44 | tab_book = new BottomTabView(getContext()); 45 | tab_film = new BottomTabView(getContext()); 46 | tab_music = new BottomTabView(getContext()); 47 | 48 | tab_book.setTabIcon(R.drawable.icon_book); 49 | tab_book.setTabIconOnly(true); 50 | tab_book.setTabIconSize(28); 51 | tab_music.setTabIcon(R.drawable.icon_music); 52 | tab_music.setTabIconOnly(true); 53 | tab_music.setTabIconSize(28); 54 | tab_film.setTabIcon(R.drawable.icon_film); 55 | tab_film.setTabIconOnly(true); 56 | tab_film.setTabIconSize(28); 57 | 58 | replaceFragment(new ContentFragment("Book")); 59 | 60 | bottomBarLayout 61 | .addTab(tab_book) 62 | .addTab(tab_music) 63 | .addTab(tab_film) 64 | .create(new BottomBarLayout.OnTabSelectedListener() { 65 | @Override 66 | public void onTabSelected(BottomTabView tab) { 67 | Log.e(TAG, "onTabSelected: =="+tab.getTabPosition() ); 68 | switch (tab.getTabPosition()){ 69 | case 0: 70 | replaceFragment(new ContentFragment("Book")); 71 | break; 72 | 73 | case 1: 74 | replaceFragment(new ContentFragment("Music")); 75 | break; 76 | 77 | case 2: 78 | replaceFragment(new ContentFragment("Movie")); 79 | break; 80 | } 81 | } 82 | 83 | @Override 84 | public void onTabUnselected(BottomTabView tab) { 85 | 86 | } 87 | 88 | @Override 89 | public void onTabReselected(BottomTabView tab) { 90 | 91 | } 92 | }); 93 | } 94 | 95 | private void replaceFragment(Fragment fragment){ 96 | FragmentManager manager = getChildFragmentManager(); 97 | FragmentTransaction transaction = manager.beginTransaction(); 98 | transaction.replace(R.id.fm_content_container, fragment); 99 | transaction.commit(); 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/drawable-hdpi/activity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/drawable-hdpi/activity.png -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/drawable-hdpi/eyebrows.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/drawable-hdpi/eyebrows.png -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/drawable-hdpi/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/drawable-hdpi/home.png -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/drawable-hdpi/user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/drawable-hdpi/user.png -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/drawable-hdpi/user_selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/drawable-hdpi/user_selected.png -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/drawable-mdpi/activity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/drawable-mdpi/activity.png -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/drawable-mdpi/eyebrows.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/drawable-mdpi/eyebrows.png -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/drawable-mdpi/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/drawable-mdpi/home.png -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/drawable-mdpi/user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/drawable-mdpi/user.png -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/drawable-mdpi/user_selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/drawable-mdpi/user_selected.png -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/drawable-xhdpi/activity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/drawable-xhdpi/activity.png -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/drawable-xhdpi/eyebrows.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/drawable-xhdpi/eyebrows.png -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/drawable-xhdpi/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/drawable-xhdpi/home.png -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/drawable-xhdpi/user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/drawable-xhdpi/user.png -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/drawable-xhdpi/user_selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/drawable-xhdpi/user_selected.png -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/drawable-xxhdpi/activity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/drawable-xxhdpi/activity.png -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/drawable-xxhdpi/eyebrows.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/drawable-xxhdpi/eyebrows.png -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/drawable-xxhdpi/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/drawable-xxhdpi/home.png -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/drawable-xxhdpi/user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/drawable-xxhdpi/user.png -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/drawable-xxhdpi/user_selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/drawable-xxhdpi/user_selected.png -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/drawable-xxhdpi/work_edit_music_selected_state.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/drawable-xxhdpi/work_edit_music_selected_state.png -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/drawable-xxhdpi/work_edit_music_unselected_state.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/drawable-xxhdpi/work_edit_music_unselected_state.png -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/drawable-xxhdpi/work_edit_sticker_selected_state.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/drawable-xxhdpi/work_edit_sticker_selected_state.png -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/drawable-xxhdpi/work_edit_sticker_unselected_state.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/drawable-xxhdpi/work_edit_sticker_unselected_state.png -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/drawable-xxhdpi/work_edit_words_selected_state.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/drawable-xxhdpi/work_edit_words_selected_state.png -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/drawable-xxhdpi/work_edit_words_unselected_state.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/drawable-xxhdpi/work_edit_words_unselected_state.png -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/drawable-xxxhdpi/activity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/drawable-xxxhdpi/activity.png -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/drawable-xxxhdpi/eyebrows.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/drawable-xxxhdpi/eyebrows.png -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/drawable-xxxhdpi/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/drawable-xxxhdpi/home.png -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/drawable-xxxhdpi/user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/drawable-xxxhdpi/user.png -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/drawable-xxxhdpi/user_selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/drawable-xxxhdpi/user_selected.png -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/drawable/icon1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/drawable/icon1.png -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/drawable/icon2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/drawable/icon2.png -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/drawable/icon3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/drawable/icon3.png -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/drawable/icon_book.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/drawable/icon_book.png -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/drawable/icon_film.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/drawable/icon_film.png -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/drawable/icon_music.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/drawable/icon_music.png -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/drawable/image1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/drawable/image1.jpg -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/drawable/image2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/drawable/image2.jpg -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/drawable/image3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/drawable/image3.jpg -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/drawable/msg_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/drawable/msg_bg.png -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/drawable/tab_unread_default_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 15 | 16 | 21 | 27 | 28 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/layout/card_item_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 12 | 16 | 22 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/layout/fm_content.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 15 | -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/layout/fm_sample_horizontal.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 12 | 13 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/layout/fm_sample_vertical.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 14 | 15 | 16 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Moosphan/Material-BottomBarLayout/43e495a7e423cc763f5ed49b8c5efa62883809d7/MaterialBottomBar/sample/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 22dp 38 | 12sp 39 | 3dp 40 | 16dp 41 | 10sp 42 | 43 | -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Material-BottomBar 3 | 99+ 4 | 5 | -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /MaterialBottomBar/sample/src/test/java/com/github/moos/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.github.moos; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /MaterialBottomBar/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':sample', ':library' 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Material-BottomBarLayout 2 | A material navigation bar library which has pretty animations and different ways of arrangement. 3 | 4 | >![preview](https://github.com/Moosphan/Material-BottomBarLayout/blob/cacba41fcb1f2694e81b303fe726c4f829f1e6cf/MaterialBottomBar/art/bottom_bar.gif) 5 | 6 | ## Usage 7 | 8 | [ ![Download](https://api.bintray.com/packages/moosphon/maven/Material-BottomBarLayout/images/download.svg) ](https://bintray.com/moosphon/maven/Material-BottomBarLayout/_latestVersion) 9 | 10 | ### In gradle: 11 | 12 | ```groovy 13 | compile 'com.moos:Material-BottomBarLayout:1.0.5' 14 | ``` 15 | 16 | ### In xml: 17 | 18 | ```xml 19 | 26 | 27 | 28 | ``` 29 | 30 | 31 | 32 | ### In java: 33 | 34 | ```java 35 | private BottomTabView tab_home, tab_look, tab_mine; 36 | ...... 37 | 38 | @Override 39 | protected void onCreate(Bundle savedInstanceState) { 40 | super.onCreate(savedInstanceState); 41 | setContentView(R.layout.activity_main); 42 | BottomBarLayout bottomBarLayout = findViewById(R.id.bottom_bar); 43 | 44 | tab_home = new BottomTabView(this); 45 | tab_home.setTabIcon(R.drawable.home); 46 | tab_home.setTabTitle("Home"); 47 | 48 | tab_look = new BottomTabView(this); 49 | tab_look.setTabIcon(R.drawable.activity); 50 | tab_look.setTabTitle("Discover"); 51 | 52 | tab_mine = new BottomTabView(this); 53 | tab_mine.setTabIcon(R.drawable.user); 54 | tab_mine.setTabTitle("Mine"); 55 | tab_mine.setUnreadCount(100); 56 | 57 | 58 | bottomBarLayout 59 | .addTab(tab_home) 60 | .addTab(tab_look) 61 | .addTab(tab_mine) 62 | .create(new BottomBarLayout.OnTabSelectedListener() { 63 | @Override 64 | public void onTabSelected(BottomTabView tab) { 65 | //you can switch the fragment here 66 | Log.e(TAG, "onTabSelected: ====="+tab.getTabPosition() ); 67 | } 68 | 69 | @Override 70 | public void onTabUnselected(BottomTabView tab) { 71 | 72 | } 73 | 74 | @Override 75 | public void onTabReselected(BottomTabView tab) { 76 | 77 | } 78 | }); 79 | } 80 | ``` 81 | 82 | ### More usage 83 | 84 | #### 1. Bind with ViewPager: 85 | 86 | ```java 87 | ViewPager viewPager = findViewById(R.id.viewPager); 88 | viewPager.setAdapter(new CardViewPagerAdapter(data)); 89 | bottomBarLayout.bindViewPager(viewPager); 90 | ``` 91 | 92 | #### 2. Customize different states of icons 93 | 94 | As we all known, the common libraries of `tab` we used can only change the color of different states of tabs. However, sometimes designers want we use different icon resource , like ![](http://ovl7kcyr4.bkt.clouddn.com/18-5-8/92537361.jpg) and ![](http://ovl7kcyr4.bkt.clouddn.com/18-5-8/22343788.jpg). I provide `setTabIcon` and `setSelectedTabIcon` to set different states of icon resource for tabs. 95 | 96 | ### API Details 97 | 98 | - **BottomTabView** 99 | 100 | Description:the tab item of bottom bar, like `TabItem`. 101 | 102 | The methods document: 103 | 104 | | Method | Usage | 105 | | ------------------------ | ----------------------------------------------------------- | 106 | | getTabPosition | get the position of current tab | 107 | | setTabIcon | set the icon res for tab | 108 | | setTabTitle | set the title for tab | 109 | | setTabIconSize | set the icon size for tab | 110 | | setTabTitleSize | set title text size for tab | 111 | | setTabPadding | set padding for each tab | 112 | | setSelectedColor | set selected color for tab | 113 | | setUnselectedColor | set unselected color for tab | 114 | | setTabIconOnly | weather show the tab title | 115 | | setTabTitleOnly | weather show the tab icon | 116 | | setBubbleBackground | set bg for unread bubble view | 117 | | setBubbleSize | set size for bubble, only update the 'vertical size' | 118 | | setUnreadTextSize | set size for unread text | 119 | | setUnreadTextColor | set color for unread text | 120 | | setUnreadTextPadding | set padding of unread text, only for padding left and right | 121 | | setUnreadTextMarginTop | set margin top to unreadText | 122 | | setUnreadTextMarginRight | set margin right to unreadText | 123 | | getTabIconView | get the tab icon's imageView | 124 | | getTabTextView | get the tab title view | 125 | | getTabContainer | get the container of tab(LinearLayout) | 126 | | setSelectedTabIcon | set the selected state icon for tab | 127 | 128 | - **BottomBarLayout** 129 | 130 | Description:the tabs' container, like `TabLayout`. 131 | 132 | The methods document: 133 | 134 | | Method | Usage | 135 | | ---------------------------------- | ----------------------------------------- | 136 | | addTab(BottomTabView tab) | add the tab for container | 137 | | getCurrentTabPosition | get current selected tab's position | 138 | | getTabCount | get the count of tabs in container | 139 | | bindViewPager(ViewPager viewPager) | bind the viewPager and scroll with it | 140 | | create | set call back of tab's selected operation | 141 | | setArrangeType | the way of tabs arranges | 142 | 143 | 144 | ## ChangeLogs 145 | 146 | - #### V1.0.1 147 | 148 | Add the `vertical` style to show the tabs and you can customize your own icon res for selected state of tabs. 149 | 150 | - #### V1.0.2 151 | 152 | Change the `minSdkVersion` down to 16, avoid of the multiple errors. 153 | 154 | - #### V1.0.3 155 | 156 | Solve the problem that `setUnselectColor` method not works in initialization. 157 | 158 | - #### V1.0.5 159 | 160 | 1. You can disable animations of tabs. 161 | 2. When we customize our `selectedIcon` , we should disable the icon color setting. 162 | 163 | - #### V1.0.7 164 | 165 | Fix the problem that unselected icons still have color filter effect. 166 | 167 | ## To-do 168 | 169 | - [x] support `horizontal` and `vertical` style. 170 | - [ ] more animations for tabs. 171 | - [x] bind with viewpager or other slide views. 172 | - [ ] change bottomBarLayout background when selected. 173 | - [x] support different states of tab icons 174 | - [ ] Not limit default icon size any more, change it's size to `wrap_content`. 175 | 176 | ## About me 177 | 178 | Welcome to improve it with me and give me some issues. 179 | 180 | E-mail:moosphon@gmail.com 181 | 182 | 183 | ## License 184 | 185 | ``` 186 | Copyright 2018 moosphon 187 | 188 | Licensed under the Apache License, Version 2.0 (the "License"); 189 | you may not use this file except in compliance with the License. 190 | You may obtain a copy of the License at 191 | 192 | http://www.apache.org/licenses/LICENSE-2.0 193 | 194 | Unless required by applicable law or agreed to in writing, software 195 | distributed under the License is distributed on an "AS IS" BASIS, 196 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 197 | See the License for the specific language governing permissions and 198 | limitations under the License. 199 | ``` 200 | 201 | --------------------------------------------------------------------------------