Skip to content

Commit

Permalink
Merge branch 'kidfolk-master' of https://github.com/kidfolk/android-p…
Browse files Browse the repository at this point in the history
…ulltorefresh into kidfolk-master
  • Loading branch information
johannilsson committed Oct 11, 2011
2 parents a41b1b1 + 4f5d9ca commit 12b178e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 22 deletions.
2 changes: 1 addition & 1 deletion pulltorefresh/default.properties
Expand Up @@ -8,5 +8,5 @@
# project structure. # project structure.


# Project target. # Project target.
target=android-8 target=android-10
android.library=true android.library=true
Expand Up @@ -196,8 +196,6 @@ public boolean onTouchEvent(MotionEvent event) {
} }


private void applyHeaderPadding(MotionEvent ev) { private void applyHeaderPadding(MotionEvent ev) {
final int historySize = ev.getHistorySize();

// Workaround for getPointerCount() which is unavailable in 1.5 // Workaround for getPointerCount() which is unavailable in 1.5
// (it's always 1 in 1.5) // (it's always 1 in 1.5)
int pointerCount = 1; int pointerCount = 1;
Expand All @@ -214,29 +212,14 @@ private void applyHeaderPadding(MotionEvent ev) {
System.err.println("unexpected " + e); System.err.println("unexpected " + e);
} }


for (int h = 0; h < historySize; h++) {
for (int p = 0; p < pointerCount; p++) { for (int p = 0; p < pointerCount; p++) {
if (mRefreshState == RELEASE_TO_REFRESH) { if (mRefreshState == RELEASE_TO_REFRESH) {
if (isVerticalFadingEdgeEnabled()) { if (isVerticalFadingEdgeEnabled()) {
setVerticalScrollBarEnabled(false); setVerticalScrollBarEnabled(false);
} }


int historicalY = 0; int historicalY = (int) ev.getHistoricalY(p);
try {
// For Android > 2.0
Method method = MotionEvent.class.getMethod(
"getHistoricalY", Integer.TYPE, Integer.TYPE);
historicalY = ((Float) method.invoke(ev, p, h)).intValue();
} catch (NoSuchMethodException e) {
// For Android < 2.0
historicalY = (int) (ev.getHistoricalY(h));
} catch (IllegalArgumentException e) {
throw e;
} catch (IllegalAccessException e) {
System.err.println("unexpected " + e);
} catch (InvocationTargetException e) {
System.err.println("unexpected " + e);
}


// Calculate the padding to apply, we divide by 1.7 to // Calculate the padding to apply, we divide by 1.7 to
// simulate a more resistant effect during pull. // simulate a more resistant effect during pull.
Expand All @@ -250,7 +233,6 @@ private void applyHeaderPadding(MotionEvent ev) {
mRefreshView.getPaddingBottom()); mRefreshView.getPaddingBottom());
} }
} }
}
} }


/** /**
Expand Down
2 changes: 1 addition & 1 deletion pulltorefreshexample/default.properties
Expand Up @@ -8,5 +8,5 @@
# project structure. # project structure.


# Project target. # Project target.
target=android-8 target=android-10
android.library.reference.1=../pulltorefresh/ android.library.reference.1=../pulltorefresh/

0 comments on commit 12b178e

Please sign in to comment.