diff --git a/README.md b/README.md index 0cec70c..4e2906e 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,33 @@ A small Android library for representing and resolving text at the right time and place — without scattering string resolution logic across your UI. +## Installation + +Add the dependencies to your `build.gradle`: +```kotlin +dependencies { + implementation("io.github.dkmarkell.textresource:core:") + + // If you use Compose: + implementation("io.github.dkmarkell.textresource:compose:") +} +``` + +## Quick Start + +```kotlin +// ViewModel +val title = TextResource.simple(R.string.greeting, userName) + +// Compose +Text(title.resolveString()) + +// Views +textView.text = title.resolveString(context) +``` + +Check out the [Sample app](./sample) for a complete demo. + ## Why? In a clean architecture, your ViewModel (or presenter) should decide what text is displayed, but not actually need to hold a Context to do it. With Android’s resource system, resolving strings usually requires a Context — which is either unavailable or awkward to inject. @@ -68,16 +95,6 @@ textView.text = greeting.resolveString(context) ``` The UI (Activity/Fragment/Composable) provides the context at render time when resolving the string. -## Installation - -Add the dependencies to your `build.gradle`: -```kotlin -dependencies { - implementation("io.github.dkmarkell.textresource:core:") - implementation("io.github.dkmarkell.textresource:compose:") -} -``` - ## Usage ### Creating TextResource diff --git a/gradle.properties b/gradle.properties index f977c13..5ccb2d3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -22,5 +22,5 @@ kotlin.code.style=official # thereby reducing the size of the R class for that library android.nonTransitiveRClass=true GROUP=io.github.dkmarkell -VERSION_NAME=0.2.0 +VERSION_NAME=0.2.1-SNAPSHOT kotlin.explicitApi=strict \ No newline at end of file