Beispiel #1
0
 public void printBackForwardList() {
   WebBackForwardList currentList = this.copyBackForwardList();
   int currentSize = currentList.getSize();
   for (int i = 0; i < currentSize; ++i) {
     WebHistoryItem item = currentList.getItemAtIndex(i);
     String url = item.getUrl();
     LOG.d(TAG, "The URL at index: " + Integer.toString(i) + " is " + url);
   }
 }
Beispiel #2
0
 // Can Go Back is BROKEN!
 public boolean startOfHistory() {
   WebBackForwardList currentList = this.copyBackForwardList();
   WebHistoryItem item = currentList.getItemAtIndex(0);
   if (item != null) { // Null-fence in case they haven't called loadUrl yet (CB-2458)
     String url = item.getUrl();
     String currentUrl = this.getUrl();
     LOG.d(TAG, "The current URL is: " + currentUrl);
     LOG.d(TAG, "The URL at item 0 is: " + url);
     return currentUrl.equals(url);
   }
   return false;
 }
Beispiel #3
0
 @Override
 public boolean onKeyDown(int keyCode, KeyEvent event) {
   if (event.getAction() == KeyEvent.ACTION_DOWN) {
     switch (keyCode) {
       case KeyEvent.KEYCODE_BACK:
         if (webView.canGoBack()) {
           WebBackForwardList history = webView.copyBackForwardList();
           if (history
               .getItemAtIndex(history.getCurrentIndex() - 1)
               .getUrl()
               .equals("about:blank")) webView.goBack();
           webView.goBack();
         } else {
           finish();
         }
         return true;
     }
   }
   return super.onKeyDown(keyCode, event);
 }