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 System; | |
| using System.Threading; | |
| namespace Chapter1 | |
| { | |
| public static class Program | |
| { | |
| public static void ThreadMethod() | |
| { | |
| for (int i = 0; i < 10; i++) |
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
| <!DOCTYPE html> | |
| <html> | |
| <meta charset="utf-8"/> | |
| <head> | |
| <link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.3/dist/leaflet.css" /> | |
| <script src="https://unpkg.com/leaflet@1.0.3/dist/leaflet.js"></script> | |
| <style type="text/css"> | |
| #mapid { height: 400px; } | |
| </style> | |
| </head> |
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
| <!DOCTYPE html> | |
| <html> | |
| <meta charset="utf-8"/> | |
| <head> | |
| <link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.3/dist/leaflet.css" /> | |
| <script src="https://unpkg.com/leaflet@1.0.3/dist/leaflet.js"></script> | |
| <style type="text/css"> | |
| #mapid { height: 400px; } | |
| </style> | |
| </head> |
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
| public class foo { | |
| private boolean isOldSignature() { | |
| Context context = this; | |
| final String SIGNATURE = "Put your app signature after retrive in log"; | |
| final boolean VALID = true; | |
| final boolean INVALID = false; | |
| try { | |
| PackageInfo packageInfo = context.getPackageManager() | |
| .getPackageInfo(context.getPackageName(), |
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 Button( | |
| private val onClick: () -> Unit | |
| ) { | |
| fun performClick() { | |
| onClick() | |
| } | |
| } | |
| class ButtonClickListener( | |
| var name: String |
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
| import javax.inject.Qualifier | |
| @Qualifier | |
| annotation class Dispatcher(val appDispatcher: AppDispatchers) | |
| enum class AppDispatchers { | |
| Default, | |
| IO, | |
| } |
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
| import [your_app_package].common.network.AppDispatchers.Default | |
| import [your_app_package].common.network.AppDispatchers.IO | |
| import [your_app_package].common.network.Dispatcher | |
| import dagger.Module | |
| import dagger.Provides | |
| import dagger.hilt.InstallIn | |
| import dagger.hilt.components.SingletonComponent | |
| import kotlinx.coroutines.CoroutineDispatcher | |
| import kotlinx.coroutines.Dispatchers |
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
| import [your_app_package].core.network.Dispatcher | |
| import [your_app_package].core.network.AppDispatchers.Default | |
| import dagger.Module | |
| import dagger.Provides | |
| import dagger.hilt.InstallIn | |
| import dagger.hilt.components.SingletonComponent | |
| import kotlinx.coroutines.CoroutineDispatcher | |
| import kotlinx.coroutines.CoroutineScope | |
| import kotlinx.coroutines.SupervisorJob | |
| import javax.inject.Qualifier |
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
| @Module | |
| @InstallIn(SingletonComponent::class) | |
| object CoroutineScopesModule { | |
| @Provides | |
| @Singleton | |
| @ApplicationScope | |
| fun providesApplicationScopeWithIODiapatcher( | |
| @Dispatcher(IO) ioDispatcher: CoroutineDispatcher, | |
| @ApplicationScope scope: CoroutineScope, | |
| ): CoroutineScope = CoroutineScope(scope.coroutineContext + ioDispatcher) // <- What I meant by updating dispatcher |
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
| sealed interface Result<out T> { | |
| data class Success<T>(val data: T) : Result<T> | |
| data class Error(val exception: Throwable? = null) : Result<Nothing> | |
| data object Loading : Result<Nothing> | |
| } |
OlderNewer