Skip to content

Commit b2469e4

Browse files
committed
Release 0.5.0
1 parent c35705d commit b2469e4

File tree

5 files changed

+41
-12
lines changed

5 files changed

+41
-12
lines changed

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# CHANGELOG
22

3+
## 0.5.0
4+
_2020-07-14_
5+
6+
**Breaking change**: Update DeferredDrawable.Resource's `transformations` constructor parameter to
7+
receive the resolving Context as a parameter. This breaks binary compatibility by removing
8+
constructors with a Function1 parameter in their signature (replaced by a Function2 parameter). This
9+
also breaks source compatibility for Java consumers but not for Kotlin consumers.
10+
11+
Add `deferred-resources-view-extensions` to simplify use of Deferred Resources with Views. Basic
12+
extensions are provided for View, TextView, and ImageView.
13+
14+
Add `DeferredColorWithAlpha` along with a corresponding `withAlpha` extension on `DeferredColor`, to
15+
make alpha transformations on unresolved `DeferredColor`s simple.
16+
317
## 0.4.0
418
_2020-06-23_
519

README.md

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,13 @@ repository](https://oss.sonatype.org/#view-repositories;snapshots~browsestorage)
1717

1818
```groovy
1919
implementation "com.backbase.oss.deferredresources:deferred-resources:$version"
20+
implementation "com.backbase.oss.deferredresources:deferred-resources-view-extensions:$version"
2021
```
2122

2223
## Use
2324

24-
In the view layer, resolve a deferred resource to display it:
25-
```kotlin
26-
val text: DeferredText = viewModel.getText()
27-
val textColor: DeferredColor = viewModel.getTextColor()
28-
textView.text = text.resolve(context)
29-
textView.setTextColor(textColor.resolve(context))
30-
```
31-
3225
In the logic layer, declare the resource values however you like, without worrying about their
33-
resolution:
26+
resolution or about Context:
3427
```kotlin
3528
class LocalViewModel : MyViewModel {
3629
override fun getText(): DeferredText = DeferredText.Resource(R.string.someText)
@@ -43,6 +36,20 @@ class RemoteViewModel(private val api: Api) : MyViewModel {
4336
}
4437
```
4538

39+
In the view layer, resolve a deferred resource to display it:
40+
```kotlin
41+
val text: DeferredText = viewModel.getText()
42+
val textColor: DeferredColor = viewModel.getTextColor()
43+
textView.text = text.resolve(context)
44+
textView.setTextColor(textColor.resolve(context))
45+
```
46+
47+
With view extensions, this is even simpler:
48+
```kotlin
49+
textView.setText(viewModel.getText())
50+
textView.setTextColor(viewModel.getTextColor())
51+
```
52+
4653
## License
4754
```
4855
Copyright 2020 Backbase R&D, B.V.

RELEASING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
1. Make sure you're on the main branch.
44
2. Change `ext.libraryVersion` in the root build.gradle to a non-SNAPSHOT version.
55
3. Update CHANGELOG.md for the impending release.
6-
4. If necessary, update README.md.
6+
4. If necessary, update README.md and docs/index.md.
77
5. Commit (don't push) the changes with message "Release x.y.z", where x.y.z is the new version.
88
6. Tag the commit `x.y.z`, where x.y.z is the new version.
99
7. Change `ext.libraryVersion` in the root build.gradle to the next SNAPSHOT version.

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ buildscript {
3939

4040
ext {
4141
publishGroup = 'com.backbase.oss.deferredresources'
42-
libraryVersion = '0.5.0-SNAPSHOT'
42+
libraryVersion = '0.5.0'
4343
minSdk = 14
4444
targetSdk = 29
4545
buildToolsVersion = '29.0.3'

docs/index.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ repository/configuration layers to remain ignorant of Android's Context.
88
## Example
99

1010
In the logic layer, declare the resource values however you like, without worrying about their
11-
resolution:
11+
resolution or about Context:
1212
```kotlin
1313
// Resource/attribute-based text and color:
1414
class LocalViewModel : MyViewModel {
@@ -31,12 +31,20 @@ textView.text = text.resolve(context)
3131
textView.setTextColor(textColor.resolve(context))
3232
```
3333

34+
With view extensions, this is even simpler. The View's own Context is used to resolve any deferred
35+
resource types:
36+
```kotlin
37+
textView.setText(viewModel.getText())
38+
textView.setTextColor(viewModel.getTextColor())
39+
```
40+
3441
### Import
3542

3643
To use Deferred Resources, add the library as a dependency to your Android module:
3744

3845
```groovy
3946
dependencies {
4047
implementation "com.backbase.oss.deferredresources:deferred-resources:$version"
48+
implementation "com.backbase.oss.deferredresources:deferred-resources-view-extensions:$version"
4149
}
4250
```

0 commit comments

Comments
 (0)