mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-07 23:03:11 +08:00
Fixing the 1.5 Storage. Got inheritance wrong in this case
This commit is contained in:
parent
5b5c2590f9
commit
d81f53465f
@ -94,7 +94,6 @@ public class DroidGap extends Activity {
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
appView.setWebChromeClient(new GapClient(this));
|
appView.setWebChromeClient(new GapClient(this));
|
||||||
cupcakeStorage = new Storage(appView);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
appView.setInitialScale(100);
|
appView.setInitialScale(100);
|
||||||
@ -113,6 +112,8 @@ public class DroidGap extends Activity {
|
|||||||
|
|
||||||
/* Bind the appView object to the gap class methods */
|
/* Bind the appView object to the gap class methods */
|
||||||
bindBrowser(appView);
|
bindBrowser(appView);
|
||||||
|
if(cupcakeStorage != null)
|
||||||
|
cupcakeStorage.setStorage(appPackage);
|
||||||
|
|
||||||
root.addView(appView);
|
root.addView(appView);
|
||||||
setContentView(root);
|
setContentView(root);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.phonegap;
|
package com.phonegap;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.database.sqlite.*;
|
import android.database.sqlite.*;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@ -12,20 +13,26 @@ public class Storage {
|
|||||||
String path;
|
String path;
|
||||||
String txid = "";
|
String txid = "";
|
||||||
WebView appView;
|
WebView appView;
|
||||||
|
Context mCtx;
|
||||||
|
|
||||||
Storage(WebView view)
|
Storage(WebView view)
|
||||||
{
|
{
|
||||||
Package pack = this.getClass().getPackage();
|
|
||||||
String appPackage = pack.getName();
|
|
||||||
path = "/data/data/" + appPackage + "/databases/";
|
|
||||||
appView = view;
|
appView = view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setStorage(String appPackage)
|
||||||
|
{
|
||||||
|
path = "/data/data/" + appPackage + "/databases/";
|
||||||
|
}
|
||||||
|
|
||||||
public void openDatabase(String db, String version, String display_name, long size)
|
public void openDatabase(String db, String version, String display_name, long size)
|
||||||
|
{
|
||||||
|
if (path != null)
|
||||||
{
|
{
|
||||||
path += db + ".db";
|
path += db + ".db";
|
||||||
myDb = SQLiteDatabase.openOrCreateDatabase(path, null);
|
myDb = SQLiteDatabase.openOrCreateDatabase(path, null);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void executeSql(String query, String[] params, String tx_id)
|
public void executeSql(String query, String[] params, String tx_id)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user