This file contains 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
One can specifies a different port than the usual 8080 to make it unique and avoid any errors, in case another service is using Jenkins | |
java -jar jenkins.war --httpPort=9091 | |
Next Step: Configure Jenkins | |
Manage Jenkins > Configure System | |
Mentioned the ANDROID_HOME as my Android SDK path variable in Global properties. | |
2. Manage Jenkins > Global Tool Configuration |
This file contains 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
override fun onStop() { | |
super.onStop() | |
unregisterReceiver(broadcastReceiver) | |
killService(locationListener) | |
} |
This file contains 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
val appComponent: List<Module> = listOf(dataBaseModule, networkModule, activityModule) |
This file contains 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
@Singleton | |
@Component( | |
modules = [ | |
DataBaseModule::class, | |
NetworkModule::class, | |
ActivityModule::class] | |
) | |
interface AppComponent { | |
@Component.Builder | |
interface Builder { |
This file contains 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
val dataBaseModule = module { | |
single { | |
Room.databaseBuilder(androidContext(), AppDatabase::class.java, BuildConfig.APPLICATION_ID) | |
.fallbackToDestructiveMigration() | |
.build() | |
} | |
single { (get() as AppDatabase).hotelsDao() } | |
single { (get() as AppDatabase).visitors() } |
This file contains 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 | |
class DataBaseModule { | |
@Provides | |
@Singleton | |
fun provideRoom(app: Application): AppDatabase = Room | |
.databaseBuilder(app, AppDatabase::class.java, BuildConfig.APPLICATION_ID) | |
.build() | |
@Provides | |
@Singleton |
This file contains 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
@Singleton | |
class ViewModelFactory @Inject constructor(private val viewModels: MutableMap<Class<out ViewModel>, Provider<ViewModel>>) : ViewModelProvider.Factory { | |
override fun <T : ViewModel> create(modelClass: Class<T>): T = viewModels[modelClass]?.get() as T | |
} | |
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER) | |
@kotlin.annotation.Retention(AnnotationRetention.RUNTIME) | |
@MapKey |
This file contains 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
@Singleton | |
class ViewModelFactory @Inject constructor(private val viewModels: MutableMap<Class<out ViewModel>, Provider<ViewModel>>) : ViewModelProvider.Factory { | |
override fun <T : ViewModel> create(modelClass: Class<T>): T = viewModels[modelClass]?.get() as T | |
} | |
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER) | |
@kotlin.annotation.Retention(AnnotationRetention.RUNTIME) | |
@MapKey |
This file contains 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
// define scope in your module | |
module { | |
scope("scope_id") { Presenter() } | |
} | |
// use scope in your activity | |
class SomeActivity: AppCompatActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
// ... other required stuff |
This file contains 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
implementation "org.koin:koin-android:${koinVersion}" | |
implementation "org.koin:koin-androidx-scope:${koinVersion}" // optional | |
implementation "org.koin:koin-androidx-viewmodel:${koinVersion}" // optional |
NewerOlder