<commit_before>package com.handmark.pulltorefresh.library;

import com.handmark.pulltorefresh.library.PullToRefreshBase.Mode;

final class OverscrollHelper {

	static void overScrollBy(PullToRefreshBase<?> view, int deltaY, int scrollY, boolean isTouchEvent) {
		final Mode mode = view.getCurrentMode();

		if (mode != Mode.DISABLED && !isTouchEvent) {
			final int newY = (deltaY + scrollY);

			if (newY != 0) {
				// Check the mode supports the overscroll direction, and
				// then move scroll
				if ((mode.canPullDown() && newY < 0) || (mode.canPullUp() && newY > 0)) {
					view.setHeaderScroll(view.getScrollY() + newY);
				}
			} else {
				// Means we've stopped overscrolling, so scroll back to 0
				view.smoothScrollTo(0, PullToRefreshBase.SMOOTH_SCROLL_LONG_DURATION_MS);
			}
		}
	}
}<commit_msg>Fix Overscroll when we're using Mode.BOTH<commit_after>package com.handmark.pulltorefresh.library;

import com.handmark.pulltorefresh.library.PullToRefreshBase.Mode;

final class OverscrollHelper {

	static void overScrollBy(PullToRefreshBase<?> view, int deltaY, int scrollY, boolean isTouchEvent) {
		final Mode mode = view.getMode();

		if (mode != Mode.DISABLED && !isTouchEvent) {
			final int newY = (deltaY + scrollY);

			if (newY != 0) {
				// Check the mode supports the overscroll direction, and
				// then move scroll
				if ((mode.canPullDown() && newY < 0) || (mode.canPullUp() && newY > 0)) {
					view.setHeaderScroll(view.getScrollY() + newY);
				}
			} else {
				// Means we've stopped overscrolling, so scroll back to 0
				view.smoothScrollTo(0, PullToRefreshBase.SMOOTH_SCROLL_LONG_DURATION_MS);
			}
		}
	}
}
{'fraction_non_alphanumeric': 0.12021857923497267, 'fraction_numerical': 0.006071645415907711, 'mean_word_length': 3.832844574780059, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4154559', 'n_tokens_mistral': 653, 'n_tokens_neox': 552, 'n_words': 135}