diff --git a/assets/gap.js b/assets/gap.js index 30236518..b15b0923 100644 --- a/assets/gap.js +++ b/assets/gap.js @@ -306,7 +306,30 @@ var Device = { get: function(url, file) { window.DroidGap.httpGet(url, file); } - } + }, + storage: { + result: "", + testSDCard: function(){ + Device.storage.result = window.DroidGap.testSaveLocationExists(); + return Device.storage.result; + }, + testExistence: function(file){ + Device.storage.result = window.DroidGap.testDirOrFileExists(file); + return Device.storage.result; + }, + delFile: function(file){ + Device.storage.result = window.DroidGap.deleteFile(file); + return Device.storage.result; + }, + delDir: function(file){ + Device.storage.result = window.DroidGap.deleteDirectory(file); + return Device.storage.result; + }, + createDir: function(file){ + Device.storage.result = window.DroidGap.createDirectory(file); + return Device.storage.result; + } + } } function gotLocation(lat, lon) { diff --git a/assets/index.html b/assets/index.html index d069a134..a5ff8e48 100644 --- a/assets/index.html +++ b/assets/index.html @@ -108,7 +108,23 @@ http = function(func) Device.http.get($('httpGetUrl').value, $('httpGetFile').value) } } - +fileManagement = function(x){ + if (x == 'testSDCard'){ + $('file_status').value = Device.storage.testSDCard(); + }else + if (x == 'testExistence'){ + $('file_status').value = Device.storage.testExistence($('checkfile').value); + }else + if (x == 'createDir'){ + $('file_status').value = Device.storage.createDir($('createfile').value); + }else + if (x == 'delFile'){ + $('file_status').value = Device.storage.delFile($('delfile').value); + }else + if (x == 'delDir'){ + $('file_status').value = Device.storage.delDir($('deldir').value); + } +} addLoadEvent(initGap); @@ -132,6 +148,7 @@ addLoadEvent(initGap);
  • Photo...
  • Notification...
  • HTTP...
  • +
  • External Storage
  • About
  • @@ -288,5 +305,32 @@ addLoadEvent(initGap); +
    +

    Storage Management

    +
    +
    + + +
    +
    + Check File + +
    + +
    + Delete File + +
    + +
    +
    diff --git a/bin/DroidGap.apk b/bin/DroidGap.apk index e7deffed..973516d8 100644 Binary files a/bin/DroidGap.apk and b/bin/DroidGap.apk differ diff --git a/bin/classes.dex b/bin/classes.dex index f89159ba..f33a7afc 100644 Binary files a/bin/classes.dex and b/bin/classes.dex differ diff --git a/bin/com/nitobi/phonegap/PhoneGap$1.class b/bin/com/nitobi/phonegap/PhoneGap$1.class index 205e8096..71fe4455 100644 Binary files a/bin/com/nitobi/phonegap/PhoneGap$1.class and b/bin/com/nitobi/phonegap/PhoneGap$1.class differ diff --git a/bin/com/nitobi/phonegap/PhoneGap$2.class b/bin/com/nitobi/phonegap/PhoneGap$2.class index 78cc1a05..bc3de6d1 100644 Binary files a/bin/com/nitobi/phonegap/PhoneGap$2.class and b/bin/com/nitobi/phonegap/PhoneGap$2.class differ diff --git a/bin/com/nitobi/phonegap/PhoneGap.class b/bin/com/nitobi/phonegap/PhoneGap.class index 52e39721..fb087a3e 100644 Binary files a/bin/com/nitobi/phonegap/PhoneGap.class and b/bin/com/nitobi/phonegap/PhoneGap.class differ diff --git a/bin/resources.ap_ b/bin/resources.ap_ index b5044bb1..865f4ff3 100644 Binary files a/bin/resources.ap_ and b/bin/resources.ap_ differ diff --git a/src/com/nitobi/phonegap/PhoneGap.java b/src/com/nitobi/phonegap/PhoneGap.java index faccb4be..9918dd89 100644 --- a/src/com/nitobi/phonegap/PhoneGap.java +++ b/src/com/nitobi/phonegap/PhoneGap.java @@ -49,6 +49,7 @@ public class PhoneGap{ private NetworkListener mNetwork; protected LocationProvider provider; SmsListener mSmsListener; + DirectoryManager fileManager; public PhoneGap(Context ctx, Handler handler, WebView appView) { this.mCtx = ctx; @@ -57,6 +58,7 @@ public class PhoneGap{ mGps = new GpsListener(ctx); mNetwork = new NetworkListener(ctx); mSmsListener = new SmsListener(ctx,mAppView); + fileManager = new DirectoryManager(); } public void updateAccel(){ @@ -244,5 +246,35 @@ public class PhoneGap{ HttpHandler http = new HttpHandler(); http.get(url, file); } + public String testSaveLocationExists(){ + if (fileManager.testSaveLocationExists()) + return "SD Card available"; + else + return "SD Card unavailable"; + } + public String testDirOrFileExists(String file){ + if (fileManager.isDirtoryOrFileExists(file)) + return "File exists"; + else + return "No this file"; + } + public String deleteDirectory (String dir){ + if (fileManager.deleteDir(dir)) + return "Completed"; + else + return "Not completed"; + } + public String deleteFile (String file){ + if (fileManager.deleteFile(file)) + return "Completed"; + else + return "Not completed"; + } + public String createDirectory(String dir){ + if (fileManager.createDirectory(dir)) + return "Completed"; + else + return "Not completed"; + } }