A Simple Android library to read through text and give you the time it will take you to finish an article.
- Androidx
- Kotlin
And add a dependency code to your module's build.gradle file.
dependencies {
implementation 'com.github.wise4rmgod:ReadTime:0.1.0'
}
Add below codes to your root build.gradle file (not your module build.gradle file).
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import kotlinx.android.synthetic.main.activity_main.*
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val ty = "f your audience reads slower or faster than 200 words per minute — \n" +
" perhaps your blog is in English, which isn’t your audience’s first language, or perhaps your material is extremely\n" +
" basic and easy to skim — then you’ll want to use calculator instead. First, you’ll have to divide your total word \n" +
" count by the average words read per minute of your audience. Let’s say your 938-word article has an audience that \n" +
" reads 150 words per minute. That gives you 6.253. Enter 6.253 into the Decimal-to-Time Calculator, choose “Minutes” \n" +
" from the drop-down menu and press “Calculate.”\n" +
" Immediately, you’ll get a minute and seconds estimate. In this case, it’s 6 minutes and 15 seconds."
//min read
// text.text = minread.readtime(ty)
//word count
wordct.text = minread.countWords(ty).toString()
//custom message in the min read
minread.text = minread.custome_minread(ty,"min read")
}
}
feel free to open an issue if any or contribute to it, its an open source library.
MIT License
nwokocha Wisdom - Android Engineer @Savics