Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1330)

Unified Diff: remoting/android/java/src/org/chromium/chromoting/FeedbackAnimator.java

Issue 2256943002: [Remoting Android] Remove old renderer code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: remoting/android/java/src/org/chromium/chromoting/FeedbackAnimator.java
diff --git a/remoting/android/java/src/org/chromium/chromoting/FeedbackAnimator.java b/remoting/android/java/src/org/chromium/chromoting/FeedbackAnimator.java
deleted file mode 100644
index f34d28c22a6fd29fb89293516b68bf2b4dff0e16..0000000000000000000000000000000000000000
--- a/remoting/android/java/src/org/chromium/chromoting/FeedbackAnimator.java
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.chromoting;
-
-import android.graphics.Color;
-import android.graphics.Paint;
-import android.graphics.Point;
-import android.graphics.RadialGradient;
-import android.graphics.Shader;
-import android.os.SystemClock;
-
-/** Helper class for displaying the press feedback animations. */
-public final class FeedbackAnimator
- implements Event.ParameterCallback<Boolean, PaintEventParameter> {
- /** Total duration of the animation, in milliseconds. */
- private static final float TOTAL_DURATION_MS = 220;
-
- /** Start time of the animation, from {@link SystemClock#uptimeMillis()}. */
- private final long mStartTimeInMs;
-
- /** Contains the size of the feedback animation for the most recent request. */
- private final float mFeedbackSizeInPixels;
-
- private final Paint mPaint = new Paint();
-
- private final Point mPos;
-
- private FeedbackAnimator(float feedbackSizeInPixels, Point pos) {
- mStartTimeInMs = SystemClock.uptimeMillis();
- mFeedbackSizeInPixels = feedbackSizeInPixels;
- mPos = pos;
- }
-
- /** Begins a new animation sequence at position (|pos|). */
- public static void startAnimation(DesktopView view,
- Point pos,
- float feedbackRadius) {
- if (feedbackRadius <= 0.0f) {
- return;
- }
-
- view.onPaint().addSelfRemovable(new FeedbackAnimator(feedbackRadius, pos));
- }
-
- @Override
- public Boolean run(PaintEventParameter parameter) {
- float elapsedTimeInMs = SystemClock.uptimeMillis() - mStartTimeInMs;
- if (elapsedTimeInMs < 1) {
- return true;
- }
-
- // |progress| is 0 at the beginning, 1 at the end.
- float progress = elapsedTimeInMs / TOTAL_DURATION_MS;
- if (progress >= 1) {
- return false;
- }
-
- float size = mFeedbackSizeInPixels / parameter.scale;
-
- // Animation grows from 0 to |size|, and goes from fully opaque to transparent for a
- // seamless fading-out effect. The animation needs to have more than one color so it's
- // visible over any background color.
- float radius = size * progress;
- int alpha = (int) ((1 - progress) * 0xff);
-
- int transparentBlack = Color.argb(0, 0, 0, 0);
- int white = Color.argb(alpha, 0xff, 0xff, 0xff);
- int black = Color.argb(alpha, 0, 0, 0);
- mPaint.setShader(new RadialGradient(mPos.x, mPos.y, radius,
- new int[] {transparentBlack, white, black, transparentBlack},
- new float[] {0.0f, 0.8f, 0.9f, 1.0f}, Shader.TileMode.CLAMP));
- parameter.canvas.drawCircle(mPos.x, mPos.y, radius, mPaint);
- return true;
- }
-}

Powered by Google App Engine
This is Rietveld 408576698