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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/appmenu/PulseInterpolator.java

Issue 2779543005: Add support for highlighting menu items (Closed)
Patch Set: Debugged drawable issues Created 3 years, 8 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: chrome/android/java/src/org/chromium/chrome/browser/appmenu/PulseInterpolator.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/appmenu/PulseInterpolator.java b/chrome/android/java/src/org/chromium/chrome/browser/appmenu/PulseInterpolator.java
new file mode 100644
index 0000000000000000000000000000000000000000..99f898d6716f939d509db905a95dab4d59e3454f
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/appmenu/PulseInterpolator.java
@@ -0,0 +1,30 @@
+// Copyright 2017 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.chrome.browser.appmenu;
+
+import android.view.animation.Interpolator;
+
+/**
+ * An {@link Interpolator} that pulses a value based on the passed in {@link Interpolator}. The
+ * pulse will fade in and out after a delay.
+ */
+public class PulseInterpolator implements Interpolator {
+ private final Interpolator mInterpolator;
+
+ /**
+ * Creates a new {@link PulseInterpolator} instance.
+ * @param interpolator The {@link Interpolator} responsible for handling the fade out and in.
+ */
+ public PulseInterpolator(Interpolator interpolator) {
+ mInterpolator = interpolator;
+ }
+
+ @Override
+ public float getInterpolation(float input) {
+ if (input < 0.4f) return 0.f;
+ if (input < 0.8f) return mInterpolator.getInterpolation((input - 0.4f) / 0.4f);
+ return mInterpolator.getInterpolation(1.f - (input - 0.8f) / 0.2f);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698