diff --git a/app/mylibrary/consumer-rules.pro b/app/mylibrary/consumer-rules.pro index 14f5d6b67..0b39b97f0 100644 --- a/app/mylibrary/consumer-rules.pro +++ b/app/mylibrary/consumer-rules.pro @@ -35,7 +35,8 @@ # Keep the public execute() method that has no parameters. # This is critical because TaskRunner calls getMethod("execute"). - # If this method is renamed (obfuscated) or removed (shrunk), your app will crash. + # If this method is renamed (obfuscated) or removed + # (shrunk), your app wont work the intended way. public void execute(); } diff --git a/app/src/main/kotlin/com/google/samples/apps/nowinandroid/MainActivity.kt b/app/src/main/kotlin/com/google/samples/apps/nowinandroid/MainActivity.kt index e166d3559..0f5e9c175 100644 --- a/app/src/main/kotlin/com/google/samples/apps/nowinandroid/MainActivity.kt +++ b/app/src/main/kotlin/com/google/samples/apps/nowinandroid/MainActivity.kt @@ -59,9 +59,7 @@ import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.launch - import javax.inject.Inject -import kotlin.reflect.KVisibility @AndroidEntryPoint class MainActivity : ComponentActivity() { @@ -90,19 +88,19 @@ class MainActivity : ComponentActivity() { val splashScreen = installSplashScreen() super.onCreate(savedInstanceState) - + // Loading class by reflection example val workerClassName = "com.google.samples.apps.nowinandroid.CrashTestWorker" WorkerLoader.loadAndRun(workerClassName) - val eventBus = EventBus() - -// val listener = CustomListener() -// eventBus.dispatch(listener) -// -// val runner = TaskRunner() -// val task1 = ImportantBackgroundTask() + // Reflection using method annotation example + val eventBus = EventBus() + val listener = CustomListener() + eventBus.dispatch(listener) -// runner.process(task1) // This will be executed. + // Reflection using class annotation example + val runner = TaskRunner() + val task1 = ImportantBackgroundTask() + runner.process(task1) // This will be executed.