| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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.cards; | 5 package org.chromium.chrome.browser.ntp.cards; |
| 6 | 6 |
| 7 import android.graphics.Rect; | 7 import android.graphics.Rect; |
| 8 import android.support.annotation.CallSuper; | 8 import android.support.annotation.CallSuper; |
| 9 import android.support.annotation.DrawableRes; | 9 import android.support.annotation.DrawableRes; |
| 10 import android.support.v4.view.animation.FastOutSlowInInterpolator; | 10 import android.support.v4.view.animation.FastOutSlowInInterpolator; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 import org.chromium.chrome.browser.widget.displaystyle.UiConfig; | 30 import org.chromium.chrome.browser.widget.displaystyle.UiConfig; |
| 31 | 31 |
| 32 /** | 32 /** |
| 33 * Holder for a generic card. | 33 * Holder for a generic card. |
| 34 * | 34 * |
| 35 * Specific behaviors added to the cards: | 35 * Specific behaviors added to the cards: |
| 36 * | 36 * |
| 37 * - Cards can peek above the fold if there is enough space. | 37 * - Cards can peek above the fold if there is enough space. |
| 38 * | 38 * |
| 39 * - When peeking, tapping on cards will make them request a scroll up (see | 39 * - When peeking, tapping on cards will make them request a scroll up (see |
| 40 * {@link SuggestionsRecyclerView#scrollToFirstCard()}). Tap events in non-pee
king state will be | 40 * {@link SuggestionsRecyclerView#interceptCardTapped}). Tap events in non-pee
king state will be |
| 41 * routed through {@link #onCardTapped()} for subclasses to override. | 41 * routed through {@link #onCardTapped()} for subclasses to override. |
| 42 * | 42 * |
| 43 * - Cards will get some lateral margins when the viewport is sufficiently wide. | 43 * - Cards will get some lateral margins when the viewport is sufficiently wide. |
| 44 * (see {@link HorizontalDisplayStyle#WIDE}) | 44 * (see {@link HorizontalDisplayStyle#WIDE}) |
| 45 * | 45 * |
| 46 * Note: If a subclass overrides {@link #onBindViewHolder()}, it should call the | 46 * Note: If a subclass overrides {@link #onBindViewHolder()}, it should call the |
| 47 * parent implementation to reset the private state when a card is recycled. | 47 * parent implementation to reset the private state when a card is recycled. |
| 48 */ | 48 */ |
| 49 public abstract class CardViewHolder | 49 public abstract class CardViewHolder |
| 50 extends NewTabPageViewHolder implements ContextMenuManager.Delegate { | 50 extends NewTabPageViewHolder implements ContextMenuManager.Delegate { |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 if (hasCardAbove && hasCardBelow) return R.drawable.card_middle; | 326 if (hasCardAbove && hasCardBelow) return R.drawable.card_middle; |
| 327 if (!hasCardAbove && hasCardBelow) return R.drawable.card_top; | 327 if (!hasCardAbove && hasCardBelow) return R.drawable.card_top; |
| 328 if (hasCardAbove && !hasCardBelow) return R.drawable.card_bottom; | 328 if (hasCardAbove && !hasCardBelow) return R.drawable.card_bottom; |
| 329 return R.drawable.card_single; | 329 return R.drawable.card_single; |
| 330 } | 330 } |
| 331 | 331 |
| 332 public SuggestionsRecyclerView getRecyclerView() { | 332 public SuggestionsRecyclerView getRecyclerView() { |
| 333 return mRecyclerView; | 333 return mRecyclerView; |
| 334 } | 334 } |
| 335 } | 335 } |
| OLD | NEW |