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

Disable debug by default #15

Open
wants to merge 3 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
15 changes: 8 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
apply plugin: 'com.android.application'

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

defaultConfig {
applicationId "com.dinuscxj.recyclerrefreshlayout"
minSdkVersion 11
targetSdkVersion 23
targetSdkVersion 25
versionCode 1
versionName "1.0"
}

buildTypes {
release {
minifyEnabled false
Expand All @@ -21,9 +22,9 @@ android {

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
compile 'com.android.support:recyclerview-v7:23.2.1'
compile 'com.android.support:cardview-v7:23.2.1'
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.android.support:design:25.0.0'
compile 'com.android.support:recyclerview-v7:25.0.0'
compile 'com.android.support:cardview-v7:25.0.0'
compile project(':recyclerrefreshlayout')
}
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'com.android.tools.build:gradle:2.2.2'
// 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 10 15:27:10 PDT 2013
#Mon Nov 14 15:33:59 CET 2016
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.2-all.zip
11 changes: 5 additions & 6 deletions recyclerrefreshlayout/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
apply plugin: 'com.android.library'

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

defaultConfig {
minSdkVersion 11
targetSdkVersion 23
targetSdkVersion 25
versionCode 1
versionName "1.0"
}

buildTypes {
release {
minifyEnabled false
Expand All @@ -21,7 +22,5 @@ android {

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:appcompat-v7:25.0.0'
}


Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.dinuscxj.refresh;

import android.content.Context;
import android.graphics.Canvas;
import android.support.annotation.NonNull;
import android.support.v4.view.MotionEventCompat;
import android.support.v4.view.NestedScrollingChild;
Expand All @@ -22,8 +21,6 @@
import android.view.animation.Transformation;
import android.widget.AbsListView;

import java.lang.reflect.Field;

/**
* NOTE: the class based on the {@link android.support.v4.widget.SwipeRefreshLayout} source code
* <p>
Expand All @@ -46,6 +43,8 @@
public class RecyclerRefreshLayout extends ViewGroup
implements NestedScrollingParent, NestedScrollingChild {

private static boolean IS_DEBUG = false;

private static final int INVALID_INDEX = -1;
private static final int INVALID_POINTER = -1;
//the default height of the RefreshView
Expand Down Expand Up @@ -421,7 +420,7 @@ public void onNestedPreScroll(View target, int dx, int dy, int[] consumed) {
consumed[1] = dy;

}
Log.i("debug", "pre scroll");
if (IS_DEBUG) Log.i("debug", "pre scroll");
moveSpinner(mTotalUnconsumed);
}

Expand Down Expand Up @@ -467,7 +466,7 @@ public void onNestedScroll(final View target, final int dxConsumed, final int dy
final int dy = dyUnconsumed + mParentOffsetInWindow[1];
if (dy < 0) {
mTotalUnconsumed += Math.abs(dy);
Log.i("debug", "nested scroll");
if (IS_DEBUG) Log.i("debug", "nested scroll");
moveSpinner(mTotalUnconsumed);
}
}
Expand Down Expand Up @@ -777,10 +776,12 @@ public boolean onTouchEvent(MotionEvent ev) {
mInitialMotionY = activeMoveY;
mInitialScrollY = overScrollY;

Log.i("debug", "animatetostart overscrolly " + overScrollY + " -- " + mInitialMotionY);
if (IS_DEBUG)
Log.i("debug", "animatetostart overscrolly " + overScrollY + " -- " + mInitialMotionY);
} else {
overScrollY = activeMoveY - mInitialMotionY + mInitialScrollY;
Log.i("debug", "overscrolly " + overScrollY + " --" + mInitialMotionY + " -- " + mInitialScrollY);
if (IS_DEBUG)
Log.i("debug", "overscrolly " + overScrollY + " --" + mInitialMotionY + " -- " + mInitialScrollY);
}

if (mIsRefreshing) {
Expand All @@ -802,7 +803,8 @@ public boolean onTouchEvent(MotionEvent ev) {
mTarget.dispatchTouchEvent(obtain);
}
}
Log.i("debug", "moveSpinner refreshing -- " + mInitialScrollY + " -- " + (activeMoveY - mInitialMotionY));
if (IS_DEBUG)
Log.i("debug", "moveSpinner refreshing -- " + mInitialScrollY + " -- " + (activeMoveY - mInitialMotionY));
moveSpinner(overScrollY);
} else {
if (mIsBeingDragged) {
Expand Down Expand Up @@ -945,7 +947,7 @@ private void animateToRefreshingPosition(int from, Animation.AnimationListener l
}

private int computeAnimateToRefreshingDuration(float from) {
Log.i("debug", "from -- refreshing " + from);
if (IS_DEBUG) Log.i("debug", "from -- refreshing " + from);

if (from < mRefreshInitialOffset) {
return 0;
Expand All @@ -962,7 +964,7 @@ private int computeAnimateToRefreshingDuration(float from) {
}

private int computeAnimateToStartDuration(float from) {
Log.i("debug", "from -- start " + from);
if (IS_DEBUG) Log.i("debug", "from -- start " + from);

if (from < mRefreshInitialOffset) {
return 0;
Expand Down Expand Up @@ -1024,8 +1026,9 @@ private void moveSpinner(float targetOrRefreshViewOffsetY) {
}
}

Log.i("debug", targetOrRefreshViewOffsetY + " -- " + refreshTargetOffset + " -- "
+ convertScrollOffset + " -- " + mTargetOrRefreshViewOffsetY + " -- " + mRefreshTargetOffset);
if (IS_DEBUG)
Log.i("debug", targetOrRefreshViewOffsetY + " -- " + refreshTargetOffset + " -- "
+ convertScrollOffset + " -- " + mTargetOrRefreshViewOffsetY + " -- " + mRefreshTargetOffset);

setTargetOrRefreshViewOffsetY((int) (convertScrollOffset - mTargetOrRefreshViewOffsetY));
}
Expand All @@ -1050,7 +1053,7 @@ private void onNewerPointerDown(MotionEvent ev) {

mInitialMotionY = getMotionEventY(ev, mActivePointerId) - mCurrentTouchOffsetY;

Log.i("debug", " onDown " + mInitialMotionY);
if (IS_DEBUG) Log.i("debug", " onDown " + mInitialMotionY);
}

private void onSecondaryPointerUp(MotionEvent ev) {
Expand All @@ -1064,12 +1067,12 @@ private void onSecondaryPointerUp(MotionEvent ev) {

mInitialMotionY = getMotionEventY(ev, mActivePointerId) - mCurrentTouchOffsetY;

Log.i("debug", " onUp " + mInitialMotionY);
if (IS_DEBUG) Log.i("debug", " onUp " + mInitialMotionY);
}

private void setTargetOrRefreshViewOffsetY(int offsetY) {
if (mTarget == null) {
return;
return;
}

switch (mRefreshStyle) {
Expand All @@ -1088,7 +1091,7 @@ private void setTargetOrRefreshViewOffsetY(int offsetY) {
break;
}

Log.i("debug", "current offset" + mTargetOrRefreshViewOffsetY);
if (IS_DEBUG) Log.i("debug", "current offset" + mTargetOrRefreshViewOffsetY);

switch (mRefreshStyle) {
case FLOAT:
Expand Down