├── .gitignore ├── LICENSE ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── codemybrainsout │ │ └── onboarding │ │ └── ApplicationTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── assets │ │ └── fonts │ │ │ └── Roboto-Light.ttf │ ├── java │ │ └── com │ │ │ └── codemybrainsout │ │ │ └── onboarding │ │ │ ├── GradientBackgroundExampleActivity.java │ │ │ ├── ImageBackgroundExampleActivity.java │ │ │ └── SolidBackgroundExampleActivity.java │ └── res │ │ ├── drawable │ │ ├── backpack.png │ │ ├── barcode.png │ │ ├── chalk.png │ │ ├── chat.png │ │ ├── download.jpg │ │ ├── food.png │ │ ├── rectangle_button.xml │ │ ├── reward.png │ │ ├── rounded_button.xml │ │ ├── spend.png │ │ ├── truck.png │ │ └── wallet.png │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-ldpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ │ ├── values-w820dp │ │ └── dimens.xml │ │ └── values │ │ ├── attrs.xml │ │ ├── colors.xml │ │ ├── dimen.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── codemybrainsout │ └── onboarding │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle ├── gradle-mvn-push.gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── onboarder ├── .gitignore ├── build.gradle ├── gradle.properties ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── codemybrainsout │ │ └── onboarder │ │ └── ApplicationTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── codemybrainsout │ │ │ └── onboarder │ │ │ ├── AhoyOnboarderActivity.java │ │ │ ├── AhoyOnboarderAdapter.java │ │ │ ├── AhoyOnboarderCard.java │ │ │ ├── AhoyOnboarderFragment.java │ │ │ ├── utils │ │ │ └── ShadowTransformer.java │ │ │ └── views │ │ │ ├── CircleIndicatorView.java │ │ │ ├── FlowingGradient.java │ │ │ └── FlowingGradientClass.java │ └── res │ │ ├── drawable │ │ ├── fifth_bg.xml │ │ ├── forth_bg.xml │ │ ├── new_state.xml │ │ ├── next.png │ │ ├── original_state.xml │ │ ├── previous.png │ │ ├── rectangle_button.xml │ │ ├── rounded_button.xml │ │ ├── seventh_bg.xml │ │ ├── sixth_b.xml │ │ ├── thrid_bg.xml │ │ └── translate.xml │ │ ├── layout-large-land │ │ └── fragment_ahoy.xml │ │ ├── layout-normal-land │ │ └── fragment_ahoy.xml │ │ ├── layout-v21 │ │ └── activity_ahoy.xml │ │ ├── layout │ │ ├── activity_ahoy.xml │ │ └── fragment_ahoy.xml │ │ └── values │ │ ├── attrs.xml │ │ ├── colors.xml │ │ ├── dimen.xml │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── codemybrainsout │ └── onboarder │ └── ExampleUnitTest.java ├── preview ├── preview-gradient.png ├── preview-image.png ├── preview-landscape.png ├── preview-solid.png └── preview.gif └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the ART/Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | out/ 15 | 16 | # Gradle files 17 | .gradle/ 18 | build/ 19 | 20 | # Local configuration file (sdk path, etc) 21 | local.properties 22 | 23 | # Proguard folder generated by Eclipse 24 | proguard/ 25 | 26 | # Log Files 27 | *.log 28 | 29 | # Android Studio Navigation editor temp files 30 | .navigation/ 31 | 32 | # Android Studio captures folder 33 | captures/ 34 | 35 | # Intellij 36 | *.iml 37 | .idea/workspace.xml 38 | .idea/ 39 | 40 | # Keystore files 41 | *.jks 42 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Ahoy! Onboarding 2 | Onboarding library for android with Gradient, Image or Solid color backgrounds. 3 | 4 | ![](preview/preview.gif) 5 | 6 | ## Installation 7 | 8 | ### Gradle 9 | Add it as a dependency in your app's build.gradle file 10 | 11 | ```groovy 12 | dependencies { 13 | compile 'com.codemybrainsout.onboarding:onboarder:1.0.4' 14 | } 15 | ``` 16 | 17 | ## How to use 18 | 19 | **First of all, you will have to extend your activity like this** 20 | 21 | ```java 22 | public class YourActivity extends AhoyOnboarderActivity { 23 | ``` 24 | 25 | **Then, Create `AhoyOnboarderCard` and configure it accordingly** 26 | 27 | ```java 28 | AhoyOnboarderCard ahoyOnboarderCard1 = new AhoyOnboarderCard("Title", "Description", R.drawable.icon1); 29 | ahoyOnboarderCard1.setBackgroundColor(R.color.black_transparent); 30 | ahoyOnboarderCard1.setTitleColor(R.color.white); 31 | ahoyOnboarderCard1.setDescriptionColor(R.color.grey_200); 32 | ahoyOnboarderCard1.setTitleTextSize(dpToPixels(10, this)); 33 | ahoyOnboarderCard1.setDescriptionTextSize(dpToPixels(8, this)); 34 | ahoyOnboarderCard1.setIconLayoutParams(iconWidth, iconHeight, marginTop, marginLeft, marginRight, marginBottom); 35 | ``` 36 | 37 | **After that, Create a list of cards and set them using** 38 | 39 | ```java 40 | List pages = new ArrayList<>(); 41 | pages.add(ahoyOnboarderCard1); 42 | pages.add(ahoyOnboarderCard2); 43 | pages.add(ahoyOnboarderCard3); 44 | ... 45 | 46 | setOnboardPages(pages); 47 | ``` 48 | 49 | ### Choose from one of these three background types 50 | 51 | - **Gradient Background** 52 | ```java 53 | setGradientBackground(); 54 | ``` 55 | 56 | ![](preview/preview-gradient.png) 57 | 58 | - **Image Background** 59 | ```java 60 | setImageBackground(R.drawable.image); 61 | ``` 62 | 63 | ![](preview/preview-image.png) 64 | 65 | - **Solid Background** 66 | 67 | ```java 68 | List colorList = new ArrayList<>(); 69 | colorList.add(R.color.solid_one); 70 | colorList.add(R.color.solid_two); 71 | colorList.add(R.color.solid_three); 72 | setColorBackground(colorList); 73 | 74 | //or 75 | 76 | setColorBackground(R.color.solid_one); 77 | ``` 78 | 79 | ![](preview/preview-solid.png) 80 | 81 | **You can also customise the font to match your app** 82 | ```java 83 | Typeface face = Typeface.createFromAsset(getAssets(), "fonts/Roboto-Light.ttf"); 84 | setFont(face); 85 | ``` 86 | 87 | ### Landscape mode 88 | 89 | ![](preview/preview-landscape.png) 90 | 91 | ### Other properties 92 | ```java 93 | 94 | //Show/Hide navigation controls 95 | showNavigationControls(false); 96 | 97 | //Set pager indicator colors 98 | setInactiveIndicatorColor(R.color.grey); 99 | setActiveIndicatorColor(R.color.white); 100 | 101 | //Set finish button text 102 | setFinishButtonTitle("Get Started"); 103 | 104 | //Set the finish button style 105 | setFinishButtonDrawableStyle(ContextCompat.getDrawable(this, R.drawable.rounded_button)); 106 | ``` 107 | 108 | ## Thanks 109 | * [dynamitechetan/Flowing-Gradient](https://github.com/dynamitechetan/Flowing-Gradient) 110 | * [chyrta/AndroidOnboarder](https://github.com/chyrta/AndroidOnboarder) 111 | 112 | ## Changelog 113 | 114 | ### v1.0.1 115 | 116 | Landscape layout by [Maxwell](https://github.com/wax911) 117 | 118 | ### v1.0.2 119 | 120 | FinishButtonDrawableStyle by [Maxwell](https://github.com/wax911) 121 | 122 | ## Support 123 | If you've any questions regarding this library, please contact us at help@codemybrainsout.com 124 | 125 | ## Credits 126 | 127 | This project was initiated by **Code My Brains Out**. You can contribute to this project by submitting issues or/and by forking this repo and sending a pull request. 128 | 129 | ![](http://codemybrainsout.com/files/img/logo-small.png) 130 | 131 | Follow us on: 132 | 133 | [![Facebook](http://codemybrainsout.com/files/img/fb.png)](https://www.facebook.com/codemybrainsout)     [![Twitter](http://codemybrainsout.com/files/img/tw.png)](https://twitter.com/codemybrainsout) 134 | 135 | Author: [Rahul Juneja](https://github.com/ahulr) 136 | 137 | # License 138 | ``` 139 | Copyright (C) 2016 Code My Brains Out 140 | 141 | Licensed under the Apache License, Version 2.0 (the "License"); 142 | you may not use this file except in compliance with the License. 143 | You may obtain a copy of the License at 144 | 145 | http://www.apache.org/licenses/LICENSE-2.0 146 | 147 | Unless required by applicable law or agreed to in writing, software 148 | distributed under the License is distributed on an "AS IS" BASIS, 149 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 150 | See the License for the specific language governing permissions and 151 | limitations under the License. 152 | ``` -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 25 5 | buildToolsVersion "25" 6 | 7 | defaultConfig { 8 | applicationId "com.codemybrainsout.onboarding" 9 | minSdkVersion 15 10 | targetSdkVersion 24 11 | versionCode 5 12 | versionName "1.0.4" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(dir: 'libs', include: ['*.jar']) 24 | testCompile 'junit:junit:4.12' 25 | compile 'com.android.support:appcompat-v7:25.3.1' 26 | compile project(path: ':onboarder') 27 | } 28 | -------------------------------------------------------------------------------- /app/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 C:\Users\Rahul Juneja\AppData\Local\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 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/codemybrainsout/onboarding/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.codemybrainsout.onboarding; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /app/src/main/assets/fonts/Roboto-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codemybrainsout/ahoy-onboarding/7c91feda44cf3e22f3051ec822a84f84627c8ea3/app/src/main/assets/fonts/Roboto-Light.ttf -------------------------------------------------------------------------------- /app/src/main/java/com/codemybrainsout/onboarding/GradientBackgroundExampleActivity.java: -------------------------------------------------------------------------------- 1 | package com.codemybrainsout.onboarding; 2 | 3 | import android.content.Context; 4 | import android.content.res.Resources; 5 | import android.graphics.Typeface; 6 | import android.os.Build; 7 | import android.os.Bundle; 8 | import android.support.v4.content.ContextCompat; 9 | import android.util.DisplayMetrics; 10 | import android.widget.Toast; 11 | 12 | import com.codemybrainsout.onboarder.AhoyOnboarderActivity; 13 | import com.codemybrainsout.onboarder.AhoyOnboarderCard; 14 | 15 | import java.util.ArrayList; 16 | import java.util.List; 17 | 18 | public class GradientBackgroundExampleActivity extends AhoyOnboarderActivity { 19 | 20 | @Override 21 | protected void onCreate(Bundle savedInstanceState) { 22 | super.onCreate(savedInstanceState); 23 | 24 | AhoyOnboarderCard ahoyOnboarderCard1 = new AhoyOnboarderCard("City Guide", "Detailed guides to help you plan your trip.", R.drawable.backpack); 25 | AhoyOnboarderCard ahoyOnboarderCard2 = new AhoyOnboarderCard("Travel Blog", "Share your travel experiences with a vast network of fellow travellers.", R.drawable.chalk); 26 | AhoyOnboarderCard ahoyOnboarderCard3 = new AhoyOnboarderCard("Chat", "Connect with like minded people and exchange your travel stories.", R.drawable.chat); 27 | 28 | ahoyOnboarderCard1.setBackgroundColor(R.color.black_transparent); 29 | ahoyOnboarderCard2.setBackgroundColor(R.color.black_transparent); 30 | ahoyOnboarderCard3.setBackgroundColor(R.color.black_transparent); 31 | 32 | List pages = new ArrayList<>(); 33 | 34 | pages.add(ahoyOnboarderCard1); 35 | pages.add(ahoyOnboarderCard2); 36 | pages.add(ahoyOnboarderCard3); 37 | 38 | for (AhoyOnboarderCard page : pages) { 39 | page.setTitleColor(R.color.white); 40 | page.setDescriptionColor(R.color.grey_200); 41 | //page.setTitleTextSize(dpToPixels(12, this)); 42 | //page.setDescriptionTextSize(dpToPixels(8, this)); 43 | //page.setIconLayoutParams(width, height, marginTop, marginLeft, marginRight, marginBottom); 44 | } 45 | 46 | setFinishButtonTitle("Finish"); 47 | showNavigationControls(true); 48 | setGradientBackground(); 49 | 50 | //set the button style you created 51 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { 52 | setFinishButtonDrawableStyle(ContextCompat.getDrawable(this, R.drawable.rounded_button)); 53 | } 54 | 55 | Typeface face = Typeface.createFromAsset(getAssets(), "fonts/Roboto-Light.ttf"); 56 | setFont(face); 57 | 58 | setOnboardPages(pages); 59 | } 60 | 61 | @Override 62 | public void onFinishButtonPressed() { 63 | Toast.makeText(this, "Finish Pressed", Toast.LENGTH_SHORT).show(); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /app/src/main/java/com/codemybrainsout/onboarding/ImageBackgroundExampleActivity.java: -------------------------------------------------------------------------------- 1 | package com.codemybrainsout.onboarding; 2 | 3 | import android.graphics.Typeface; 4 | import android.support.v4.content.ContextCompat; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.os.Bundle; 7 | import android.widget.Toast; 8 | 9 | import com.codemybrainsout.onboarder.AhoyOnboarderActivity; 10 | import com.codemybrainsout.onboarder.AhoyOnboarderCard; 11 | 12 | import java.util.ArrayList; 13 | import java.util.List; 14 | 15 | public class ImageBackgroundExampleActivity extends AhoyOnboarderActivity { 16 | 17 | @Override 18 | protected void onCreate(Bundle savedInstanceState) { 19 | super.onCreate(savedInstanceState); 20 | 21 | AhoyOnboarderCard ahoyOnboarderCard1 = new AhoyOnboarderCard("Link Cards", "Sign up for free by activating your credit cards.", R.drawable.spend); 22 | AhoyOnboarderCard ahoyOnboarderCard2 = new AhoyOnboarderCard("Dine Out", "Choose from 100's of restaurants with new spots added daily.", R.drawable.food); 23 | AhoyOnboarderCard ahoyOnboarderCard3 = new AhoyOnboarderCard("Get Cashback", "Earn upto 30% each time you dine with linked cards in network.", R.drawable.reward); 24 | 25 | ahoyOnboarderCard1.setBackgroundColor(R.color.black_transparent); 26 | ahoyOnboarderCard2.setBackgroundColor(R.color.black_transparent); 27 | ahoyOnboarderCard3.setBackgroundColor(R.color.black_transparent); 28 | 29 | List pages = new ArrayList<>(); 30 | 31 | pages.add(ahoyOnboarderCard1); 32 | pages.add(ahoyOnboarderCard2); 33 | pages.add(ahoyOnboarderCard3); 34 | 35 | for (AhoyOnboarderCard page : pages) { 36 | page.setTitleColor(R.color.white); 37 | page.setDescriptionColor(R.color.grey_200); 38 | } 39 | 40 | setFinishButtonTitle("Get Started"); 41 | showNavigationControls(true); 42 | //setGradientBackground(); 43 | setImageBackground(R.drawable.download); 44 | 45 | Typeface face = Typeface.createFromAsset(getAssets(), "fonts/Roboto-Light.ttf"); 46 | //setFont(face); 47 | 48 | setInactiveIndicatorColor(R.color.grey_600); 49 | setActiveIndicatorColor(R.color.white); 50 | 51 | setOnboardPages(pages); 52 | 53 | } 54 | 55 | @Override 56 | public void onFinishButtonPressed() { 57 | Toast.makeText(this, "Finish Pressed", Toast.LENGTH_SHORT).show(); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /app/src/main/java/com/codemybrainsout/onboarding/SolidBackgroundExampleActivity.java: -------------------------------------------------------------------------------- 1 | package com.codemybrainsout.onboarding; 2 | 3 | import android.graphics.Color; 4 | import android.graphics.Typeface; 5 | import android.os.Bundle; 6 | import android.support.annotation.IntegerRes; 7 | import android.widget.Toast; 8 | 9 | import com.codemybrainsout.onboarder.AhoyOnboarderActivity; 10 | import com.codemybrainsout.onboarder.AhoyOnboarderCard; 11 | 12 | import java.util.ArrayList; 13 | import java.util.List; 14 | 15 | public class SolidBackgroundExampleActivity extends AhoyOnboarderActivity { 16 | 17 | @Override 18 | protected void onCreate(Bundle savedInstanceState) { 19 | super.onCreate(savedInstanceState); 20 | 21 | AhoyOnboarderCard ahoyOnboarderCard1 = new AhoyOnboarderCard("Scan Barcode", "Label your packages with a barcode before we collect it from you.", R.drawable.barcode); 22 | AhoyOnboarderCard ahoyOnboarderCard2 = new AhoyOnboarderCard("Shipping", "Our huge network of shipping partners ensures that your packages are always on schedule.", R.drawable.truck); 23 | AhoyOnboarderCard ahoyOnboarderCard3 = new AhoyOnboarderCard("Payment", "Receive payments immediately after the package is delivered.", R.drawable.wallet); 24 | 25 | ahoyOnboarderCard1.setBackgroundColor(R.color.white); 26 | ahoyOnboarderCard2.setBackgroundColor(R.color.white); 27 | ahoyOnboarderCard3.setBackgroundColor(R.color.white); 28 | 29 | List pages = new ArrayList<>(); 30 | 31 | pages.add(ahoyOnboarderCard1); 32 | pages.add(ahoyOnboarderCard2); 33 | pages.add(ahoyOnboarderCard3); 34 | 35 | for (AhoyOnboarderCard page : pages) { 36 | page.setTitleColor(R.color.black); 37 | page.setDescriptionColor(R.color.grey_600); 38 | } 39 | 40 | setFinishButtonTitle("Finish"); 41 | showNavigationControls(false); 42 | 43 | List colorList = new ArrayList<>(); 44 | colorList.add(R.color.solid_one); 45 | colorList.add(R.color.solid_two); 46 | colorList.add(R.color.solid_three); 47 | 48 | setColorBackground(colorList); 49 | 50 | Typeface face = Typeface.createFromAsset(getAssets(), "fonts/Roboto-Light.ttf"); 51 | setFont(face); 52 | 53 | setOnboardPages(pages); 54 | 55 | } 56 | 57 | @Override 58 | public void onFinishButtonPressed() { 59 | Toast.makeText(this, "Finish Pressed", Toast.LENGTH_SHORT).show(); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/backpack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codemybrainsout/ahoy-onboarding/7c91feda44cf3e22f3051ec822a84f84627c8ea3/app/src/main/res/drawable/backpack.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/barcode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codemybrainsout/ahoy-onboarding/7c91feda44cf3e22f3051ec822a84f84627c8ea3/app/src/main/res/drawable/barcode.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/chalk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codemybrainsout/ahoy-onboarding/7c91feda44cf3e22f3051ec822a84f84627c8ea3/app/src/main/res/drawable/chalk.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/chat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codemybrainsout/ahoy-onboarding/7c91feda44cf3e22f3051ec822a84f84627c8ea3/app/src/main/res/drawable/chat.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/download.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codemybrainsout/ahoy-onboarding/7c91feda44cf3e22f3051ec822a84f84627c8ea3/app/src/main/res/drawable/download.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/food.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codemybrainsout/ahoy-onboarding/7c91feda44cf3e22f3051ec822a84f84627c8ea3/app/src/main/res/drawable/food.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/rectangle_button.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/reward.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codemybrainsout/ahoy-onboarding/7c91feda44cf3e22f3051ec822a84f84627c8ea3/app/src/main/res/drawable/reward.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/rounded_button.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/spend.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codemybrainsout/ahoy-onboarding/7c91feda44cf3e22f3051ec822a84f84627c8ea3/app/src/main/res/drawable/spend.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/truck.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codemybrainsout/ahoy-onboarding/7c91feda44cf3e22f3051ec822a84f84627c8ea3/app/src/main/res/drawable/truck.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/wallet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codemybrainsout/ahoy-onboarding/7c91feda44cf3e22f3051ec822a84f84627c8ea3/app/src/main/res/drawable/wallet.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codemybrainsout/ahoy-onboarding/7c91feda44cf3e22f3051ec822a84f84627c8ea3/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-ldpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codemybrainsout/ahoy-onboarding/7c91feda44cf3e22f3051ec822a84f84627c8ea3/app/src/main/res/mipmap-ldpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codemybrainsout/ahoy-onboarding/7c91feda44cf3e22f3051ec822a84f84627c8ea3/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codemybrainsout/ahoy-onboarding/7c91feda44cf3e22f3051ec822a84f84627c8ea3/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codemybrainsout/ahoy-onboarding/7c91feda44cf3e22f3051ec822a84f84627c8ea3/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codemybrainsout/ahoy-onboarding/7c91feda44cf3e22f3051ec822a84f84627c8ea3/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | #4abc96 8 | #357180 9 | #ffce00 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimen.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 8dp 5 | 8dp 6 | 128dp 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Ahoy! 3 | FINISH 4 | NEXT 5 | SKIP 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/test/java/com/codemybrainsout/onboarding/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.codemybrainsout.onboarding; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * To work on unit tests, switch the Test Artifact in the Build Variants view. 9 | */ 10 | public class ExampleUnitTest { 11 | @Test 12 | public void addition_isCorrect() throws Exception { 13 | assertEquals(4, 2 + 2); 14 | } 15 | } -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:2.3.3' 9 | //classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6' 10 | classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1' 11 | // NOTE: Do not place your application dependencies here; they belong 12 | // in the individual module build.gradle files 13 | } 14 | } 15 | 16 | plugins { 17 | id "com.jfrog.bintray" version "1.7.3" 18 | } 19 | 20 | allprojects { 21 | repositories { 22 | jcenter() 23 | } 24 | } 25 | 26 | task clean(type: Delete) { 27 | delete rootProject.buildDir 28 | } 29 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | 20 | GROUP=com.codemybrainsout.onboarding 21 | VERSION_NAME=1.0.4 22 | 23 | POM_DESCRIPTION=Onboarding library for android with Gradient, Image or Solid color backgrounds. 24 | 25 | POM_URL=https://github.com/codemybrainsout/ahoy-onboarding 26 | POM_SCM_URL=https://github.com/codemybrainsout/ahoy-onboarding 27 | POM_SCM_CONNECTION=scm:git:git://github.com/codemybrainsout/ahoy-onboarding.git 28 | POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com:codemybrainsout/ahoy-onboarding.git 29 | POM_ISSUE_URL=https://github.com/codemybrainsout/ahoy-onboarding/issues 30 | 31 | POM_LICENCE_NAME=The Apache Software License, Version 2.0 32 | POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt 33 | POM_ALL_LICENCES=['Apache-2.0'] 34 | POM_LICENCE_DIST=repo 35 | 36 | POM_DEVELOPER_ID=codemybrainsout 37 | POM_DEVELOPER_NAME=Rahul Juneja -------------------------------------------------------------------------------- /gradle/gradle-mvn-push.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Chris Banes 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 | apply plugin: 'com.jfrog.bintray' 18 | apply plugin: 'com.github.dcendents.android-maven' 19 | 20 | version = VERSION_NAME 21 | group = GROUP 22 | 23 | // Bintray 24 | Properties properties = new Properties() 25 | properties.load(project.rootProject.file('local.properties').newDataInputStream()) 26 | 27 | bintray { 28 | user = properties.getProperty("bintray.user") 29 | key = properties.getProperty("bintray.apikey") 30 | 31 | configurations = ['archives'] 32 | pkg { 33 | repo = 'maven' 34 | name = POM_ARTIFACT_ID 35 | desc = POM_DESCRIPTION 36 | websiteUrl = POM_URL 37 | issueTrackerUrl = POM_ISSUE_URL 38 | vcsUrl = POM_SCM_URL 39 | licenses = ["Apache-2.0"] 40 | publish = true 41 | publicDownloadNumbers = true 42 | version { 43 | desc = POM_DESCRIPTION 44 | gpg { 45 | sign = true //Determines whether to GPG sign the files. The default is false 46 | passphrase = properties.getProperty("bintray.gpg.password") 47 | //Optional. The passphrase for GPG signing' 48 | } 49 | 50 | mavenCentralSync { 51 | sync = true 52 | user = properties.getProperty("bintray.oss.user") 53 | password = properties.getProperty("bintray.oss.password") 54 | close = '1' 55 | } 56 | } 57 | } 58 | } 59 | 60 | if (project.getPlugins().hasPlugin('com.android.application') || 61 | project.getPlugins().hasPlugin('com.android.library')) { 62 | install { 63 | repositories.mavenInstaller { 64 | configuration = configurations.archives 65 | 66 | pom.groupId = GROUP 67 | pom.artifactId = POM_ARTIFACT_ID 68 | pom.version = VERSION_NAME 69 | 70 | pom.project { 71 | name POM_NAME 72 | packaging POM_PACKAGING 73 | description POM_DESCRIPTION 74 | url POM_URL 75 | 76 | scm { 77 | url POM_SCM_URL 78 | connection POM_SCM_CONNECTION 79 | developerConnection POM_SCM_DEV_CONNECTION 80 | } 81 | 82 | licenses { 83 | license { 84 | name POM_LICENCE_NAME 85 | url POM_LICENCE_URL 86 | distribution POM_LICENCE_DIST 87 | } 88 | } 89 | 90 | developers { 91 | developer { 92 | id POM_DEVELOPER_ID 93 | name POM_DEVELOPER_NAME 94 | } 95 | } 96 | } 97 | } 98 | } 99 | 100 | task androidJavadocs(type: Javadoc) { 101 | source = android.sourceSets.main.java.source 102 | classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) 103 | } 104 | 105 | task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) { 106 | classifier = 'javadoc' 107 | from androidJavadocs.destinationDir 108 | } 109 | 110 | task androidSourcesJar(type: Jar) { 111 | classifier = 'sources' 112 | from android.sourceSets.main.java.source 113 | } 114 | } else { 115 | install { 116 | repositories.mavenInstaller { 117 | pom.groupId = GROUP 118 | pom.artifactId = POM_ARTIFACT_ID 119 | pom.version = VERSION_NAME 120 | 121 | pom.project { 122 | name POM_NAME 123 | packaging POM_PACKAGING 124 | description POM_DESCRIPTION 125 | url POM_URL 126 | 127 | scm { 128 | url POM_SCM_URL 129 | connection POM_SCM_CONNECTION 130 | developerConnection POM_SCM_DEV_CONNECTION 131 | } 132 | 133 | licenses { 134 | license { 135 | name POM_LICENCE_NAME 136 | url POM_LICENCE_URL 137 | distribution POM_LICENCE_DIST 138 | } 139 | } 140 | 141 | developers { 142 | developer { 143 | id POM_DEVELOPER_ID 144 | name POM_DEVELOPER_NAME 145 | } 146 | } 147 | } 148 | } 149 | } 150 | 151 | task sourcesJar(type: Jar, dependsOn: classes) { 152 | classifier = 'sources' 153 | from sourceSets.main.allSource 154 | } 155 | 156 | task javadocJar(type: Jar, dependsOn: javadoc) { 157 | classifier = 'javadoc' 158 | from javadoc.destinationDir 159 | } 160 | } 161 | 162 | if (JavaVersion.current().isJava8Compatible()) { 163 | allprojects { 164 | tasks.withType(Javadoc) { 165 | options.addStringOption('Xdoclint:none', '-quiet') 166 | } 167 | } 168 | } 169 | 170 | artifacts { 171 | if (project.getPlugins().hasPlugin('com.android.application') || 172 | project.getPlugins().hasPlugin('com.android.library')) { 173 | archives androidSourcesJar 174 | archives androidJavadocsJar 175 | } else { 176 | archives sourcesJar 177 | archives javadocJar 178 | } 179 | } 180 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codemybrainsout/ahoy-onboarding/7c91feda44cf3e22f3051ec822a84f84627c8ea3/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jul 28 19:57:08 IST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-bin.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn ( ) { 37 | echo "$*" 38 | } 39 | 40 | die ( ) { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save ( ) { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /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 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 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 Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /onboarder/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /onboarder/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 25 5 | buildToolsVersion "25" 6 | 7 | defaultConfig { 8 | minSdkVersion 15 9 | targetSdkVersion 25 10 | versionCode 5 11 | versionName "1.0.4" 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | } 20 | 21 | dependencies { 22 | compile fileTree(dir: 'libs', include: ['*.jar']) 23 | testCompile 'junit:junit:4.12' 24 | compile 'com.android.support:appcompat-v7:25.3.1' 25 | compile 'com.android.support:cardview-v7:25.3.1' 26 | compile 'com.android.support:support-v4:25.3.1' 27 | } 28 | 29 | apply from: rootProject.file('gradle/gradle-mvn-push.gradle') -------------------------------------------------------------------------------- /onboarder/gradle.properties: -------------------------------------------------------------------------------- 1 | POM_NAME=onboarder 2 | POM_ARTIFACT_ID=onboarder 3 | POM_PACKAGING=aar -------------------------------------------------------------------------------- /onboarder/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 C:\Users\Rahul Juneja\AppData\Local\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 | -------------------------------------------------------------------------------- /onboarder/src/androidTest/java/com/codemybrainsout/onboarder/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.codemybrainsout.onboarder; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /onboarder/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /onboarder/src/main/java/com/codemybrainsout/onboarder/AhoyOnboarderActivity.java: -------------------------------------------------------------------------------- 1 | package com.codemybrainsout.onboarder; 2 | 3 | import android.animation.Animator; 4 | import android.content.Context; 5 | import android.graphics.Typeface; 6 | import android.graphics.drawable.Drawable; 7 | import android.os.Build; 8 | import android.os.Bundle; 9 | import android.support.annotation.ColorRes; 10 | import android.support.annotation.RequiresApi; 11 | import android.support.annotation.StringRes; 12 | import android.support.v4.content.ContextCompat; 13 | import android.support.v4.view.ViewPager; 14 | import android.support.v7.app.AppCompatActivity; 15 | import android.view.View; 16 | import android.view.animation.AccelerateInterpolator; 17 | import android.view.animation.AlphaAnimation; 18 | import android.view.animation.Animation; 19 | import android.view.animation.DecelerateInterpolator; 20 | import android.widget.FrameLayout; 21 | import android.widget.ImageView; 22 | import android.widget.RelativeLayout; 23 | import android.widget.TextView; 24 | 25 | import com.codemybrainsout.onboarder.utils.ShadowTransformer; 26 | import com.codemybrainsout.onboarder.views.CircleIndicatorView; 27 | import com.codemybrainsout.onboarder.views.FlowingGradientClass; 28 | 29 | import java.util.List; 30 | 31 | public abstract class AhoyOnboarderActivity extends AppCompatActivity implements View.OnClickListener, ViewPager.OnPageChangeListener { 32 | 33 | private CircleIndicatorView circleIndicatorView; 34 | private ViewPager vpOnboarderPager; 35 | private AhoyOnboarderAdapter ahoyOnboarderAdapter; 36 | private TextView btnSkip; 37 | private ImageView ivNext, ivPrev; 38 | private FrameLayout navigationControls; 39 | private FrameLayout buttonsLayout; 40 | private RelativeLayout parentLayout; 41 | private ImageView backgroundImage; 42 | private View backgroundImageOverlay; 43 | 44 | private ShadowTransformer mCardShadowTransformer; 45 | private Typeface typeface; 46 | private List colorList; 47 | private boolean solidBackground = false; 48 | private List pages; 49 | 50 | @Override 51 | protected void onCreate(Bundle savedInstanceState) { 52 | super.onCreate(savedInstanceState); 53 | setContentView(R.layout.activity_ahoy); 54 | setStatusBackgroundColor(); 55 | hideActionBar(); 56 | 57 | parentLayout = (RelativeLayout) findViewById(R.id.parent_layout); 58 | circleIndicatorView = (CircleIndicatorView) findViewById(R.id.circle_indicator_view); 59 | btnSkip = (TextView) findViewById(R.id.btn_skip); 60 | buttonsLayout = (FrameLayout) findViewById(R.id.buttons_layout); 61 | navigationControls = (FrameLayout) findViewById(R.id.navigation_layout); 62 | ivNext = (ImageView) findViewById(R.id.ivNext); 63 | ivPrev = (ImageView) findViewById(R.id.ivPrev); 64 | backgroundImage = (ImageView) findViewById(R.id.background_image); 65 | backgroundImageOverlay = (View) findViewById(R.id.background_image_overlay); 66 | vpOnboarderPager = (ViewPager) findViewById(R.id.vp_pager); 67 | vpOnboarderPager.addOnPageChangeListener(this); 68 | btnSkip.setOnClickListener(this); 69 | ivPrev.setOnClickListener(this); 70 | ivNext.setOnClickListener(this); 71 | 72 | hideFinish(false); 73 | fadeOut(ivPrev, false); 74 | } 75 | 76 | public void setOnboardPages(List pages) { 77 | 78 | this.pages = pages; 79 | ahoyOnboarderAdapter = new AhoyOnboarderAdapter(pages, getSupportFragmentManager(), dpToPixels(0, this), typeface); 80 | mCardShadowTransformer = new ShadowTransformer(vpOnboarderPager, ahoyOnboarderAdapter); 81 | mCardShadowTransformer.enableScaling(true); 82 | vpOnboarderPager.setAdapter(ahoyOnboarderAdapter); 83 | vpOnboarderPager.setPageTransformer(false, mCardShadowTransformer); 84 | circleIndicatorView.setPageIndicators(pages.size()); 85 | 86 | } 87 | 88 | public float dpToPixels(int dp, Context context) { 89 | return dp * (context.getResources().getDisplayMetrics().density); 90 | } 91 | 92 | private void setStatusBackgroundColor() { 93 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { 94 | getWindow().getDecorView().setSystemUiVisibility( 95 | View.SYSTEM_UI_FLAG_LAYOUT_STABLE 96 | | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); 97 | getWindow().setStatusBarColor(ContextCompat.getColor(this, R.color.black_transparent)); 98 | } 99 | } 100 | 101 | @Override 102 | public void onClick(View v) { 103 | int i = v.getId(); 104 | boolean isInFirstPage = vpOnboarderPager.getCurrentItem() == 0; 105 | boolean isInLastPage = vpOnboarderPager.getCurrentItem() == ahoyOnboarderAdapter.getCount() - 1; 106 | 107 | if (i == R.id.btn_skip && isInLastPage) { 108 | onFinishButtonPressed(); 109 | } else if (i == R.id.ivPrev && !isInFirstPage) { 110 | vpOnboarderPager.setCurrentItem(vpOnboarderPager.getCurrentItem() - 1); 111 | } else if (i == R.id.ivNext && !isInLastPage) { 112 | vpOnboarderPager.setCurrentItem(vpOnboarderPager.getCurrentItem() + 1); 113 | } 114 | } 115 | 116 | @Override 117 | public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { 118 | 119 | } 120 | 121 | @Override 122 | public void onPageSelected(int position) { 123 | 124 | int firstPagePosition = 0; 125 | int lastPagePosition = ahoyOnboarderAdapter.getCount() - 1; 126 | circleIndicatorView.setCurrentPage(position); 127 | circleIndicatorView.setCurrentPage(position); 128 | 129 | if (position == lastPagePosition) { 130 | fadeOut(circleIndicatorView); 131 | showFinish(); 132 | fadeOut(ivNext); 133 | fadeIn(ivPrev); 134 | } else if (position == firstPagePosition) { 135 | fadeOut(ivPrev); 136 | fadeIn(ivNext); 137 | hideFinish(); 138 | fadeIn(circleIndicatorView); 139 | } else { 140 | fadeIn(circleIndicatorView); 141 | hideFinish(); 142 | fadeIn(ivPrev); 143 | fadeIn(ivNext); 144 | } 145 | 146 | if (solidBackground && (pages.size() == colorList.size())) { 147 | backgroundImage.setBackgroundColor(ContextCompat.getColor(this, colorList.get(position))); 148 | } 149 | 150 | } 151 | 152 | @Override 153 | public void onPageScrollStateChanged(int state) { 154 | 155 | } 156 | 157 | private void fadeOut(View v) { 158 | fadeOut(v, true); 159 | } 160 | 161 | private void fadeOut(final View v, boolean delay) { 162 | 163 | long duration = 0; 164 | if (delay) { 165 | duration = 300; 166 | } 167 | 168 | if (v.getVisibility() != View.GONE) { 169 | Animation fadeOut = new AlphaAnimation(1, 0); 170 | fadeOut.setInterpolator(new AccelerateInterpolator()); //and this 171 | fadeOut.setDuration(duration); 172 | fadeOut.setAnimationListener(new Animation.AnimationListener() { 173 | @Override 174 | public void onAnimationStart(Animation animation) { 175 | 176 | } 177 | 178 | @Override 179 | public void onAnimationEnd(Animation animation) { 180 | v.setVisibility(View.GONE); 181 | } 182 | 183 | @Override 184 | public void onAnimationRepeat(Animation animation) { 185 | 186 | } 187 | }); 188 | v.startAnimation(fadeOut); 189 | } 190 | } 191 | 192 | private void fadeIn(final View v) { 193 | 194 | if (v.getVisibility() != View.VISIBLE) { 195 | Animation fadeIn = new AlphaAnimation(0, 1); 196 | fadeIn.setInterpolator(new DecelerateInterpolator()); //add this 197 | fadeIn.setDuration(300); 198 | fadeIn.setAnimationListener(new Animation.AnimationListener() { 199 | @Override 200 | public void onAnimationStart(Animation animation) { 201 | 202 | } 203 | 204 | @Override 205 | public void onAnimationEnd(Animation animation) { 206 | 207 | v.setVisibility(View.VISIBLE); 208 | } 209 | 210 | @Override 211 | public void onAnimationRepeat(Animation animation) { 212 | 213 | } 214 | }); 215 | v.startAnimation(fadeIn); 216 | } 217 | } 218 | 219 | private void showFinish() { 220 | btnSkip.setVisibility(View.VISIBLE); 221 | this.btnSkip.animate().translationY(0 - dpToPixels(5, this)).setInterpolator(new DecelerateInterpolator()).setDuration(500).start(); 222 | } 223 | 224 | private void hideFinish(boolean delay) { 225 | 226 | long duration = 0; 227 | if (delay) { 228 | duration = 250; 229 | } 230 | 231 | this.btnSkip.animate().translationY(this.btnSkip.getBottom() + dpToPixels(100, this)).setInterpolator(new AccelerateInterpolator()).setDuration(duration).setListener(new Animator.AnimatorListener() { 232 | @Override 233 | public void onAnimationStart(Animator animator) { 234 | 235 | } 236 | 237 | @Override 238 | public void onAnimationEnd(Animator animator) { 239 | 240 | btnSkip.setVisibility(View.VISIBLE); 241 | } 242 | 243 | @Override 244 | public void onAnimationCancel(Animator animator) { 245 | 246 | } 247 | 248 | @Override 249 | public void onAnimationRepeat(Animator animator) { 250 | 251 | } 252 | }).start(); 253 | } 254 | 255 | private void hideFinish() { 256 | hideFinish(true); 257 | } 258 | 259 | private void hideActionBar() { 260 | if (getSupportActionBar() != null) { 261 | getSupportActionBar().hide(); 262 | } 263 | } 264 | 265 | abstract public void onFinishButtonPressed(); 266 | 267 | public void showNavigationControls(boolean navigation) { 268 | if (navigation) { 269 | navigationControls.setVisibility(View.VISIBLE); 270 | } else { 271 | navigationControls.setVisibility(View.GONE); 272 | } 273 | } 274 | 275 | public void setImageBackground(int resId) { 276 | backgroundImageOverlay.setVisibility(View.VISIBLE); 277 | backgroundImage.setImageResource(resId); 278 | } 279 | 280 | public void setColorBackground(@ColorRes int color) { 281 | backgroundImage.setBackgroundColor(ContextCompat.getColor(this, color)); 282 | } 283 | 284 | public void setColorBackground(List color) { 285 | this.colorList = color; 286 | solidBackground = true; 287 | backgroundImage.setBackgroundColor(ContextCompat.getColor(this, color.get(0))); 288 | } 289 | 290 | public void setGradientBackground() { 291 | 292 | FlowingGradientClass grad = new FlowingGradientClass(); 293 | grad.setBackgroundResource(R.drawable.translate) 294 | .onRelativeLayout(parentLayout) 295 | .setTransitionDuration(4000) 296 | .start(); 297 | } 298 | 299 | public void setGradientBackground(int drawable) { 300 | FlowingGradientClass grad = new FlowingGradientClass(); 301 | grad.setBackgroundResource(drawable) 302 | .onRelativeLayout(parentLayout) 303 | .setTransitionDuration(4000) 304 | .start(); 305 | } 306 | 307 | public void setInactiveIndicatorColor(int color) { 308 | this.circleIndicatorView.setInactiveIndicatorColor(color); 309 | } 310 | 311 | public void setActiveIndicatorColor(int color) { 312 | this.circleIndicatorView.setActiveIndicatorColor(color); 313 | } 314 | 315 | /** 316 | *

317 | * N.B. Builds before JELLY_BEAN will use the default style 318 | *

319 | * Set the xml drawable style of the skip/done button,
320 | * using for example: ContextCompat.getDrawable(this, R.drawable.rectangle_button); 321 | * 322 | * @param res A drawable xml file representing your desired button style 323 | */ 324 | @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN) 325 | public void setFinishButtonDrawableStyle(Drawable res) { 326 | btnSkip.setBackground(res); 327 | } 328 | 329 | public void setFinishButtonTitle(CharSequence title) { 330 | btnSkip.setText(title); 331 | } 332 | 333 | public void setFinishButtonTitle(@StringRes int titleResId) { 334 | btnSkip.setText(titleResId); 335 | } 336 | 337 | public void setFont(Typeface typeface) { 338 | this.btnSkip.setTypeface(typeface); 339 | this.typeface = typeface; 340 | } 341 | 342 | } 343 | -------------------------------------------------------------------------------- /onboarder/src/main/java/com/codemybrainsout/onboarder/AhoyOnboarderAdapter.java: -------------------------------------------------------------------------------- 1 | package com.codemybrainsout.onboarder; 2 | 3 | import android.graphics.Typeface; 4 | import android.support.v4.app.Fragment; 5 | import android.support.v4.app.FragmentManager; 6 | import android.support.v4.app.FragmentStatePagerAdapter; 7 | import android.support.v7.widget.CardView; 8 | import android.util.Log; 9 | import android.view.ViewGroup; 10 | 11 | import com.codemybrainsout.onboarder.utils.ShadowTransformer; 12 | 13 | import java.util.ArrayList; 14 | import java.util.List; 15 | 16 | public class AhoyOnboarderAdapter extends FragmentStatePagerAdapter implements ShadowTransformer.CardAdapter { 17 | 18 | private String TAG = AhoyOnboarderAdapter.class.getSimpleName(); 19 | List pages = new ArrayList(); 20 | private List mFragments = new ArrayList<>(); 21 | private float mBaseElevation; 22 | private Typeface typeface; 23 | 24 | public AhoyOnboarderAdapter(List pages, FragmentManager fm, float baseElevation, Typeface typeface) { 25 | super(fm); 26 | this.pages = pages; 27 | this.typeface = typeface; 28 | this.mBaseElevation = baseElevation; 29 | 30 | for (int i = 0; i < pages.size(); i++) { 31 | addCardFragment(pages.get(i)); 32 | } 33 | 34 | //setTypeface(typeface); 35 | 36 | } 37 | 38 | @Override 39 | public Fragment getItem(int position) { 40 | //return AhoyOnboarderFragment.newInstance(pages.get(position)); 41 | return mFragments.get(position); 42 | } 43 | 44 | @Override 45 | public Object instantiateItem(ViewGroup container, int position) { 46 | Object fragment = super.instantiateItem(container, position); 47 | mFragments.set(position, (AhoyOnboarderFragment) fragment); 48 | return fragment; 49 | } 50 | 51 | @Override 52 | public float getBaseElevation() { 53 | return mBaseElevation; 54 | } 55 | 56 | @Override 57 | public CardView getCardViewAt(int position) { 58 | setTypeface(typeface, position); 59 | return mFragments.get(position).getCardView(); 60 | } 61 | 62 | public void addCardFragment(AhoyOnboarderCard page) { 63 | mFragments.add(AhoyOnboarderFragment.newInstance(page)); 64 | } 65 | 66 | @Override 67 | public int getCount() { 68 | return pages.size(); 69 | } 70 | 71 | @Override 72 | public void destroyItem(ViewGroup container, int position, Object object) { 73 | // TODO Auto-generated method stub 74 | super.destroyItem(container, position, object); 75 | 76 | } 77 | 78 | public void setTypeface(Typeface typeface, int i) { 79 | if (typeface != null) { 80 | 81 | if (mFragments.get(i) == null) { 82 | Log.i(TAG, "Fragment is null"); 83 | return; 84 | } 85 | 86 | if (mFragments.get(i).getTitleView() == null) { 87 | Log.i(TAG, "TitleView is null"); 88 | return; 89 | } 90 | 91 | if (mFragments.get(i).getTitleView() == null) { 92 | Log.i(TAG, "DescriptionView is null"); 93 | return; 94 | } 95 | 96 | mFragments.get(i).getTitleView().setTypeface(typeface); 97 | mFragments.get(i).getDescriptionView().setTypeface(typeface); 98 | 99 | } 100 | } 101 | 102 | } 103 | -------------------------------------------------------------------------------- /onboarder/src/main/java/com/codemybrainsout/onboarder/AhoyOnboarderCard.java: -------------------------------------------------------------------------------- 1 | package com.codemybrainsout.onboarder; 2 | 3 | import android.graphics.Typeface; 4 | import android.graphics.drawable.Drawable; 5 | import android.support.annotation.ColorRes; 6 | import android.support.annotation.DrawableRes; 7 | import android.support.annotation.StringRes; 8 | 9 | public class AhoyOnboarderCard { 10 | 11 | public String title; 12 | public String description; 13 | public Drawable imageResource; 14 | @StringRes 15 | public int titleResourceId; 16 | @StringRes 17 | public int descriptionResourceId; 18 | @DrawableRes 19 | public int imageResourceId; 20 | @ColorRes 21 | public int titleColor; 22 | @ColorRes 23 | public int descriptionColor; 24 | @ColorRes 25 | public int backgroundColor; 26 | 27 | public float titleTextSize; 28 | public float descriptionTextSize; 29 | public int iconWidth, iconHeight, marginTop, marginLeft, marginRight, marginBottom; 30 | 31 | public AhoyOnboarderCard(String title, String description) { 32 | this.title = title; 33 | this.description = description; 34 | } 35 | 36 | public AhoyOnboarderCard(int title, int description) { 37 | this.titleResourceId = title; 38 | this.descriptionResourceId = description; 39 | } 40 | 41 | public AhoyOnboarderCard(String title, String description, int imageResourceId) { 42 | this.title = title; 43 | this.description = description; 44 | this.imageResourceId = imageResourceId; 45 | } 46 | 47 | public AhoyOnboarderCard(String title, String description, Drawable imageResource) { 48 | this.title = title; 49 | this.description = description; 50 | this.imageResource = imageResource; 51 | } 52 | 53 | public AhoyOnboarderCard(int title, int description, int imageResourceId) { 54 | this.titleResourceId = title; 55 | this.descriptionResourceId = description; 56 | this.imageResourceId = imageResourceId; 57 | } 58 | 59 | public AhoyOnboarderCard(int title, int description, Drawable imageResource) { 60 | this.titleResourceId = title; 61 | this.descriptionResourceId = description; 62 | this.imageResource = imageResource; 63 | } 64 | 65 | public String getTitle() { 66 | return title; 67 | } 68 | 69 | public int getTitleResourceId() { 70 | return titleResourceId; 71 | } 72 | 73 | public String getDescription() { 74 | return description; 75 | } 76 | 77 | public int getDescriptionResourceId() { 78 | return descriptionResourceId; 79 | } 80 | 81 | public int getTitleColor() { 82 | return titleColor; 83 | } 84 | 85 | public int getDescriptionColor() { 86 | return descriptionColor; 87 | } 88 | 89 | public void setTitleColor(int color) { 90 | this.titleColor = color; 91 | } 92 | 93 | public void setDescriptionColor(int color) { 94 | this.descriptionColor = color; 95 | } 96 | 97 | public void setImageResourceId(int imageResourceId) { 98 | this.imageResourceId = imageResourceId; 99 | } 100 | 101 | public int getImageResourceId() { 102 | return imageResourceId; 103 | } 104 | 105 | public float getTitleTextSize() { 106 | return titleTextSize; 107 | } 108 | 109 | public void setTitleTextSize(float titleTextSize) { 110 | this.titleTextSize = titleTextSize; 111 | } 112 | 113 | public float getDescriptionTextSize() { 114 | return descriptionTextSize; 115 | } 116 | 117 | public void setDescriptionTextSize(float descriptionTextSize) { 118 | this.descriptionTextSize = descriptionTextSize; 119 | } 120 | 121 | public int getBackgroundColor() { 122 | return backgroundColor; 123 | } 124 | 125 | public void setBackgroundColor(int backgroundColor) { 126 | this.backgroundColor = backgroundColor; 127 | } 128 | 129 | public int getIconWidth() { 130 | return iconWidth; 131 | } 132 | 133 | public void setIconLayoutParams(int iconWidth, int iconHeight, int marginTop, int marginLeft, int marginRight, int marginBottom) { 134 | this.iconWidth = iconWidth; 135 | this.iconHeight = iconHeight; 136 | this.marginLeft = marginLeft; 137 | this.marginRight = marginRight; 138 | this.marginTop = marginTop; 139 | this.marginBottom = marginBottom; 140 | } 141 | 142 | public int getIconHeight() { 143 | return iconHeight; 144 | } 145 | 146 | public int getMarginTop() { 147 | return marginTop; 148 | } 149 | 150 | public int getMarginLeft() { 151 | return marginLeft; 152 | } 153 | 154 | public int getMarginRight() { 155 | return marginRight; 156 | } 157 | 158 | public int getMarginBottom() { 159 | return marginBottom; 160 | } 161 | } 162 | -------------------------------------------------------------------------------- /onboarder/src/main/java/com/codemybrainsout/onboarder/AhoyOnboarderFragment.java: -------------------------------------------------------------------------------- 1 | package com.codemybrainsout.onboarder; 2 | 3 | import android.content.Context; 4 | import android.os.Bundle; 5 | import android.support.annotation.ColorRes; 6 | import android.support.annotation.DrawableRes; 7 | import android.support.annotation.StringRes; 8 | import android.support.v4.app.Fragment; 9 | import android.support.v4.content.ContextCompat; 10 | import android.support.v7.widget.CardView; 11 | import android.view.Gravity; 12 | import android.view.LayoutInflater; 13 | import android.view.View; 14 | import android.view.ViewGroup; 15 | import android.widget.FrameLayout; 16 | import android.widget.ImageView; 17 | import android.widget.TextView; 18 | 19 | public class AhoyOnboarderFragment extends Fragment { 20 | 21 | private static final String AHOY_PAGE_TITLE = "ahoy_page_title"; 22 | private static final String AHOY_PAGE_TITLE_RES_ID = "ahoy_page_title_res_id"; 23 | private static final String AHOY_PAGE_TITLE_COLOR = "ahoy_page_title_color"; 24 | private static final String AHOY_PAGE_TITLE_TEXT_SIZE = "ahoy_page_title_text_size"; 25 | private static final String AHOY_PAGE_DESCRIPTION = "ahoy_page_description"; 26 | private static final String AHOY_PAGE_DESCRIPTION_RES_ID = "ahoy_page_description_res_id"; 27 | private static final String AHOY_PAGE_DESCRIPTION_COLOR = "ahoy_page_description_color"; 28 | private static final String AHOY_PAGE_DESCRIPTION_TEXT_SIZE = "ahoy_page_description_text_size"; 29 | private static final String AHOY_PAGE_IMAGE_RES_ID = "ahoy_page_image_res_id"; 30 | private static final String AHOY_PAGE_BACKGROUND_COLOR = "ahoy_page_background_color"; 31 | private static final String AHOY_PAGE_ICON_WIDTH = "ahoy_page_icon_width"; 32 | private static final String AHOY_PAGE_ICON_HEIGHT = "ahoy_page_icon_height"; 33 | private static final String AHOY_PAGE_MARGIN_LEFT = "ahoy_page_margin_left"; 34 | private static final String AHOY_PAGE_MARGIN_RIGHT = "ahoy_page_margin_right"; 35 | private static final String AHOY_PAGE_MARGIN_TOP = "ahoy_page_margin_top"; 36 | private static final String AHOY_PAGE_MARGIN_BOTTOM = "ahoy_page_margin_bottom"; 37 | 38 | 39 | private String title; 40 | private String description; 41 | @StringRes 42 | private int titleResId; 43 | @ColorRes 44 | private int titleColor; 45 | @StringRes 46 | private int descriptionResId; 47 | @ColorRes 48 | private int backgroundColor; 49 | @ColorRes 50 | private int descriptionColor; 51 | @DrawableRes 52 | private int imageResId; 53 | private float titleTextSize; 54 | private float descriptionTextSize; 55 | 56 | private View view; 57 | private ImageView ivOnboarderImage; 58 | private TextView tvOnboarderTitle; 59 | private TextView tvOnboarderDescription; 60 | private CardView cardView; 61 | private int iconHeight, iconWidth; 62 | private int marginTop, marginBottom, marginLeft, marginRight; 63 | 64 | public AhoyOnboarderFragment() { 65 | } 66 | 67 | public static AhoyOnboarderFragment newInstance(AhoyOnboarderCard card) { 68 | Bundle args = new Bundle(); 69 | args.putString(AHOY_PAGE_TITLE, card.getTitle()); 70 | args.putString(AHOY_PAGE_DESCRIPTION, card.getDescription()); 71 | args.putInt(AHOY_PAGE_TITLE_RES_ID, card.getTitleResourceId()); 72 | args.putInt(AHOY_PAGE_DESCRIPTION_RES_ID, card.getDescriptionResourceId()); 73 | args.putInt(AHOY_PAGE_TITLE_COLOR, card.getTitleColor()); 74 | args.putInt(AHOY_PAGE_DESCRIPTION_COLOR, card.getDescriptionColor()); 75 | args.putInt(AHOY_PAGE_IMAGE_RES_ID, card.getImageResourceId()); 76 | args.putFloat(AHOY_PAGE_TITLE_TEXT_SIZE, card.getTitleTextSize()); 77 | args.putFloat(AHOY_PAGE_DESCRIPTION_TEXT_SIZE, card.getDescriptionTextSize()); 78 | args.putInt(AHOY_PAGE_BACKGROUND_COLOR, card.getBackgroundColor()); 79 | args.putInt(AHOY_PAGE_ICON_HEIGHT, card.getIconHeight()); 80 | args.putInt(AHOY_PAGE_ICON_WIDTH, card.getIconWidth()); 81 | args.putInt(AHOY_PAGE_MARGIN_LEFT, card.getMarginLeft()); 82 | args.putInt(AHOY_PAGE_MARGIN_RIGHT, card.getMarginRight()); 83 | args.putInt(AHOY_PAGE_MARGIN_TOP, card.getMarginTop()); 84 | args.putInt(AHOY_PAGE_MARGIN_BOTTOM, card.getMarginBottom()); 85 | 86 | AhoyOnboarderFragment fragment = new AhoyOnboarderFragment(); 87 | fragment.setArguments(args); 88 | return fragment; 89 | } 90 | 91 | @Override 92 | public void onAttach(Context context) { 93 | super.onAttach(context); 94 | } 95 | 96 | @Override 97 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 98 | 99 | Bundle bundle = getArguments(); 100 | 101 | title = bundle.getString(AHOY_PAGE_TITLE, null); 102 | titleResId = bundle.getInt(AHOY_PAGE_TITLE_RES_ID, 0); 103 | titleColor = bundle.getInt(AHOY_PAGE_TITLE_COLOR, 0); 104 | titleTextSize = bundle.getFloat(AHOY_PAGE_TITLE_TEXT_SIZE, 0f); 105 | description = bundle.getString(AHOY_PAGE_DESCRIPTION, null); 106 | descriptionResId = bundle.getInt(AHOY_PAGE_DESCRIPTION_RES_ID, 0); 107 | descriptionColor = bundle.getInt(AHOY_PAGE_DESCRIPTION_COLOR, 0); 108 | descriptionTextSize = bundle.getFloat(AHOY_PAGE_DESCRIPTION_TEXT_SIZE, 0f); 109 | imageResId = bundle.getInt(AHOY_PAGE_IMAGE_RES_ID, 0); 110 | backgroundColor = bundle.getInt(AHOY_PAGE_BACKGROUND_COLOR, 0); 111 | iconWidth = bundle.getInt(AHOY_PAGE_ICON_WIDTH, (int) dpToPixels(128, getActivity())); 112 | iconHeight = bundle.getInt(AHOY_PAGE_ICON_HEIGHT, (int) dpToPixels(128, getActivity())); 113 | marginTop = bundle.getInt(AHOY_PAGE_MARGIN_TOP, (int) dpToPixels(80, getActivity())); 114 | marginBottom = bundle.getInt(AHOY_PAGE_MARGIN_BOTTOM, (int) dpToPixels(0, getActivity())); 115 | marginLeft = bundle.getInt(AHOY_PAGE_MARGIN_LEFT, (int) dpToPixels(0, getActivity())); 116 | marginRight = bundle.getInt(AHOY_PAGE_MARGIN_RIGHT, (int) dpToPixels(0, getActivity())); 117 | 118 | view = inflater.inflate(R.layout.fragment_ahoy, container, false); 119 | ivOnboarderImage = (ImageView) view.findViewById(R.id.iv_image); 120 | tvOnboarderTitle = (TextView) view.findViewById(R.id.tv_title); 121 | tvOnboarderDescription = (TextView) view.findViewById(R.id.tv_description); 122 | cardView = (CardView) view.findViewById(R.id.cv_cardview); 123 | 124 | if (title != null) { 125 | tvOnboarderTitle.setText(title); 126 | } 127 | 128 | if (titleResId != 0) { 129 | tvOnboarderTitle.setText(getResources().getString(titleResId)); 130 | } 131 | 132 | if (description != null) { 133 | tvOnboarderDescription.setText(description); 134 | } 135 | 136 | if (descriptionResId != 0) { 137 | tvOnboarderDescription.setText(getResources().getString(descriptionResId)); 138 | } 139 | 140 | if (titleColor != 0) { 141 | tvOnboarderTitle.setTextColor(ContextCompat.getColor(getActivity(), titleColor)); 142 | } 143 | 144 | if (descriptionColor != 0) { 145 | tvOnboarderDescription.setTextColor(ContextCompat.getColor(getActivity(), descriptionColor)); 146 | } 147 | 148 | if (imageResId != 0) { 149 | ivOnboarderImage.setImageDrawable(ContextCompat.getDrawable(getActivity(), imageResId)); 150 | } 151 | 152 | if (titleTextSize != 0f) { 153 | tvOnboarderTitle.setTextSize(titleTextSize); 154 | } 155 | 156 | if (descriptionTextSize != 0f) { 157 | tvOnboarderDescription.setTextSize(descriptionTextSize); 158 | } 159 | 160 | if (backgroundColor != 0) { 161 | cardView.setCardBackgroundColor(ContextCompat.getColor(getActivity(), backgroundColor)); 162 | } 163 | 164 | if (iconWidth != 0 && iconHeight != 0) { 165 | FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(iconWidth, iconHeight); 166 | layoutParams.gravity = Gravity.CENTER_HORIZONTAL; 167 | layoutParams.setMargins(marginLeft, marginTop, marginRight, marginBottom); 168 | ivOnboarderImage.setLayoutParams(layoutParams); 169 | } 170 | 171 | return view; 172 | } 173 | 174 | public float dpToPixels(int dp, Context context) { 175 | return dp * (context.getResources().getDisplayMetrics().density); 176 | } 177 | 178 | @Override 179 | public void onDetach() { 180 | super.onDetach(); 181 | } 182 | 183 | public CardView getCardView() { 184 | return cardView; 185 | } 186 | 187 | public TextView getTitleView() { 188 | return tvOnboarderTitle; 189 | } 190 | 191 | public TextView getDescriptionView() { 192 | return tvOnboarderDescription; 193 | } 194 | } 195 | -------------------------------------------------------------------------------- /onboarder/src/main/java/com/codemybrainsout/onboarder/utils/ShadowTransformer.java: -------------------------------------------------------------------------------- 1 | package com.codemybrainsout.onboarder.utils; 2 | 3 | import android.support.v4.view.ViewPager; 4 | import android.support.v7.widget.CardView; 5 | import android.view.View; 6 | 7 | /** 8 | * Created by Rahul Juneja on 30-08-2016. 9 | */ 10 | public class ShadowTransformer implements ViewPager.OnPageChangeListener, ViewPager.PageTransformer { 11 | 12 | private ViewPager mViewPager; 13 | private CardAdapter mAdapter; 14 | private float mLastOffset; 15 | private boolean mScalingEnabled; 16 | 17 | public interface CardAdapter { 18 | 19 | int MAX_ELEVATION_FACTOR = 6; 20 | float getBaseElevation(); 21 | CardView getCardViewAt(int position); 22 | int getCount(); 23 | } 24 | 25 | public ShadowTransformer(ViewPager viewPager, CardAdapter adapter) { 26 | mViewPager = viewPager; 27 | viewPager.addOnPageChangeListener(this); 28 | mAdapter = adapter; 29 | } 30 | 31 | public void enableScaling(boolean enable) { 32 | if (mScalingEnabled && !enable) { 33 | // shrink main card 34 | CardView currentCard = mAdapter.getCardViewAt(mViewPager.getCurrentItem()); 35 | if (currentCard != null) { 36 | currentCard.animate().scaleY(1); 37 | currentCard.animate().scaleX(1); 38 | } 39 | }else if(!mScalingEnabled && enable){ 40 | // grow main card 41 | CardView currentCard = mAdapter.getCardViewAt(mViewPager.getCurrentItem()); 42 | if (currentCard != null) { 43 | currentCard.animate().scaleY(1.1f); 44 | currentCard.animate().scaleX(1.1f); 45 | } 46 | } 47 | 48 | mScalingEnabled = enable; 49 | } 50 | 51 | @Override 52 | public void transformPage(View page, float position) { 53 | 54 | } 55 | 56 | @Override 57 | public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { 58 | int realCurrentPosition; 59 | int nextPosition; 60 | float baseElevation = mAdapter.getBaseElevation(); 61 | float realOffset; 62 | boolean goingLeft = mLastOffset > positionOffset; 63 | 64 | // If we're going backwards, onPageScrolled receives the last position 65 | // instead of the current one 66 | if (goingLeft) { 67 | realCurrentPosition = position + 1; 68 | nextPosition = position; 69 | realOffset = 1 - positionOffset; 70 | } else { 71 | nextPosition = position + 1; 72 | realCurrentPosition = position; 73 | realOffset = positionOffset; 74 | } 75 | 76 | // Avoid crash on overscroll 77 | if (nextPosition > mAdapter.getCount() - 1 78 | || realCurrentPosition > mAdapter.getCount() - 1) { 79 | return; 80 | } 81 | 82 | CardView currentCard = mAdapter.getCardViewAt(realCurrentPosition); 83 | 84 | // This might be null if a fragment is being used 85 | // and the views weren't created yet 86 | if (currentCard != null) { 87 | if (mScalingEnabled) { 88 | currentCard.setScaleX((float) (1 + 0.1 * (1 - realOffset))); 89 | currentCard.setScaleY((float) (1 + 0.1 * (1 - realOffset))); 90 | } 91 | currentCard.setCardElevation((baseElevation + baseElevation 92 | * (CardAdapter.MAX_ELEVATION_FACTOR - 1) * (1 - realOffset))); 93 | } 94 | 95 | CardView nextCard = mAdapter.getCardViewAt(nextPosition); 96 | 97 | // We might be scrolling fast enough so that the next (or previous) card 98 | // was already destroyed or a fragment might not have been created yet 99 | if (nextCard != null) { 100 | if (mScalingEnabled) { 101 | nextCard.setScaleX((float) (1 + 0.1 * (realOffset))); 102 | nextCard.setScaleY((float) (1 + 0.1 * (realOffset))); 103 | } 104 | nextCard.setCardElevation((baseElevation + baseElevation 105 | * (CardAdapter.MAX_ELEVATION_FACTOR - 1) * (realOffset))); 106 | } 107 | 108 | mLastOffset = positionOffset; 109 | } 110 | 111 | @Override 112 | public void onPageSelected(int position) { 113 | 114 | } 115 | 116 | @Override 117 | public void onPageScrollStateChanged(int state) { 118 | 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /onboarder/src/main/java/com/codemybrainsout/onboarder/views/CircleIndicatorView.java: -------------------------------------------------------------------------------- 1 | package com.codemybrainsout.onboarder.views; 2 | 3 | import android.content.Context; 4 | import android.graphics.Canvas; 5 | import android.graphics.Paint; 6 | import android.support.annotation.ColorRes; 7 | import android.support.v4.content.ContextCompat; 8 | import android.util.AttributeSet; 9 | import android.view.View; 10 | 11 | import com.codemybrainsout.onboarder.R; 12 | 13 | public class CircleIndicatorView extends View { 14 | 15 | private Context context; 16 | private Paint activeIndicatorPaint; 17 | private Paint inactiveIndicatorPaint; 18 | private int radius; 19 | private int size; 20 | private int position; 21 | private int indicatorsCount; 22 | 23 | public CircleIndicatorView(Context context) { 24 | super(context); 25 | init(context); 26 | } 27 | 28 | public CircleIndicatorView(Context context, AttributeSet attrs) { 29 | super(context, attrs); 30 | init(context); 31 | } 32 | 33 | public CircleIndicatorView(Context context, AttributeSet attrs, int defStyle) { 34 | super(context, attrs, defStyle); 35 | init(context); 36 | } 37 | 38 | private void init(Context context) { 39 | this.context = context; 40 | activeIndicatorPaint = new Paint(); 41 | activeIndicatorPaint.setColor(ContextCompat.getColor(context, R.color.active_indicator)); 42 | activeIndicatorPaint.setAntiAlias(true); 43 | inactiveIndicatorPaint = new Paint(); 44 | inactiveIndicatorPaint.setColor(ContextCompat.getColor(context, R.color.inactive_indicator)); 45 | inactiveIndicatorPaint.setAntiAlias(true); 46 | radius = getResources().getDimensionPixelSize(R.dimen.indicator_size); 47 | size = radius * 2; 48 | } 49 | 50 | @Override 51 | protected void onDraw(Canvas canvas) { 52 | super.onDraw(canvas); 53 | for (int i = 0; i < indicatorsCount; i++) { 54 | canvas.drawCircle(radius + (size * i), radius, radius / 2, inactiveIndicatorPaint); 55 | } 56 | canvas.drawCircle(radius + (size * position), radius, radius / 2, activeIndicatorPaint); 57 | } 58 | 59 | @Override 60 | protected void onLayout(boolean changed, int left, int top, int right, int bottom) { 61 | super.onLayout(changed, left, top, right, bottom); 62 | } 63 | 64 | @Override 65 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 66 | setMeasuredDimension(measureWidth(widthMeasureSpec), measureHeight(heightMeasureSpec)); 67 | } 68 | 69 | public void setCurrentPage(int position) { 70 | this.position = position; 71 | invalidate(); 72 | } 73 | 74 | public void setPageIndicators(int size) { 75 | this.indicatorsCount = size; 76 | invalidate(); 77 | } 78 | 79 | private int measureWidth(int measureSpec) { 80 | int result = 0; 81 | int specMode = MeasureSpec.getMode(measureSpec); 82 | int specSize = MeasureSpec.getSize(measureSpec); 83 | 84 | if (specMode == MeasureSpec.EXACTLY) { 85 | result = specSize; 86 | } else { 87 | result = size * indicatorsCount; 88 | if (specMode == MeasureSpec.AT_MOST) { 89 | result = Math.min(result, specSize); 90 | } 91 | } 92 | return result; 93 | } 94 | 95 | private int measureHeight(int measureSpec) { 96 | int result = 0; 97 | int specMode = MeasureSpec.getMode(measureSpec); 98 | int specSize = MeasureSpec.getSize(measureSpec); 99 | 100 | if (specMode == MeasureSpec.EXACTLY) { 101 | result = specSize; 102 | } else { 103 | result = 2 * radius + getPaddingTop() + getPaddingBottom(); 104 | if (specMode == MeasureSpec.AT_MOST) { 105 | result = Math.min(result, specSize); 106 | } 107 | } 108 | return result; 109 | } 110 | 111 | public void setInactiveIndicatorColor(@ColorRes int color) { 112 | inactiveIndicatorPaint.setColor(ContextCompat.getColor(context, color)); 113 | invalidate(); 114 | } 115 | 116 | public void setActiveIndicatorColor(@ColorRes int color) { 117 | activeIndicatorPaint.setColor(ContextCompat.getColor(context, color)); 118 | invalidate(); 119 | } 120 | 121 | } 122 | -------------------------------------------------------------------------------- /onboarder/src/main/java/com/codemybrainsout/onboarder/views/FlowingGradient.java: -------------------------------------------------------------------------------- 1 | package com.codemybrainsout.onboarder.views; 2 | 3 | import android.content.Context; 4 | import android.content.res.TypedArray; 5 | import android.graphics.drawable.AnimationDrawable; 6 | import android.util.AttributeSet; 7 | import android.view.View; 8 | 9 | import com.codemybrainsout.onboarder.R; 10 | 11 | public class FlowingGradient extends View { 12 | 13 | int duration; 14 | int draw; 15 | public FlowingGradient(Context context, AttributeSet attrs, int defStyle) { 16 | super(context, attrs, defStyle); 17 | init(); 18 | } 19 | 20 | public FlowingGradient(Context context, AttributeSet attrs) { 21 | super(context, attrs); 22 | TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.gradient,0, 0); 23 | 24 | draw = a.getResourceId(R.styleable.gradient_transition_drawable, R.drawable.translate); 25 | duration = a.getInt(R.styleable.gradient_transition_duration,75); 26 | init(); 27 | } 28 | 29 | public FlowingGradient(Context context) { 30 | super(context); 31 | init(); 32 | } 33 | 34 | private void init() { 35 | setBackgroundResource(draw); 36 | final AnimationDrawable frameAnimation = (AnimationDrawable) getBackground(); 37 | frameAnimation.setEnterFadeDuration(duration); 38 | frameAnimation.setExitFadeDuration(duration); 39 | post(new Runnable(){ 40 | public void run(){ 41 | frameAnimation.start(); 42 | } 43 | }); 44 | } 45 | } -------------------------------------------------------------------------------- /onboarder/src/main/java/com/codemybrainsout/onboarder/views/FlowingGradientClass.java: -------------------------------------------------------------------------------- 1 | package com.codemybrainsout.onboarder.views; 2 | 3 | import android.graphics.drawable.AnimationDrawable; 4 | import android.widget.ImageView; 5 | import android.widget.LinearLayout; 6 | import android.widget.RelativeLayout; 7 | 8 | public class FlowingGradientClass { 9 | 10 | int Duration=4000; 11 | RelativeLayout rl; 12 | LinearLayout ll; 13 | ImageView im; 14 | int alphaint; 15 | int d; 16 | AnimationDrawable frameAnimation; 17 | 18 | public FlowingGradientClass setTransitionDuration(int time) { 19 | this.Duration = time; 20 | 21 | return this; 22 | } 23 | public FlowingGradientClass onLinearLayout(LinearLayout ll) { 24 | this.ll = ll; 25 | return this; 26 | } 27 | 28 | public FlowingGradientClass onImageView(ImageView im) { 29 | this.im = im; 30 | return this; 31 | } 32 | 33 | public FlowingGradientClass onRelativeLayout(RelativeLayout rl) { 34 | this.rl = rl; 35 | return this; 36 | } 37 | public FlowingGradientClass start() { 38 | 39 | if(ll!=null){ 40 | ll.setBackgroundResource(d); 41 | } 42 | else if(rl!=null){ 43 | rl.setBackgroundResource(d); 44 | } 45 | else if(im!=null){ 46 | im.setBackgroundResource(d); 47 | } 48 | if(ll!=null){ 49 | frameAnimation = (AnimationDrawable) ll.getBackground(); 50 | } 51 | else if(rl!=null){ 52 | frameAnimation = (AnimationDrawable) rl.getBackground(); 53 | } 54 | else if(im!=null){ 55 | frameAnimation = (AnimationDrawable) im.getBackground(); 56 | } 57 | frameAnimation.setEnterFadeDuration(Duration); 58 | frameAnimation.setExitFadeDuration(Duration); 59 | frameAnimation.start(); 60 | 61 | return this; 62 | } 63 | 64 | public FlowingGradientClass setBackgroundResource(int d) { 65 | this.d = d; 66 | return this; 67 | } 68 | public FlowingGradientClass setAlpha(int alphaint) { 69 | this.alphaint = alphaint; 70 | frameAnimation.setAlpha(alphaint); 71 | return this; 72 | } 73 | 74 | } -------------------------------------------------------------------------------- /onboarder/src/main/res/drawable/fifth_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 11 | 13 | 14 | -------------------------------------------------------------------------------- /onboarder/src/main/res/drawable/forth_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 11 | 13 | 14 | -------------------------------------------------------------------------------- /onboarder/src/main/res/drawable/new_state.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 11 | 13 | 14 | -------------------------------------------------------------------------------- /onboarder/src/main/res/drawable/next.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codemybrainsout/ahoy-onboarding/7c91feda44cf3e22f3051ec822a84f84627c8ea3/onboarder/src/main/res/drawable/next.png -------------------------------------------------------------------------------- /onboarder/src/main/res/drawable/original_state.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 11 | 13 | 14 | -------------------------------------------------------------------------------- /onboarder/src/main/res/drawable/previous.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codemybrainsout/ahoy-onboarding/7c91feda44cf3e22f3051ec822a84f84627c8ea3/onboarder/src/main/res/drawable/previous.png -------------------------------------------------------------------------------- /onboarder/src/main/res/drawable/rectangle_button.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /onboarder/src/main/res/drawable/rounded_button.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /onboarder/src/main/res/drawable/seventh_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 11 | 13 | 14 | -------------------------------------------------------------------------------- /onboarder/src/main/res/drawable/sixth_b.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 11 | 13 | 14 | -------------------------------------------------------------------------------- /onboarder/src/main/res/drawable/thrid_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 11 | 13 | 14 | -------------------------------------------------------------------------------- /onboarder/src/main/res/drawable/translate.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /onboarder/src/main/res/layout-large-land/fragment_ahoy.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 18 | 19 | 20 | 25 | 26 | 34 | 35 | 44 | 45 | 53 | 54 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /onboarder/src/main/res/layout-normal-land/fragment_ahoy.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 18 | 19 | 24 | 25 | 34 | 35 | 42 | 43 | 51 | 52 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /onboarder/src/main/res/layout-v21/activity_ahoy.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 15 | 16 | 22 | 23 | 29 | 30 | 37 | 38 | 49 | 50 | 58 | 59 | 65 | 66 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 89 | 90 | -------------------------------------------------------------------------------- /onboarder/src/main/res/layout/activity_ahoy.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 15 | 16 | 22 | 23 | 29 | 30 | 37 | 38 | 48 | 49 | 57 | 58 | 64 | 65 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 88 | 89 | -------------------------------------------------------------------------------- /onboarder/src/main/res/layout/fragment_ahoy.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 18 | 19 | 24 | 25 | 33 | 34 | 46 | 47 | 55 | 56 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /onboarder/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /onboarder/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | @android:color/black 4 | @android:color/white 5 | #14000000 6 | #46000000 7 | @android:color/white 8 | #4D000000 9 | #757575 10 | #e0e0e0 11 | #EEEEEE 12 | #757575 13 | 14 | -------------------------------------------------------------------------------- /onboarder/src/main/res/values/dimen.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 8dp 5 | 8dp 6 | 128dp 7 | -------------------------------------------------------------------------------- /onboarder/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Ahoy! 3 | FINISH 4 | NEXT 5 | SKIP 6 | 7 | -------------------------------------------------------------------------------- /onboarder/src/test/java/com/codemybrainsout/onboarder/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.codemybrainsout.onboarder; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * To work on unit tests, switch the Test Artifact in the Build Variants view. 9 | */ 10 | public class ExampleUnitTest { 11 | @Test 12 | public void addition_isCorrect() throws Exception { 13 | assertEquals(4, 2 + 2); 14 | } 15 | } -------------------------------------------------------------------------------- /preview/preview-gradient.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codemybrainsout/ahoy-onboarding/7c91feda44cf3e22f3051ec822a84f84627c8ea3/preview/preview-gradient.png -------------------------------------------------------------------------------- /preview/preview-image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codemybrainsout/ahoy-onboarding/7c91feda44cf3e22f3051ec822a84f84627c8ea3/preview/preview-image.png -------------------------------------------------------------------------------- /preview/preview-landscape.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codemybrainsout/ahoy-onboarding/7c91feda44cf3e22f3051ec822a84f84627c8ea3/preview/preview-landscape.png -------------------------------------------------------------------------------- /preview/preview-solid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codemybrainsout/ahoy-onboarding/7c91feda44cf3e22f3051ec822a84f84627c8ea3/preview/preview-solid.png -------------------------------------------------------------------------------- /preview/preview.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codemybrainsout/ahoy-onboarding/7c91feda44cf3e22f3051ec822a84f84627c8ea3/preview/preview.gif -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':onboarder' 2 | --------------------------------------------------------------------------------