Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,38 @@
# 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](https://github.com/elimu-ai/common-utils/blob/1.0.1/utils/src/main/java/ai/elimu/common/utils/viewmodel/TextToSpeechViewModelImpl.kt),
which is implemented using [Hilt](https://developer.android.com/training/dependency-injection/hilt-android) and
[kapt](https://kotlinlang.org/docs/kapt.html)
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
```groovy
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
```groovy
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
```groovy
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
```kotlin
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
12 changes: 7 additions & 5 deletions utils/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,19 @@ plugins {
id 'org.ajoberstar.grgit'
}

def libVersion = '1.0.1-SNAPSHOT'
def group = "ai.elimu.common"
def artifact = "utils"

android {
namespace 'ai.elimu.common.utils'
compileSdk 35

defaultConfig {
minSdk 26

versionCode 1000001
versionName libVersion
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
Expand Down Expand Up @@ -53,10 +59,6 @@ dependencies {
androidTestImplementation libs.androidx.espresso.core
}

def libVersion = '1.0.0'
def group = "ai.elimu.common"
def artifact = "utils"

publishing {
publications {
release(MavenPublication) {
Expand Down Expand Up @@ -206,4 +208,4 @@ tasks.register('releasePerform') {
}
println "Done!"
}
}
}