Skip to content

Commit

Permalink
remove onComplete callback for RxRequestAction
Browse files Browse the repository at this point in the history
  • Loading branch information
donchenko_r committed Oct 23, 2017
1 parent 1333236 commit ec72cd1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 33 deletions.
2 changes: 1 addition & 1 deletion actionhandler/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apply plugin: 'com.android.library'
ext {
libraryVersionMajor = 1
libraryVersionMinor = 2
libraryVersionRevision = 0
libraryVersionRevision = 1

libraryVersion = libraryVersionMajor + '.' + libraryVersionMinor + '.' + libraryVersionRevision

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
* @param <M> The type of model which can be handled
*/
public abstract class RxRequestAction<RM, M> extends RequestAction<RM, M> implements Cancelable {
public static final Object NO_RESULT = new Object();

protected CompositeDisposable mDisposable;
protected boolean mUnsubscribeOnNewRequest = true;

Expand Down Expand Up @@ -73,7 +75,6 @@ protected void onMakeRequest(final Context context, final View view, final Strin
@Override
public void onSuccess(RM response) {
onResponseSuccess(context, view, actionType, model, response);
onResponseCompleted(context, view, actionType, model);
}

@Override
Expand Down Expand Up @@ -135,35 +136,4 @@ public void cancel() {
@Nullable
protected abstract Single<RM> getRequest(Context context, View view, String actionType, M model, @Nullable Object payload);

/**
* Called when request observable emits "onComplete" event.
* Hides progress dialog if enabled
*
* @param context The Context, which generally get from view by {@link View#getContext()}
* @param view The view, which can be used for prepare any visual effect (like animation),
* Generally it is that view which was clicked and initiated action to fire
* @param actionType Type of the action which was executed.
* @param oldModel The model which was used in request.
*/
protected void onResponseCompleted(Context context, View view, String actionType, M oldModel) {
if (mShowProgressEnabled) hideProgressDialog();
}

/**
* Called on request observable emits "onNext" event.
* Overrides super, so that does not hide progress dialog but calls {@link #notifyOnActionFired} here.
* See {@link #onResponseCompleted(Context, View, String, Object)} for that.
*
* @param context The Context, which generally get from view by {@link View#getContext()}
* @param view The view, which can be used for prepare any visual effect (like animation),
* Generally it is that view which was clicked and initiated action to fire
* @param actionType Type of the action which was executed.
* @param oldModel The model which was used in request.
* @param response network response
*/
@Override
protected void onResponseSuccess(Context context, View view, String actionType, M oldModel, RM response) {
// super.onResponseSuccess(context, view, actionType, oldModel, response);
notifyOnActionFired(view, actionType, oldModel, response);
}
}

0 comments on commit ec72cd1

Please sign in to comment.