| 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.preferences.website; | 5 package org.chromium.chrome.browser.preferences.website; |
| 6 | 6 |
| 7 import android.content.Context; | 7 import android.content.Context; |
| 8 import android.graphics.Bitmap; | 8 import android.graphics.Bitmap; |
| 9 import android.graphics.Color; | 9 import android.graphics.Color; |
| 10 import android.graphics.drawable.BitmapDrawable; | 10 import android.graphics.drawable.BitmapDrawable; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 class WebsitePreference extends Preference implements FaviconImageCallback { | 30 class WebsitePreference extends Preference implements FaviconImageCallback { |
| 31 private final Website mSite; | 31 private final Website mSite; |
| 32 private final SiteSettingsCategory mCategory; | 32 private final SiteSettingsCategory mCategory; |
| 33 | 33 |
| 34 private static final int TEXT_SIZE_SP = 13; | 34 private static final int TEXT_SIZE_SP = 13; |
| 35 | 35 |
| 36 // Loads the favicons asynchronously. | 36 // Loads the favicons asynchronously. |
| 37 private FaviconHelper mFaviconHelper; | 37 private FaviconHelper mFaviconHelper; |
| 38 | 38 |
| 39 // Whether the favicon has been fetched already. | 39 // Whether the favicon has been fetched already. |
| 40 private boolean mFaviconFetched = false; | 40 private boolean mFaviconFetched; |
| 41 | 41 |
| 42 // Metrics for favicon processing. | 42 // Metrics for favicon processing. |
| 43 private static final int FAVICON_CORNER_RADIUS_DP = 2; | 43 private static final int FAVICON_CORNER_RADIUS_DP = 2; |
| 44 private static final int FAVICON_PADDING_DP = 4; | 44 private static final int FAVICON_PADDING_DP = 4; |
| 45 private static final int FAVICON_TEXT_SIZE_DP = 10; | 45 private static final int FAVICON_TEXT_SIZE_DP = 10; |
| 46 private static final int FAVICON_BACKGROUND_COLOR = 0xff969696; | 46 private static final int FAVICON_BACKGROUND_COLOR = 0xff969696; |
| 47 | 47 |
| 48 private int mFaviconSizePx; | 48 private int mFaviconSizePx; |
| 49 | 49 |
| 50 WebsitePreference(Context context, Website site, SiteSettingsCategory catego
ry) { | 50 WebsitePreference(Context context, Website site, SiteSettingsCategory catego
ry) { |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 } | 156 } |
| 157 mFaviconFetched = true; | 157 mFaviconFetched = true; |
| 158 } | 158 } |
| 159 | 159 |
| 160 float density = getContext().getResources().getDisplayMetrics().density; | 160 float density = getContext().getResources().getDisplayMetrics().density; |
| 161 int iconPadding = Math.round(FAVICON_PADDING_DP * density); | 161 int iconPadding = Math.round(FAVICON_PADDING_DP * density); |
| 162 View iconView = view.findViewById(android.R.id.icon); | 162 View iconView = view.findViewById(android.R.id.icon); |
| 163 iconView.setPadding(iconPadding, iconPadding, iconPadding, iconPadding); | 163 iconView.setPadding(iconPadding, iconPadding, iconPadding, iconPadding); |
| 164 } | 164 } |
| 165 } | 165 } |
| OLD | NEW |