| 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.chromoting; | 5 package org.chromium.chromoting; |
| 6 | 6 |
| 7 import android.graphics.Color; | 7 import android.graphics.Color; |
| 8 import android.graphics.Paint; | 8 import android.graphics.Paint; |
| 9 import android.graphics.Point; | 9 import android.graphics.Point; |
| 10 import android.graphics.RadialGradient; | 10 import android.graphics.RadialGradient; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 private final Point mPos; | 28 private final Point mPos; |
| 29 | 29 |
| 30 private FeedbackAnimator(float feedbackSizeInPixels, Point pos) { | 30 private FeedbackAnimator(float feedbackSizeInPixels, Point pos) { |
| 31 mStartTimeInMs = SystemClock.uptimeMillis(); | 31 mStartTimeInMs = SystemClock.uptimeMillis(); |
| 32 mFeedbackSizeInPixels = feedbackSizeInPixels; | 32 mFeedbackSizeInPixels = feedbackSizeInPixels; |
| 33 mPos = pos; | 33 mPos = pos; |
| 34 } | 34 } |
| 35 | 35 |
| 36 /** Begins a new animation sequence at position (|pos|). */ | 36 /** Begins a new animation sequence at position (|pos|). */ |
| 37 public static void startAnimation(DesktopViewInterface view, | 37 public static void startAnimation(AbstractDesktopView view, |
| 38 Point pos, | 38 Point pos, |
| 39 DesktopView.InputFeedbackType feedbackType
) { | 39 DesktopView.InputFeedbackType feedbackType
) { |
| 40 if (feedbackType == DesktopView.InputFeedbackType.NONE) { | 40 if (feedbackType == DesktopView.InputFeedbackType.NONE) { |
| 41 return; | 41 return; |
| 42 } | 42 } |
| 43 | 43 |
| 44 view.onPaint().addSelfRemovable(new FeedbackAnimator( | 44 view.onPaint().addSelfRemovable(new FeedbackAnimator( |
| 45 getInputFeedbackSizeInPixels(feedbackType), pos)); | 45 getInputFeedbackSizeInPixels(feedbackType), pos)); |
| 46 } | 46 } |
| 47 | 47 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 int transparentBlack = Color.argb(0, 0, 0, 0); | 84 int transparentBlack = Color.argb(0, 0, 0, 0); |
| 85 int white = Color.argb(alpha, 0xff, 0xff, 0xff); | 85 int white = Color.argb(alpha, 0xff, 0xff, 0xff); |
| 86 int black = Color.argb(alpha, 0, 0, 0); | 86 int black = Color.argb(alpha, 0, 0, 0); |
| 87 mPaint.setShader(new RadialGradient(mPos.x, mPos.y, radius, | 87 mPaint.setShader(new RadialGradient(mPos.x, mPos.y, radius, |
| 88 new int[] {transparentBlack, white, black, transparentBlack}, | 88 new int[] {transparentBlack, white, black, transparentBlack}, |
| 89 new float[] {0.0f, 0.8f, 0.9f, 1.0f}, Shader.TileMode.CLAMP)); | 89 new float[] {0.0f, 0.8f, 0.9f, 1.0f}, Shader.TileMode.CLAMP)); |
| 90 parameter.canvas.drawCircle(mPos.x, mPos.y, radius, mPaint); | 90 parameter.canvas.drawCircle(mPos.x, mPos.y, radius, mPaint); |
| 91 return true; | 91 return true; |
| 92 } | 92 } |
| 93 } | 93 } |
| OLD | NEW |