Skip to content

AND-145: add TextValue #63

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
18 changes: 4 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,17 @@ Gears could be used together or alone.
- [![Version](https://img.shields.io/maven-central/v/com.redmadrobot.extensions/resources-ktx?style=flat-square&label=resources-ktx)][resources-ktx] — A set of extensions for accessing resources
- [![Version](https://img.shields.io/maven-central/v/com.redmadrobot.extensions/viewbinding-ktx?style=flat-square&label=viewbinding-ktx)][viewbinding-ktx] — A set of extensions for dealing with ViewBinding

### :mag_right: **[ViewModelEvents](viewmodelevents/)**
### :mag_right: **[ViewModelEvents](viewmodelevents/)** [![Version](https://img.shields.io/maven-central/v/com.redmadrobot.gears/kotlin?style=flat-square&label=viewmodelevents)

- [![Version](https://img.shields.io/maven-central/v/com.redmadrobot.gears/kotlin?style=flat-square&label=viewmodelevents-compose)][viewmodelevents-compose] — A set of extensions for dealing with ViewModelEvents inside `@Composable` functions
- [![Version](https://img.shields.io/maven-central/v/com.redmadrobot.gears/kotlin?style=flat-square&label=viewmodelevents-flow)][viewmodelevents-flow] — An implementation of ViewModelEvents via `Flow`
- [![Version](https://img.shields.io/maven-central/v/com.redmadrobot.gears/kotlin?style=flat-square&label=viewmodelevents-livedata)][viewmodelevents-livedata] — An implementation of ViewModelEvents via `LiveData`
`ViewModelEvents` addresses the challenge of buffering and consuming one-time events:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`ViewModelEvents` addresses the challenge of buffering and consuming one-time events:
`ViewModelEvents` addresses the challenge of buffering and consuming one-time events.


### :hourglass_flowing_sand: **[Result Flow](resultflow/)** ![Version](https://img.shields.io/maven-central/v/com.redmadrobot.gears/resultflow?style=flat-square)

A couple of extensions to convert long operations into `Flow<Result<T>>`.

### :speech_balloon: **[TextValue](textvalue/)**
### :speech_balloon: **[TextValue](textvalue/)** ![Version](https://img.shields.io/maven-central/v/com.redmadrobot.textvalue/textvalue?style=flat-square)

- [![Version](https://img.shields.io/maven-central/v/com.redmadrobot.gears/kotlin?style=flat-square&label=textvalue-common)][textvalue-common] - An implementation of the TextValue - an abstraction over Android text
- [![Version](https://img.shields.io/maven-central/v/com.redmadrobot.gears/kotlin?style=flat-square&label=textvalue-compose)][textvalue-compose] - A set of handy tools for dealing with TextValue inside `@Composable` functions
An abstraction over Android text

## Why Gears?

Expand Down Expand Up @@ -76,12 +73,5 @@ For major changes, open a [discussion][discussions] first to discuss what you wo
[gears-compose]: gears/gears-compose
[gears-kotlin]: gears/gears-kotlin

[viewmodelevents-compose]: viewmodelevents/viewmodelevents-compose/
[viewmodelevents-flow]: viewmodelevents/viewmodelevents-flow/
[viewmodelevents-livedata]: viewmodelevents/viewmodelevents-livedata/

[textvalue-common]: textvalue/textvalue-common/
[textvalue-compose]: textvalue/textvalue-compose/

[ci]: https://github.com/RedMadRobot/gears-android/actions?query=branch%3Amain++
[discussions]: https://github.com/RedMadRobot/gears-android/discussions
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@ include(
":viewmodelevents:viewmodelevents-flow",
":viewmodelevents:viewmodelevents-livedata",
":resultflow",
":textvalue:textvalue-common",
":textvalue:textvalue",
":textvalue:textvalue-compose"
)
11 changes: 6 additions & 5 deletions textvalue/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# TextValue <GitHub path="RedMadRobot/textvalue/tree/main/"/>
# TextValue

[![Version](https://img.shields.io/maven-central/v/com.redmadrobot.textvalue/textvalue?style=flat-square)][mavenCentral]
[![License](https://img.shields.io/github/license/RedMadRobot/textvalue?style=flat-square)][license]
[![License](https://img.shields.io/github/license/RedMadRobot/gears-android?style=flat-square)][license]

TextValue is an abstraction allowing to work with a `String` and a string resource ID the same way.

Expand All @@ -25,7 +26,7 @@ repositories {

dependencies {
// Views version
implementation("com.redmadrobot.textvalue:textvalue-common:<version>")
implementation("com.redmadrobot.textvalue:textvalue:<version>")

// Compose extensions for textvalue
implementation("com.redmadrobot.textvalue:textvalue-compose:<version>")
Expand Down Expand Up @@ -73,5 +74,5 @@ There are extensions to work with `TextValue` like with `StringRes`:
Merge requests are welcome.
For major changes, please open an issue first to discuss what you would like to change.

[mavenCentral]: https://search.maven.org/artifact/com.redmadrobot.textvalue/textvalue
[license]: LICENSE
[mavenCentral]: https://central.sonatype.com/artifact/com.redmadrobot.textvalue/textvalue
[license]: ../LICENSE
2 changes: 1 addition & 1 deletion textvalue/textvalue-compose/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
description = "Compose extensions for TextValue"

dependencies {
api(project(":textvalue:textvalue-common"))
api(project(":textvalue:textvalue"))
api(androidx.compose.ui)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ import androidx.compose.ui.platform.LocalContext
@Composable
@ReadOnlyComposable
public fun stringResource(text: TextValue): String {
val resources = resources()
return resources.getString(text)
return resources().getString(text)
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
description = "TextValue is an abstraction over Android text"

android {
namespace = "$group.common"
namespace = "$group"
}

dependencies {
Expand Down