OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 package org.chromium.chrome.browser.ntp; |
| 6 |
| 7 import android.content.Context; |
| 8 import android.graphics.Canvas; |
| 9 import android.util.AttributeSet; |
| 10 import android.widget.ListView; |
| 11 |
| 12 import com.google.android.apps.chrome.R; |
| 13 |
| 14 import org.chromium.chrome.browser.widget.FadingShadow; |
| 15 |
| 16 /** |
| 17 * The ListView that holds the bookmark items. |
| 18 */ |
| 19 public class BookmarksListView extends ListView { |
| 20 |
| 21 private static final int SHADOW_COLOR = 0x11000000; |
| 22 |
| 23 private FadingShadow mFadingShadow; |
| 24 |
| 25 public BookmarksListView(Context context, AttributeSet attrs) { |
| 26 super(context, attrs); |
| 27 mFadingShadow = new FadingShadow(SHADOW_COLOR); |
| 28 setFadingEdgeLength(getResources().getDimensionPixelSize(R.dimen.ntp_sha
dow_height)); |
| 29 setDivider(null); |
| 30 setDividerHeight(0); |
| 31 } |
| 32 |
| 33 @Override |
| 34 protected void dispatchDraw(Canvas canvas) { |
| 35 super.dispatchDraw(canvas); |
| 36 setVerticalFadingEdgeEnabled(true); |
| 37 float shadowStrength = getTopFadingEdgeStrength(); |
| 38 float shadowHeight = getVerticalFadingEdgeLength(); |
| 39 setVerticalFadingEdgeEnabled(false); |
| 40 mFadingShadow.drawShadow(this, canvas, FadingShadow.POSITION_TOP, shadow
Height, |
| 41 shadowStrength); |
| 42 } |
| 43 |
| 44 // Change the visibility of this method to public, so BookmarksPageView can
call it. |
| 45 @Override |
| 46 public boolean awakenScrollBars() { |
| 47 return super.awakenScrollBars(); |
| 48 } |
| 49 } |
OLD | NEW |