From 62eed923c121e5246f6c2b20d9cc26e4772ecc35 Mon Sep 17 00:00:00 2001 From: Derek Markell Date: Wed, 20 Aug 2025 11:26:47 -0400 Subject: [PATCH 1/2] Bump version to 0.2.1-SNAPSHOT --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 233383325058062e7208c521aca890e36410df55 Mon Sep 17 00:00:00 2001 From: Derek Markell Date: Wed, 20 Aug 2025 11:33:00 -0400 Subject: [PATCH 2/2] Update readme --- README.md | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) 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