diff --git a/src/net/i2p/android/router/activity/I2PWebViewClient.java b/src/net/i2p/android/router/activity/I2PWebViewClient.java index cf28ca8aeb36d39f75aeae3a769f968ffc3603f7..4057acae5620a9c2bc5cec31e587cccc29a8f050 100644 --- a/src/net/i2p/android/router/activity/I2PWebViewClient.java +++ b/src/net/i2p/android/router/activity/I2PWebViewClient.java @@ -4,6 +4,7 @@ import android.app.Dialog; import android.app.ProgressDialog; import android.content.Context; import android.content.DialogInterface; +import android.graphics.Bitmap; import android.net.Uri; import android.os.AsyncTask; import android.view.Gravity; @@ -149,6 +150,18 @@ class I2PWebViewClient extends WebViewClient { super.onReceivedError(view, errorCode, description, failingUrl); } + @Override + public void onPageStarted(WebView view, String url, Bitmap favicon) { + Util.e("OPS URL: " + url); + super.onPageStarted(view, url, favicon); + } + + @Override + public void onPageFinished(WebView view, String url) { + Util.e("OPF URL: " + url); + super.onPageFinished(view, url); + } + /****** API 11 :( diff --git a/src/net/i2p/android/router/util/AppCache.java b/src/net/i2p/android/router/util/AppCache.java index a9cafdcb18694449f1fc1abafccd40e12bb7a539..0fcd3dee17822b2fa032cc1c75ccb928094a6178 100644 --- a/src/net/i2p/android/router/util/AppCache.java +++ b/src/net/i2p/android/router/util/AppCache.java @@ -115,14 +115,19 @@ public class AppCache { /** * Return a content:// uri for any cached content in question. * The file may or may not exist, and it may be deleted at any time. + * Side effect: If exists, sets as current base + * * @param key no fragment allowed */ public Uri getCacheUri(Uri key) { int hash = toHash(key); // poke the LRU + Object present = null; synchronized(_cache) { - _cache.get(Integer.valueOf(hash)); + present = _cache.get(Integer.valueOf(hash)); } + if (present != null) + setAsCurrentBase(key); return CacheProvider.getContentUri(key); } @@ -253,6 +258,17 @@ public class AppCache { return null; } + /** + * Set key as current base. May be content or i2p key. + */ + private static void setAsCurrentBase(Uri key) { + ContentValues cv = new ContentValues(); + cv.put(CacheProvider.CURRENT_BASE, Boolean.TRUE); + Uri uri = CacheProvider.getContentUri(key); + if (uri != null) + _resolver.insert(uri, cv); + } + /** ok for now but we will need to store key in the map and delete by integer */ private static void deleteContent(Uri key) { Uri uri = CacheProvider.getContentUri(key);