| OLD | NEW |
| 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 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 // display. Never let the height be more than the |maxSnippetHeaderH
eight|. | 544 // display. Never let the height be more than the |maxSnippetHeaderH
eight|. |
| 545 headerHeight = Math.min( | 545 headerHeight = Math.min( |
| 546 amountScrolledIntoHeaderSpace / numberHeaderHeight, maxSnipp
etHeaderHeight); | 546 amountScrolledIntoHeaderSpace / numberHeaderHeight, maxSnipp
etHeaderHeight); |
| 547 | 547 |
| 548 // Get the alpha for the snippet header. | 548 // Get the alpha for the snippet header. |
| 549 headerAlpha = (float) headerHeight / maxSnippetHeaderHeight; | 549 headerAlpha = (float) headerHeight / maxSnippetHeaderHeight; |
| 550 } | 550 } |
| 551 snippetHeader.setAlpha(headerAlpha); | 551 snippetHeader.setAlpha(headerAlpha); |
| 552 params.height = headerHeight; | 552 params.height = headerHeight; |
| 553 snippetHeader.setLayoutParams(params); | 553 snippetHeader.setLayoutParams(params); |
| 554 |
| 555 // Update the space at the bottom, which needs to know about the height
of the header. |
| 556 mRecyclerView.refreshBottomSpacing(); |
| 554 } | 557 } |
| 555 | 558 |
| 556 /** | 559 /** |
| 557 * Sets up scrolling when snippets are enabled. It adds scroll listeners and
touch listeners to | 560 * Sets up scrolling when snippets are enabled. It adds scroll listeners and
touch listeners to |
| 558 * the RecyclerView. | 561 * the RecyclerView. |
| 559 */ | 562 */ |
| 560 private void initializeSearchBoxRecyclerViewScrollHandling() { | 563 private void initializeSearchBoxRecyclerViewScrollHandling() { |
| 561 final Runnable mSnapScrollRunnable = new Runnable() { | 564 final Runnable mSnapScrollRunnable = new Runnable() { |
| 562 @Override | 565 @Override |
| 563 public void run() { | 566 public void run() { |
| (...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1217 } | 1220 } |
| 1218 | 1221 |
| 1219 private int getVerticalScroll() { | 1222 private int getVerticalScroll() { |
| 1220 if (mUseCardsUi) { | 1223 if (mUseCardsUi) { |
| 1221 return mRecyclerView.computeVerticalScrollOffset(); | 1224 return mRecyclerView.computeVerticalScrollOffset(); |
| 1222 } else { | 1225 } else { |
| 1223 return mScrollView.getScrollY(); | 1226 return mScrollView.getScrollY(); |
| 1224 } | 1227 } |
| 1225 } | 1228 } |
| 1226 } | 1229 } |
| OLD | NEW |