diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7546c08..4df0bd9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,8 +1,15 @@
Change Log
==========
+Version 1.2.0 *(2019-05-30)*
+----------------------------
+
+ * `Bridge` can now save the state of `View` objects. You may now optionally provide a `ViewSavedStateHandler` to `Bridge.initialize` in order to unlock this functionality.
+ * Improved performance during configuration changes and when navigating while apps are in the foreground.
+
Version 1.1.3 *(2018-10-08)*
----------------------------
+
* `Bridge.clear` is now safe to call in `Activity.onDestroy` when "Don't Keep Activities" is enabled.
* All data is now correctly cleared on fresh launches for apps that do not use `Bridge` in every `Activity`.
* Min SDK is now 14.
diff --git a/README.md b/README.md
index 8f780da..4daa9c9 100644
--- a/README.md
+++ b/README.md
@@ -9,6 +9,7 @@ A library for avoiding TransactionTooLargeException during state saving and rest
* [Motivation](#motivation)
* [Setup](#setup)
* [Clearing Data](#clear)
+* [Bridge for Views](#views)
* [Install](#install)
* [How Does It Work](#how)
* [Limitations](#limitations)
@@ -84,6 +85,50 @@ This method is typically safe to call without any additional logic, as it will o
In the event that you might like to migrate away from the use of `Bridge` but ensure that all associated data is cleared, `Bridge.clearAll` may be called at any time.
+
+## Bridge for Views
+
+In addition to `Activity`, `Fragment`, presenter, etc. classes, `Bridge` can also be used to assist in saving the state of `View` classes using `View`-specific save and restore methods :
+
+```java
+ @Override
+ protected Parcelable onSaveInstanceState() {
+ return Bridge.saveInstanceState(this, super.onSaveInstanceState());
+ }
+
+ @Override
+ protected void onRestoreInstanceState(Parcelable state) {
+ super.onRestoreInstanceState(Bridge.restoreInstanceState(this, state));
+ }
+```
+
+In order to enable this ability, a `ViewSavedStateHandler` must be passed to the `Bridge.initialize` method. For example:
+
+```java
+ Bridge.initialize(
+ getApplicationContext(),
+ new SavedStateHandler() {
+ ...
+ },
+ new ViewSavedStateHandler() {
+ @NonNull
+ @Override
+ public Parcelable saveInstanceState(
+ @NonNull T target,
+ @Nullable Parcelable parentState) {
+ return Icepick.saveInstanceState(target, parentState);
+ }
+
+ @Nullable
+ @Override
+ public Parcelable restoreInstanceState(
+ @NonNull T target,
+ @Nullable Parcelable state) {
+ return Icepick.restoreInstanceState(target, state);
+ }
+ });
+```
+
## Install
@@ -95,7 +140,7 @@ repositories {
}
dependencies {
- implementation 'com.github.livefront:bridge:v1.1.3'
+ implementation 'com.github.livefront:bridge:v1.2.0'
}
```