├── .gitignore ├── .idea ├── codeStyles │ ├── Project.xml │ └── codeStyleConfig.xml ├── gradle.xml ├── misc.xml ├── qaplug_profiles.xml ├── runConfigurations.xml └── vcs.xml ├── .travis.yml ├── README.md ├── abstraction ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── app │ │ └── isfaaghyth │ │ └── abstraction │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── app │ │ │ └── isfaaghyth │ │ │ └── abstraction │ │ │ ├── base │ │ │ ├── BaseActivity.kt │ │ │ ├── BaseFragment.kt │ │ │ ├── BasePresenter.kt │ │ │ ├── BasePresenterIntr.kt │ │ │ └── BaseView.kt │ │ │ └── utils │ │ │ ├── ImageLoaderExt.kt │ │ │ ├── KeyboardUtils.kt │ │ │ ├── NetworkUtils.kt │ │ │ ├── ViewExt.kt │ │ │ └── rx │ │ │ ├── AppSchedulerProvider.kt │ │ │ ├── Ext.kt │ │ │ └── SchedulerProvider.kt │ └── res │ │ └── values │ │ └── strings.xml │ └── test │ └── java │ └── app │ └── isfaaghyth │ └── abstraction │ └── ExampleUnitTest.java ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── app │ │ └── isfaaghyth │ │ └── git │ │ └── ExampleInstrumentedTest.kt │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── app │ │ │ └── isfaaghyth │ │ │ └── git │ │ │ └── MainActivity.kt │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ └── ic_launcher_background.xml │ │ ├── layout │ │ └── activity_main.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 │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── app │ └── isfaaghyth │ └── git │ └── ExampleUnitTest.kt ├── build.gradle ├── buildSrc ├── build.gradle.kts ├── build │ ├── classes │ │ └── kotlin │ │ │ └── main │ │ │ ├── AndroidSupport.class │ │ │ ├── Anko.class │ │ │ ├── ApplicationId.class │ │ │ ├── Dagger.class │ │ │ ├── Dependencies.class │ │ │ ├── Glide.class │ │ │ ├── Modules.class │ │ │ ├── Reactivex.class │ │ │ ├── Releases.class │ │ │ ├── Retrofit.class │ │ │ ├── Testing.class │ │ │ └── Version.class │ ├── kotlin-build │ │ ├── artifact-difference.tab │ │ ├── artifact-difference.tab.keystream │ │ ├── artifact-difference.tab.keystream.len │ │ ├── artifact-difference.tab.len │ │ ├── artifact-difference.tab.values.at │ │ ├── artifact-difference.tab_i │ │ ├── artifact-difference.tab_i.len │ │ └── version.txt │ ├── kotlin │ │ └── compileKotlin │ │ │ ├── build-history.bin │ │ │ ├── caches-jvm │ │ │ ├── inputs │ │ │ │ ├── source-to-output.tab │ │ │ │ ├── source-to-output.tab.keystream │ │ │ │ ├── source-to-output.tab.keystream.len │ │ │ │ ├── source-to-output.tab.len │ │ │ │ ├── source-to-output.tab.values.at │ │ │ │ ├── source-to-output.tab_i │ │ │ │ └── source-to-output.tab_i.len │ │ │ ├── jvm │ │ │ │ └── kotlin │ │ │ │ │ ├── class-fq-name-to-source.tab │ │ │ │ │ ├── class-fq-name-to-source.tab.keystream │ │ │ │ │ ├── class-fq-name-to-source.tab.keystream.len │ │ │ │ │ ├── class-fq-name-to-source.tab.len │ │ │ │ │ ├── class-fq-name-to-source.tab.values.at │ │ │ │ │ ├── class-fq-name-to-source.tab_i │ │ │ │ │ ├── class-fq-name-to-source.tab_i.len │ │ │ │ │ ├── constants.tab │ │ │ │ │ ├── constants.tab.keystream │ │ │ │ │ ├── constants.tab.keystream.len │ │ │ │ │ ├── constants.tab.len │ │ │ │ │ ├── constants.tab.values.at │ │ │ │ │ ├── constants.tab_i │ │ │ │ │ ├── constants.tab_i.len │ │ │ │ │ ├── internal-name-to-source.tab │ │ │ │ │ ├── internal-name-to-source.tab.keystream │ │ │ │ │ ├── internal-name-to-source.tab.keystream.len │ │ │ │ │ ├── internal-name-to-source.tab.len │ │ │ │ │ ├── internal-name-to-source.tab.values.at │ │ │ │ │ ├── internal-name-to-source.tab_i │ │ │ │ │ ├── internal-name-to-source.tab_i.len │ │ │ │ │ ├── proto.tab │ │ │ │ │ ├── proto.tab.keystream │ │ │ │ │ ├── proto.tab.keystream.len │ │ │ │ │ ├── proto.tab.len │ │ │ │ │ ├── proto.tab.values.at │ │ │ │ │ ├── proto.tab_i │ │ │ │ │ ├── proto.tab_i.len │ │ │ │ │ ├── source-to-classes.tab │ │ │ │ │ ├── source-to-classes.tab.keystream │ │ │ │ │ ├── source-to-classes.tab.keystream.len │ │ │ │ │ ├── source-to-classes.tab.len │ │ │ │ │ ├── source-to-classes.tab.values.at │ │ │ │ │ ├── source-to-classes.tab_i │ │ │ │ │ └── source-to-classes.tab_i.len │ │ │ └── lookups │ │ │ │ ├── counters.tab │ │ │ │ ├── file-to-id.tab │ │ │ │ ├── file-to-id.tab.keystream │ │ │ │ ├── file-to-id.tab.keystream.len │ │ │ │ ├── file-to-id.tab.len │ │ │ │ ├── file-to-id.tab.values.at │ │ │ │ ├── file-to-id.tab_i │ │ │ │ ├── file-to-id.tab_i.len │ │ │ │ ├── id-to-file.tab │ │ │ │ ├── id-to-file.tab.keystream │ │ │ │ ├── id-to-file.tab.keystream.len │ │ │ │ ├── id-to-file.tab.len │ │ │ │ ├── id-to-file.tab.values.at │ │ │ │ ├── id-to-file.tab_i │ │ │ │ ├── id-to-file.tab_i.len │ │ │ │ ├── lookups.tab │ │ │ │ ├── lookups.tab.keystream │ │ │ │ ├── lookups.tab.keystream.len │ │ │ │ ├── lookups.tab.len │ │ │ │ ├── lookups.tab.values.at │ │ │ │ ├── lookups.tab_i │ │ │ │ └── lookups.tab_i.len │ │ │ ├── data-container-format-version.txt │ │ │ ├── format-version.txt │ │ │ ├── gradle-format-version.txt │ │ │ └── last-build.bin │ ├── libs │ │ └── buildSrc.jar │ └── tmp │ │ └── jar │ │ └── MANIFEST.MF └── src │ └── main │ └── java │ ├── Dependencies.kt │ └── Modules.kt ├── common.gradle ├── feature ├── gists │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ ├── androidTest │ │ └── java │ │ │ └── isfaaghyth │ │ │ └── app │ │ │ └── gists │ │ │ └── ExampleInstrumentedTest.java │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ │ └── isfaaghyth │ │ │ │ └── app │ │ │ │ └── gists │ │ │ │ ├── data │ │ │ │ ├── AppDataManager.kt │ │ │ │ ├── DataManager.kt │ │ │ │ ├── GistServices.kt │ │ │ │ ├── entity │ │ │ │ │ └── Gist.kt │ │ │ │ └── remote │ │ │ │ │ ├── GistRepository.kt │ │ │ │ │ └── GistRepositoryImpl.kt │ │ │ │ ├── di │ │ │ │ ├── GistComponent.kt │ │ │ │ ├── GistModule.kt │ │ │ │ └── GistScope.kt │ │ │ │ └── feature │ │ │ │ ├── GistActivity.kt │ │ │ │ ├── GistPresenter.kt │ │ │ │ ├── GistPresenterInteractor.kt │ │ │ │ └── GistView.kt │ │ └── res │ │ │ ├── layout │ │ │ └── activity_gist.xml │ │ │ └── values │ │ │ └── strings.xml │ │ └── test │ │ └── java │ │ └── isfaaghyth │ │ └── app │ │ └── gists │ │ ├── ExampleUnitTest.java │ │ └── data │ │ └── remote │ │ └── GistRepositoryImplTest.kt └── repos │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ ├── androidTest │ └── java │ │ └── app │ │ └── isfaaghyth │ │ └── repos │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── app │ │ │ └── isfaaghyth │ │ │ └── repos │ │ │ ├── data │ │ │ ├── AppDataManager.kt │ │ │ ├── DataManager.kt │ │ │ ├── ReposServices.kt │ │ │ ├── entity │ │ │ │ └── Repo.kt │ │ │ └── remote │ │ │ │ ├── RemoteRepository.kt │ │ │ │ └── RemoteRepositoryImpl.kt │ │ │ ├── di │ │ │ ├── ReposComponent.kt │ │ │ ├── ReposModule.kt │ │ │ └── ReposScope.kt │ │ │ └── feature │ │ │ ├── ReposActivity.kt │ │ │ ├── ReposPresenter.kt │ │ │ ├── ReposPresenterInteractor.kt │ │ │ ├── ReposState.kt │ │ │ └── ReposView.kt │ └── res │ │ ├── layout │ │ └── activity_repos_main.xml │ │ └── values │ │ └── strings.xml │ └── test │ └── java │ └── app │ └── isfaaghyth │ └── repos │ └── ExampleUnitTest.java ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── network ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── app │ │ └── isfaaghyth │ │ └── network │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── app │ │ │ └── isfaaghyth │ │ │ └── network │ │ │ └── Network.kt │ └── res │ │ └── values │ │ └── strings.xml │ └── test │ └── java │ └── app │ └── isfaaghyth │ └── network │ └── ExampleUnitTest.java ├── settings.gradle ├── uicomponent ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── app │ │ └── isfaaghyth │ │ └── uicomponent │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ └── res │ │ └── values │ │ ├── colors.xml │ │ ├── dimens.xml │ │ └── strings.xml │ └── test │ └── java │ └── app │ └── isfaaghyth │ └── uicomponent │ └── ExampleUnitTest.java └── update.sh /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches/build_file_checksums.ser 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | .DS_Store 9 | /build 10 | /captures 11 | .externalNativeBuild 12 | -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 9 | 10 | 11 | 21 | 22 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 39 | 40 | 41 | 43 | 44 | -------------------------------------------------------------------------------- /.idea/codeStyles/codeStyleConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 24 | 25 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 37 | 38 | 39 | 40 | 41 | 42 | 44 | 45 | 47 | -------------------------------------------------------------------------------- /.idea/qaplug_profiles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 12 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: android 2 | sudo: required 3 | jdk: oraclejdk8 4 | before_cache: 5 | -rm -f $HOME/.gradle/caches/modules-2/modules-2.lock 6 | -rm -fr $HOME/.gradle/caches/*/plugin-resolution/ 7 | cache: 8 | directories: 9 | -$HOME/.gradle/caches/ 10 | -$HOME/.gradle/wrapper/ 11 | env: 12 | global: 13 | - ANDROID_API=24 14 | - EMULATOR_API=21 15 | - ANDROID_BUILD_TOOLS=24.0.2 16 | - ADB_INSTALL_TIMEOUT=5 # minutes 17 | android: 18 | components: 19 | - tools 20 | - platform-tools 21 | - build-tools-$ANDROID_BUILD_TOOLS 22 | - android-$ANDROID_API 23 | - android-$EMULATOR_API_LEVEL 24 | - extra-google-m2repository 25 | - extra-android-m2repository # for design library 26 | - addon-google_apis-google-19 # google play services 27 | - sys-img-armeabi-v7a-addon-google_apis-google-$ANDROID_API_LEVEL 28 | - sys-img-armeabi-v7a-addon-google_apis-google-$EMULATOR_API_LEVEL 29 | licenses: 30 | - android-sdk-preview-license-.+ 31 | - android-sdk-license-.+ 32 | - google-gdk-license-.+ 33 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Modularization in a Nutshell 2 | Implementation of Modularization on Architecture Pattern 3 | 4 | Tech stack: 5 | 6 | - Kotlin 7 | - Dagger2 8 | - Koin `(on going)` 9 | - RxJava2 10 | - MVP 11 | - MVVM `(on going)` 12 | - Retrofit 13 | - Room `(on going)` 14 | - Mockito `(on going)` 15 | - Applink 16 | 17 | 18 | Cheers! 2019 19 | 20 | @isfaaghyth 21 | -------------------------------------------------------------------------------- /abstraction/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /abstraction/build.gradle: -------------------------------------------------------------------------------- 1 | apply from: "$rootDir/common.gradle" 2 | 3 | dependencies { 4 | //rx 5 | implementation Reactivex.android 6 | implementation Reactivex.kotlin 7 | 8 | //android support 9 | implementation AndroidSupport.appCompat 10 | implementation AndroidSupport.design 11 | implementation AndroidSupport.constraint 12 | 13 | //glide 14 | implementation Glide.glide 15 | kapt Glide.compiler 16 | 17 | //testing 18 | testImplementation Testing.jUnit 19 | } -------------------------------------------------------------------------------- /abstraction/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 | -------------------------------------------------------------------------------- /abstraction/src/androidTest/java/app/isfaaghyth/abstraction/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package app.isfaaghyth.abstraction; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("app.isfaaghyth.abstraction.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /abstraction/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /abstraction/src/main/java/app/isfaaghyth/abstraction/base/BaseActivity.kt: -------------------------------------------------------------------------------- 1 | package app.isfaaghyth.abstraction.base 2 | 3 | import android.os.Bundle 4 | import android.support.v7.app.AppCompatActivity 5 | import android.widget.Toast 6 | import app.isfaaghyth.abstraction.utils.KeyboardUtils 7 | import app.isfaaghyth.abstraction.utils.NetworkUtils 8 | 9 | /** 10 | * Created by isfaaghyth on 11/04/19. 11 | * github: @isfaaghyth 12 | */ 13 | abstract class BaseActivity: AppCompatActivity(), BaseView { 14 | 15 | /** 16 | * lifecycle method 17 | * @method contentView(): @return resLayoutId 18 | * @method initView() 19 | */ 20 | abstract fun contentView(): Int 21 | abstract fun initView() 22 | abstract fun initInjector() 23 | 24 | /** 25 | * (optional, use it if needed) 26 | */ 27 | protected lateinit var savedInstanceState: Bundle 28 | 29 | override fun onCreate(savedInstanceState: Bundle?) { 30 | super.onCreate(savedInstanceState) 31 | if (savedInstanceState != null) { 32 | this.savedInstanceState = savedInstanceState 33 | } 34 | setContentView(contentView()) 35 | initInjector() 36 | initView() 37 | } 38 | 39 | override fun onMessage(message: String?) { 40 | Toast.makeText(this, message, Toast.LENGTH_LONG).show() 41 | } 42 | 43 | override fun onMessage(stringResId: Int) { 44 | onMessage(getString(stringResId)) 45 | } 46 | 47 | /** 48 | * check internet connection 49 | */ 50 | override fun isNetworkConnect(): Boolean { 51 | return NetworkUtils.connection(this) 52 | } 53 | 54 | /** 55 | * hide keyboard layout 56 | */ 57 | override fun hideKeyboard() { 58 | return KeyboardUtils.hide(this) 59 | } 60 | 61 | } -------------------------------------------------------------------------------- /abstraction/src/main/java/app/isfaaghyth/abstraction/base/BaseFragment.kt: -------------------------------------------------------------------------------- 1 | package app.isfaaghyth.abstraction.base 2 | 3 | import android.app.Activity 4 | import android.os.Bundle 5 | import android.support.v4.app.Fragment 6 | import android.view.LayoutInflater 7 | import android.view.View 8 | import android.view.ViewGroup 9 | import android.widget.Toast 10 | import app.isfaaghyth.abstraction.utils.KeyboardUtils 11 | import app.isfaaghyth.abstraction.utils.NetworkUtils 12 | 13 | /** 14 | * Created by isfaaghyth on 11/04/19. 15 | * github: @isfaaghyth 16 | */ 17 | abstract class BaseFragment: Fragment(), BaseView { 18 | 19 | /** 20 | * lifecycle method 21 | * @method contentView(): @return resLayoutId 22 | * @method initView() 23 | */ 24 | abstract fun contentView(): Int 25 | abstract fun initView() 26 | abstract fun initInjector() 27 | 28 | /** 29 | * (optional, use it if needed) 30 | */ 31 | protected lateinit var savedInstanceState: Bundle 32 | 33 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { 34 | return inflater.inflate(contentView(), container, false) 35 | } 36 | 37 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { 38 | super.onViewCreated(view, savedInstanceState) 39 | if (savedInstanceState != null) { 40 | this.savedInstanceState = savedInstanceState 41 | } 42 | initInjector() 43 | initView() 44 | } 45 | 46 | override fun onMessage(message: String?) { 47 | Toast.makeText(context, message, Toast.LENGTH_LONG).show() 48 | } 49 | 50 | override fun onMessage(stringResId: Int) { 51 | onMessage(getString(stringResId)) 52 | } 53 | 54 | /** 55 | * check internet connection 56 | */ 57 | override fun isNetworkConnect(): Boolean { 58 | return if (context != null) { 59 | NetworkUtils.connection(context!!) 60 | } else { 61 | false 62 | } 63 | } 64 | 65 | /** 66 | * hide keyboard layout 67 | */ 68 | override fun hideKeyboard() { 69 | return (activity as Activity).let { 70 | KeyboardUtils.hide(it) 71 | } 72 | } 73 | 74 | } -------------------------------------------------------------------------------- /abstraction/src/main/java/app/isfaaghyth/abstraction/base/BasePresenter.kt: -------------------------------------------------------------------------------- 1 | package app.isfaaghyth.abstraction.base 2 | 3 | import io.reactivex.disposables.CompositeDisposable 4 | import io.reactivex.disposables.Disposable 5 | 6 | /** 7 | * Created by isfaaghyth on 11/04/19. 8 | * github: @isfaaghyth 9 | */ 10 | open class BasePresenter: BasePresenterIntr { 11 | 12 | private val compositeDisposable = CompositeDisposable() 13 | protected lateinit var view: V 14 | 15 | override fun attachView(view: V?) { 16 | if (view != null) { 17 | this.view = view 18 | } else { 19 | throw NullPointerException("presenter: please attach your view on onCreate() method.") 20 | } 21 | } 22 | 23 | /** 24 | * adding a new task (as a disposable) into compositeDisposable 25 | * @param: disposable 26 | */ 27 | protected fun subscribe(job: () -> Disposable) { 28 | compositeDisposable.add(job()) 29 | } 30 | 31 | override fun dettachView() { 32 | compositeDisposable.clear() 33 | } 34 | 35 | } -------------------------------------------------------------------------------- /abstraction/src/main/java/app/isfaaghyth/abstraction/base/BasePresenterIntr.kt: -------------------------------------------------------------------------------- 1 | package app.isfaaghyth.abstraction.base 2 | 3 | /** 4 | * Created by isfaaghyth on 19/04/19. 5 | * github: @isfaaghyth 6 | */ 7 | interface BasePresenterIntr { 8 | fun attachView(view: V?) 9 | fun dettachView() 10 | } -------------------------------------------------------------------------------- /abstraction/src/main/java/app/isfaaghyth/abstraction/base/BaseView.kt: -------------------------------------------------------------------------------- 1 | package app.isfaaghyth.abstraction.base 2 | 3 | import android.support.annotation.StringRes 4 | 5 | /** 6 | * Created by isfaaghyth on 11/04/19. 7 | * github: @isfaaghyth 8 | */ 9 | interface BaseView { 10 | /** 11 | * showing custom message in current activity 12 | * @param message 13 | * @param stringResId 14 | */ 15 | fun onMessage(message: String?) 16 | fun onMessage(@StringRes stringResId: Int) 17 | 18 | /** 19 | * check internet connection 20 | * @return boolean 21 | */ 22 | fun isNetworkConnect(): Boolean 23 | 24 | /** 25 | * hide keyboard. 26 | * you could use this when you have any editText actively 27 | * @return boolean 28 | */ 29 | fun hideKeyboard() 30 | } -------------------------------------------------------------------------------- /abstraction/src/main/java/app/isfaaghyth/abstraction/utils/ImageLoaderExt.kt: -------------------------------------------------------------------------------- 1 | package app.isfaaghyth.abstraction.utils 2 | 3 | import android.widget.ImageView 4 | import com.bumptech.glide.Glide 5 | import com.bumptech.glide.load.resource.bitmap.CircleCrop 6 | import com.bumptech.glide.request.RequestOptions 7 | 8 | /** 9 | * Created by isfaaghyth on 27/04/19. 10 | * github: @isfaaghyth 11 | */ 12 | 13 | fun ImageView.load(imageUri: Any) { 14 | Glide.with(context) 15 | .load(imageUri) 16 | .apply(RequestOptions()) 17 | .into(this) 18 | } 19 | 20 | fun ImageView.circleLoad(imageUri: Any) { 21 | Glide.with(context) 22 | .asBitmap() 23 | .load(imageUri) 24 | .apply(RequestOptions() 25 | .transform(CircleCrop()) 26 | ) 27 | .into(this) 28 | } -------------------------------------------------------------------------------- /abstraction/src/main/java/app/isfaaghyth/abstraction/utils/KeyboardUtils.kt: -------------------------------------------------------------------------------- 1 | package app.isfaaghyth.abstraction.utils 2 | 3 | import android.app.Activity 4 | import android.content.Context 5 | import android.view.View 6 | import android.view.inputmethod.InputMethodManager 7 | import android.widget.EditText 8 | 9 | /** 10 | * Created by isfaaghyth on 19/04/19. 11 | * github: @isfaaghyth 12 | */ 13 | object KeyboardUtils { 14 | 15 | fun hide(activity: Activity) { 16 | var view = activity.currentFocus 17 | if (view == null) view = View(activity) 18 | val imm = activity.getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager 19 | imm.hideSoftInputFromWindow(view.windowToken, 0) 20 | } 21 | 22 | fun show(edit: EditText, context: Context) { 23 | edit.isFocusable = true 24 | edit.isFocusableInTouchMode = true 25 | edit.requestFocus() 26 | val imm = context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager 27 | imm.showSoftInput(edit, 0) 28 | } 29 | 30 | fun toggle(context: Context) { 31 | val imm = context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager 32 | imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0) 33 | } 34 | 35 | } -------------------------------------------------------------------------------- /abstraction/src/main/java/app/isfaaghyth/abstraction/utils/NetworkUtils.kt: -------------------------------------------------------------------------------- 1 | package app.isfaaghyth.abstraction.utils 2 | 3 | import android.content.Context 4 | import android.net.ConnectivityManager 5 | 6 | /** 7 | * Created by isfaaghyth on 19/04/19. 8 | * github: @isfaaghyth 9 | */ 10 | object NetworkUtils { 11 | 12 | fun connection(context: Context): Boolean { 13 | val connectivityManager = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager 14 | return connectivityManager.activeNetworkInfo != null && connectivityManager.activeNetworkInfo.isConnected 15 | } 16 | 17 | } -------------------------------------------------------------------------------- /abstraction/src/main/java/app/isfaaghyth/abstraction/utils/ViewExt.kt: -------------------------------------------------------------------------------- 1 | package app.isfaaghyth.abstraction.utils 2 | 3 | import android.app.Activity 4 | import android.support.v4.app.Fragment 5 | import android.widget.Toast 6 | 7 | /** 8 | * Created by isfaaghyth on 29/04/19. 9 | * github: @isfaaghyth 10 | */ 11 | 12 | fun Activity.toast(message: String?) { 13 | Toast.makeText(this, message, Toast.LENGTH_SHORT).show() 14 | } 15 | 16 | fun Fragment.toast(message: String?) { 17 | Toast.makeText(context, message, Toast.LENGTH_SHORT).show() 18 | } -------------------------------------------------------------------------------- /abstraction/src/main/java/app/isfaaghyth/abstraction/utils/rx/AppSchedulerProvider.kt: -------------------------------------------------------------------------------- 1 | package app.isfaaghyth.abstraction.utils.rx 2 | 3 | import io.reactivex.Scheduler 4 | import io.reactivex.android.schedulers.AndroidSchedulers 5 | import io.reactivex.schedulers.Schedulers 6 | 7 | /** 8 | * Created by isfaaghyth on 29/04/19. 9 | * github: @isfaaghyth 10 | */ 11 | class AppSchedulerProvider: SchedulerProvider { 12 | override fun mainThread(): Scheduler = AndroidSchedulers.mainThread() 13 | override fun computation(): Scheduler = Schedulers.trampoline() 14 | override fun trampoline(): Scheduler = Schedulers.trampoline() 15 | override fun newThread(): Scheduler = Schedulers.newThread() 16 | override fun io(): Scheduler = Schedulers.io() 17 | } -------------------------------------------------------------------------------- /abstraction/src/main/java/app/isfaaghyth/abstraction/utils/rx/Ext.kt: -------------------------------------------------------------------------------- 1 | package app.isfaaghyth.abstraction.utils.rx 2 | 3 | import io.reactivex.Completable 4 | import io.reactivex.Maybe 5 | import io.reactivex.Single 6 | 7 | /** 8 | * Created by isfaaghyth on 29/04/19. 9 | * github: @isfaaghyth 10 | */ 11 | 12 | /** 13 | * Use SchedulerProvider configuration for Observable 14 | */ 15 | fun Completable.with(schedulerProvider: SchedulerProvider): Completable = 16 | this.observeOn(schedulerProvider.mainThread()).subscribeOn(schedulerProvider.io()) 17 | 18 | /** 19 | * Use SchedulerProvider configuration for Single 20 | */ 21 | fun Single.with(schedulerProvider: SchedulerProvider): Single = 22 | this.observeOn(schedulerProvider.mainThread()).subscribeOn(schedulerProvider.io()) 23 | 24 | /** 25 | * Use SchedulerProvider configuration for Maybe 26 | */ 27 | fun Maybe.with(schedulerProvider: SchedulerProvider): Maybe = 28 | this.observeOn(schedulerProvider.mainThread()).subscribeOn(schedulerProvider.io()) -------------------------------------------------------------------------------- /abstraction/src/main/java/app/isfaaghyth/abstraction/utils/rx/SchedulerProvider.kt: -------------------------------------------------------------------------------- 1 | package app.isfaaghyth.abstraction.utils.rx 2 | 3 | import io.reactivex.Scheduler 4 | 5 | /** 6 | * Created by isfaaghyth on 29/04/19. 7 | * github: @isfaaghyth 8 | */ 9 | interface SchedulerProvider { 10 | fun mainThread(): Scheduler 11 | fun computation(): Scheduler 12 | fun trampoline(): Scheduler 13 | fun newThread(): Scheduler 14 | fun io(): Scheduler 15 | } -------------------------------------------------------------------------------- /abstraction/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | abstraction 3 | 4 | -------------------------------------------------------------------------------- /abstraction/src/test/java/app/isfaaghyth/abstraction/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package app.isfaaghyth.abstraction; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'kotlin-android' 3 | apply plugin: 'kotlin-android-extensions' 4 | apply plugin: 'kotlin-kapt' 5 | 6 | android { 7 | compileSdkVersion Releases.compileSdkVersion 8 | 9 | defaultConfig { 10 | applicationId ApplicationId.id 11 | minSdkVersion Releases.minSdkVersion 12 | targetSdkVersion Releases.targetSdkVersion 13 | versionCode Releases.versionCode 14 | versionName Releases.versionName 15 | } 16 | 17 | buildTypes { 18 | release { 19 | minifyEnabled false 20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 21 | } 22 | } 23 | } 24 | 25 | dependencies { 26 | implementation fileTree(dir: 'libs', include: ['*.jar']) 27 | implementation Dependencies.kotlin 28 | 29 | //project 30 | implementation project(Modules.repos) 31 | implementation project(Modules.gists) 32 | 33 | //android support 34 | implementation AndroidSupport.appCompat 35 | implementation AndroidSupport.design 36 | implementation AndroidSupport.constraint 37 | 38 | //dependency injection 39 | implementation Dagger.dagger 40 | implementation Dagger.android 41 | implementation Dagger.androidSupport 42 | kapt Dagger.compiler 43 | kapt Dagger.processor 44 | 45 | //testing 46 | testImplementation Testing.jUnit 47 | testImplementation Testing.mockito 48 | testImplementation Testing.mockKotlin 49 | testImplementation Testing.mockKtRunner 50 | androidTestImplementation Testing.testRunner 51 | androidTestImplementation Testing.espresso 52 | } 53 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /app/src/androidTest/java/app/isfaaghyth/git/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package app.isfaaghyth.git 2 | 3 | import android.support.test.InstrumentationRegistry 4 | import android.support.test.runner.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.getTargetContext() 22 | assertEquals("app.isfaaghyth.git", appContext.packageName) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/java/app/isfaaghyth/git/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package app.isfaaghyth.git 2 | 3 | import android.content.Intent 4 | import android.net.Uri 5 | import android.os.Bundle 6 | import android.support.v7.app.AppCompatActivity 7 | import isfaaghyth.app.gists.feature.GistActivity 8 | import kotlinx.android.synthetic.main.activity_main.* 9 | 10 | class MainActivity : AppCompatActivity() { 11 | 12 | override fun onCreate(savedInstanceState: Bundle?) { 13 | super.onCreate(savedInstanceState) 14 | setContentView(R.layout.activity_main) 15 | 16 | btnViewRepo.setOnClickListener { 17 | startActivity(GistActivity.open(this, "isfaaghyth")) 18 | //passing own github username with lastSegment trough applink 19 | // val uri = Uri.parse("gitjkt://repos/isfaaghyth") 20 | // val intent = Intent(Intent.ACTION_VIEW, uri) 21 | // startActivity(intent) 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 10 | 12 | 14 | 16 | 18 | 20 | 22 | 24 | 26 | 28 | 30 | 32 | 34 | 36 | 38 | 40 | 42 | 44 | 46 | 48 | 50 | 52 | 54 | 56 | 58 | 60 | 62 | 64 | 66 | 68 | 70 | 72 | 74 | 75 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 |