Skip to content

This repository provides commonly shared functions being used across Android apps

License

Notifications You must be signed in to change notification settings

elimu-ai/common-utils

Repository files navigation

common-utils

This repository provides commonly shared functions being used across Android apps

How to use TTS function?

The TTS function is provided via TextToSpeechViewModel, which is implemented using Hilt and kapt So, make sure you have Hilt & kapt imported in your projects via below check-list:

  1. Add Hilt and kapt plugins in app/build.gradle file
    apply plugin: 'dagger.hilt.android.plugin'
    apply plugin: 'org.jetbrains.kotlin.android'
    apply plugin: 'kotlin-kapt'
  2. Add Hilt & common-utils dependencies in app/build.gradle file
    implementation 'com.github.elimu-ai:common-utils:1.0.1'
    implementation 'com.google.dagger:hilt-android:2.55'
    kapt 'com.google.dagger:hilt-compiler:2.55'
  3. Add Hilt & Kotlin gradle plugin classpaths to project's build.gradle file
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.0"
    classpath "com.google.dagger:hilt-android-gradle-plugin:2.55"
  4. Add @HiltAndroidApp to your Application class
  5. Add @AndroidEntryPoint to your Activity/Fragment
  6. Initialize your TextToSpeechViewModel in your onCreate method of your Activity/Fragment
    private lateinit var ttsViewModel: TextToSpeechViewModel
    fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        ttsViewModel = ViewModelProvider(this)[TextToSpeechViewModelImpl::class.java]
    }
  7. Now you're ready to use the Text to Speech function

How to publish a snapshot for local development & testing?

  1. Change the libVersion and versionCode in https://github.com/elimu-ai/common-utils/blob/main/utils/build.gradle
  2. Under publishing -> repositories block in the same Gradle script: Replace the existing maven repo by mavenLocal()
  3. Run ./gradlew clean utils:publishReleasePublicationToMavenLocal from project's root folder
  4. In app side: Add mavenLocal() to repositories block in build.gradle script
  5. Implement ai.elimu.common:utils:$snapshot_version in app's build.gradle file
  6. You're now ready to test the snapshot!

How to release a new version?

  1. Update versionCode, versionName in utils/build.gradle file by increment either major/minor/patch number and merge to main (Do not remove the SNAPSHOT suffix)
  2. Trigger Release task in Github Actions on main branch
  3. Draft a new Release in https://github.com/elimu-ai/common-utils/releases

elimu.ai - Free open-source learning software for out-of-school children πŸš€βœ¨

Website 🌐  β€’  Wiki πŸ“ƒ  β€’  Projects πŸ‘©πŸ½β€πŸ’»  β€’  Milestones 🎯  β€’  Community πŸ‘‹πŸ½  β€’  Support πŸ’œ