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.graphics.Canvas; | 9 import android.graphics.Canvas; |
10 import android.os.Build; | 10 import android.os.Build; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 52 |
53 mGestureDetector = new GestureDetector( | 53 mGestureDetector = new GestureDetector( |
54 getContext(), new GestureDetector.SimpleOnGestureListener() { | 54 getContext(), new GestureDetector.SimpleOnGestureListener() { |
55 @Override | 55 @Override |
56 public boolean onSingleTapUp(MotionEvent e) { | 56 public boolean onSingleTapUp(MotionEvent e) { |
57 boolean retVal = super.onSingleTapUp(e); | 57 boolean retVal = super.onSingleTapUp(e); |
58 requestFocus(); | 58 requestFocus(); |
59 return retVal; | 59 return retVal; |
60 } | 60 } |
61 }); | 61 }); |
62 setBackgroundColor(NtpColorUtils.getBackgroundColorResource(getResources
())); | |
63 } | 62 } |
64 | 63 |
65 /** | 64 /** |
66 * Enables drawing a shadow at the bottom of the view when the view's conten
t extends beyond | 65 * Enables drawing a shadow at the bottom of the view when the view's conten
t extends beyond |
67 * the bottom of the view. This is exactly the same as a fading edge, except
that the shadow | 66 * the bottom of the view. This is exactly the same as a fading edge, except
that the shadow |
68 * color can have an alpha component, whereas a fading edge color must be op
aque. | 67 * color can have an alpha component, whereas a fading edge color must be op
aque. |
69 * | 68 * |
70 * @param shadowColor The color of the shadow, e.g. 0x11000000. | 69 * @param shadowColor The color of the shadow, e.g. 0x11000000. |
71 */ | 70 */ |
72 public void enableBottomShadow(int shadowColor) { | 71 public void enableBottomShadow(int shadowColor) { |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 if (mFadingShadow != null) { | 153 if (mFadingShadow != null) { |
155 setVerticalFadingEdgeEnabled(true); | 154 setVerticalFadingEdgeEnabled(true); |
156 float shadowStrength = getBottomFadingEdgeStrength(); | 155 float shadowStrength = getBottomFadingEdgeStrength(); |
157 float shadowHeight = getVerticalFadingEdgeLength(); | 156 float shadowHeight = getVerticalFadingEdgeLength(); |
158 setVerticalFadingEdgeEnabled(false); | 157 setVerticalFadingEdgeEnabled(false); |
159 mFadingShadow.drawShadow(this, canvas, FadingShadow.POSITION_BOTTOM, | 158 mFadingShadow.drawShadow(this, canvas, FadingShadow.POSITION_BOTTOM, |
160 shadowHeight, shadowStrength); | 159 shadowHeight, shadowStrength); |
161 } | 160 } |
162 } | 161 } |
163 } | 162 } |
OLD | NEW |