🏴☠️
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
/** | |
* An activity with a `HomeViewModel` dependency | |
*/ | |
class HomeActivity : AppCompatActivity() { | |
@Inject | |
lateinit var homeViewModel: HomeViewModel // Requesting the dependency | |
override fun onCreate(savedInstanceState: Bundle?) { |
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
/** | |
* Declaring application implementing `HasActivityInjector` with `DispatchingAndroidInjector` | |
*/ | |
class DefineApplication : Application(), HasActivityInjector { | |
override fun activityInjector(): DispatchingAndroidInjector<Activity> = mAndroidInjector | |
@Inject | |
lateinit var mAndroidInjector: DispatchingAndroidInjector<Activity> |
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
/** | |
* Declaring a activity bindings using @ContributesAndroidInjector and @Activity scope (custom scope) | |
*/ | |
@Module | |
abstract class ActivityBindings { | |
@ActivityScope | |
@ContributesAndroidInjector | |
abstract fun contributeHomeActivity(): HomeActivity |
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
/** | |
* Using ComputerComponent as dependency to MiningRigComponent | |
*/ | |
@Component(dependency = arrayOf(ComputerComponent::class)) | |
interface MiningRigComponent |
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
/** | |
* Declaring a module with a sub component | |
*/ | |
@Module(subcomponents = arrayOf(MySubComponent::class)) | |
class SomeModuleForParentComponent{} |
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
/** | |
* Declaring a sub component | |
*/ | |
@SubComponent(modules = arrayOf(ComputerModule::class)) | |
@MyCustomScope | |
interface MySubComponent {} |
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
/** | |
* Declaring a custom qualifier | |
*/ | |
@Qualifier // Required to specify the annotation as a qualifier | |
@Documented | |
@Retention(RUNTIME) | |
public @interface MyCustomQualifier { | |
String value() default ""; | |
} |
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
// Declaring our component | |
@Component(modules = arrayOf(ComputerModule::class)) | |
interface ComputerComponent { | |
// provision function | |
fun getComputer(): Computer | |
} |
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
from xml.dom.minidom import parse, parseString | |
from sys import argv | |
import os | |
def fix_path(pathdata, token): | |
# Fix missing 0 after space | |
points = pathdata.split(token) | |
for i, b in enumerate(points): | |
if b.startswith('.'): | |
points[i] = '0' + b |
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
package di | |
import dagger.Module | |
import dagger.Provides | |
import di.dependencies.* | |
@Module | |
abstract class ComputerModule(private val memorySize: Int, | |
private val vMemorySize: Int) { | |