Skip to content

Commit

Permalink
Update libs versions
Browse files Browse the repository at this point in the history
Fix callback issue when page changed not fired
when scroll to the position without any further
adjustment (easy to reproduce for the first item).
  • Loading branch information
dryaz committed Apr 28, 2017
1 parent a26cd9e commit 488c593
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 28 deletions.
17 changes: 10 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ repositories {
apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
compileSdkVersion 25
buildToolsVersion "25.0.3"

defaultConfig {
applicationId "com.lsjwzh.widget.recyclerviewpagerdeomo"
minSdkVersion 11
targetSdkVersion 22
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
Expand All @@ -33,9 +33,12 @@ dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':lib')
compile project(':tablayoutsupport')
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:support-v13:25.3.1'

compile 'com.github.bumptech.glide:glide:3.6.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'de.hdodenhof:circleimageview:1.3.0'
}
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'com.android.tools.build:gradle:2.3.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
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 @@
#Wed Apr 27 11:07:47 IDT 2016
#Fri Apr 28 13:11:28 MSK 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
12 changes: 7 additions & 5 deletions lib/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 23
buildToolsVersion '23.0.3'
compileSdkVersion 25
buildToolsVersion '25.0.3'
defaultConfig {
minSdkVersion 7
targetSdkVersion 23
minSdkVersion 9
targetSdkVersion 25
versionCode 27
versionName "1.0.12"
}
Expand All @@ -25,5 +25,7 @@ android {

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:recyclerview-v7:23.3.0'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
}
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,21 @@ protected void onTargetFound(View targetView, RecyclerView.State state, Action a
protected float calculateSpeedPerPixel(DisplayMetrics displayMetrics) {
return mMillisecondsPerInch / displayMetrics.densityDpi;
}

@Override
protected void onStop() {
super.onStop();
if (mOnPageChangedListeners != null) {
for (OnPageChangedListener onPageChangedListener : mOnPageChangedListeners) {
if (onPageChangedListener != null) {
onPageChangedListener.OnPageChanged(mPositionBeforeScroll, mSmoothScrollTargetPosition);
}
}
}
mHasCalledOnPageChanged = true;
}
};

linearSmoothScroller.setTargetPosition(position);
if (position == RecyclerView.NO_POSITION) {
return;
Expand Down Expand Up @@ -535,14 +549,6 @@ public void onScrollStateChanged(int state) {
if (DEBUG) {
Log.d("@", "onPageChanged:" + mSmoothScrollTargetPosition);
}
if (mOnPageChangedListeners != null) {
for (OnPageChangedListener onPageChangedListener : mOnPageChangedListeners) {
if (onPageChangedListener != null) {
onPageChangedListener.OnPageChanged(mPositionBeforeScroll, mSmoothScrollTargetPosition);
}
}
}
mHasCalledOnPageChanged = true;
mPositionBeforeScroll = mSmoothScrollTargetPosition;
}
// reset
Expand Down Expand Up @@ -582,6 +588,11 @@ private int safeTargetPosition(int position, int count) {
}

public interface OnPageChangedListener {
/**
* Fires when viewpager changes it's page
* @param oldPosition old position
* @param newPosition new position
*/
void OnPageChanged(int oldPosition, int newPosition);
}

Expand Down
10 changes: 5 additions & 5 deletions tablayoutsupport/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
compileSdkVersion 25
buildToolsVersion "25.0.3"

defaultConfig {
minSdkVersion 7
targetSdkVersion 23
minSdkVersion 9
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
Expand All @@ -19,6 +19,6 @@ android {
}

dependencies {
compile 'com.android.support:design:23.3.0'
compile 'com.android.support:design:25.3.1'
compile project(':lib')
}

0 comments on commit 488c593

Please sign in to comment.