├── extra ├── navigation.gif ├── onbackpressed.gif └── shared_elements.gif ├── deploy ├── BintrayDeployAutomator.jar └── configuration.json ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── app ├── src │ └── main │ │ ├── res │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_round.png │ │ │ └── ic_launcher_foreground.png │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_round.png │ │ │ └── ic_launcher_foreground.png │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_round.png │ │ │ └── ic_launcher_foreground.png │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_round.png │ │ │ └── ic_launcher_foreground.png │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_round.png │ │ │ └── ic_launcher_foreground.png │ │ ├── values │ │ │ ├── colors.xml │ │ │ ├── dimens.xml │ │ │ ├── styles.xml │ │ │ └── strings.xml │ │ ├── layout │ │ │ ├── activity_fullscreen.xml │ │ │ ├── activity_primary.xml │ │ │ ├── fragment_shared_elements_options.xml │ │ │ ├── adapter_image.xml │ │ │ ├── fragment_splash.xml │ │ │ ├── fragment_onbackpressed.xml │ │ │ ├── fragment_shared_element.xml │ │ │ ├── fragment_home.xml │ │ │ └── fragment_add.xml │ │ ├── mipmap-anydpi-v26 │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ ├── anim │ │ │ ├── pop_enter.xml │ │ │ ├── pop_exit.xml │ │ │ ├── exit_from_left.xml │ │ │ └── enter_from_right.xml │ │ └── drawable │ │ │ └── ic_launcher_background.xml │ │ ├── kotlin │ │ └── com │ │ │ └── massivedisaster │ │ │ └── afm │ │ │ └── sample │ │ │ ├── activity │ │ │ ├── ActivityHome.kt │ │ │ ├── ActivityFullscreen.kt │ │ │ └── ActivityToolbar.kt │ │ │ └── feature │ │ │ ├── splash │ │ │ └── FragmentSplash.kt │ │ │ ├── sharedelements │ │ │ ├── FragmentSharedElement.kt │ │ │ ├── ImageAdapter.kt │ │ │ └── FragmentSharedElementsOptions.kt │ │ │ ├── backpressed │ │ │ └── FragmentOnBackPressed.kt │ │ │ ├── home │ │ │ └── FragmentHome.kt │ │ │ └── navigation │ │ │ └── FragmentAddReplace.kt │ │ └── AndroidManifest.xml ├── proguard-rules.pro ├── .gitignore ├── dependencies.gradle └── build.gradle ├── afm ├── proguard-rules.pro ├── src │ └── main │ │ ├── AndroidManifest.xml │ │ └── kotlin │ │ └── com │ │ └── massivedisaster │ │ └── afm │ │ ├── Builder.kt │ │ ├── activity │ │ ├── DataBindingBaseActivity.kt │ │ └── BaseActivity.kt │ │ ├── fragment │ │ └── OnBackPressedListener.kt │ │ ├── animation │ │ └── TransactionAnimation.kt │ │ ├── FragmentCall.kt │ │ └── ActivityCall.kt ├── dependencies.gradle ├── .gitignore └── build.gradle ├── .travis.yml ├── LICENSE.md ├── settings.gradle ├── .gitignore ├── gradle.properties ├── gradlew.bat ├── gradlew └── README.md /extra/navigation.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/massivedisaster/AFM/HEAD/extra/navigation.gif -------------------------------------------------------------------------------- /extra/onbackpressed.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/massivedisaster/AFM/HEAD/extra/onbackpressed.gif -------------------------------------------------------------------------------- /extra/shared_elements.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/massivedisaster/AFM/HEAD/extra/shared_elements.gif -------------------------------------------------------------------------------- /deploy/BintrayDeployAutomator.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/massivedisaster/AFM/HEAD/deploy/BintrayDeployAutomator.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/massivedisaster/AFM/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/massivedisaster/AFM/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/massivedisaster/AFM/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/massivedisaster/AFM/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/massivedisaster/AFM/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/massivedisaster/AFM/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/massivedisaster/AFM/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/massivedisaster/AFM/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/massivedisaster/AFM/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/massivedisaster/AFM/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/massivedisaster/AFM/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/massivedisaster/AFM/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/massivedisaster/AFM/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/massivedisaster/AFM/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /deploy/configuration.json: -------------------------------------------------------------------------------- 1 | { 2 | "basePath": "../", 3 | "readmePath": "../README.md", 4 | "version": "0.0.1", 5 | "modules": [ 6 | "afm" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/massivedisaster/AFM/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/massivedisaster/AFM/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /afm/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /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 22 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: android 2 | 3 | jdk: 4 | - oraclejdk8 5 | 6 | install: 7 | - echo y | android update sdk -u -a -t tools 8 | - echo y | android update sdk -u -a -t platform-tools 9 | - echo y | android update sdk -u -a -t build-tools-26.0.1 10 | - echo y | android update sdk -u -a -t android-26 11 | - echo y | android update sdk -u -a -t extra-google-m2repository 12 | - echo y | android update sdk -u -a -t extra-android-m2repository 13 | 14 | branches: 15 | only: 16 | - master 17 | - develop 18 | - travis 19 | 20 | script: 21 | - ./gradlew clean build 22 | 23 | sudo: false 24 | 25 | before_cache: 26 | - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock 27 | - rm -fr $HOME/.gradle/caches/*/plugin-resolution/ 28 | cache: 29 | directories: 30 | - $HOME/.gradle/caches/ 31 | - $HOME/.gradle/wrapper/ 32 | - $HOME/.android/build-cache 33 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | ===================== 3 | 4 | Copyright © `2017` `copyright massivedisaster` 5 | 6 | Permission is hereby granted, free of charge, to any person 7 | obtaining a copy of this software and associated documentation 8 | files (the “Software”), to deal in the Software without 9 | restriction, including without limitation the rights to use, 10 | copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the 12 | Software is furnished to do so, subject to the following 13 | conditions: 14 | 15 | The above copyright notice and this permission notice shall be 16 | included in all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | OTHER DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * AFM - A library to help android developer working easily with activities and fragments. 3 | * 4 | * Copyright (c) 2017 AFM 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining 7 | * a copy of this software and associated documentation files (the 8 | * "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sublicense, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | include ':app', ':afm' 27 | -------------------------------------------------------------------------------- /afm/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /afm/dependencies.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * AFM - A library to help android developer working easily with activities and fragments. 3 | * 4 | * Copyright (c) 2017 AFM 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining 7 | * a copy of this software and associated documentation files (the 8 | * "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sublicense, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | dependencies { 27 | implementation fileTree(dir: 'libs', include: ['*.jar']) 28 | 29 | implementation "com.android.support:appcompat-v7:$appCompatVersion" 30 | } -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | # 2 | # AFM - A library to help android developer working easily with activities and fragments. 3 | # 4 | # Copyright (c) 2017 AFM 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining 7 | # a copy of this software and associated documentation files (the 8 | # "Software"), to deal in the Software without restriction, including 9 | # without limitation the rights to use, copy, modify, merge, publish, 10 | # distribute, sublicense, and/or sell copies of the Software, and to 11 | # permit persons to whom the Software is furnished to do so, subject to 12 | # the following conditions: 13 | # 14 | # The above copyright notice and this permission notice shall be 15 | # included in all copies or substantial portions of the Software. 16 | # 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | # 25 | 26 | #Sun Oct 01 21:36:29 WEST 2017 27 | distributionBase=GRADLE_USER_HOME 28 | distributionPath=wrapper/dists 29 | zipStoreBase=GRADLE_USER_HOME 30 | zipStorePath=wrapper/dists 31 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip 32 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 26 | 27 | 28 | #26a69a 29 | #00796b 30 | #4db6ac 31 | 32 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_fullscreen.xml: -------------------------------------------------------------------------------- 1 | 2 | 26 | 31 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_primary.xml: -------------------------------------------------------------------------------- 1 | 2 | 26 | 27 | 32 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 25 | 26 | 27 | 28 | 16dp 29 | 16dp 30 | 16dp 31 | 32 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_shared_elements_options.xml: -------------------------------------------------------------------------------- 1 | 2 | 26 | 27 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /app/src/main/kotlin/com/massivedisaster/afm/sample/activity/ActivityHome.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * AFM - A library to help android developer working easily with activities and fragments. 3 | * 4 | * Copyright (c) 2017 AFM 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining 7 | * a copy of this software and associated documentation files (the 8 | * "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sublicense, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | package com.massivedisaster.afm.sample.activity 27 | 28 | import android.os.Bundle 29 | 30 | class ActivityHome : ActivityToolbar() { 31 | 32 | override fun onCreate(savedInstanceState: Bundle?) { 33 | super.onCreate(savedInstanceState) 34 | 35 | supportActionBar?.setDisplayHomeAsUpEnabled(false) 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/src/main/res/anim/pop_enter.xml: -------------------------------------------------------------------------------- 1 | 2 | 26 | 27 | 28 | 33 | -------------------------------------------------------------------------------- /app/src/main/res/anim/pop_exit.xml: -------------------------------------------------------------------------------- 1 | 2 | 26 | 27 | 28 | 33 | -------------------------------------------------------------------------------- /afm/src/main/kotlin/com/massivedisaster/afm/Builder.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * AFM - A library to help android developer working easily with activities and fragments. 3 | * 4 | * Copyright (c) 2017 AFM 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining 7 | * a copy of this software and associated documentation files (the 8 | * "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sublicense, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | package com.massivedisaster.afm 27 | 28 | abstract class Builder { 29 | 30 | /** 31 | * Build, call and finish the request 32 | */ 33 | abstract fun build() 34 | 35 | /** 36 | * Validates if the builder is correctly filled 37 | */ 38 | protected abstract fun validate() 39 | 40 | /** 41 | * Reset all values stored on last call 42 | */ 43 | protected abstract fun reset() 44 | 45 | } -------------------------------------------------------------------------------- /afm/.gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.gitignore.io/api/android,java,macos 2 | 3 | ### Android ### 4 | # Built application files 5 | *.apk 6 | *.ap_ 7 | 8 | # Files for the ART/Dalvik VM 9 | *.dex 10 | 11 | # Java class files 12 | *.class 13 | 14 | # Generated files 15 | bin/ 16 | gen/ 17 | out/ 18 | 19 | # Gradle files 20 | .gradle/ 21 | build/ 22 | 23 | # Local configuration file (sdk path, etc) 24 | local.properties 25 | 26 | # Proguard folder generated by Eclipse 27 | proguard/ 28 | 29 | # Log Files 30 | *.log 31 | 32 | # Android Studio Navigation editor temp files 33 | .navigation/ 34 | 35 | # Android Studio captures folder 36 | captures/ 37 | 38 | # Intellij 39 | *.iml 40 | .idea/ 41 | .idea/workspace.xml 42 | .idea/libraries 43 | 44 | # Keystore files 45 | *.jks 46 | 47 | ### Android Patch ### 48 | gen-external-apklibs 49 | 50 | 51 | ### macOS ### 52 | *.DS_Store 53 | .AppleDouble 54 | .LSOverride 55 | 56 | # Icon must end with two \r 57 | Icon 58 | 59 | 60 | # Thumbnails 61 | ._* 62 | 63 | # Files that might appear in the root of a volume 64 | .DocumentRevisions-V100 65 | .fseventsd 66 | .Spotlight-V100 67 | .TemporaryItems 68 | .Trashes 69 | .VolumeIcon.icns 70 | .com.apple.timemachine.donotpresent 71 | 72 | # Directories potentially created on remote AFP share 73 | .AppleDB 74 | .AppleDesktop 75 | Network Trash Folder 76 | Temporary Items 77 | .apdisk 78 | 79 | 80 | ### Java ### 81 | *.class 82 | 83 | # Mobile Tools for Java (J2ME) 84 | .mtj.tmp/ 85 | 86 | # Package Files # 87 | *.jar 88 | *.war 89 | *.ear 90 | 91 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 92 | hs_err_pid* 93 | 94 | # Allow anything in the gradle wrapper folder 95 | !gradle/wrapper/* 96 | !gradle/wrapper/gradle-wrapper.jar 97 | !gradle/wrapper/gradle-wrapper.properties -------------------------------------------------------------------------------- /afm/src/main/kotlin/com/massivedisaster/afm/activity/DataBindingBaseActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * AFM - A library to help android developer working easily with activities and fragments. 3 | * 4 | * Copyright (c) 2017 AFM 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining 7 | * a copy of this software and associated documentation files (the 8 | * "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sublicense, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | package com.massivedisaster.afm.activity 27 | 28 | import android.databinding.DataBindingUtil 29 | import android.databinding.ViewDataBinding 30 | import android.view.View 31 | 32 | abstract class DataBindingBaseActivity : BaseActivity() { 33 | 34 | protected lateinit var dataBinding: T 35 | 36 | override fun initializeDataBinding(view: View) { 37 | dataBinding = DataBindingUtil.bind(view) 38 | } 39 | } -------------------------------------------------------------------------------- /app/src/main/res/anim/exit_from_left.xml: -------------------------------------------------------------------------------- 1 | 2 | 26 | 27 | 29 | 36 | -------------------------------------------------------------------------------- /app/src/main/res/anim/enter_from_right.xml: -------------------------------------------------------------------------------- 1 | 2 | 26 | 27 | 28 | 30 | 37 | -------------------------------------------------------------------------------- /afm/src/main/kotlin/com/massivedisaster/afm/fragment/OnBackPressedListener.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * AFM - A library to help android developer working easily with activities and fragments. 3 | * 4 | * Copyright (c) 2017 AFM 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining 7 | * a copy of this software and associated documentation files (the 8 | * "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sublicense, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | package com.massivedisaster.afm.fragment 27 | 28 | /** 29 | * OnBackPressedListener Interface. 30 | * Implement this interface in fragments to get back pressed events from activity. 31 | */ 32 | interface OnBackPressedListener { 33 | /** 34 | * Used to check if the active fragment wants to consume the back press. 35 | 36 | * @return false if the fragment wants the activity to call super.onBackPressed, otherwise nothing will happen. 37 | */ 38 | fun onBackPressed(): Boolean 39 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/adapter_image.xml: -------------------------------------------------------------------------------- 1 | 2 | 26 | 27 | 31 | 32 | 38 | 39 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_splash.xml: -------------------------------------------------------------------------------- 1 | 2 | 26 | 27 | 31 | 32 | 38 | 39 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.gitignore.io/api/android,java,macos 2 | 3 | ### Android ### 4 | # Built application files 5 | *.apk 6 | *.ap_ 7 | 8 | # Files for the ART/Dalvik VM 9 | *.dex 10 | 11 | # Java class files 12 | *.class 13 | 14 | # Generated files 15 | bin/ 16 | gen/ 17 | out/ 18 | 19 | # Gradle files 20 | .gradle/ 21 | build/ 22 | 23 | # Local configuration file (sdk path, etc) 24 | local.properties 25 | 26 | # Proguard folder generated by Eclipse 27 | proguard/ 28 | 29 | # Log Files 30 | *.log 31 | 32 | # Android Studio Navigation editor temp files 33 | .navigation/ 34 | 35 | # Android Studio captures folder 36 | captures/ 37 | 38 | # Intellij 39 | *.iml 40 | .idea/ 41 | .idea/workspace.xml 42 | .idea/libraries 43 | 44 | # Keystore files 45 | *.jks 46 | 47 | ### Android Patch ### 48 | gen-external-apklibs 49 | 50 | 51 | ### macOS ### 52 | *.DS_Store 53 | .AppleDouble 54 | .LSOverride 55 | 56 | # Icon must end with two \r 57 | Icon 58 | 59 | 60 | # Thumbnails 61 | ._* 62 | 63 | # Files that might appear in the root of a volume 64 | .DocumentRevisions-V100 65 | .fseventsd 66 | .Spotlight-V100 67 | .TemporaryItems 68 | .Trashes 69 | .VolumeIcon.icns 70 | .com.apple.timemachine.donotpresent 71 | 72 | # Directories potentially created on remote AFP share 73 | .AppleDB 74 | .AppleDesktop 75 | Network Trash Folder 76 | Temporary Items 77 | .apdisk 78 | 79 | 80 | ### Java ### 81 | *.class 82 | 83 | # Mobile Tools for Java (J2ME) 84 | .mtj.tmp/ 85 | 86 | # Package Files # 87 | *.jar 88 | *.war 89 | *.ear 90 | 91 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 92 | hs_err_pid* 93 | 94 | # Allow anything in the gradle wrapper folder 95 | !gradle/wrapper/* 96 | !gradle/wrapper/gradle-wrapper.jar 97 | !gradle/wrapper/gradle-wrapper.properties 98 | 99 | # Allow Deploy 100 | !deploy/BintrayDeployAutomator.jar 101 | -------------------------------------------------------------------------------- /app/src/main/kotlin/com/massivedisaster/afm/sample/activity/ActivityFullscreen.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * AFM - A library to help android developer working easily with activities and fragments. 3 | * 4 | * Copyright (c) 2017 AFM 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining 7 | * a copy of this software and associated documentation files (the 8 | * "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sublicense, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | package com.massivedisaster.afm.sample.activity 27 | 28 | import android.support.v4.app.Fragment 29 | import com.massivedisaster.afm.activity.BaseActivity 30 | import com.massivedisaster.afm.sample.R 31 | import com.massivedisaster.afm.sample.feature.splash.FragmentSplash 32 | 33 | class ActivityFullscreen : BaseActivity() { 34 | 35 | override fun layoutToInflate(): Int { 36 | return R.layout.activity_fullscreen 37 | } 38 | 39 | override fun getContainerViewId(): Int { 40 | return R.id.frmContainer 41 | } 42 | 43 | override fun getDefaultFragment(): Class? { 44 | return FragmentSplash::class.java 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_onbackpressed.xml: -------------------------------------------------------------------------------- 1 | 2 | 26 | 27 | 31 | 32 | 37 | 38 | 43 | 44 | -------------------------------------------------------------------------------- /afm/src/main/kotlin/com/massivedisaster/afm/animation/TransactionAnimation.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * AFM - A library to help android developer working easily with activities and fragments. 3 | * 4 | * Copyright (c) 2017 AFM 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining 7 | * a copy of this software and associated documentation files (the 8 | * "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sublicense, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | package com.massivedisaster.afm.animation 27 | 28 | import android.support.annotation.AnimRes 29 | 30 | interface TransactionAnimation { 31 | 32 | /** 33 | * Gets the entering animation. 34 | 35 | * @return the animation. 36 | */ 37 | @get:AnimRes 38 | val animationEnter: Int 39 | 40 | /** 41 | * Gets the exiting animation. 42 | 43 | * @return the animation. 44 | */ 45 | @get:AnimRes 46 | val animationExit: Int 47 | 48 | /** 49 | * Gets the pop entering animation. 50 | 51 | * @return the animation. 52 | */ 53 | @get:AnimRes 54 | val animationPopEnter: Int 55 | 56 | /** 57 | * Gets the pop exiting animation. 58 | 59 | * @return the animation. 60 | */ 61 | @get:AnimRes 62 | val animationPopExit: Int 63 | } -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # AFM - A library to help android developer working easily with activities and fragments. 3 | # 4 | # Copyright (c) 2017 AFM 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining 7 | # a copy of this software and associated documentation files (the 8 | # "Software"), to deal in the Software without restriction, including 9 | # without limitation the rights to use, copy, modify, merge, publish, 10 | # distribute, sublicense, and/or sell copies of the Software, and to 11 | # permit persons to whom the Software is furnished to do so, subject to 12 | # the following conditions: 13 | # 14 | # The above copyright notice and this permission notice shall be 15 | # included in all copies or substantial portions of the Software. 16 | # 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | # 25 | 26 | # Project-wide Gradle settings. 27 | 28 | # IDE (e.g. Android Studio) users: 29 | # Gradle settings configured through the IDE *will override* 30 | # any settings specified in this file. 31 | 32 | # For more details on how to configure your build environment visit 33 | # http://www.gradle.org/docs/current/userguide/build_environment.html 34 | 35 | # Specifies the JVM arguments used for the daemon process. 36 | # The setting is particularly useful for tweaking memory settings. 37 | org.gradle.jvmargs=-Xmx1536m 38 | 39 | # When configured, Gradle will run in incubating parallel mode. 40 | # This option should only be used with decoupled projects. More details, visit 41 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 42 | # org.gradle.parallel=true 43 | 44 | # Dependency versions 45 | appCompatVersion = 26.1.0 46 | dataBindingVersion = 3.0.0-beta5 47 | 48 | libraryVersionName=0.0.1 49 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | # Android 2 | # Built application files 3 | 4 | # Files for the Dalvik VM 5 | *.dex 6 | 7 | # Java class files 8 | *.class 9 | 10 | # Generated files 11 | bin/ 12 | gen/ 13 | 14 | # Gradle files 15 | .gradle/ 16 | build/ 17 | 18 | # Local configuration file (sdk path, etc) 19 | local.properties 20 | 21 | # Proguard folder generated by Eclipse 22 | proguard/ 23 | 24 | # Log Files 25 | *.log 26 | 27 | # Android Studio Navigation editor temp files 28 | .navigation/ 29 | 30 | ### Android Patch ### 31 | gen-external-apklibs 32 | 33 | # Mobile Tools for Java (J2ME) 34 | .mtj.tmp/ 35 | 36 | # Package Files # 37 | *.war 38 | *.ear 39 | 40 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 41 | hs_err_pid* 42 | 43 | 44 | ### Intellij ### 45 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio 46 | 47 | *.iml 48 | 49 | 50 | ## Directory-based project format: 51 | .idea/* 52 | 53 | # Track copyright configuration 54 | !.idea/copyright 55 | .idea/copyright/* 56 | !.idea/copyright/ADAL_GNU_LESSER_GENERAL_PUBLIC_LICENSE.xml 57 | !.idea/copyright/profiles_settings.xml 58 | 59 | # if you remove the above rule, at least ignore the following: 60 | 61 | # User-specific stuff: 62 | # .idea/workspace.xml 63 | # .idea/tasks.xml 64 | # .idea/dictionaries 65 | 66 | # Sensitive or high-churn files: 67 | # .idea/dataSources.ids 68 | # .idea/dataSources.xml 69 | # .idea/sqlDataSources.xml 70 | # .idea/dynamic.xml 71 | # .idea/uiDesigner.xml 72 | 73 | # Gradle: 74 | # .idea/gradle.xml 75 | # .idea/libraries 76 | 77 | # Mongo Explorer plugin: 78 | # .idea/mongoSettings.xml 79 | 80 | ## File-based project format: 81 | *.ipr 82 | *.iws 83 | 84 | ## Plugin-specific files: 85 | 86 | # IntelliJ 87 | /out/ 88 | /captures 89 | 90 | # mpeltonen/sbt-idea plugin 91 | .idea_modules/ 92 | 93 | # JIRA plugin 94 | atlassian-ide-plugin.xml 95 | 96 | # Crashlytics plugin (for Android Studio and IntelliJ) 97 | com_crashlytics_export_strings.xml 98 | crashlytics.properties 99 | crashlytics-build.properties 100 | 101 | #Ignore stupid mac files 102 | .DS_Store -------------------------------------------------------------------------------- /app/dependencies.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * AFM - A library to help android developer working easily with activities and fragments. 3 | * 4 | * Copyright (c) 2017 AFM 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining 7 | * a copy of this software and associated documentation files (the 8 | * "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sublicense, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | apply plugin: 'kotlin-kapt' 27 | 28 | ext { 29 | 30 | appCompat = [ 31 | base: "com.android.support:appcompat-v7:$appCompatVersion", 32 | design: "com.android.support:design:$appCompatVersion" 33 | ] 34 | 35 | dataBinding = [ 36 | compiler: "com.android.databinding:compiler:$dataBindingVersion" 37 | ] 38 | 39 | kotlin = [ 40 | base: "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" 41 | ] 42 | } 43 | 44 | dependencies { 45 | implementation project(':afm') 46 | 47 | /* APP COMPAT */ 48 | implementation appCompat.base 49 | implementation appCompat.design 50 | 51 | /* DATA BINDING */ 52 | kapt dataBinding.compiler 53 | 54 | /* KOTLIN */ 55 | implementation kotlin.base 56 | 57 | implementation 'com.massivedisaster.adal:adal-fragments:0.1.15' 58 | 59 | implementation 'com.massivedisaster.adal:adal-adapters:0.1.15' 60 | 61 | implementation 'com.github.bumptech.glide:glide:3.7.0' 62 | } -------------------------------------------------------------------------------- /app/src/main/kotlin/com/massivedisaster/afm/sample/feature/splash/FragmentSplash.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * AFM - A library to help android developer working easily with activities and fragments. 3 | * 4 | * Copyright (c) 2017 AFM 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining 7 | * a copy of this software and associated documentation files (the 8 | * "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sublicense, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | package com.massivedisaster.afm.sample.feature.splash 27 | 28 | import android.app.Activity 29 | import com.massivedisaster.adal.fragment.AbstractSplashFragment 30 | import com.massivedisaster.afm.ActivityCall 31 | import com.massivedisaster.afm.sample.R 32 | import com.massivedisaster.afm.sample.activity.ActivityHome 33 | import com.massivedisaster.afm.sample.feature.home.FragmentHome 34 | 35 | class FragmentSplash : AbstractSplashFragment() { 36 | 37 | override fun layoutToInflate(): Int { 38 | return R.layout.fragment_splash 39 | } 40 | 41 | override fun onSplashStarted() { 42 | onSplashFinish { openHomeScreen(activity) } 43 | } 44 | 45 | /** 46 | * Open the home screen 47 | * 48 | * @param activity The actual activity. 49 | */ 50 | private fun openHomeScreen(activity: Activity) { 51 | ActivityCall.init(activity, ActivityHome::class, FragmentHome::class).build() 52 | activity.finish() 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /app/src/main/kotlin/com/massivedisaster/afm/sample/feature/sharedelements/FragmentSharedElement.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * AFM - A library to help android developer working easily with activities and fragments. 3 | * 4 | * Copyright (c) 2017 AFM 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining 7 | * a copy of this software and associated documentation files (the 8 | * "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sublicense, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | package com.massivedisaster.afm.sample.feature.sharedelements 27 | 28 | import android.os.Bundle 29 | import com.bumptech.glide.Glide 30 | import com.bumptech.glide.load.engine.DiskCacheStrategy 31 | import com.massivedisaster.adal.fragment.BaseFragment 32 | import com.massivedisaster.afm.sample.R 33 | 34 | class FragmentSharedElement : BaseFragment() { 35 | 36 | private var mUrl: String? = null 37 | 38 | override fun layoutToInflate(): Int { 39 | return R.layout.fragment_shared_element 40 | } 41 | 42 | override fun getFromBundle(bundle: Bundle?) { 43 | mUrl = bundle!!.getString("URL") 44 | } 45 | 46 | override fun doOnCreated() { 47 | activity.setTitle(R.string.image_detail) 48 | 49 | Glide.with(context) 50 | .load(mUrl) 51 | .diskCacheStrategy(DiskCacheStrategy.SOURCE) 52 | .dontAnimate() 53 | .into(findViewById(R.id.imgSharedElement)) 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /app/src/main/kotlin/com/massivedisaster/afm/sample/activity/ActivityToolbar.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * AFM - A library to help android developer working easily with activities and fragments. 3 | * 4 | * Copyright (c) 2017 AFM 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining 7 | * a copy of this software and associated documentation files (the 8 | * "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sublicense, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | package com.massivedisaster.afm.sample.activity 27 | 28 | import android.os.Bundle 29 | import android.view.MenuItem 30 | import com.massivedisaster.afm.activity.BaseActivity 31 | import com.massivedisaster.afm.sample.R 32 | 33 | open class ActivityToolbar : BaseActivity() { 34 | 35 | override fun layoutToInflate(): Int { 36 | return R.layout.activity_primary 37 | } 38 | 39 | override fun getContainerViewId(): Int { 40 | return R.id.frmContainer 41 | } 42 | 43 | override fun onCreate(savedInstanceState: Bundle?) { 44 | super.onCreate(savedInstanceState) 45 | 46 | supportActionBar?.setDisplayHomeAsUpEnabled(true) 47 | } 48 | 49 | override fun onOptionsItemSelected(item: MenuItem): Boolean { 50 | return when (item.itemId) { 51 | android.R.id.home -> { 52 | onBackPressed() 53 | true 54 | } 55 | else -> super.onOptionsItemSelected(item) 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_shared_element.xml: -------------------------------------------------------------------------------- 1 | 2 | 26 | 27 | 30 | 31 | 35 | 36 | 43 | 44 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * AFM - A library to help android developer working easily with activities and fragments. 3 | * 4 | * Copyright (c) 2017 AFM 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining 7 | * a copy of this software and associated documentation files (the 8 | * "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sublicense, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | apply plugin: 'com.android.application' 27 | apply plugin: 'kotlin-android' 28 | apply plugin: 'kotlin-android-extensions' 29 | android { 30 | compileSdkVersion 26 31 | buildToolsVersion "26.0.1" 32 | defaultConfig { 33 | applicationId "com.massivedisaster.afm.sample" 34 | minSdkVersion 16 35 | targetSdkVersion 26 36 | versionCode 1 37 | versionName "1.0" 38 | 39 | javaCompileOptions { 40 | annotationProcessorOptions { 41 | arguments = ["room.schemaLocation": "$projectDir/schemas".toString()] 42 | } 43 | } 44 | } 45 | buildTypes { 46 | release { 47 | minifyEnabled false 48 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 49 | } 50 | } 51 | dataBinding { 52 | enabled true 53 | } 54 | packagingOptions { 55 | exclude 'META-INF/rxjava.properties' 56 | } 57 | sourceSets { 58 | main.java.srcDirs += 'src/main/kotlin' 59 | androidTest.assets.srcDirs += files("$projectDir/schemas".toString()) 60 | } 61 | } 62 | apply from: 'dependencies.gradle' 63 | -------------------------------------------------------------------------------- /app/src/main/kotlin/com/massivedisaster/afm/sample/feature/backpressed/FragmentOnBackPressed.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * AFM - A library to help android developer working easily with activities and fragments. 3 | * 4 | * Copyright (c) 2017 AFM 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining 7 | * a copy of this software and associated documentation files (the 8 | * "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sublicense, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | package com.massivedisaster.afm.sample.feature.backpressed 27 | 28 | import android.widget.TextView 29 | import com.massivedisaster.adal.fragment.BaseFragment 30 | import com.massivedisaster.afm.fragment.OnBackPressedListener 31 | import com.massivedisaster.afm.sample.R 32 | 33 | class FragmentOnBackPressed : BaseFragment(), OnBackPressedListener { 34 | 35 | private var mNumberOfBacks: Int = 0 36 | private lateinit var mTxtCount: TextView 37 | 38 | override fun layoutToInflate(): Int { 39 | return R.layout.fragment_onbackpressed 40 | } 41 | 42 | override fun doOnCreated() { 43 | activity.setTitle(R.string.fragment_onbackpressed) 44 | 45 | mTxtCount = findViewById(R.id.txtCount) 46 | 47 | mTxtCount.text = getString(R.string.number_of_counts, 0) 48 | } 49 | 50 | override fun onBackPressed(): Boolean { 51 | return if (mNumberOfBacks < 5) { 52 | mNumberOfBacks++ 53 | mTxtCount.text = getString(R.string.number_of_counts, mNumberOfBacks) 54 | true 55 | } else { 56 | false 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /app/src/main/kotlin/com/massivedisaster/afm/sample/feature/sharedelements/ImageAdapter.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * AFM - A library to help android developer working easily with activities and fragments. 3 | * 4 | * Copyright (c) 2017 AFM 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining 7 | * a copy of this software and associated documentation files (the 8 | * "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sublicense, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | package com.massivedisaster.afm.sample.feature.sharedelements 27 | 28 | import com.bumptech.glide.Glide 29 | import com.bumptech.glide.load.engine.DiskCacheStrategy 30 | import com.massivedisaster.adal.adapter.AbstractLoadMoreBaseAdapter 31 | import com.massivedisaster.adal.adapter.BaseViewHolder 32 | import com.massivedisaster.afm.sample.R 33 | 34 | internal class ImageAdapter 35 | /** 36 | * Image Adapter constructor 37 | * 38 | * @param lstItems List of items to populate adapter 39 | */ 40 | (lstItems: List) : AbstractLoadMoreBaseAdapter(R.layout.adapter_image, lstItems) { 41 | 42 | override fun bindItem(holder: BaseViewHolder, item: Int?) { 43 | Glide.with(holder.itemView.context) 44 | .load("http://lorempixel.com/400/200/nature/" + item!!) 45 | .diskCacheStrategy(DiskCacheStrategy.SOURCE) 46 | .into(holder.getView(R.id.imgExample)) 47 | } 48 | 49 | override fun bindError(holder: BaseViewHolder?, loadingError: Boolean) { 50 | //TODO("not implemented") //To change body of created functions use File | Settings | File Templates. 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_home.xml: -------------------------------------------------------------------------------- 1 | 2 | 26 | 27 | 31 | 32 |