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

SliderLayout #256

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
6 changes: 4 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@ task wrapper(type: Wrapper) {
buildscript {
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.2'
classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.10.+'
classpath 'com.android.tools.build:gradle:2.2.0'
classpath 'com.github.JakeWharton:sdk-manager-plugin:220bf7a88a7072df3ed16dc8466fb144f2817070'
}
}

allprojects {
repositories {
mavenCentral()

}
}
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sun May 03 23:34:25 CST 2015
#Mon Oct 24 10:24:31 CEST 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import android.os.Message;
import android.support.v4.view.PagerAdapter;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
Expand Down Expand Up @@ -86,6 +87,7 @@
*/
public class SliderLayout extends RelativeLayout{

private static final String LOG_TAG = "Android SLIDER";
private Context mContext;
/**
* InfiniteViewPager is extended from ViewPagerEx. As the name says, it can scroll without bounder.
Expand All @@ -106,14 +108,14 @@ public class SliderLayout extends RelativeLayout{
/**
* A timer and a TimerTask using to cycle the {@link com.daimajia.slider.library.Tricks.ViewPagerEx}.
*/
private Timer mCycleTimer;
private TimerTask mCycleTask;
private static Timer mCycleTimer;
private static TimerTask mCycleTask;

/**
* For resuming the cycle, after user touch or click the {@link com.daimajia.slider.library.Tricks.ViewPagerEx}.
*/
private Timer mResumingTimer;
private TimerTask mResumingTask;
private static Timer mResumingTimer;
private static TimerTask mResumingTask;

/**
* If {@link com.daimajia.slider.library.Tricks.ViewPagerEx} is Cycling
Expand Down Expand Up @@ -526,6 +528,18 @@ public void setPresetTransformer(Transformer ts){
}


@Override
public void onDetachedFromWindow() {
super.onDetachedFromWindow();
Log.d(LOG_TAG, "onDetachedFromWindow() ***");
if(mCycleTimer != null) mCycleTimer.cancel();
if(mCycleTask != null) mCycleTask.cancel();
if(mResumingTask != null) mResumingTask.cancel();
if(mResumingTimer != null) mResumingTimer.cancel();
mh.removeCallbacksAndMessages(null);
}



/**
* Set the visibility of the indicators.
Expand Down