Skip to content

Commit

Permalink
fix no onNestedFling method earlier than Android 5.0 Lollipop && grad…
Browse files Browse the repository at this point in the history
…le update
  • Loading branch information
ashqal committed Feb 5, 2016
1 parent e73e8ae commit 11ca70e
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 89 deletions.
3 changes: 3 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions{
dexInProcess false
}
}

dependencies {
Expand Down
5 changes: 1 addition & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-alpha9'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.5'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand All @@ -17,7 +14,7 @@ buildscript {
allprojects {
repositories {
jcenter()
maven{ url 'https://dl.bintray.com/ashqal/maven/' }
maven { url "https://jitpack.io" }
}
}

Expand Down
5 changes: 2 additions & 3 deletions chromelikeswipelayout/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
apply plugin: 'com.android.library'
apply from :'upload.gradle'

android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
defaultConfig {
minSdkVersion 7
targetSdkVersion 23
versionCode 1
versionName releaseVersion
versionCode 4
versionName "0.4"
}
buildTypes {
release {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -570,11 +570,11 @@ public void onNestedPreScroll(View target, int dx, int dy, int[] consumed) {

@Override
public boolean onNestedFling(View target, float velocityX, float velocityY, boolean consumed) {
return super.onNestedFling(target, velocityX, velocityY, consumed);
return false;
}

@Override
public boolean onNestedPreFling(View target, float velocityX, float velocityY) {
return super.onNestedPreFling(target, velocityX, velocityY);
return false;
}
}
16 changes: 8 additions & 8 deletions chromelikeswipelayout/src/main/java/com/asha/TouchManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class TouchManager {
private int mActivePointerId = INVALID_POINTER;
private PointF mTmpPoint = new PointF();
private ITouchCallback mTouchCallback;
private int sThreshold = dp2px(120);
private int mThreshold = dp2px(120);
private static final int sThreshold2 = dp2px(400);
private int mMotionX;
private boolean mInterceptEnabled = true;
Expand Down Expand Up @@ -69,7 +69,7 @@ public void endDrag(){
}

public float calExpandProgress(int currentTop){
return currentTop * 1.0f / sThreshold;
return currentTop * 1.0f / mThreshold;
}

public int calTargetTopOffset(int currentTop){
Expand Down Expand Up @@ -113,8 +113,8 @@ private float motionY2TouchDown(float y){
float diff;
if ( mTopOffset < 0 ){
diff = 0;
} else if( mTopOffset > sThreshold ){
diff = (mTopOffset - sThreshold ) / 0.3f / 0.6f + sThreshold / 0.6f;
} else if( mTopOffset > mThreshold){
diff = (mTopOffset - mThreshold) / 0.3f / 0.6f + mThreshold / 0.6f;
} else {
diff = mTopOffset / 0.6f;
}
Expand All @@ -124,8 +124,8 @@ private float motionY2TouchDown(float y){
private int motionY2TopOffset(float y){
float original = y - mTouchDownActor;
float basic = original * 0.6f;
if ( basic > sThreshold ){
basic = sThreshold + (basic - sThreshold) * 0.3f;
if ( basic > mThreshold){
basic = mThreshold + (basic - mThreshold) * 0.3f;
}
return (int) basic;
}
Expand Down Expand Up @@ -183,7 +183,7 @@ public boolean onFeedTouchEvent(MotionEvent event){
final float y = MotionEventCompat.getY(event, pointerIndex);
setTopOffset(y);

boolean isExpanded = mTopOffset >= sThreshold && mBeginDragging;
boolean isExpanded = mTopOffset >= mThreshold && mBeginDragging;
//first point

switch ( action ) {
Expand Down Expand Up @@ -225,7 +225,7 @@ public void setInterceptEnabled(boolean interceptEnabled) {
}

public void setMaxHeight(int maxHeight) {
this.sThreshold = maxHeight;
this.mThreshold = maxHeight;
}

public interface ITouchCallback {
Expand Down
70 changes: 0 additions & 70 deletions chromelikeswipelayout/upload.gradle

This file was deleted.

3 changes: 1 addition & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,4 @@
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
releaseVersion=0.3
# org.gradle.parallel=true

0 comments on commit 11ca70e

Please sign in to comment.