From 0af30a6e8244ecb30a4648b4075216c7ede996d1 Mon Sep 17 00:00:00 2001 From: Joe Bowser Date: Thu, 26 Nov 2009 11:48:16 -0800 Subject: [PATCH] Fixed --- framework/AndroidManifest.xml | 4 ++-- framework/default.properties | 2 +- framework/src/com/phonegap/GapClient.java | 3 ++- .../src/com/phonegap/WebViewReflect.java | 22 +++++++++++++++---- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/framework/AndroidManifest.xml b/framework/AndroidManifest.xml index e30be848..b8ac3bee 100644 --- a/framework/AndroidManifest.xml +++ b/framework/AndroidManifest.xml @@ -24,7 +24,7 @@ + android:debuggable="true"> @@ -38,6 +38,6 @@ - + diff --git a/framework/default.properties b/framework/default.properties index 62bef18a..d4b59de7 100644 --- a/framework/default.properties +++ b/framework/default.properties @@ -9,6 +9,6 @@ apk-configurations= # Project target. -target=android-4 +target=android-5 # Indicates whether an apk should be generated for each density. split.density=false diff --git a/framework/src/com/phonegap/GapClient.java b/framework/src/com/phonegap/GapClient.java index 1aae88a8..be27e32e 100644 --- a/framework/src/com/phonegap/GapClient.java +++ b/framework/src/com/phonegap/GapClient.java @@ -41,7 +41,7 @@ public class GapClient extends WebChromeClient { result.confirm(); return true; } - + public void onExceededDatabaseQuota(String url, String databaseIdentifier, long currentQuota, long estimatedSize, long totalUsedQuota, WebStorage.QuotaUpdater quotaUpdater) { @@ -58,4 +58,5 @@ public class GapClient extends WebChromeClient { quotaUpdater.updateQuota(currentQuota); } } + } diff --git a/framework/src/com/phonegap/WebViewReflect.java b/framework/src/com/phonegap/WebViewReflect.java index 3d1d2cd2..072fa9dc 100644 --- a/framework/src/com/phonegap/WebViewReflect.java +++ b/framework/src/com/phonegap/WebViewReflect.java @@ -8,7 +8,7 @@ import android.webkit.WebSettings; public class WebViewReflect { private static Method mWebSettings_setDatabaseEnabled; - + private static Method mWebSettings_setDatabasePath; static { checkCompatibility(); @@ -41,18 +41,32 @@ public class WebViewReflect { try { mWebSettings_setDatabaseEnabled = WebSettings.class.getMethod( "setDatabaseEnabled", new Class[] { boolean.class } ); + mWebSettings_setDatabasePath = WebSettings.class.getMethod( + "setDatabasePath", new Class[] { String.class }); /* success, this is a newer device */ } catch (NoSuchMethodException nsme) { /* failure, must be older device */ } } - public static void setStorage(WebSettings setting, boolean enable, String path) { if (mWebSettings_setDatabaseEnabled != null) { /* feature is supported */ - setting.setDatabaseEnabled(enable); - setting.setDatabasePath(path); + try { + mWebSettings_setDatabaseEnabled.invoke(setting, true); + mWebSettings_setDatabasePath.invoke(setting, path); + } catch (IllegalArgumentException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IllegalAccessException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (InvocationTargetException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + //setting.setDatabaseEnabled(enable); + //setting.setDatabasePath(path); } else { /* feature not supported, do something else */ System.out.println("dump not supported");