use of org.mozilla.focus.history.model.Site in project Rocket by mozilla-tw.
the class HomeFragment method removeDefaultSites.
private void removeDefaultSites(List<Site> removeSites) {
boolean isRemove = false;
for (int i = 0; i < removeSites.size(); i++) {
Site rSite = removeSites.get(i);
if (rSite.getId() < 0) {
removeDefaultSites(rSite);
isRemove = true;
}
}
if (isRemove) {
TopSitesUtils.saveDefaultSites(getContext(), this.orginalDefaultSites);
}
}
use of org.mozilla.focus.history.model.Site in project Rocket by mozilla-tw.
the class WebkitView method insertBrowsingHistory.
public void insertBrowsingHistory() {
final String url = getUrl();
if (TextUtils.isEmpty(url)) {
return;
} else if (SupportUtils.BLANK_URL.equals(url)) {
return;
}
if (!UrlUtils.isHttpOrHttps(url)) {
return;
}
evaluateJavascript("(function() { return document.getElementById('mozillaErrorPage'); })();", new ValueCallback<String>() {
@Override
public void onReceiveValue(String errorPage) {
if (!"null".equals(errorPage)) {
return;
}
Site site = new Site();
site.setUrl(url);
site.setTitle(getTitle());
site.setLastViewTimestamp(System.currentTimeMillis());
site.setFavIcon(FavIconUtils.getInitialBitmap(getResources(), null, FavIconUtils.getRepresentativeCharacter(url)));
BrowsingHistoryManager.getInstance().insert(site, null);
}
});
}
Aggregations