Skip to content

Commit

Permalink
Merge pull request #33 from Aspsine/dev
Browse files Browse the repository at this point in the history
fix stuck header&footer issue
  • Loading branch information
Aspsine committed Dec 29, 2015
2 parents de30d00 + fb169b4 commit 037acc7
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 53 deletions.
16 changes: 8 additions & 8 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
buildToolsVersion "23.0.2"

defaultConfig {
applicationId "com.aspsine.swipetoloadlayout"
minSdkVersion 10
targetSdkVersion 23
versionCode 1
versionName "1.0.0"
versionCode 2
versionName "1.0.2"
}
buildTypes {
release {
Expand All @@ -23,11 +23,11 @@ dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile project(':library')
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:recyclerview-v7:23.1.0'
compile 'com.android.support:support-v4:23.1.0'
compile 'com.android.support:design:23.1.0'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.google.code.gson:gson:2.4'
compile 'com.mcxiaoke.volley:library-aar:1.0.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.lsjwzh:materialloadingprogressbar:0.5.8-RELEASE'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ private void setStrictMode() {

public static RequestQueue getRequestQueue() {
if (sRequestQueue == null) {
synchronized (App.class) {
sRequestQueue = Volley.newRequestQueue(sContext);
}
sRequestQueue = Volley.newRequestQueue(sContext);
}
return sRequestQueue;
}
Expand Down

This file was deleted.

Binary file modified art/demo.apk
Binary file not shown.
8 changes: 4 additions & 4 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ apply plugin: 'com.android.library'

android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
buildToolsVersion "23.0.2"

defaultConfig {
minSdkVersion 8
targetSdkVersion 23
versionCode 1
versionName "1.0.0"
versionCode 2
versionName "1.0.2"
}
buildTypes {
release {
Expand All @@ -20,5 +20,5 @@ android {

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:support-v4:23.1.1'
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ public class SwipeToLoadLayout extends ViewGroup {

private boolean mHasFooterView;

/**
* indicate whether in debug mode
*/
private boolean mDebug;

/**
* the threshold of the touch event
*/
Expand All @@ -74,7 +79,7 @@ public class SwipeToLoadLayout extends ViewGroup {
/**
* status of SwipeToLoadLayout
*/
private byte mStatus = STATUS.STATUS_DEFAULT;
private int mStatus = STATUS.STATUS_DEFAULT;

/**
* target view top offset
Expand Down Expand Up @@ -296,6 +301,15 @@ public SwipeToLoadLayout(Context context, AttributeSet attrs, int defStyleAttr)
mAutoScroller = new AutoScroller();
}

/**
* set debug mode(default value false)
*
* @param debug if true log on, false log off
*/
public void setDebug(boolean debug) {
this.mDebug = debug;
}

/**
* is refresh function is enabled
*
Expand Down Expand Up @@ -1491,83 +1505,85 @@ abstract class LoadMoreCallback implements SwipeTrigger, SwipeLoadMoreTrigger {
*
* @param status
*/
private void setStatus(byte status) {
private void setStatus(int status) {
mStatus = status;
STATUS.printStatus(status);
if (mDebug) {
STATUS.printStatus(status);
}
}

/**
* an inner util class.
* enum of status
*/
private final static class STATUS {
private static final byte STATUS_REFRESH_RETURNING = -5;
private static final byte STATS_REFRESH_COMPLETE = -4;
private static final byte STATUS_REFRESHING = -3;
private static final byte STATUS_RELEASE_TO_REFRESH = -2;
private static final byte STATUS_SWIPING_TO_REFRESH = -1;
private static final byte STATUS_DEFAULT = 0;
private static final byte STATUS_SWIPING_TO_LOAD_MORE = 1;
private static final byte STATUS_RELEASE_TO_LOAD_MORE = 2;
private static final byte STATUS_LOADING_MORE = 3;
private static final byte STATUS_LOAD_MORE_COMPLETE = 4;
private static final byte STATUS_LOAD_MORE_RETURNING = 5;

private static boolean isRefreshing(final byte status) {
private static final int STATUS_REFRESH_RETURNING = -5;
private static final int STATS_REFRESH_COMPLETE = -4;
private static final int STATUS_REFRESHING = -3;
private static final int STATUS_RELEASE_TO_REFRESH = -2;
private static final int STATUS_SWIPING_TO_REFRESH = -1;
private static final int STATUS_DEFAULT = 0;
private static final int STATUS_SWIPING_TO_LOAD_MORE = 1;
private static final int STATUS_RELEASE_TO_LOAD_MORE = 2;
private static final int STATUS_LOADING_MORE = 3;
private static final int STATUS_LOAD_MORE_COMPLETE = 4;
private static final int STATUS_LOAD_MORE_RETURNING = 5;

private static boolean isRefreshing(final int status) {
return status == STATUS.STATUS_REFRESHING;
}

private static boolean isLoadingMore(final byte status) {
private static boolean isLoadingMore(final int status) {
return status == STATUS.STATUS_LOADING_MORE;
}

private static boolean isRefreshComplete(final byte status) {
private static boolean isRefreshComplete(final int status) {
return status == STATS_REFRESH_COMPLETE;
}

private static boolean isLoadMoreComplete(final byte status) {
private static boolean isLoadMoreComplete(final int status) {
return status == STATUS_LOAD_MORE_COMPLETE;
}

@SuppressWarnings({"unused"})
private static boolean isRefreshReturning(final byte status) {
private static boolean isRefreshReturning(final int status) {
return status == STATUS.STATUS_REFRESH_RETURNING;
}

@SuppressWarnings({"unused"})
private static boolean isLoadMoreReturning(final byte status) {
private static boolean isLoadMoreReturning(final int status) {
return status == STATUS.STATUS_LOAD_MORE_RETURNING;
}

private static boolean isReleaseToRefresh(final byte status) {
private static boolean isReleaseToRefresh(final int status) {
return status == STATUS.STATUS_RELEASE_TO_REFRESH;
}

private static boolean isReleaseToLoadMore(final byte status) {
private static boolean isReleaseToLoadMore(final int status) {
return status == STATUS.STATUS_RELEASE_TO_LOAD_MORE;
}

private static boolean isSwipingToRefresh(final byte status) {
private static boolean isSwipingToRefresh(final int status) {
return status == STATUS.STATUS_SWIPING_TO_REFRESH;
}

private static boolean isSwipingToLoadMore(final byte status) {
private static boolean isSwipingToLoadMore(final int status) {
return status == STATUS.STATUS_SWIPING_TO_LOAD_MORE;
}

private static boolean isRefreshStatus(final byte status) {
private static boolean isRefreshStatus(final int status) {
return status < STATUS.STATUS_DEFAULT;
}

public static boolean isLoadMoreStatus(final byte status) {
public static boolean isLoadMoreStatus(final int status) {
return status > STATUS.STATUS_DEFAULT;
}

private static boolean isStatusDefault(final byte status) {
private static boolean isStatusDefault(final int status) {
return status == STATUS.STATUS_DEFAULT;
}

private static String getStatus(byte status) {
private static String getStatus(int status) {
final String statusInfo;
switch (status) {
case STATUS_REFRESH_RETURNING:
Expand Down Expand Up @@ -1610,7 +1626,7 @@ private static String getStatus(byte status) {
return statusInfo;
}

private static void printStatus(byte status) {
private static void printStatus(int status) {
Log.d(TAG, "printStatus:" + getStatus(status));
}
}
Expand Down

0 comments on commit 037acc7

Please sign in to comment.