https://github.com/taig/viewvalue
Android View API helper
https://github.com/taig/viewvalue
Last synced: 5 months ago
JSON representation
Android View API helper
- Host: GitHub
- URL: https://github.com/taig/viewvalue
- Owner: taig
- License: mit
- Archived: true
- Created: 2016-02-11T15:43:16.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-12-19T10:12:01.000Z (over 9 years ago)
- Last Synced: 2025-04-19T14:09:08.751Z (about 1 year ago)
- Language: Scala
- Size: 66.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# ViewValue
> Android View API helper
## Dependencies
```scala
"io.taig.android" %% "viewvalue" % "1.5.0"
```
## Usage
````scala
import android.widget.TextView
import io.taig.android.viewvalue.implicits._
val tv: TextView = new TextView( context )
val c1 = tv.value[String]
val c2 = tv.value[Option[String]]
tv.value = "foo"
tv.value = Some( "foo" )
tv.value = None
tv.error = Some( "my error message" )
tv.error = "my error message"
tv.error = None
````
## Supported widgets
### Core
#### Value
| Widget | Injections | Extractions | Description |
| --- | --- | --- | --- |
| `CompoundButton` | `Boolean` | `Boolean` | Checked state |
| `ImageView` | `Drawable`, `Bitmap`, `Int` (resource), `Uri` | `Drawable` | Image drawable (foreground) |
| `RadioGroup` | `Int`, `Option[Int]` | `Int`, `Option[Int]` | Selected item id |
| `TextView` | `CharSequence`, `Option[CharSequence]`, `Int` (resource) | `String`, `Option[String]` | Text value |
#### Error
| Widget | Injections | Extractions | Description |
| --- | --- | --- | --- |
| `TextView` | `CharSequence`, `Option[CharSequence]`, `Int` (resource) | `Option[String]` | Error value |
### Design
#### Value
| Widget | Injections | Extractions | Description |
| --- | --- | --- | --- |
| `TextInputLayout` | `CharSequence`, `Option[CharSequence]`, `Int` (resource) | `String`, `Option[String]` | Text value of the inner `EditText` |
#### Error
| Widget | Injections | Extractions | Description |
| --- | --- | --- | --- |
| `TextInputLayout` | `CharSequence`, `Option[CharSequence]`, `Int` (resource) | `Option[String]` | Error value |
| `TextView` | `CharSequence`, `Option[CharSequence]`, `Int` (resource) | `Option[String]` | Error value will be forwarded to parent `TextInputLayout` (if available) |