| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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.chrome.browser.customtabs; | 5 package org.chromium.chrome.browser.customtabs; |
| 6 | 6 |
| 7 import android.app.PendingIntent; | 7 import android.app.PendingIntent; |
| 8 import android.content.Context; | 8 import android.content.Context; |
| 9 import android.content.Intent; | 9 import android.content.Intent; |
| 10 import android.content.res.Resources; | 10 import android.content.res.Resources; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 */ | 80 */ |
| 81 int getId() { | 81 int getId() { |
| 82 return mId; | 82 return mId; |
| 83 } | 83 } |
| 84 | 84 |
| 85 /** | 85 /** |
| 86 * @return The drawable for the customized button. | 86 * @return The drawable for the customized button. |
| 87 */ | 87 */ |
| 88 Drawable getIcon(Resources res) { | 88 Drawable getIcon(Resources res) { |
| 89 if (mShouldTint) { | 89 if (mShouldTint) { |
| 90 return TintedDrawable.constructTintedDrawable(res, mIcon); | 90 return new TintedDrawable(res, mIcon); |
| 91 } else { | 91 } else { |
| 92 return new BitmapDrawable(res, mIcon); | 92 return new BitmapDrawable(res, mIcon); |
| 93 } | 93 } |
| 94 } | 94 } |
| 95 | 95 |
| 96 /** | 96 /** |
| 97 * @return The content description for the customized button. | 97 * @return The content description for the customized button. |
| 98 */ | 98 */ |
| 99 String getDescription() { | 99 String getDescription() { |
| 100 return mDescription; | 100 return mDescription; |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 * @return Whether the given icon's size is suitable to put on toolbar. | 272 * @return Whether the given icon's size is suitable to put on toolbar. |
| 273 */ | 273 */ |
| 274 static boolean doesIconFitToolbar(Context context, Bitmap bitmap) { | 274 static boolean doesIconFitToolbar(Context context, Bitmap bitmap) { |
| 275 int height = context.getResources().getDimensionPixelSize(R.dimen.toolba
r_icon_height); | 275 int height = context.getResources().getDimensionPixelSize(R.dimen.toolba
r_icon_height); |
| 276 if (bitmap.getHeight() < height) return false; | 276 if (bitmap.getHeight() < height) return false; |
| 277 int scaledWidth = bitmap.getWidth() / bitmap.getHeight() * height; | 277 int scaledWidth = bitmap.getWidth() / bitmap.getHeight() * height; |
| 278 if (scaledWidth > 2 * height) return false; | 278 if (scaledWidth > 2 * height) return false; |
| 279 return true; | 279 return true; |
| 280 } | 280 } |
| 281 } | 281 } |
| OLD | NEW |