mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-19 07:02:51 +08:00
changed 'deviceReady' to 'deviceready' in index.html. fixed up the file utils a bit so that they sort of work.
This commit is contained in:
parent
9ff45f70e2
commit
ab4ca5ec8b
@ -113,7 +113,7 @@
|
||||
|
||||
function init(){
|
||||
document.addEventListener("touchmove", preventBehavior, false);
|
||||
document.addEventListener("deviceReady", deviceInfo, true);
|
||||
document.addEventListener("deviceready", deviceInfo, true);
|
||||
}
|
||||
|
||||
|
||||
|
@ -128,7 +128,7 @@ FileMgr.prototype.createDirectory = function(dirName, successCallback, errorCall
|
||||
{
|
||||
this.successCallback = successCallback;
|
||||
this.errorCallback = errorCallback;
|
||||
var test = FileUtils.createDirectory(dirName);
|
||||
var test = FileUtil.createDirectory(dirName);
|
||||
test ? successCallback() : errorCallback();
|
||||
}
|
||||
|
||||
@ -136,7 +136,7 @@ FileMgr.prototype.deleteDirectory = function(dirName, successCallback, errorCall
|
||||
{
|
||||
this.successCallback = successCallback;
|
||||
this.errorCallback = errorCallback;
|
||||
var test = FileUtils.deleteDirectory(dirName);
|
||||
var test = FileUtil.deleteDirectory(dirName);
|
||||
test ? successCallback() : errorCallback();
|
||||
}
|
||||
|
||||
@ -144,7 +144,7 @@ FileMgr.prototype.deleteFile = function(fileName, successCallback, errorCallback
|
||||
{
|
||||
this.successCallback = successCallback;
|
||||
this.errorCallback = errorCallback;
|
||||
FileUtils.deleteFile(fileName);
|
||||
FileUtil.deleteFile(fileName);
|
||||
test ? successCallback() : errorCallback();
|
||||
}
|
||||
|
||||
@ -158,7 +158,7 @@ FileMgr.prototype.getFreeDiskSpace = function(successCallback, errorCallback)
|
||||
{
|
||||
this.successCallback = successCallback;
|
||||
this.errorCallback = errorCallback;
|
||||
this.freeDiskSpace = FileUtils.getFreeDiskSpace();
|
||||
this.freeDiskSpace = FileUtil.getFreeDiskSpace();
|
||||
(this.freeDiskSpace > 0) ? successCallback() : errorCallback();
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ import android.util.Log;
|
||||
|
||||
public class DirectoryManager {
|
||||
|
||||
protected boolean testFileExists (String name){
|
||||
protected static boolean testFileExists (String name){
|
||||
boolean status;
|
||||
if ((testSaveLocationExists())&&(!name.equals(""))){
|
||||
File path = Environment.getExternalStorageDirectory();
|
||||
@ -20,7 +20,7 @@ public class DirectoryManager {
|
||||
return status;
|
||||
}
|
||||
|
||||
protected long getFreeDiskSpace(){
|
||||
protected static long getFreeDiskSpace(){
|
||||
/*
|
||||
* gets the available SD card free space or returns -1 if the SD card is not mounted.
|
||||
*/
|
||||
@ -38,7 +38,7 @@ public class DirectoryManager {
|
||||
return (freeSpace);
|
||||
}
|
||||
|
||||
protected boolean createDirectory(String directoryName){
|
||||
protected static boolean createDirectory(String directoryName){
|
||||
boolean status;
|
||||
if ((testSaveLocationExists())&&(!directoryName.equals(""))){
|
||||
File path = Environment.getExternalStorageDirectory();
|
||||
@ -50,7 +50,7 @@ public class DirectoryManager {
|
||||
return status;
|
||||
}
|
||||
|
||||
protected boolean testSaveLocationExists(){
|
||||
protected static boolean testSaveLocationExists(){
|
||||
String sDCardStatus = Environment.getExternalStorageState();
|
||||
boolean status;
|
||||
if (sDCardStatus.equals(Environment.MEDIA_MOUNTED)){
|
||||
@ -60,7 +60,7 @@ public class DirectoryManager {
|
||||
return status;
|
||||
}
|
||||
|
||||
protected boolean deleteDirectory(String fileName){
|
||||
protected static boolean deleteDirectory(String fileName){
|
||||
boolean status;
|
||||
SecurityManager checker = new SecurityManager();
|
||||
|
||||
@ -92,7 +92,7 @@ public class DirectoryManager {
|
||||
return status;
|
||||
}
|
||||
|
||||
protected boolean deleteFile(String fileName){
|
||||
protected static boolean deleteFile(String fileName){
|
||||
boolean status;
|
||||
SecurityManager checker = new SecurityManager();
|
||||
|
||||
@ -117,7 +117,7 @@ public class DirectoryManager {
|
||||
return status;
|
||||
}
|
||||
|
||||
private File constructFilePaths (String file1, String file2){
|
||||
private static File constructFilePaths (String file1, String file2){
|
||||
File newPath;
|
||||
newPath = new File(file1+"/"+file2);
|
||||
return newPath;
|
||||
|
@ -8,7 +8,6 @@ public class FileUtils {
|
||||
|
||||
|
||||
WebView mView;
|
||||
DirectoryManager fileManager;
|
||||
FileReader f_in;
|
||||
FileWriter f_out;
|
||||
|
||||
@ -18,26 +17,26 @@ public class FileUtils {
|
||||
}
|
||||
|
||||
public int testSaveLocationExists(){
|
||||
if (fileManager.testSaveLocationExists())
|
||||
if (DirectoryManager.testSaveLocationExists())
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
public long getFreeDiskSpace(){
|
||||
long freeDiskSpace=fileManager.getFreeDiskSpace();
|
||||
long freeDiskSpace=DirectoryManager.getFreeDiskSpace();
|
||||
return freeDiskSpace;
|
||||
}
|
||||
|
||||
public int testFileExists(String file){
|
||||
if (fileManager.testFileExists(file))
|
||||
if (DirectoryManager.testFileExists(file))
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int testDirectoryExists(String file){
|
||||
if (fileManager.testFileExists(file))
|
||||
if (DirectoryManager.testFileExists(file))
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
@ -49,7 +48,7 @@ public class FileUtils {
|
||||
* TODO: JavaScript Call backs for success and error handling
|
||||
*/
|
||||
public int deleteDirectory (String dir){
|
||||
if (fileManager.deleteDirectory(dir))
|
||||
if (DirectoryManager.deleteDirectory(dir))
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
@ -61,7 +60,7 @@ public class FileUtils {
|
||||
* TODO: JavaScript Call backs for success and error handling
|
||||
*/
|
||||
public int deleteFile (String file){
|
||||
if (fileManager.deleteFile(file))
|
||||
if (DirectoryManager.deleteFile(file))
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
@ -73,7 +72,7 @@ public class FileUtils {
|
||||
* TODO: JavaScript Call backs for success and error handling
|
||||
*/
|
||||
public int createDirectory(String dir){
|
||||
if (fileManager.createDirectory(dir))
|
||||
if (DirectoryManager.createDirectory(dir))
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
|
Loading…
Reference in New Issue
Block a user