| 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.Configuration; | 9 import android.content.res.Configuration; |
| 10 import android.graphics.Canvas; | 10 import android.graphics.Canvas; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 import org.chromium.chrome.browser.ntp.cards.CardsVariationParameters; | 40 import org.chromium.chrome.browser.ntp.cards.CardsVariationParameters; |
| 41 import org.chromium.chrome.browser.ntp.cards.NewTabPageAdapter; | 41 import org.chromium.chrome.browser.ntp.cards.NewTabPageAdapter; |
| 42 import org.chromium.chrome.browser.ntp.cards.NewTabPageRecyclerView; | 42 import org.chromium.chrome.browser.ntp.cards.NewTabPageRecyclerView; |
| 43 import org.chromium.chrome.browser.offlinepages.OfflinePageBridge; | 43 import org.chromium.chrome.browser.offlinepages.OfflinePageBridge; |
| 44 import org.chromium.chrome.browser.profiles.Profile; | 44 import org.chromium.chrome.browser.profiles.Profile; |
| 45 import org.chromium.chrome.browser.suggestions.SuggestionsUiDelegate; | 45 import org.chromium.chrome.browser.suggestions.SuggestionsUiDelegate; |
| 46 import org.chromium.chrome.browser.suggestions.Tile; | 46 import org.chromium.chrome.browser.suggestions.Tile; |
| 47 import org.chromium.chrome.browser.suggestions.TileGridLayout; | 47 import org.chromium.chrome.browser.suggestions.TileGridLayout; |
| 48 import org.chromium.chrome.browser.suggestions.TileGroup; | 48 import org.chromium.chrome.browser.suggestions.TileGroup; |
| 49 import org.chromium.chrome.browser.tab.Tab; | 49 import org.chromium.chrome.browser.tab.Tab; |
| 50 import org.chromium.chrome.browser.util.FeatureUtilities; |
| 50 import org.chromium.chrome.browser.util.MathUtils; | 51 import org.chromium.chrome.browser.util.MathUtils; |
| 51 import org.chromium.chrome.browser.util.ViewUtils; | 52 import org.chromium.chrome.browser.util.ViewUtils; |
| 52 import org.chromium.chrome.browser.widget.displaystyle.UiConfig; | 53 import org.chromium.chrome.browser.widget.displaystyle.UiConfig; |
| 53 import org.chromium.ui.base.DeviceFormFactor; | 54 import org.chromium.ui.base.DeviceFormFactor; |
| 54 | 55 |
| 55 import jp.tomorrowkey.android.gifplayer.BaseGifImage; | 56 import jp.tomorrowkey.android.gifplayer.BaseGifImage; |
| 56 | 57 |
| 57 /** | 58 /** |
| 58 * The native new tab page, represented by some basic data such as title and url
, and an Android | 59 * The native new tab page, represented by some basic data such as title and url
, and an Android |
| 59 * View that displays the page. | 60 * View that displays the page. |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 | 584 |
| 584 /** | 585 /** |
| 585 * @return The percentage that the URL bar is focused during an animation. | 586 * @return The percentage that the URL bar is focused during an animation. |
| 586 */ | 587 */ |
| 587 @VisibleForTesting | 588 @VisibleForTesting |
| 588 float getUrlFocusChangeAnimationPercent() { | 589 float getUrlFocusChangeAnimationPercent() { |
| 589 return mUrlFocusChangePercent; | 590 return mUrlFocusChangePercent; |
| 590 } | 591 } |
| 591 | 592 |
| 592 private void onUrlFocusAnimationChanged() { | 593 private void onUrlFocusAnimationChanged() { |
| 593 if (mDisableUrlFocusChangeAnimations) return; | 594 if (mDisableUrlFocusChangeAnimations || FeatureUtilities.isChromeHomeEna
bled()) return; |
| 594 | 595 |
| 595 // Translate so that the search box is at the top, but only upwards. | 596 // Translate so that the search box is at the top, but only upwards. |
| 596 float percent = mSearchProviderHasLogo ? mUrlFocusChangePercent : 0; | 597 float percent = mSearchProviderHasLogo ? mUrlFocusChangePercent : 0; |
| 597 int basePosition = mRecyclerView.computeVerticalScrollOffset() | 598 int basePosition = mRecyclerView.computeVerticalScrollOffset() |
| 598 + mNewTabPageLayout.getPaddingTop(); | 599 + mNewTabPageLayout.getPaddingTop(); |
| 599 int target = Math.max(basePosition, | 600 int target = Math.max(basePosition, |
| 600 mSearchBoxView.getBottom() - mSearchBoxView.getPaddingBottom
()); | 601 mSearchBoxView.getBottom() - mSearchBoxView.getPaddingBottom
()); |
| 601 | 602 |
| 602 mNewTabPageLayout.setTranslationY(percent * (basePosition - target)); | 603 mNewTabPageLayout.setTranslationY(percent * (basePosition - target)); |
| 603 } | 604 } |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 852 @Override | 853 @Override |
| 853 public void onLoadTaskAdded() { | 854 public void onLoadTaskAdded() { |
| 854 mPendingLoadTasks++; | 855 mPendingLoadTasks++; |
| 855 } | 856 } |
| 856 | 857 |
| 857 @Override | 858 @Override |
| 858 public void onLoadTaskCompleted() { | 859 public void onLoadTaskCompleted() { |
| 859 loadTaskCompleted(); | 860 loadTaskCompleted(); |
| 860 } | 861 } |
| 861 } | 862 } |
| OLD | NEW |