| 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.content.res.Resources; | 10 import android.content.res.Resources; |
| (...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1013 break; | 1013 break; |
| 1014 } | 1014 } |
| 1015 } | 1015 } |
| 1016 | 1016 |
| 1017 // If nothing can be reused, create a new item. | 1017 // If nothing can be reused, create a new item. |
| 1018 if (item == null) { | 1018 if (item == null) { |
| 1019 item = new MostVisitedItem(mManager, title, url, whitelistIconPa
th, | 1019 item = new MostVisitedItem(mManager, title, url, whitelistIconPa
th, |
| 1020 offlineAvailable, i, source); | 1020 offlineAvailable, i, source); |
| 1021 View view = | 1021 View view = |
| 1022 mMostVisitedDesign.createMostVisitedItemView(inflater, i
tem, isInitialLoad); | 1022 mMostVisitedDesign.createMostVisitedItemView(inflater, i
tem, isInitialLoad); |
| 1023 item.initView(view); | 1023 item.initView(view, mUseCardsUi ? mRecyclerView : mScrollView); |
| 1024 } | 1024 } |
| 1025 | 1025 |
| 1026 mMostVisitedItems[i] = item; | 1026 mMostVisitedItems[i] = item; |
| 1027 mMostVisitedLayout.addView(item.getView()); | 1027 mMostVisitedLayout.addView(item.getView()); |
| 1028 } | 1028 } |
| 1029 | 1029 |
| 1030 mHasReceivedMostVisitedSites = true; | 1030 mHasReceivedMostVisitedSites = true; |
| 1031 updateMostVisitedPlaceholderVisibility(); | 1031 updateMostVisitedPlaceholderVisibility(); |
| 1032 | 1032 |
| 1033 if (mUrlFocusChangePercent == 1f && oldItemCount != mMostVisitedItems.le
ngth) { | 1033 if (mUrlFocusChangePercent == 1f && oldItemCount != mMostVisitedItems.le
ngth) { |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1238 } | 1238 } |
| 1239 | 1239 |
| 1240 /** | 1240 /** |
| 1241 * @return The adapter position the user has scrolled to. | 1241 * @return The adapter position the user has scrolled to. |
| 1242 */ | 1242 */ |
| 1243 public int getScrollPosition() { | 1243 public int getScrollPosition() { |
| 1244 if (mUseCardsUi) return mRecyclerView.getScrollPosition(); | 1244 if (mUseCardsUi) return mRecyclerView.getScrollPosition(); |
| 1245 return RecyclerView.NO_POSITION; | 1245 return RecyclerView.NO_POSITION; |
| 1246 } | 1246 } |
| 1247 } | 1247 } |
| OLD | NEW |