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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 package org.chromium.chromoting;
6
7 import android.content.Context;
8 import android.graphics.PorterDuff;
9 import android.graphics.drawable.Drawable;
10 import android.util.TypedValue;
11 import android.view.Menu;
12
13 /** Utility methods for chromoting code. */
14 public abstract class ChromotingUtil {
15 /**
16 * Tints all icons of a toolbar menu so they have the same color as the 'bac k' navigation icon
17 * and the three-dots overflow icon.
18 * @param context Context for getting theme and resource information.
19 * @param menu Menu with icons to be tinted.
20 */
21 public static void tintMenuIcons(Context context, Menu menu) {
22 TypedValue typedValue = new TypedValue();
23 context.getTheme().resolveAttribute(R.attr.colorControlNormal, typedValu e, true);
24 int color = context.getResources().getColor(typedValue.resourceId);
25 int items = menu.size();
26 for (int i = 0; i < items; i++) {
27 Drawable icon = menu.getItem(i).getIcon();
28 if (icon != null) {
29 icon.mutate().setColorFilter(color, PorterDuff.Mode.SRC_IN);
30 }
31 }
32 }
33 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698