├── navigationbarview ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── values.xml │ │ │ │ ├── colors.xml │ │ │ │ ├── attrs.xml │ │ │ │ └── dimens.xml │ │ │ ├── drawable │ │ │ │ └── item_badge_background.xml │ │ │ └── layout │ │ │ │ └── view_bottom_navigation_bar_item.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── jp │ │ │ └── s64 │ │ │ └── android │ │ │ └── navigationbarview │ │ │ ├── view │ │ │ ├── INavigationBarTransitionView.java │ │ │ ├── INavigationBarItemView.java │ │ │ ├── INavigationBarView.java │ │ │ └── NavigationBarViewHelper.java │ │ │ ├── item │ │ │ ├── INavigationBarItem.java │ │ │ ├── AbsBadgeNavigationBarItem.java │ │ │ └── AbsNavigationBarItem.java │ │ │ └── bottom │ │ │ ├── BottomNavigationBarItemView.java │ │ │ └── BottomNavigationBarView.java │ ├── test │ │ └── java │ │ │ └── jp │ │ │ └── s64 │ │ │ └── android │ │ │ └── navigationbarview │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── jp │ │ └── s64 │ │ └── android │ │ └── navigationbarview │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── example ├── .gitignore ├── src │ ├── main │ │ ├── ic_launcher-web.png │ │ ├── res │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── colors.xml │ │ │ │ ├── styles.xml │ │ │ │ └── ids.xml │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_rasterized_active.png │ │ │ │ └── ic_rasterized_inactive.png │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_rasterized_active.png │ │ │ │ └── ic_rasterized_inactive.png │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_rasterized_active.png │ │ │ │ └── ic_rasterized_inactive.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_rasterized_active.png │ │ │ │ └── ic_rasterized_inactive.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_rasterized_active.png │ │ │ │ └── ic_rasterized_inactive.png │ │ │ ├── drawable │ │ │ │ └── ic_account_circle_black.xml │ │ │ └── layout │ │ │ │ └── activity_main.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── jp │ │ │ └── s64 │ │ │ └── android │ │ │ └── navigationbarview │ │ │ └── example │ │ │ └── MainActivity.java │ ├── test │ │ └── java │ │ │ └── jp │ │ │ └── s64 │ │ │ └── android │ │ │ └── navigationbarview │ │ │ └── example │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── jp │ │ └── s64 │ │ └── android │ │ └── navigationbarview │ │ └── example │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── assets ├── header.png ├── screenshot1.png ├── screenshot2.png ├── screenshot3.png └── screenrecord1.gif ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── gradle.properties ├── README.md ├── gradlew.bat └── gradlew /navigationbarview/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | /src/*/google-services.json 3 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':navigationbarview', ':example' 2 | -------------------------------------------------------------------------------- /assets/header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/S64/android-navigation-bar-view/HEAD/assets/header.png -------------------------------------------------------------------------------- /assets/screenshot1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/S64/android-navigation-bar-view/HEAD/assets/screenshot1.png -------------------------------------------------------------------------------- /assets/screenshot2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/S64/android-navigation-bar-view/HEAD/assets/screenshot2.png -------------------------------------------------------------------------------- /assets/screenshot3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/S64/android-navigation-bar-view/HEAD/assets/screenshot3.png -------------------------------------------------------------------------------- /assets/screenrecord1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/S64/android-navigation-bar-view/HEAD/assets/screenrecord1.gif -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/S64/android-navigation-bar-view/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /example/src/main/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/S64/android-navigation-bar-view/HEAD/example/src/main/ic_launcher-web.png -------------------------------------------------------------------------------- /example/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | NavigationBarView Example 3 | 4 | -------------------------------------------------------------------------------- /navigationbarview/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | NavigationBarView 3 | 4 | -------------------------------------------------------------------------------- /example/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/S64/android-navigation-bar-view/HEAD/example/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/S64/android-navigation-bar-view/HEAD/example/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/S64/android-navigation-bar-view/HEAD/example/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/S64/android-navigation-bar-view/HEAD/example/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/S64/android-navigation-bar-view/HEAD/example/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/src/main/res/mipmap-hdpi/ic_rasterized_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/S64/android-navigation-bar-view/HEAD/example/src/main/res/mipmap-hdpi/ic_rasterized_active.png -------------------------------------------------------------------------------- /example/src/main/res/mipmap-mdpi/ic_rasterized_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/S64/android-navigation-bar-view/HEAD/example/src/main/res/mipmap-mdpi/ic_rasterized_active.png -------------------------------------------------------------------------------- /example/src/main/res/mipmap-xhdpi/ic_rasterized_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/S64/android-navigation-bar-view/HEAD/example/src/main/res/mipmap-xhdpi/ic_rasterized_active.png -------------------------------------------------------------------------------- /example/src/main/res/mipmap-hdpi/ic_rasterized_inactive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/S64/android-navigation-bar-view/HEAD/example/src/main/res/mipmap-hdpi/ic_rasterized_inactive.png -------------------------------------------------------------------------------- /example/src/main/res/mipmap-mdpi/ic_rasterized_inactive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/S64/android-navigation-bar-view/HEAD/example/src/main/res/mipmap-mdpi/ic_rasterized_inactive.png -------------------------------------------------------------------------------- /example/src/main/res/mipmap-xhdpi/ic_rasterized_inactive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/S64/android-navigation-bar-view/HEAD/example/src/main/res/mipmap-xhdpi/ic_rasterized_inactive.png -------------------------------------------------------------------------------- /example/src/main/res/mipmap-xxhdpi/ic_rasterized_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/S64/android-navigation-bar-view/HEAD/example/src/main/res/mipmap-xxhdpi/ic_rasterized_active.png -------------------------------------------------------------------------------- /example/src/main/res/mipmap-xxxhdpi/ic_rasterized_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/S64/android-navigation-bar-view/HEAD/example/src/main/res/mipmap-xxxhdpi/ic_rasterized_active.png -------------------------------------------------------------------------------- /.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 | .idea 11 | 12 | -------------------------------------------------------------------------------- /example/src/main/res/mipmap-xxhdpi/ic_rasterized_inactive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/S64/android-navigation-bar-view/HEAD/example/src/main/res/mipmap-xxhdpi/ic_rasterized_inactive.png -------------------------------------------------------------------------------- /example/src/main/res/mipmap-xxxhdpi/ic_rasterized_inactive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/S64/android-navigation-bar-view/HEAD/example/src/main/res/mipmap-xxxhdpi/ic_rasterized_inactive.png -------------------------------------------------------------------------------- /navigationbarview/src/main/res/values/values.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 3 5 | 5 6 | 7 | -------------------------------------------------------------------------------- /navigationbarview/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #E04747 5 | #ffffff 6 | 7 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sat Jul 14 16:03:06 JST 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.4-all.zip 7 | -------------------------------------------------------------------------------- /navigationbarview/src/main/res/drawable/item_badge_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /navigationbarview/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /navigationbarview/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | #BDBDBD 8 | #19A4BA 9 | #FAFAFA 10 | 11 | 12 | -------------------------------------------------------------------------------- /example/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /navigationbarview/src/test/java/jp/s64/android/navigationbarview/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package jp.s64.android.navigationbarview; 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 | } -------------------------------------------------------------------------------- /example/src/test/java/jp/s64/android/navigationbarview/example/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package jp.s64.android.navigationbarview.example; 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 | } -------------------------------------------------------------------------------- /example/src/main/res/drawable/ic_account_circle_black.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /example/src/main/res/values/ids.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /example/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /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 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /navigationbarview/src/androidTest/java/jp/s64/android/navigationbarview/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package jp.s64.android.navigationbarview; 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 | * Instrumentation 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("jp.s64.android.navigationbarview.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /example/src/androidTest/java/jp/s64/android/navigationbarview/example/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package jp.s64.android.navigationbarview.example; 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 | * Instrumentation 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("jp.s64.android.navigationbarview.example", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /navigationbarview/src/main/java/jp/s64/android/navigationbarview/view/INavigationBarTransitionView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Shuma Yoshioka 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package jp.s64.android.navigationbarview.view; 18 | 19 | import android.animation.TimeInterpolator; 20 | 21 | public interface INavigationBarTransitionView { 22 | 23 | void setDuration(long duration); 24 | 25 | void setInterpolator(TimeInterpolator interpolator); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /navigationbarview/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/shuma/Library/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | -------------------------------------------------------------------------------- /navigationbarview/src/main/java/jp/s64/android/navigationbarview/view/INavigationBarItemView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Shuma Yoshioka 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package jp.s64.android.navigationbarview.view; 18 | 19 | import jp.s64.android.navigationbarview.item.INavigationBarItem; 20 | 21 | public interface INavigationBarItemView extends INavigationBarTransitionView { 22 | 23 | void setHeight(int height); 24 | 25 | void setWidth(int inactive, int active); 26 | 27 | void setItem(INavigationBarItem item); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /example/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/shuma/Library/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | 27 | -dontwarn com.google.common.** 28 | -keep class com.google.common.** { *; } 29 | -keep interface com.google.common.** { *; } 30 | 31 | -dontwarn com.google.errorprone.** 32 | -keep class com.google.errorprone.** { *; } 33 | -keep interface com.google.errorprone.** { *; } 34 | -------------------------------------------------------------------------------- /navigationbarview/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | @dimen/horizontal_height 5 | 6 | 96dp 7 | 168dp 8 | 9 | 24dp 10 | 11 | 6dp 12 | 8dp 13 | 14 | 6dp 15 | 10dp 16 | 0dp 17 | 18 | 1.2 19 | 1.0 20 | 1.0 21 | 22 | 12sp 23 | 24 | 12dp 25 | 26 | 56dp 27 | 8dp 28 | 29 | 16dp 30 | 10sp 31 | 32 | -------------------------------------------------------------------------------- /navigationbarview/src/main/res/layout/view_bottom_navigation_bar_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 15 | 16 | 23 | 24 | 25 | 26 | 34 | 35 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /navigationbarview/src/main/java/jp/s64/android/navigationbarview/item/INavigationBarItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Shuma Yoshioka 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package jp.s64.android.navigationbarview.item; 18 | 19 | import android.content.Context; 20 | import android.support.annotation.ColorInt; 21 | import android.support.annotation.IdRes; 22 | import android.support.annotation.Nullable; 23 | import android.view.View; 24 | 25 | public interface INavigationBarItem { 26 | 27 | @IdRes 28 | int getIdRes(); 29 | 30 | @Nullable 31 | String getText(boolean isChecked); 32 | 33 | @ColorInt 34 | int getTextColorInt(boolean isChecked); 35 | 36 | View updateIcon(@Nullable View original, Context context, int width, int height, IconAnimator animator); 37 | 38 | void onItemViewCreated(View newView); 39 | 40 | void onItemViewRemoved(View removedView); 41 | 42 | @Nullable 43 | Integer getIconPixelSize(); 44 | 45 | class IconAnimator { 46 | 47 | public final boolean isChecked; 48 | public final boolean oldIsChecked; 49 | public final float fraction; 50 | 51 | public IconAnimator(boolean isChecked, boolean oldIsChecked, float fraction) { 52 | this.isChecked = isChecked; 53 | this.oldIsChecked = oldIsChecked; 54 | this.fraction = fraction; 55 | } 56 | 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NavigationBarView 2 | 3 | Get it on Google Play 4 | 5 | An example project / library of customizable Bottom Navigation 6 | 7 | ![](assets/screenrecord1.gif) 8 | 9 | 10 | 11 | This is contains below components: 12 | 13 | - BottomNavigationBarView 14 | 15 | ## Usages 16 | 17 | Add following lines to your buildscripts. 18 | 19 | ```groovy 20 | buildscript { 21 | ext { 22 | navigation_bar_view_version = '0.0.8' 23 | } 24 | } 25 | ``` 26 | 27 | ```groovy 28 | repositories { 29 | maven { 30 | url 'http://dl.bintray.com/s64/maven' 31 | } 32 | } 33 | 34 | dependencies { 35 | compile "jp.s64.android:navigationbarview:${navigation_bar_view_version}" 36 | } 37 | ``` 38 | 39 | ## Apps using android-navigation-bar-view 40 | 41 | - [Wantedly Visit](https://play.google.com/store/apps/details?id=com.wantedly.android.visit) & [Intern](https://play.google.com/store/apps/details?id=com.wantedly.android.student) 42 | - [Balloon](https://play.google.com/store/apps/details?id=jp.co.fowd.balloon) 43 | 44 | ## Donate 45 | 46 | 47 | 48 | ## License 49 | 50 | ``` 51 | Copyright 2017 Shuma Yoshioka 52 | 53 | Licensed under the Apache License, Version 2.0 (the "License"); 54 | you may not use this file except in compliance with the License. 55 | You may obtain a copy of the License at 56 | 57 | http://www.apache.org/licenses/LICENSE-2.0 58 | 59 | Unless required by applicable law or agreed to in writing, software 60 | distributed under the License is distributed on an "AS IS" BASIS, 61 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 62 | See the License for the specific language governing permissions and 63 | limitations under the License. 64 | ``` 65 | -------------------------------------------------------------------------------- /navigationbarview/src/main/java/jp/s64/android/navigationbarview/view/INavigationBarView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Shuma Yoshioka 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package jp.s64.android.navigationbarview.view; 18 | 19 | import android.support.annotation.IdRes; 20 | import android.support.annotation.Nullable; 21 | import android.view.View; 22 | 23 | import jp.s64.android.navigationbarview.item.INavigationBarItem; 24 | 25 | public interface INavigationBarView extends INavigationBarTransitionView { 26 | 27 | void clearItems(); 28 | 29 | void add(INavigationBarItem... items); 30 | 31 | void remove(INavigationBarItem... items); 32 | 33 | void remove(int index); 34 | 35 | void replace(int index, INavigationBarItem item); 36 | 37 | int size(); 38 | 39 | void setItemLimit(@Nullable Integer min, @Nullable Integer max); 40 | 41 | int getMaxSize(); 42 | 43 | int getMinSize(); 44 | 45 | void check(@IdRes int idRes); 46 | 47 | void uncheck(); 48 | 49 | @Nullable 50 | View getItemView(@IdRes int idRes); 51 | 52 | void setOnCheckChangedListener(@Nullable OnCheckChangeListener listener); 53 | 54 | void show(OnVisibilityAnimateListener doAnimate); 55 | 56 | void hide(OnVisibilityAnimateListener doAnimate); 57 | 58 | boolean isNavigationBarShown(); 59 | 60 | @IdRes 61 | int getChecked(); 62 | 63 | interface OnCheckChangeListener { 64 | 65 | void onCheckChanged(@IdRes int oldIdRes, @IdRes int newIdRes); 66 | 67 | } 68 | 69 | interface OnVisibilityAnimateListener { 70 | 71 | void onVisibilityAnimate(SELF self); 72 | 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /example/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'com.google.firebase.firebase-crash' 3 | 4 | android { 5 | compileSdkVersion android_compilesdk_version 6 | buildToolsVersion android_buildtools_version 7 | 8 | configurations.all { 9 | resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9' 10 | } 11 | 12 | defaultConfig { 13 | applicationId "jp.s64.android.navigationbarview.example" 14 | minSdkVersion android_minsdk_version 15 | targetSdkVersion android_targetsdk_version 16 | versionCode android_version_code 17 | versionName navigation_bar_view_version_name 18 | 19 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 20 | 21 | } 22 | 23 | signingConfigs { 24 | 25 | /* 26 | debug { 27 | storeFile System.getenv('ANDROID_DEBUG_KEYSTORE_FILE') != null ? file(System.getenv('ANDROID_DEBUG_KEYSTORE_FILE')) : rootProject.file('debug.keystore') 28 | storePassword 'android' 29 | keyAlias 'androiddebugkey' 30 | keyPassword 'android' 31 | } 32 | */ 33 | 34 | release { 35 | storeFile file(release_keystore_file) 36 | storePassword release_keystore_password 37 | keyAlias release_key_alias 38 | keyPassword release_key_password 39 | } 40 | 41 | } 42 | 43 | buildTypes { 44 | 45 | debug { 46 | minifyEnabled false 47 | debuggable true 48 | zipAlignEnabled true 49 | shrinkResources false 50 | //signingConfig signingConfigs.debug 51 | 52 | applicationIdSuffix '.debug' 53 | versionNameSuffix '-debug' 54 | } 55 | 56 | release { 57 | minifyEnabled true 58 | debuggable false 59 | zipAlignEnabled true 60 | shrinkResources true 61 | signingConfig signingConfigs.release 62 | 63 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 64 | } 65 | 66 | } 67 | 68 | } 69 | 70 | dependencies { 71 | compile fileTree(dir: 'libs', include: ['*.jar']) 72 | 73 | androidTestCompile("com.android.support.test.espresso:espresso-core:${espresso_version}", { 74 | exclude group: 'com.android.support', module: 'support-annotations' 75 | }) 76 | 77 | testCompile "junit:junit:${junit_version}" 78 | compile "com.google.firebase:firebase-crash:${firebase_library_version}" 79 | 80 | compile project(':navigationbarview') 81 | } 82 | 83 | apply plugin: 'com.google.gms.google-services' -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /navigationbarview/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'com.github.dcendents.android-maven' 3 | apply plugin: 'com.jfrog.bintray' 4 | 5 | group = artifact_group 6 | version = navigation_bar_view_version_name 7 | 8 | android { 9 | compileSdkVersion android_compilesdk_version 10 | buildToolsVersion android_buildtools_version 11 | 12 | defaultConfig { 13 | minSdkVersion android_minsdk_version 14 | targetSdkVersion android_targetsdk_version 15 | versionCode android_version_code 16 | versionName navigation_bar_view_version_name 17 | 18 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 19 | 20 | } 21 | buildTypes { 22 | release { 23 | minifyEnabled false 24 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 25 | } 26 | } 27 | } 28 | 29 | dependencies { 30 | compile fileTree(dir: 'libs', include: ['*.jar']) 31 | androidTestCompile("com.android.support.test.espresso:espresso-core:${espresso_version}", { 32 | exclude group: 'com.android.support', module: 'support-annotations' 33 | }) 34 | compile "com.android.support:appcompat-v7:${android_support_library_version}" 35 | compile "com.android.support:design:${android_support_library_version}" 36 | 37 | compile "com.google.guava:guava:${guava_version}" 38 | compile "jp.s64.android.radiobuttonextended:core:${radiobutton_extended_version}" 39 | 40 | testCompile "junit:junit:${junit_version}" 41 | } 42 | 43 | bintray { 44 | user = bintray_user 45 | key = bintray_api_key 46 | 47 | configurations = default_configurations 48 | 49 | pkg { 50 | repo = default_repo 51 | name = 'android-navigation-bar-view' 52 | licenses = default_licenses 53 | websiteUrl = site_url 54 | issueTrackerUrl = issues_url 55 | vcsUrl = git_url 56 | labels = shared_labels 57 | publicDownloadNumbers = true 58 | 59 | version { 60 | name = navigation_bar_view_version_name 61 | released = toIsoDateFormat(new Date()) 62 | vcsTag = navigation_bar_view_version_name 63 | } 64 | } 65 | 66 | } 67 | 68 | install { 69 | repositories.mavenInstaller { 70 | pom { 71 | project { 72 | packaging 'aar' 73 | scm { 74 | url site_url 75 | } 76 | } 77 | } 78 | } 79 | } 80 | 81 | task sourcesJar(type: Jar) { 82 | classifier = 'sources' 83 | from android.sourceSets.main.java.srcDirs 84 | } 85 | 86 | task javadoc(type: Javadoc) { 87 | source = android.sourceSets.main.java.srcDirs 88 | classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) 89 | } 90 | 91 | task javadocJar(type: Jar, dependsOn: javadoc) { 92 | classifier = 'javadoc' 93 | from javadoc.destinationDir 94 | } 95 | 96 | artifacts { 97 | archives sourcesJar, javadocJar 98 | } -------------------------------------------------------------------------------- /navigationbarview/src/main/java/jp/s64/android/navigationbarview/item/AbsBadgeNavigationBarItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Shuma Yoshioka 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package jp.s64.android.navigationbarview.item; 18 | 19 | import android.content.Context; 20 | import android.graphics.Typeface; 21 | import android.support.annotation.Nullable; 22 | import android.support.v4.content.ContextCompat; 23 | import android.support.v4.content.res.ResourcesCompat; 24 | import android.support.v4.view.ViewCompat; 25 | import android.support.v7.widget.AppCompatTextView; 26 | import android.util.TypedValue; 27 | import android.view.Gravity; 28 | import android.view.View; 29 | import android.widget.RelativeLayout; 30 | import android.widget.TextView; 31 | 32 | import jp.s64.android.navigationbarview.R; 33 | 34 | public abstract class AbsBadgeNavigationBarItem extends AbsNavigationBarItem { 35 | 36 | protected AppCompatTextView mBadge; 37 | 38 | protected CharSequence mBadgeText; 39 | 40 | @Override 41 | public View updateIcon(@Nullable View original, Context context, int width, int height, IconAnimator animator) { 42 | RelativeLayout ret = (RelativeLayout) super.updateIcon(original, context, width, height, animator); 43 | AppCompatTextView badge = null; 44 | { 45 | for (int i = 0; i < ret.getChildCount(); i++) { 46 | View v = ret.getChildAt(i); 47 | if (v instanceof TextView) { 48 | badge = (AppCompatTextView) v; 49 | break; 50 | } 51 | } 52 | } 53 | if (badge == null) { 54 | CharSequence oldText; 55 | if (mBadgeText != null) { 56 | oldText = mBadgeText; 57 | mBadgeText = null; 58 | } else { 59 | oldText = mBadge != null ? mBadge.getText() : null; 60 | } 61 | badge = mBadge = new AppCompatTextView(context); 62 | int size = context.getResources().getDimensionPixelSize(R.dimen.item_badge_size); 63 | { 64 | RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(size, size); 65 | params.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE); 66 | params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, RelativeLayout.TRUE); 67 | params.topMargin = (size / 4) * -1; 68 | params.rightMargin = (size / 3) * -1; 69 | badge.setLayoutParams(params); 70 | badge.setIncludeFontPadding(false); 71 | badge.setGravity(Gravity.CENTER); 72 | } 73 | { 74 | badge.setTextColor(ContextCompat.getColor(context, R.color.item_badge_text_color)); 75 | ViewCompat.setBackground(badge, ResourcesCompat.getDrawable(context.getResources(), R.drawable.item_badge_background, context.getTheme())); 76 | badge.setTextSize(TypedValue.COMPLEX_UNIT_PX, context.getResources().getDimension(R.dimen.item_badge_text_size)); 77 | badge.setTypeface(null, Typeface.BOLD); 78 | } 79 | { 80 | setBadgeText(oldText); 81 | } 82 | ret.addView(badge); 83 | } 84 | return ret; 85 | } 86 | 87 | public void setBadgeText(@Nullable CharSequence text) { 88 | if (mBadge != null) { 89 | mBadge.setText(text); 90 | mBadge.setAlpha(text != null ? 1f : 0f); 91 | } else { 92 | mBadgeText = text; 93 | } 94 | } 95 | 96 | } 97 | -------------------------------------------------------------------------------- /navigationbarview/src/main/java/jp/s64/android/navigationbarview/item/AbsNavigationBarItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Shuma Yoshioka 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package jp.s64.android.navigationbarview.item; 18 | 19 | import android.animation.ArgbEvaluator; 20 | import android.content.Context; 21 | import android.graphics.PorterDuff; 22 | import android.graphics.drawable.Drawable; 23 | import android.support.annotation.ColorInt; 24 | import android.support.annotation.DrawableRes; 25 | import android.support.annotation.Nullable; 26 | import android.support.v4.graphics.drawable.DrawableCompat; 27 | import android.support.v7.widget.AppCompatImageView; 28 | import android.view.View; 29 | import android.view.ViewGroup; 30 | import android.widget.ImageView; 31 | import android.widget.RelativeLayout; 32 | 33 | public abstract class AbsNavigationBarItem implements INavigationBarItem { 34 | 35 | @Override 36 | public View updateIcon(@Nullable View original, Context context, int width, int height, IconAnimator animator) { 37 | RelativeLayout ret; 38 | AppCompatImageView img; 39 | if (original == null) { 40 | ret = new RelativeLayout(context); 41 | { 42 | ret.setLayoutParams(new ViewGroup.LayoutParams(width, height)); 43 | } 44 | img = new AppCompatImageView(context); 45 | RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); 46 | { 47 | img.setLayoutParams(params); 48 | img.setScaleType(ImageView.ScaleType.FIT_CENTER); 49 | } 50 | ret.addView(img); 51 | } else { 52 | ret = (RelativeLayout) original; 53 | img = (AppCompatImageView) ret.getChildAt(0); 54 | } 55 | { 56 | img.setImageResource(getDrawableIdRes(animator.isChecked)); 57 | } 58 | Integer colorInt; 59 | if (animator.isChecked != animator.oldIsChecked) { 60 | ArgbEvaluator ev = new ArgbEvaluator(); 61 | Integer before, after; 62 | { 63 | before = getColorInt(animator.oldIsChecked); 64 | after = getColorInt(animator.isChecked); 65 | } 66 | if (before != null && after != null) { 67 | colorInt = (int) ev.evaluate( 68 | animator.fraction, 69 | before, 70 | after 71 | ); 72 | } else { 73 | colorInt = null; 74 | } 75 | } else { 76 | colorInt = getColorInt(animator.isChecked); 77 | } 78 | { 79 | Drawable d = DrawableCompat.wrap(img.getDrawable()).mutate(); 80 | if (colorInt != null) { 81 | DrawableCompat.setTint(d, colorInt); 82 | DrawableCompat.setTintMode(d, PorterDuff.Mode.SRC_IN); 83 | } else { 84 | DrawableCompat.setTintList(d, null); 85 | } 86 | img.setImageDrawable(d); 87 | } 88 | return ret; 89 | } 90 | 91 | @Override 92 | public void onItemViewCreated(View newView) { 93 | // no-op 94 | } 95 | 96 | @Override 97 | public void onItemViewRemoved(View removedView) { 98 | // no-op 99 | } 100 | 101 | @DrawableRes 102 | public abstract int getDrawableIdRes(boolean isChecked); 103 | 104 | @Nullable 105 | @ColorInt 106 | public abstract Integer getColorInt(boolean isChecked); 107 | 108 | @Nullable 109 | @Override 110 | public Integer getIconPixelSize() { 111 | return null; 112 | } 113 | 114 | } 115 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /example/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 11 | 12 | 16 | 17 | 25 | 26 | 31 | 32 |