https://github.com/chrynan/precomputed-text

A convenient Kotlin Coroutine wrapper around Android's PrecomputedTextCompat.

https://github.com/chrynan/precomputed-text

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (9.9%) to scientific vocabulary

Keywords

android android-library coroutines kotlin kotlin-coroutines kotlin-library precomputedtext text
Last synced: 5 months ago · JSON representation

Repository

A convenient Kotlin Coroutine wrapper around Android's PrecomputedTextCompat.

Basic Info
  • Host: GitHub
  • Owner: chRyNaN
  • License: apache-2.0
  • Language: Kotlin
  • Default Branch: main
  • Homepage:
  • Size: 81.1 KB
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 1
Topics
android android-library coroutines kotlin kotlin-coroutines kotlin-library precomputedtext text
Created almost 5 years ago · Last pushed almost 5 years ago
Metadata Files
Readme License

README.md

precomputed-text

A convenient Kotlin Coroutine wrapper around Android PrecomputedTextCompat.
GitHub tag (latest by date)

kotlin preComputeText(textView = textView, computeText = { textGenerator.generate() })

Using the library

Getting PrecomputedTextCompat.Params from a TextView

kotlin textView.textMetricParams

Setting PrecomputedTextCompat text to a TextView

kotlin textView.setPreComputedText(precomputedTextCompat)

Pre-computing text for a TextView

```kotlin myCoroutineScope.launch { val text = preComputeText(textView = textView, computeText = { ... })

withContext(dispatchers.main) {
    textView.setPreComputedText(text)
}

} ```

Pre-computing and rendering text for a TextView in a single call

kotlin preComputeTextAndRender( textView = textView, // Or params = textView.textMetricParams computeText = { ... }, coroutineScope = myCoroutineScope )

Using Kotlin Coroutine Flows

kotlin flowOfPreComputedText( params = textView.textMetricParams, // Or textView = textView computeText = { ... }) .flowOn(dispatchers.io) .renderToTextView(textView) .flowOn(dispatchers.main) .launchIn(myCoroutineScope)

Making multiple text generation passes and emitting the progress

kotlin flowOfConcurrentPreComputedText( textView = textView, // Or params = textView.textMetricParams computeText = { ... }, // The first pass to generate the text inOrderTextComputers = listOf( ... )) // Consecutive passes to generate the text .flowOn(dispatchers.io) .renderToTextView(textView) .flowOn(dispatchers.main) .launchIn(myCoroutineScope)

Documentation

Have a look at the docs folder for documentation and more information about usage.

Building the library

The library is provided through Repsy. Checkout the releases page to get the latest version.
GitHub tag (latest by date)

Repository

groovy repositories { maven { url "https://repo.repsy.io/mvn/chrynan/public" } }

Dependencies

groovy implementation "com.chrynan.precomputedtext:precomputedtext-android:0.1.0-release"

License

``` Copyright 2021 chRyNaN

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ```

Owner

  • Name: Christopher
  • Login: chRyNaN
  • Kind: user
  • Location: Austin, TX
  • Company: Starry

GitHub Events

Total
Last Year

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 3
  • Total Committers: 1
  • Avg Commits per committer: 3.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Chris c****n@s****m 3
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 7 months ago