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

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

Issue 1928063002: [NTP Snippets] Fill space below the last snippet if necessary (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: suppress warning, back to int instead of viewlist, remove unnecessary checks Created 4 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser.ntp; 5 package org.chromium.chrome.browser.ntp;
6 6
7 import android.annotation.SuppressLint; 7 import android.annotation.SuppressLint;
8 import android.content.Context; 8 import android.content.Context;
9 import android.content.res.Resources; 9 import android.content.res.Resources;
10 import android.graphics.Bitmap; 10 import android.graphics.Bitmap;
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 // display. Never let the height be more than the |maxSnippetHeaderH eight|. 546 // display. Never let the height be more than the |maxSnippetHeaderH eight|.
547 headerHeight = Math.min( 547 headerHeight = Math.min(
548 amountScrolledIntoHeaderSpace / numberHeaderHeight, maxSnipp etHeaderHeight); 548 amountScrolledIntoHeaderSpace / numberHeaderHeight, maxSnipp etHeaderHeight);
549 549
550 // Get the alpha for the snippet header. 550 // Get the alpha for the snippet header.
551 headerAlpha = (float) headerHeight / maxSnippetHeaderHeight; 551 headerAlpha = (float) headerHeight / maxSnippetHeaderHeight;
552 } 552 }
553 snippetHeader.setAlpha(headerAlpha); 553 snippetHeader.setAlpha(headerAlpha);
554 params.height = headerHeight; 554 params.height = headerHeight;
555 snippetHeader.setLayoutParams(params); 555 snippetHeader.setLayoutParams(params);
556
557 // Update the space at the bottom, which needs to know about the height of the header.
558 mRecyclerView.refreshBottomSpacing();
556 } 559 }
557 560
558 /** 561 /**
559 * Sets up scrolling when snippets are enabled. It adds scroll listeners and touch listeners to 562 * Sets up scrolling when snippets are enabled. It adds scroll listeners and touch listeners to
560 * the RecyclerView. 563 * the RecyclerView.
561 */ 564 */
562 private void initializeSearchBoxRecyclerViewScrollHandling() { 565 private void initializeSearchBoxRecyclerViewScrollHandling() {
563 final Runnable mSnapScrollRunnable = new Runnable() { 566 final Runnable mSnapScrollRunnable = new Runnable() {
564 @Override 567 @Override
565 public void run() { 568 public void run() {
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after
1218 } 1221 }
1219 1222
1220 private int getVerticalScroll() { 1223 private int getVerticalScroll() {
1221 if (mUseCardsUi) { 1224 if (mUseCardsUi) {
1222 return mRecyclerView.computeVerticalScrollOffset(); 1225 return mRecyclerView.computeVerticalScrollOffset();
1223 } else { 1226 } else {
1224 return mScrollView.getScrollY(); 1227 return mScrollView.getScrollY();
1225 } 1228 }
1226 } 1229 }
1227 } 1230 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698