forked from sanyaade-mobiledev/chromium.src
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Android] Add a native pull-to-refresh overscroll effect
Add a restricted pull-to-refresh effect to Android. The effect is triggered only when 1) the scroll starts when the page has no vertical offset, 2) the scroll direction is upward and 3) the initial scroll is not consumed by the page. Page reloads are triggered only when the user pulls and releases beyond a certain threshold. BUG=428429 Review URL: https://codereview.chromium.org/679493002 Cr-Commit-Position: refs/heads/master@{#304320}
- Loading branch information
jdduke
authored and
Commit bot
committed
Nov 15, 2014
1 parent
2140408
commit 9db1b9d
Showing
44 changed files
with
1,495 additions
and
415 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright 2014 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef CONTENT_BROWSER_ANDROID_ANIMATION_UTILS_H_ | ||
#define CONTENT_BROWSER_ANDROID_ANIMATION_UTILS_H_ | ||
|
||
namespace content { | ||
|
||
template <typename T> | ||
T Lerp(T a, T b, T t) { | ||
return a + (b - a) * t; | ||
} | ||
|
||
template <typename T> | ||
T Clamp(T value, T low, T high) { | ||
return value < low ? low : (value > high ? high : value); | ||
} | ||
|
||
template <typename T> | ||
T Damp(T input, T factor) { | ||
T result; | ||
if (factor == 1) { | ||
result = 1 - (1 - input) * (1 - input); | ||
} else { | ||
result = 1 - std::pow(1 - input, 2 * factor); | ||
} | ||
return result; | ||
} | ||
|
||
} // namespace content | ||
|
||
#endif // CONTENT_BROWSER_ANDROID_ANIMATION_UTILS_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.