Skip to content

Commit 037acc7

Browse files
committed
Merge pull request #33 from Aspsine/dev
fix stuck header&footer issue
2 parents de30d00 + fb169b4 commit 037acc7

File tree

6 files changed

+59
-53
lines changed

6 files changed

+59
-53
lines changed

app/build.gradle

+8-8
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ apply plugin: 'com.android.application'
22

33
android {
44
compileSdkVersion 23
5-
buildToolsVersion "23.0.1"
5+
buildToolsVersion "23.0.2"
66

77
defaultConfig {
88
applicationId "com.aspsine.swipetoloadlayout"
99
minSdkVersion 10
1010
targetSdkVersion 23
11-
versionCode 1
12-
versionName "1.0.0"
11+
versionCode 2
12+
versionName "1.0.2"
1313
}
1414
buildTypes {
1515
release {
@@ -23,11 +23,11 @@ dependencies {
2323
compile fileTree(include: ['*.jar'], dir: 'libs')
2424
testCompile 'junit:junit:4.12'
2525
compile project(':library')
26-
compile 'com.android.support:appcompat-v7:23.1.0'
27-
compile 'com.android.support:recyclerview-v7:23.1.0'
28-
compile 'com.android.support:support-v4:23.1.0'
29-
compile 'com.android.support:design:23.1.0'
30-
compile 'com.google.code.gson:gson:2.3.1'
26+
compile 'com.android.support:appcompat-v7:23.1.1'
27+
compile 'com.android.support:recyclerview-v7:23.1.1'
28+
compile 'com.android.support:support-v4:23.1.1'
29+
compile 'com.android.support:design:23.1.1'
30+
compile 'com.google.code.gson:gson:2.4'
3131
compile 'com.mcxiaoke.volley:library-aar:1.0.1'
3232
compile 'com.squareup.picasso:picasso:2.5.2'
3333
compile 'com.lsjwzh:materialloadingprogressbar:0.5.8-RELEASE'

app/src/main/java/com/aspsine/swipetoloadlayout/demo/App.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ private void setStrictMode() {
3333

3434
public static RequestQueue getRequestQueue() {
3535
if (sRequestQueue == null) {
36-
synchronized (App.class) {
37-
sRequestQueue = Volley.newRequestQueue(sContext);
38-
}
36+
sRequestQueue = Volley.newRequestQueue(sContext);
3937
}
4038
return sRequestQueue;
4139
}

app/src/main/java/com/aspsine/swipetoloadlayout/demo/DataSource.java

-8
This file was deleted.

art/demo.apk

5.65 KB
Binary file not shown.

library/build.gradle

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ apply plugin: 'com.android.library'
22

33
android {
44
compileSdkVersion 23
5-
buildToolsVersion "23.0.1"
5+
buildToolsVersion "23.0.2"
66

77
defaultConfig {
88
minSdkVersion 8
99
targetSdkVersion 23
10-
versionCode 1
11-
versionName "1.0.0"
10+
versionCode 2
11+
versionName "1.0.2"
1212
}
1313
buildTypes {
1414
release {
@@ -20,5 +20,5 @@ android {
2020

2121
dependencies {
2222
compile fileTree(dir: 'libs', include: ['*.jar'])
23-
compile 'com.android.support:appcompat-v7:23.0.1'
23+
compile 'com.android.support:support-v4:23.1.1'
2424
}

library/src/main/java/com/aspsine/swipetoloadlayout/SwipeToLoadLayout.java

+46-30
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ public class SwipeToLoadLayout extends ViewGroup {
6666

6767
private boolean mHasFooterView;
6868

69+
/**
70+
* indicate whether in debug mode
71+
*/
72+
private boolean mDebug;
73+
6974
/**
7075
* the threshold of the touch event
7176
*/
@@ -74,7 +79,7 @@ public class SwipeToLoadLayout extends ViewGroup {
7479
/**
7580
* status of SwipeToLoadLayout
7681
*/
77-
private byte mStatus = STATUS.STATUS_DEFAULT;
82+
private int mStatus = STATUS.STATUS_DEFAULT;
7883

7984
/**
8085
* target view top offset
@@ -296,6 +301,15 @@ public SwipeToLoadLayout(Context context, AttributeSet attrs, int defStyleAttr)
296301
mAutoScroller = new AutoScroller();
297302
}
298303

304+
/**
305+
* set debug mode(default value false)
306+
*
307+
* @param debug if true log on, false log off
308+
*/
309+
public void setDebug(boolean debug) {
310+
this.mDebug = debug;
311+
}
312+
299313
/**
300314
* is refresh function is enabled
301315
*
@@ -1491,83 +1505,85 @@ abstract class LoadMoreCallback implements SwipeTrigger, SwipeLoadMoreTrigger {
14911505
*
14921506
* @param status
14931507
*/
1494-
private void setStatus(byte status) {
1508+
private void setStatus(int status) {
14951509
mStatus = status;
1496-
STATUS.printStatus(status);
1510+
if (mDebug) {
1511+
STATUS.printStatus(status);
1512+
}
14971513
}
14981514

14991515
/**
15001516
* an inner util class.
15011517
* enum of status
15021518
*/
15031519
private final static class STATUS {
1504-
private static final byte STATUS_REFRESH_RETURNING = -5;
1505-
private static final byte STATS_REFRESH_COMPLETE = -4;
1506-
private static final byte STATUS_REFRESHING = -3;
1507-
private static final byte STATUS_RELEASE_TO_REFRESH = -2;
1508-
private static final byte STATUS_SWIPING_TO_REFRESH = -1;
1509-
private static final byte STATUS_DEFAULT = 0;
1510-
private static final byte STATUS_SWIPING_TO_LOAD_MORE = 1;
1511-
private static final byte STATUS_RELEASE_TO_LOAD_MORE = 2;
1512-
private static final byte STATUS_LOADING_MORE = 3;
1513-
private static final byte STATUS_LOAD_MORE_COMPLETE = 4;
1514-
private static final byte STATUS_LOAD_MORE_RETURNING = 5;
1515-
1516-
private static boolean isRefreshing(final byte status) {
1520+
private static final int STATUS_REFRESH_RETURNING = -5;
1521+
private static final int STATS_REFRESH_COMPLETE = -4;
1522+
private static final int STATUS_REFRESHING = -3;
1523+
private static final int STATUS_RELEASE_TO_REFRESH = -2;
1524+
private static final int STATUS_SWIPING_TO_REFRESH = -1;
1525+
private static final int STATUS_DEFAULT = 0;
1526+
private static final int STATUS_SWIPING_TO_LOAD_MORE = 1;
1527+
private static final int STATUS_RELEASE_TO_LOAD_MORE = 2;
1528+
private static final int STATUS_LOADING_MORE = 3;
1529+
private static final int STATUS_LOAD_MORE_COMPLETE = 4;
1530+
private static final int STATUS_LOAD_MORE_RETURNING = 5;
1531+
1532+
private static boolean isRefreshing(final int status) {
15171533
return status == STATUS.STATUS_REFRESHING;
15181534
}
15191535

1520-
private static boolean isLoadingMore(final byte status) {
1536+
private static boolean isLoadingMore(final int status) {
15211537
return status == STATUS.STATUS_LOADING_MORE;
15221538
}
15231539

1524-
private static boolean isRefreshComplete(final byte status) {
1540+
private static boolean isRefreshComplete(final int status) {
15251541
return status == STATS_REFRESH_COMPLETE;
15261542
}
15271543

1528-
private static boolean isLoadMoreComplete(final byte status) {
1544+
private static boolean isLoadMoreComplete(final int status) {
15291545
return status == STATUS_LOAD_MORE_COMPLETE;
15301546
}
15311547

15321548
@SuppressWarnings({"unused"})
1533-
private static boolean isRefreshReturning(final byte status) {
1549+
private static boolean isRefreshReturning(final int status) {
15341550
return status == STATUS.STATUS_REFRESH_RETURNING;
15351551
}
15361552

15371553
@SuppressWarnings({"unused"})
1538-
private static boolean isLoadMoreReturning(final byte status) {
1554+
private static boolean isLoadMoreReturning(final int status) {
15391555
return status == STATUS.STATUS_LOAD_MORE_RETURNING;
15401556
}
15411557

1542-
private static boolean isReleaseToRefresh(final byte status) {
1558+
private static boolean isReleaseToRefresh(final int status) {
15431559
return status == STATUS.STATUS_RELEASE_TO_REFRESH;
15441560
}
15451561

1546-
private static boolean isReleaseToLoadMore(final byte status) {
1562+
private static boolean isReleaseToLoadMore(final int status) {
15471563
return status == STATUS.STATUS_RELEASE_TO_LOAD_MORE;
15481564
}
15491565

1550-
private static boolean isSwipingToRefresh(final byte status) {
1566+
private static boolean isSwipingToRefresh(final int status) {
15511567
return status == STATUS.STATUS_SWIPING_TO_REFRESH;
15521568
}
15531569

1554-
private static boolean isSwipingToLoadMore(final byte status) {
1570+
private static boolean isSwipingToLoadMore(final int status) {
15551571
return status == STATUS.STATUS_SWIPING_TO_LOAD_MORE;
15561572
}
15571573

1558-
private static boolean isRefreshStatus(final byte status) {
1574+
private static boolean isRefreshStatus(final int status) {
15591575
return status < STATUS.STATUS_DEFAULT;
15601576
}
15611577

1562-
public static boolean isLoadMoreStatus(final byte status) {
1578+
public static boolean isLoadMoreStatus(final int status) {
15631579
return status > STATUS.STATUS_DEFAULT;
15641580
}
15651581

1566-
private static boolean isStatusDefault(final byte status) {
1582+
private static boolean isStatusDefault(final int status) {
15671583
return status == STATUS.STATUS_DEFAULT;
15681584
}
15691585

1570-
private static String getStatus(byte status) {
1586+
private static String getStatus(int status) {
15711587
final String statusInfo;
15721588
switch (status) {
15731589
case STATUS_REFRESH_RETURNING:
@@ -1610,7 +1626,7 @@ private static String getStatus(byte status) {
16101626
return statusInfo;
16111627
}
16121628

1613-
private static void printStatus(byte status) {
1629+
private static void printStatus(int status) {
16141630
Log.d(TAG, "printStatus:" + getStatus(status));
16151631
}
16161632
}

0 commit comments

Comments
 (0)