├── .gitignore ├── .idea └── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── plus │ │ └── adaptive │ │ └── example │ │ └── ExampleInstrumentedTest.kt │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── plus │ │ │ └── adaptive │ │ │ └── example │ │ │ ├── MyApp.kt │ │ │ └── SplashActivity.kt │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ └── ic_launcher_background.xml │ │ ├── layout │ │ └── activity_splash.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── values-night │ │ └── themes.xml │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── themes.xml │ └── test │ └── java │ └── plus │ └── adaptive │ └── example │ └── ExampleUnitTest.kt ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.toptal.com/developers/gitignore/api/android,androidstudio 2 | # Edit at https://www.toptal.com/developers/gitignore?templates=android,androidstudio 3 | 4 | ### Android ### 5 | # Built application files 6 | *.apk 7 | *.aar 8 | *.ap_ 9 | *.aab 10 | 11 | # Files for the ART/Dalvik VM 12 | *.dex 13 | 14 | # Java class files 15 | *.class 16 | 17 | # Generated files 18 | bin/ 19 | gen/ 20 | out/ 21 | # Uncomment the following line in case you need and you don't have the release build type files in your app 22 | # release/ 23 | 24 | # Gradle files 25 | .gradle/ 26 | build/ 27 | 28 | # Local configuration file (sdk path, etc) 29 | local.properties 30 | 31 | # Proguard folder generated by Eclipse 32 | proguard/ 33 | 34 | # Log Files 35 | *.log 36 | 37 | # Android Studio Navigation editor temp files 38 | .navigation/ 39 | 40 | # Android Studio captures folder 41 | captures/ 42 | 43 | # IntelliJ 44 | *.iml 45 | .idea/workspace.xml 46 | .idea/tasks.xml 47 | .idea/gradle.xml 48 | .idea/assetWizardSettings.xml 49 | .idea/dictionaries 50 | .idea/libraries 51 | # Android Studio 3 in .gitignore file. 52 | .idea/caches 53 | .idea/modules.xml 54 | # Comment next line if keeping position of elements in Navigation Editor is relevant for you 55 | .idea/navEditor.xml 56 | 57 | # Keystore files 58 | # Uncomment the following lines if you do not want to check your keystore files in. 59 | #*.jks 60 | #*.keystore 61 | 62 | # External native build folder generated in Android Studio 2.2 and later 63 | .externalNativeBuild 64 | .cxx/ 65 | 66 | # Google Services (e.g. APIs or Firebase) 67 | # google-services.json 68 | 69 | # Freeline 70 | freeline.py 71 | freeline/ 72 | freeline_project_description.json 73 | 74 | # fastlane 75 | fastlane/report.xml 76 | fastlane/Preview.html 77 | fastlane/screenshots 78 | fastlane/test_output 79 | fastlane/readme.md 80 | 81 | # Version control 82 | vcs.xml 83 | 84 | # lint 85 | lint/intermediates/ 86 | lint/generated/ 87 | lint/outputs/ 88 | lint/tmp/ 89 | # lint/reports/ 90 | 91 | ### Android Patch ### 92 | gen-external-apklibs 93 | output.json 94 | 95 | # Replacement of .externalNativeBuild directories introduced 96 | # with Android Studio 3.5. 97 | 98 | ### AndroidStudio ### 99 | # Covers files to be ignored for android development using Android Studio. 100 | 101 | # Built application files 102 | 103 | # Files for the ART/Dalvik VM 104 | 105 | # Java class files 106 | 107 | # Generated files 108 | 109 | # Gradle files 110 | .gradle 111 | 112 | # Signing files 113 | .signing/ 114 | 115 | # Local configuration file (sdk path, etc) 116 | 117 | # Proguard folder generated by Eclipse 118 | 119 | # Log Files 120 | 121 | # Android Studio 122 | /*/build/ 123 | /*/local.properties 124 | /*/out 125 | /*/*/build 126 | /*/*/production 127 | *.ipr 128 | *~ 129 | *.swp 130 | 131 | # Keystore files 132 | *.jks 133 | *.keystore 134 | 135 | # Google Services (e.g. APIs or Firebase) 136 | # google-services.json 137 | 138 | # Android Patch 139 | 140 | # External native build folder generated in Android Studio 2.2 and later 141 | 142 | # NDK 143 | obj/ 144 | 145 | # IntelliJ IDEA 146 | *.iws 147 | /out/ 148 | 149 | # User-specific configurations 150 | .idea/caches/ 151 | .idea/libraries/ 152 | .idea/shelf/ 153 | .idea/.name 154 | .idea/compiler.xml 155 | .idea/copyright/profiles_settings.xml 156 | .idea/encodings.xml 157 | .idea/misc.xml 158 | .idea/scopes/scope_settings.xml 159 | .idea/vcs.xml 160 | .idea/jsLibraryMappings.xml 161 | .idea/datasources.xml 162 | .idea/dataSources.ids 163 | .idea/sqlDataSources.xml 164 | .idea/dynamic.xml 165 | .idea/uiDesigner.xml 166 | .idea/jarRepositories.xml 167 | .idea/runConfigurations.xml 168 | 169 | # OS-specific files 170 | .DS_Store 171 | .DS_Store? 172 | ._* 173 | .Spotlight-V100 174 | .Trashes 175 | ehthumbs.db 176 | Thumbs.db 177 | 178 | # Legacy Eclipse project files 179 | .classpath 180 | .project 181 | .cproject 182 | .settings/ 183 | 184 | # Mobile Tools for Java (J2ME) 185 | .mtj.tmp/ 186 | 187 | # Package Files # 188 | *.war 189 | *.ear 190 | 191 | # virtual machine crash logs (Reference: http://www.java.com/en/download/help/error_hotspot.xml) 192 | hs_err_pid* 193 | 194 | ## Plugin-specific files: 195 | 196 | # mpeltonen/sbt-idea plugin 197 | .idea_modules/ 198 | 199 | # JIRA plugin 200 | atlassian-ide-plugin.xml 201 | 202 | # Mongo Explorer plugin 203 | .idea/mongoSettings.xml 204 | 205 | # Crashlytics plugin (for Android Studio and IntelliJ) 206 | com_crashlytics_export_strings.xml 207 | crashlytics.properties 208 | crashlytics-build.properties 209 | fabric.properties 210 | 211 | ### AndroidStudio Patch ### 212 | 213 | !/gradle/wrapper/gradle-wrapper.jar 214 | 215 | # End of https://www.toptal.com/developers/gitignore/api/android,androidstudio -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## Version 2.1.1 4 | * Shows SDK generated Splash Screen with countdown timer: able to display Images & GIFs & Texts, execute simplest set of actions on click 5 | * Action list contains:\ 6 | (1) *Web URL Opening in WebView dialog window*,\ 7 | (2) *DeepLink call to Android Operating System*,\ 8 | (3) *Send SMS & Call Phone*,\ 9 | (4) *Custom Action (you should implement it, nothing will happen otherwise)* -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | ---------------------------------------------------------------- 2 | 3 | This product includes 'Material Components for Android' (https://github.com/material-components/material-components-android), which is released under the following license(s): 4 | Apache License, Version 2.0 5 | 6 | ---------------------------------------------------------------- 7 | 8 | This product includes 'Gson' (https://github.com/google/gson), which is released under the following license(s): 9 | Apache License, Version 2.0 10 | 11 | ---------------------------------------------------------------- 12 | 13 | This product includes 'OkHttp' (https://github.com/square/okhttp), which is released under the following license(s): 14 | Apache License, Version 2.0 15 | 16 | ---------------------------------------------------------------- 17 | 18 | This product includes 'Glide' (https://github.com/bumptech/glide), which is released under the following license(s): 19 | Apache License, Version 2.0 20 | 21 | ---------------------------------------------------------------- 22 | 23 | All other components of this product are provided under the following license: 24 | 25 | Apache License 26 | Version 2.0, January 2004 27 | http://www.apache.org/licenses/ 28 | 29 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 30 | 31 | 1. Definitions. 32 | 33 | "License" shall mean the terms and conditions for use, reproduction, 34 | and distribution as defined by Sections 1 through 9 of this document. 35 | 36 | "Licensor" shall mean the copyright owner or entity authorized by 37 | the copyright owner that is granting the License. 38 | 39 | "Legal Entity" shall mean the union of the acting entity and all 40 | other entities that control, are controlled by, or are under common 41 | control with that entity. For the purposes of this definition, 42 | "control" means (i) the power, direct or indirect, to cause the 43 | direction or management of such entity, whether by contract or 44 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 45 | outstanding shares, or (iii) beneficial ownership of such entity. 46 | 47 | "You" (or "Your") shall mean an individual or Legal Entity 48 | exercising permissions granted by this License. 49 | 50 | "Source" form shall mean the preferred form for making modifications, 51 | including but not limited to software source code, documentation 52 | source, and configuration files. 53 | 54 | "Object" form shall mean any form resulting from mechanical 55 | transformation or translation of a Source form, including but 56 | not limited to compiled object code, generated documentation, 57 | and conversions to other media types. 58 | 59 | "Work" shall mean the work of authorship, whether in Source or 60 | Object form, made available under the License, as indicated by a 61 | copyright notice that is included in or attached to the work 62 | (an example is provided in the Appendix below). 63 | 64 | "Derivative Works" shall mean any work, whether in Source or Object 65 | form, that is based on (or derived from) the Work and for which the 66 | editorial revisions, annotations, elaborations, or other modifications 67 | represent, as a whole, an original work of authorship. For the purposes 68 | of this License, Derivative Works shall not include works that remain 69 | separable from, or merely link (or bind by name) to the interfaces of, 70 | the Work and Derivative Works thereof. 71 | 72 | "Contribution" shall mean any work of authorship, including 73 | the original version of the Work and any modifications or additions 74 | to that Work or Derivative Works thereof, that is intentionally 75 | submitted to Licensor for inclusion in the Work by the copyright owner 76 | or by an individual or Legal Entity authorized to submit on behalf of 77 | the copyright owner. For the purposes of this definition, "submitted" 78 | means any form of electronic, verbal, or written communication sent 79 | to the Licensor or its representatives, including but not limited to 80 | communication on electronic mailing lists, source code control systems, 81 | and issue tracking systems that are managed by, or on behalf of, the 82 | Licensor for the purpose of discussing and improving the Work, but 83 | excluding communication that is conspicuously marked or otherwise 84 | designated in writing by the copyright owner as "Not a Contribution." 85 | 86 | "Contributor" shall mean Licensor and any individual or Legal Entity 87 | on behalf of whom a Contribution has been received by Licensor and 88 | subsequently incorporated within the Work. 89 | 90 | 2. Grant of Copyright License. Subject to the terms and conditions of 91 | this License, each Contributor hereby grants to You a perpetual, 92 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 93 | copyright license to reproduce, prepare Derivative Works of, 94 | publicly display, publicly perform, sublicense, and distribute the 95 | Work and such Derivative Works in Source or Object form. 96 | 97 | 3. Grant of Patent License. Subject to the terms and conditions of 98 | this License, each Contributor hereby grants to You a perpetual, 99 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 100 | (except as stated in this section) patent license to make, have made, 101 | use, offer to sell, sell, import, and otherwise transfer the Work, 102 | where such license applies only to those patent claims licensable 103 | by such Contributor that are necessarily infringed by their 104 | Contribution(s) alone or by combination of their Contribution(s) 105 | with the Work to which such Contribution(s) was submitted. If You 106 | institute patent litigation against any entity (including a 107 | cross-claim or counterclaim in a lawsuit) alleging that the Work 108 | or a Contribution incorporated within the Work constitutes direct 109 | or contributory patent infringement, then any patent licenses 110 | granted to You under this License for that Work shall terminate 111 | as of the date such litigation is filed. 112 | 113 | 4. Redistribution. You may reproduce and distribute copies of the 114 | Work or Derivative Works thereof in any medium, with or without 115 | modifications, and in Source or Object form, provided that You 116 | meet the following conditions: 117 | 118 | (a) You must give any other recipients of the Work or 119 | Derivative Works a copy of this License; and 120 | 121 | (b) You must cause any modified files to carry prominent notices 122 | stating that You changed the files; and 123 | 124 | (c) You must retain, in the Source form of any Derivative Works 125 | that You distribute, all copyright, patent, trademark, and 126 | attribution notices from the Source form of the Work, 127 | excluding those notices that do not pertain to any part of 128 | the Derivative Works; and 129 | 130 | (d) If the Work includes a "NOTICE" text file as part of its 131 | distribution, then any Derivative Works that You distribute must 132 | include a readable copy of the attribution notices contained 133 | within such NOTICE file, excluding those notices that do not 134 | pertain to any part of the Derivative Works, in at least one 135 | of the following places: within a NOTICE text file distributed 136 | as part of the Derivative Works; within the Source form or 137 | documentation, if provided along with the Derivative Works; or, 138 | within a display generated by the Derivative Works, if and 139 | wherever such third-party notices normally appear. The contents 140 | of the NOTICE file are for informational purposes only and 141 | do not modify the License. You may add Your own attribution 142 | notices within Derivative Works that You distribute, alongside 143 | or as an addendum to the NOTICE text from the Work, provided 144 | that such additional attribution notices cannot be construed 145 | as modifying the License. 146 | 147 | You may add Your own copyright statement to Your modifications and 148 | may provide additional or different license terms and conditions 149 | for use, reproduction, or distribution of Your modifications, or 150 | for any such Derivative Works as a whole, provided Your use, 151 | reproduction, and distribution of the Work otherwise complies with 152 | the conditions stated in this License. 153 | 154 | 5. Submission of Contributions. Unless You explicitly state otherwise, 155 | any Contribution intentionally submitted for inclusion in the Work 156 | by You to the Licensor shall be under the terms and conditions of 157 | this License, without any additional terms or conditions. 158 | Notwithstanding the above, nothing herein shall supersede or modify 159 | the terms of any separate license agreement you may have executed 160 | with Licensor regarding such Contributions. 161 | 162 | 6. Trademarks. This License does not grant permission to use the trade 163 | names, trademarks, service marks, or product names of the Licensor, 164 | except as required for reasonable and customary use in describing the 165 | origin of the Work and reproducing the content of the NOTICE file. 166 | 167 | 7. Disclaimer of Warranty. Unless required by applicable law or 168 | agreed to in writing, Licensor provides the Work (and each 169 | Contributor provides its Contributions) on an "AS IS" BASIS, 170 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 171 | implied, including, without limitation, any warranties or conditions 172 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 173 | PARTICULAR PURPOSE. You are solely responsible for determining the 174 | appropriateness of using or redistributing the Work and assume any 175 | risks associated with Your exercise of permissions under this License. 176 | 177 | 8. Limitation of Liability. In no event and under no legal theory, 178 | whether in tort (including negligence), contract, or otherwise, 179 | unless required by applicable law (such as deliberate and grossly 180 | negligent acts) or agreed to in writing, shall any Contributor be 181 | liable to You for damages, including any direct, indirect, special, 182 | incidental, or consequential damages of any character arising as a 183 | result of this License or out of the use or inability to use the 184 | Work (including but not limited to damages for loss of goodwill, 185 | work stoppage, computer failure or malfunction, or any and all 186 | other commercial damages or losses), even if such Contributor 187 | has been advised of the possibility of such damages. 188 | 189 | 9. Accepting Warranty or Additional Liability. While redistributing 190 | the Work or Derivative Works thereof, You may choose to offer, 191 | and charge a fee for, acceptance of support, warranty, indemnity, 192 | or other liability obligations and/or rights consistent with this 193 | License. However, in accepting such obligations, You may act only 194 | on Your own behalf and on Your sole responsibility, not on behalf 195 | of any other Contributor, and only if You agree to indemnify, 196 | defend, and hold each Contributor harmless for any liability 197 | incurred by, or claims asserted against, such Contributor by reason 198 | of your accepting any such warranty or additional liability. 199 | 200 | END OF TERMS AND CONDITIONS 201 | 202 | APPENDIX: How to apply the Apache License to your work. 203 | 204 | To apply the Apache License to your work, attach the following 205 | boilerplate notice, with the fields enclosed by brackets "[]" 206 | replaced with your own identifying information. (Don't include 207 | the brackets!) The text should be enclosed in the appropriate 208 | comment syntax for the file format. We also recommend that a 209 | file or class name and description of purpose be included on the 210 | same "printed page" as the copyright notice for easier 211 | identification within third-party archives. 212 | 213 | Copyright 2021 Adaptive Plus, Inc. 214 | 215 | Licensed under the Apache License, Version 2.0 (the "License"); 216 | you may not use this file except in compliance with the License. 217 | You may obtain a copy of the License at 218 | 219 | http://www.apache.org/licenses/LICENSE-2.0 220 | 221 | Unless required by applicable law or agreed to in writing, software 222 | distributed under the License is distributed on an "AS IS" BASIS, 223 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 224 | See the License for the specific language governing permissions and 225 | limitations under the License. 226 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | AdaptivePlus 2 | 3 | # [AdaptivePlus Android SDK](https://adaptive.plus/) 4 | 5 | [**AdaptivePlus**](https://adaptive.plus/) is the control center for marketing campaigns in mobile applications 6 | 7 | ## Requirements 8 | - minSdkVersion 16 9 | 10 | *Examples provided in Kotlin programming language* 11 | 12 | ## Installation 13 | Add the following dependency to your app's `build.gradle` file: 14 | 15 | ```groovy 16 | dependencies { 17 | implementation 'plus.adaptive:android-sdk:2.3.9' 18 | } 19 | ``` 20 | 21 | ### Maven central 22 | Add the following to your root build.gradle file 23 | ```groovy 24 | allprojects { 25 | repositories { 26 | mavenCentral() 27 | } 28 | } 29 | ``` 30 | 31 | *Do not forget to sync project with gradle files afterwards* 32 | 33 | ## Adding AdaptivePlus API base url 34 | 35 | Put API base url into your app manifest file inside `` tag 36 | 37 | ```xml 38 | 39 | 40 | 44 | 45 | 46 | ``` 47 | 48 | !!! BE CAREFUL !!! It is possible that your company hosts several development environments, thus the API base url depends on the environment 49 | 50 | ## Initialization 51 | Register an account in the admin panel of [AdaptivePlus](https://adaptive.plus/) 52 | 53 | Initialize AdaptivePlusSDK on app startup and pass the **API key** that you received upon account registration 54 | 55 | ```kotlin 56 | // App StartUp 57 | class YourApp: Application() { 58 | override fun onCreate() { 59 | super.onCreate() 60 | 61 | AdaptivePlusSDK 62 | .init(apiKey = "your api key") 63 | } 64 | } 65 | ``` 66 | ### Initialization Exception 67 | SDK throws `APInitializationException` on `newInstance` method call if **adaptivePlusApiKey** is not provided beforehand via `init` method 68 | 69 | ## AdaptivePlusView (Banner & Story) 70 | You can visit the admin panel and create some content. Do not forget to change the status of the content to **active**. Then create **AdaptivePlusView** instance or add it in xml and specify APViewId(e. g. `APV-00000000`). 71 | ```kotlin 72 | class MainActivity: Activity() { 73 | override fun onCreate(savedInstanceState: Bundle?) { 74 | super.onCreate(savedInstanceState) 75 | setContentView(R.layout.activity_main) 76 | 77 | val adaptiveView = AdaptivePlusView(ctx).apply 78 | adaptiveView.setAdaptivePlusViewId("APV-00000000") 79 | } 80 | } 81 | ``` 82 | 83 | XML 84 | ```xml 85 | 91 | ``` 92 | 93 | ## AdaptivePlusViewless (Instruction & PopUp) 94 | 95 | You can visit the admin panel and create some content. Do not forget to change the status of the content to **active**. When you call `preload` and `show` methods you need add created APViewId(e. g. `APV-00000000`) as argument. `preload` method preloads the Instruction(or PopUp) contents to your device, and `show` displaying it. 96 | 97 | ```kotlin 98 | class MainActivity: Activity() { 99 | override fun onCreate(savedInstanceState: Bundle?) { 100 | super.onCreate(savedInstanceState) 101 | setContentView(R.layout.activity_main) 102 | 103 | AdaptivePlusViewless(this).apply { 104 | preload("APV-00000000") 105 | show("APV-00000000") 106 | } 107 | } 108 | } 109 | ``` 110 | 111 | Show AdaptivePlus Viewless at any suitable moment but note that 112 | `preload` must call before calling `show` method. 113 | 114 | Also you can add **OnStoriesFinishedCallback** 115 | ```kotlin 116 | class MainActivity: Activity() { 117 | override fun onCreate(savedInstanceState: Bundle?) { 118 | super.onCreate(savedInstanceState) 119 | setContentView(R.layout.activity_main) 120 | 121 | val adaptiveInstruction = AdaptivePlusInstruction(this) 122 | adaptiveInstruction.preload("APV-00000000") 123 | adaptiveInstruction.setOnDismissedListener { 124 | // TODO: dosomething when instructions finished 125 | } 126 | } 127 | } 128 | ``` 129 | 130 | If you are not able to observe the created content - probable reasons are: 131 | - You forgot to activate the content in the AdaptivePlus admin panel 132 | - Check again the integration guide, maybe you missed something out 133 | - The SDK couldn't preload the contents on the previous ` preload` method calls due to network issues or internal sdk issues 134 | 135 | ### Custom Action Listener 136 | ```kotlin 137 | interface APCustomActionListener { 138 | fun onRun(action: APCustomAction) 139 | } 140 | ``` 141 | ```kotlin 142 | data class APCustomAction( 143 | val name: String?, 144 | val parameters: HashMap? 145 | ) : Serializable 146 | ``` 147 | For listening of the events - you should provide your implementation of `APCustomActionListener`: 148 | ```kotlin 149 | AdaptivePlusView(this).apply( 150 | setAdaptivePlusViewId("APV-00000000") 151 | setAPCustomActionListener( 152 | object: APCustomActionListener { 153 | override fun onRun(action: APCustomAction) { 154 | // TODO: your implementation of Adaptive Plus Custom Actions 155 | } 156 | } 157 | ) 158 | ) 159 | ``` 160 | OR 161 | ```kotlin 162 | AdaptivePlusInstruction(this).apply( 163 | setAPCustomActionListener( 164 | object: APCustomActionListener { 165 | override fun onRun(action: APCustomAction) { 166 | // TODO: your implementation of Adaptive Plus Custom Actions 167 | } 168 | } 169 | ) 170 | ) 171 | ``` 172 | ### Personalized Experience 173 | In order to make SDK experience more personalized, you can provide following user data: 174 | ```kotlin 175 | AdaptivePlusSDK 176 | .newInstance(context) 177 | .setUserId(userId) 178 | .setUserProperties(userProperties) 179 | .setLocation(userLocation) 180 | ``` 181 | `userId: String` - id assigned to the user by your own system/service, useful for identifying the same user across multiple devices\ 182 | `userProperties: Map` - user properties, e.g. - age, gender, etc. User properties help SDK to select and show content relevant to the user. Ex: 183 | ```kotlin 184 | val userProperties = mapOf("age" to "25", "gender" to "male") 185 | ``` 186 | `userLocation: APLocation` - user location (latitude & longitude). Required if you want to display geo-oriented content to the user 187 | ```kotlin 188 | data class APLocation( 189 | val latitude: Double, 190 | val longitude: Double 191 | ) : Serializable 192 | ``` 193 | 194 | ## AdaptivePlus Debug Mode 195 | To observe network logs of the SDK - pass `true` to `setIsDebuggable` method: 196 | ```kotlin 197 | AdaptivePlusSDK 198 | .setIsDebuggable(true) 199 | ``` 200 | OR 201 | ```kotlin 202 | AdaptivePlusSDK 203 | .newInstance(context) 204 | .setIsDebuggable(true) 205 | ``` 206 | Do not forget to switch *Debug Mode* off for the release build of your app. 207 | 208 | ## Permissions 209 | We include the [INTERNET](http://developer.android.com/reference/android/Manifest.permission.html#INTERNET) permission by default as we need it to make network requests: 210 | ```xml 211 | 212 | ``` 213 | will be added to the manifest file during the app build process 214 | 215 | ## Dependency graph 216 | 217 | Here is our complete dependency graph: 218 | ``` 219 | # Transitive (shared with your app) 220 | org.jetbrains.kotlin:kotlin-stdlib:1.4.31 221 | 222 | androidx.core:core-ktx:1.3.2 223 | androidx.appcompat:appcompat:1.2.0 224 | androidx.lifecycle:lifecycle-extensions:2.2.0 225 | androidx.recyclerview:recyclerview:1.2.0 226 | androidx.constraintlayout:constraintlayout:2.1.0-beta01 227 | androidx.cardview:cardview:1.0.0 228 | 229 | com.google.android.material:material:1.3.0 230 | com.google.code.gson:gson:2.8.6 231 | 232 | com.squareup.okhttp3:okhttp:4.9.1 233 | com.squareup.okhttp3:logging-interceptor:4.9.1 234 | 235 | com.github.bumptech.glide:glide:4.12.0 236 | com.github.bumptech.glide:okhttp3-integration:4.12.0 237 | com.github.bumptech.glide:compiler:4.12.0 238 | ``` 239 | 240 | ### Transitive Dependencies 241 | AdaptivePlus Android SDK transitively depends on the above libraries. If your app is using any one of these libraries, they should at least be on the same major version that AdaptivePlus SDK is using. 242 | When there are two versions of a library at build time, Gradle automatically picks the newer version. 243 | This means if you are currently using say Glide 3.x, your app would automatically get Glide 4.x after including AdaptivePlus. -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.application' 3 | id 'kotlin-android' 4 | } 5 | 6 | android { 7 | compileSdkVersion 30 8 | buildToolsVersion "30.0.3" 9 | 10 | defaultConfig { 11 | applicationId "plus.adaptive.example" 12 | minSdkVersion 16 13 | targetSdkVersion 30 14 | versionCode 1 15 | versionName "1.0" 16 | 17 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 18 | } 19 | 20 | buildTypes { 21 | release { 22 | minifyEnabled false 23 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 24 | } 25 | } 26 | compileOptions { 27 | sourceCompatibility JavaVersion.VERSION_1_8 28 | targetCompatibility JavaVersion.VERSION_1_8 29 | } 30 | kotlinOptions { 31 | jvmTarget = '1.8' 32 | } 33 | } 34 | 35 | dependencies { 36 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" 37 | implementation 'androidx.core:core-ktx:1.3.2' 38 | implementation 'androidx.appcompat:appcompat:1.2.0' 39 | implementation 'com.google.android.material:material:1.3.0' 40 | implementation 'androidx.constraintlayout:constraintlayout:2.0.4' 41 | 42 | implementation 'plus.adaptive:android-sdk:2.1.2' 43 | 44 | testImplementation 'junit:junit:4.13.2' 45 | androidTestImplementation 'androidx.test.ext:junit:1.1.2' 46 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' 47 | } -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /app/src/androidTest/java/plus/adaptive/example/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package plus.adaptive.example 2 | 3 | import androidx.test.platform.app.InstrumentationRegistry 4 | import androidx.test.ext.junit.runners.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 22 | assertEquals("plus.adaptive.example", appContext.packageName) 23 | } 24 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/java/plus/adaptive/example/MyApp.kt: -------------------------------------------------------------------------------- 1 | package plus.adaptive.example 2 | 3 | import android.app.Application 4 | import plus.adaptive.sdk.AdaptivePlusSDK 5 | 6 | 7 | class MyApp : Application() { 8 | 9 | override fun onCreate() { 10 | super.onCreate() 11 | 12 | AdaptivePlusSDK.init( 13 | apiKey = "your api key") 14 | } 15 | } -------------------------------------------------------------------------------- /app/src/main/java/plus/adaptive/example/SplashActivity.kt: -------------------------------------------------------------------------------- 1 | package plus.adaptive.example 2 | 3 | import androidx.appcompat.app.AppCompatActivity 4 | import android.os.Bundle 5 | import plus.adaptive.sdk.AdaptivePlusSDK 6 | import plus.adaptive.sdk.data.listeners.APSplashScreenListener 7 | import plus.adaptive.sdk.data.models.APLocation 8 | 9 | 10 | class SplashActivity : AppCompatActivity() { 11 | 12 | override fun onCreate(savedInstanceState: Bundle?) { 13 | super.onCreate(savedInstanceState) 14 | setContentView(R.layout.activity_splash) 15 | 16 | // Default Use Case 17 | AdaptivePlusSDK 18 | .newInstance(this) 19 | .showSplashScreen() 20 | 21 | // User-Centric Use Case 22 | AdaptivePlusSDK 23 | .newInstance(this) 24 | .setUserId("app_user_id") 25 | .setUserProperties( 26 | mapOf("age" to "25", "gender" to "male") 27 | ) 28 | .setLocation( 29 | APLocation( 30 | latitude = 37.7749, 31 | longitude = 122.4194 32 | ) 33 | ) 34 | .showSplashScreen() 35 | 36 | // Drafts Enabled Mode Use Case 37 | AdaptivePlusSDK 38 | .newInstance(this) 39 | .showSplashScreen(hasDrafts = true) 40 | 41 | // Splash Screen Listener Use Case 42 | AdaptivePlusSDK 43 | .newInstance(this) 44 | .setSplashScreenListener( 45 | object: APSplashScreenListener { 46 | override fun onFinish() { 47 | // TODO: actions to do on the splash screen finish 48 | } 49 | 50 | override fun onRunAPCustomAction(params: HashMap) { 51 | // TODO: your implementation of Adaptive Plus Custom Action 52 | } 53 | } 54 | ) 55 | .showSplashScreen() 56 | 57 | // All-in Use Case 58 | AdaptivePlusSDK 59 | .newInstance(this) 60 | .setUserId("app_user_id") 61 | .setUserProperties( 62 | mapOf("age" to "25", "gender" to "male") 63 | ) 64 | .setLocation( 65 | APLocation( 66 | latitude = 37.7749, 67 | longitude = 122.4194 68 | ) 69 | ) 70 | .setSplashScreenListener( 71 | object: APSplashScreenListener { 72 | override fun onFinish() { 73 | // TODO: actions to do on the splash screen finish 74 | } 75 | 76 | override fun onRunAPCustomAction(params: HashMap) { 77 | // TODO: your implementation of Adaptive Plus Custom Actions 78 | } 79 | } 80 | ) 81 | .showSplashScreen(hasDrafts = true) 82 | } 83 | 84 | } -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 15 | 18 | 21 | 22 | 23 | 24 | 30 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_splash.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adaptiveplus/AdaptivePlus-Android/0510692123c8d8df3f4f956124b9d6963b9de95d/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adaptiveplus/AdaptivePlus-Android/0510692123c8d8df3f4f956124b9d6963b9de95d/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adaptiveplus/AdaptivePlus-Android/0510692123c8d8df3f4f956124b9d6963b9de95d/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adaptiveplus/AdaptivePlus-Android/0510692123c8d8df3f4f956124b9d6963b9de95d/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adaptiveplus/AdaptivePlus-Android/0510692123c8d8df3f4f956124b9d6963b9de95d/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adaptiveplus/AdaptivePlus-Android/0510692123c8d8df3f4f956124b9d6963b9de95d/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adaptiveplus/AdaptivePlus-Android/0510692123c8d8df3f4f956124b9d6963b9de95d/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adaptiveplus/AdaptivePlus-Android/0510692123c8d8df3f4f956124b9d6963b9de95d/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adaptiveplus/AdaptivePlus-Android/0510692123c8d8df3f4f956124b9d6963b9de95d/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adaptiveplus/AdaptivePlus-Android/0510692123c8d8df3f4f956124b9d6963b9de95d/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/values-night/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFBB86FC 4 | #FF6200EE 5 | #FF3700B3 6 | #FF03DAC5 7 | #FF018786 8 | #FF000000 9 | #FFFFFFFF 10 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | AdaptivePlusExample 3 | -------------------------------------------------------------------------------- /app/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /app/src/test/java/plus/adaptive/example/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package plus.adaptive.example 2 | 3 | import org.junit.Test 4 | 5 | import org.junit.Assert.* 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * See [testing documentation](http://d.android.com/tools/testing). 11 | */ 12 | class ExampleUnitTest { 13 | @Test 14 | fun addition_isCorrect() { 15 | assertEquals(4, 2 + 2) 16 | } 17 | } -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | buildscript { 3 | ext.kotlin_version = "1.4.31" 4 | repositories { 5 | google() 6 | jcenter() 7 | } 8 | dependencies { 9 | classpath "com.android.tools.build:gradle:4.1.3" 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | 12 | // NOTE: Do not place your application dependencies here; they belong 13 | // in the individual module build.gradle files 14 | } 15 | } 16 | 17 | allprojects { 18 | repositories { 19 | google() 20 | jcenter() 21 | } 22 | } 23 | 24 | task clean(type: Delete) { 25 | delete rootProject.buildDir 26 | } -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app"s APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Automatically convert third-party libraries to use AndroidX 19 | android.enableJetifier=true 20 | # Kotlin code style for this project: "official" or "obsolete": 21 | kotlin.code.style=official -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adaptiveplus/AdaptivePlus-Android/0510692123c8d8df3f4f956124b9d6963b9de95d/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Apr 21 18:30:58 ALMT 2021 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-6.5-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 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | rootProject.name = "AdaptivePlusExample" --------------------------------------------------------------------------------