This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| " .ideavimrc is a configuration file for IdeaVim plugin. It uses | |
| " the same commands as the original .vimrc configuration. | |
| " You can find a list of commands here: https://jb.gg/h38q75 | |
| " Find more examples here: https://jb.gg/share-ideavimrc | |
| let mapleader="\<Space>" | |
| set nocompatible | |
| """ Plugins | |
| set surround |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class MyActivity : Activity() { | |
| private val myDependency by inject { myDependency() } | |
| // ... | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Component(modules = [MyApplicationModule::class]) | |
| @Singleton | |
| interface MyAppComponent { | |
| // These functions will be auto-generated by Dagger to provide that specific dependency | |
| fun myDependency(): MyDependency | |
| // Inject methods such as this are the commonly documented method for injecting into JSR-330 annotated fields | |
| fun inject(application: MyApplication) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| inline fun <reified T> Fragment.inject( | |
| noinline initializer: MyAppComponent.() -> T) = lazy { | |
| context?.let { | |
| (it.applicationContext as MyApplication).component.initializer() | |
| } ?: throw IllegalStateException("Context must be set before accessing this property") | |
| } | |
| inline fun <reified T> Context.inject( | |
| noinline initializer: MyAppComponent.() -> T | |
| ) = lazy(LazyThreadSafetyMode.NONE) { |