Search in sources :

Example 11 with Site

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);
    }
}
Also used : Site(org.mozilla.focus.history.model.Site)

Example 12 with Site

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);
        }
    });
}
Also used : Site(org.mozilla.focus.history.model.Site)

Aggregations

Site (org.mozilla.focus.history.model.Site)12 Test (org.junit.Test)3 ArrayList (java.util.ArrayList)2 Random (java.util.Random)2 JSONException (org.json.JSONException)2 DateSection (org.mozilla.focus.history.model.DateSection)2 Intent (android.content.Intent)1 Bitmap (android.graphics.Bitmap)1 PopupMenu (android.support.v7.widget.PopupMenu)1 RecyclerView (android.support.v7.widget.RecyclerView)1 MenuItem (android.view.MenuItem)1 View (android.view.View)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 JSONArray (org.json.JSONArray)1 JSONObject (org.json.JSONObject)1 SessionLoadedIdlingResource (org.mozilla.focus.helper.SessionLoadedIdlingResource)1