Skip to content
This repository has been archived by the owner on Jun 13, 2018. It is now read-only.

Commit

Permalink
v0.9.3 (Add support to <fragment> tag)
Browse files Browse the repository at this point in the history
  • Loading branch information
nuuneoi committed Mar 19, 2015
1 parent 4e7b80e commit 915a7d3
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 15 deletions.
12 changes: 8 additions & 4 deletions README.md
Expand Up @@ -4,7 +4,7 @@ The library is documented in http://inthecheesefactory.com/blog/best-approach-to

# Version

0.9.2
0.9.3

# Installation

Expand All @@ -14,15 +14,15 @@ StatedFragment for Android Support Library v4's Fragment

```sh
dependencies {
compile 'com.inthecheesefactory.thecheeselibrary:stated-fragment-support-v4:0.9.2'
compile 'com.inthecheesefactory.thecheeselibrary:stated-fragment-support-v4:0.9.3'
}
```

StatedFragment for Android's Fragment

```sh
dependencies {
compile 'com.inthecheesefactory.thecheeselibrary:stated-fragment:0.9.2'
compile 'com.inthecheesefactory.thecheeselibrary:stated-fragment:0.9.3'
}
```

Expand Down Expand Up @@ -64,7 +64,7 @@ public class MainFragment extends StatedFragment {

### onActivityResult for Nested Fragment

In **v0.9.2**, `StatedFragment` comes up with a feature that can fix `onActivityResult` problem which couldn't be called on nested fragment. To use it, you have to override `onActivityResult` on your `Activity` and add a line of code:
In **v0.9.2** onward, `StatedFragment` comes up with a feature that can fix `onActivityResult` problem which couldn't be called on nested fragment. To use it, you have to override `onActivityResult` on your `Activity` and add a line of code:

```java
@Override
Expand All @@ -89,6 +89,10 @@ Lastly, override `onActivityResult` in your fragment in the standard way.

# Change Logs

### v0.9.3

Add support to `<fragment>` tag.

### v0.9.2

Add onActivityResult feature for nested fragment.
Expand Down
1 change: 1 addition & 0 deletions app/app.iml
Expand Up @@ -82,6 +82,7 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Expand Up @@ -27,7 +27,7 @@ libraryDescription = Android's Fragment that could handle state saving and resto
siteUrl = https://github.com/nuuneoi/StatedFragment
gitUrl = https://github.com/nuuneoi/StatedFragment.git

libraryVersion = 0.9.2
libraryVersion = 0.9.3

developerId = nuuneoi
developerName = Sittiphol Phanvilai
Expand Down
Expand Up @@ -17,6 +17,8 @@ public class StatedFragment extends Fragment {

public StatedFragment() {
super();
if (getArguments() == null)
setArguments(new Bundle());
}

@Override
Expand Down Expand Up @@ -61,7 +63,8 @@ private void saveStateToArguments() {
savedState = saveState();
if (savedState != null) {
Bundle b = getArguments();
b.putBundle("internalSavedViewState8954201239547", savedState);
if (b != null)
b.putBundle("internalSavedViewState8954201239547", savedState);
}
}

Expand All @@ -71,10 +74,12 @@ private void saveStateToArguments() {

private boolean restoreStateFromArguments() {
Bundle b = getArguments();
savedState = b.getBundle("internalSavedViewState8954201239547");
if (savedState != null) {
restoreState();
return true;
if (b != null) {
savedState = b.getBundle("internalSavedViewState8954201239547");
if (savedState != null) {
restoreState();
return true;
}
}
return false;
}
Expand Down
Expand Up @@ -17,6 +17,8 @@ public class StatedFragment extends Fragment {

public StatedFragment() {
super();
if (getArguments() == null)
setArguments(new Bundle());
}

@Override
Expand Down Expand Up @@ -61,7 +63,8 @@ private void saveStateToArguments() {
savedState = saveState();
if (savedState != null) {
Bundle b = getArguments();
b.putBundle("internalSavedViewState8954201239547", savedState);
if (b != null)
b.putBundle("internalSavedViewState8954201239547", savedState);
}
}

Expand All @@ -71,10 +74,12 @@ private void saveStateToArguments() {

private boolean restoreStateFromArguments() {
Bundle b = getArguments();
savedState = b.getBundle("internalSavedViewState8954201239547");
if (savedState != null) {
restoreState();
return true;
if (b != null) {
savedState = b.getBundle("internalSavedViewState8954201239547");
if (savedState != null) {
restoreState();
return true;
}
}
return false;
}
Expand Down

0 comments on commit 915a7d3

Please sign in to comment.