Skip to content
This repository has been archived by the owner on Aug 9, 2020. It is now read-only.

Convenience methods for Result #47

Open
wants to merge 1 commit into
base: 2.x
Choose a base branch
from
Open
Changes from all commits
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
13 changes: 13 additions & 0 deletions rx_activity_result/src/main/java/rx_activity_result2/Result.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package rx_activity_result2;

import android.app.Activity;
import android.content.Intent;

public class Result<T> {
Expand Down Expand Up @@ -46,4 +47,16 @@ public Intent data() {
public T targetUI() {
return targetUI;
}

public boolean isOk() {
return resultCode == Activity.RESULT_OK;
}

public boolean isCanceled() {
return resultCode == Activity.RESULT_CANCELED;
}

public boolean isFirstUser() {
return resultCode == Activity.RESULT_FIRST_USER;
}
}