Skip to content

Commit

Permalink
Merge pull request #96 from bkromhout/master
Browse files Browse the repository at this point in the history
Allow for cases where a return intent should be sent (fixes #95)
  • Loading branch information
heinrichreimer committed Jul 10, 2016
2 parents 17cf16d + 0dc7caf commit f90a214
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.ActivityManager;
import android.content.Intent;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.content.res.TypedArray;
Expand All @@ -18,13 +19,7 @@
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.ColorInt;
import android.support.annotation.ColorRes;
import android.support.annotation.IntDef;
import android.support.annotation.IntRange;
import android.support.annotation.InterpolatorRes;
import android.support.annotation.NonNull;
import android.support.annotation.StringRes;
import android.support.annotation.*;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.content.ContextCompat;
Expand All @@ -46,7 +41,6 @@
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.TextSwitcher;

import com.heinrichreimersoftware.materialintro.R;
import com.heinrichreimersoftware.materialintro.slide.ButtonCtaSlide;
import com.heinrichreimersoftware.materialintro.slide.Slide;
Expand Down Expand Up @@ -447,7 +441,9 @@ private boolean canGoBackward(int position, boolean notifyListeners) {

private boolean finishIfNeeded() {
if (positionOffset == 0 && position == adapter.getCount()) {
setResult(RESULT_OK);
Intent returnIntent = makeReturnIntent();
if (returnIntent != null) setResult(RESULT_OK, returnIntent);
else setResult(RESULT_OK);
finish();
overridePendingTransition(0, 0);
return true;
Expand Down Expand Up @@ -1203,6 +1199,10 @@ public List<Slide> setSlides(List<? extends Slide> list) {
return adapter.setSlides(list);
}

public Intent makeReturnIntent() {
return null;
}

private class IntroPageChangeListener extends FadeableViewPager.SimpleOnOverscrollPageChangeListener {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
Expand Down

0 comments on commit f90a214

Please sign in to comment.