Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for cases where a return intent should be sent #96

Merged
merged 1 commit into from
Jul 10, 2016
Merged
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
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