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

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

Issue 1369653002: Android Chromoting: Tint menu icons. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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/ChromotingUtil.java
diff --git a/remoting/android/java/src/org/chromium/chromoting/ChromotingUtil.java b/remoting/android/java/src/org/chromium/chromoting/ChromotingUtil.java
new file mode 100644
index 0000000000000000000000000000000000000000..a094cbec8624fe61485df95d18caf0b5715cbd09
--- /dev/null
+++ b/remoting/android/java/src/org/chromium/chromoting/ChromotingUtil.java
@@ -0,0 +1,33 @@
+// Copyright 2015 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.content.Context;
+import android.graphics.PorterDuff;
+import android.graphics.drawable.Drawable;
+import android.util.TypedValue;
+import android.view.Menu;
+
+/** Utility methods for chromoting code. */
+public abstract class ChromotingUtil {
+ /**
+ * Tints all icons of a toolbar menu so they have the same color as the 'back' navigation icon
+ * and the three-dots overflow icon.
+ * @param context Context for getting theme and resource information.
+ * @param menu Menu with icons to be tinted.
+ */
+ public static void tintMenuIcons(Context context, Menu menu) {
+ TypedValue typedValue = new TypedValue();
+ context.getTheme().resolveAttribute(R.attr.colorControlNormal, typedValue, true);
+ int color = context.getResources().getColor(typedValue.resourceId);
+ int items = menu.size();
+ for (int i = 0; i < items; i++) {
+ Drawable icon = menu.getItem(i).getIcon();
+ if (icon != null) {
+ icon.mutate().setColorFilter(color, PorterDuff.Mode.SRC_IN);
+ }
+ }
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698