use of org.chromium.chrome.browser.favicon.FaviconHelper in project AndroidChromium by JackyAndroid.
the class NavigationPopup method initialize.
private void initialize() {
ThreadUtils.assertOnUiThread();
mInitialized = true;
mFaviconHelper = new FaviconHelper();
Set<String> requestedUrls = new HashSet<String>();
for (int i = 0; i < mHistory.getEntryCount(); i++) {
NavigationEntry entry = mHistory.getEntryAtIndex(i);
if (entry.getFavicon() != null)
continue;
final String pageUrl = entry.getUrl();
if (!requestedUrls.contains(pageUrl)) {
FaviconImageCallback imageCallback = new FaviconImageCallback() {
@Override
public void onFaviconAvailable(Bitmap bitmap, String iconUrl) {
NavigationPopup.this.onFaviconAvailable(pageUrl, bitmap);
}
};
mFaviconHelper.getLocalFaviconImageForURL(mProfile, pageUrl, mFaviconSize, imageCallback);
requestedUrls.add(pageUrl);
}
}
FaviconImageCallback historyImageCallback = new FaviconImageCallback() {
@Override
public void onFaviconAvailable(Bitmap bitmap, String iconUrl) {
NavigationPopup.this.onFaviconAvailable(UrlConstants.HISTORY_URL, bitmap);
}
};
mFaviconHelper.getLocalFaviconImageForURL(mProfile, UrlConstants.HISTORY_URL, mFaviconSize, historyImageCallback);
}
use of org.chromium.chrome.browser.favicon.FaviconHelper in project AndroidChromium by JackyAndroid.
the class WebsitePreference method onBindView.
@Override
protected void onBindView(View view) {
super.onBindView(view);
TextView usageText = (TextView) view.findViewById(R.id.usage_text);
usageText.setVisibility(View.GONE);
if (mCategory.showStorageSites()) {
long totalUsage = mSite.getTotalUsage();
if (totalUsage > 0) {
usageText.setText(Formatter.formatShortFileSize(getContext(), totalUsage));
usageText.setTextSize(TEXT_SIZE_SP);
usageText.setVisibility(View.VISIBLE);
}
}
if (!mFaviconFetched) {
// Start the favicon fetching. Will respond in onFaviconAvailable.
mFaviconHelper = new FaviconHelper();
if (!mFaviconHelper.getLocalFaviconImageForURL(Profile.getLastUsedProfile(), faviconUrl(), mFaviconSizePx, this)) {
onFaviconAvailable(null, null);
}
mFaviconFetched = true;
}
float density = getContext().getResources().getDisplayMetrics().density;
int iconPadding = Math.round(FAVICON_PADDING_DP * density);
View iconView = view.findViewById(android.R.id.icon);
iconView.setPadding(iconPadding, iconPadding, iconPadding, iconPadding);
}
Aggregations