Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2835)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageView.java

Issue 2345673002: [NewTabPage] Refine fakebox scrolling transition on tablets. (Closed)
Patch Set: Adjust start distance. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/android/java/res/values-sw600dp/dimens.xml ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageView.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageView.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageView.java
index 588906404277f7c7a31c9aedf55b8fd79967859c..fddc26ea35d472a32a9440fef3e929389722851d 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageView.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageView.java
@@ -490,10 +490,13 @@ public class NewTabPageView extends FrameLayout
final int scrollY = getVerticalScroll();
final float transitionLength =
getResources().getDimension(R.dimen.ntp_search_box_transition_length);
+ // Tab strip height is zero on phones, nonzero on tablets.
+ int tabStripHeight = getResources().getDimensionPixelSize(R.dimen.tab_strip_height);
- // |scrollY - searchBoxTop| gives the distance the search bar is from the top of the screen.
- return MathUtils.clamp(
- (scrollY - searchBoxTop + transitionLength) / transitionLength, 0f, 1f);
+ // |scrollY - searchBoxTop + tabStripHeight| gives the distance the search bar is from the
+ // top of the tab.
+ return MathUtils.clamp((scrollY - searchBoxTop + transitionLength + tabStripHeight)
+ / transitionLength, 0f, 1f);
}
private ViewGroup getWrapperView() {
« no previous file with comments | « chrome/android/java/res/values-sw600dp/dimens.xml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698