diff --git a/assets/gap.js b/assets/gap.js index 3b481fb9..871efb9f 100644 --- a/assets/gap.js +++ b/assets/gap.js @@ -308,27 +308,31 @@ var Device = { } }, - storage: { + file: { result: "", - testSDCard: function(){ - Device.storage.result = window.DroidGap.testSaveLocationExists(); - return Device.storage.result; + testSaveLocationExists: function(){ + Device.file.result = window.DroidGap.testSaveLocationExists(); + return Device.file.result; }, - testExistence: function(file){ - Device.storage.result = window.DroidGap.testFileExists(file); - return Device.storage.result; + testFileExists: function(file){ + Device.file.result = window.DroidGap.testFileExists(file); + return Device.file.result; }, - delFile: function(file){ - Device.storage.result = window.DroidGap.deleteFile(file); - return Device.storage.result; + testDirectoryExists: function(file){ + Device.file.result = window.DroidGap.testFileExists(file); + return Device.file.result; }, - delDir: function(file){ - Device.storage.result = window.DroidGap.deleteDirectory(file); - return Device.storage.result; + deleteFile: function(file){ + Device.file.result = window.DroidGap.deleteFile(file); + return Device.file.result; }, - createDir: function(file){ - Device.storage.result = window.DroidGap.createDirectory(file); - return Device.storage.result; + deleteDirectory: function(file){ + Device.file.result = window.DroidGap.deleteDirectory(file); + return Device.file.result; + }, + createDirectory: function(file){ + Device.file.result = window.DroidGap.createDirectory(file); + return Device.file.result; } }, diff --git a/assets/index.html b/assets/index.html index 1f16d66a..9fdc6479 100644 --- a/assets/index.html +++ b/assets/index.html @@ -111,19 +111,22 @@ http = function(func) fileManagement = function(x){ if (x == 'testSDCard'){ - $('file_status').value = Device.storage.testSDCard(); + $('file_status').value = Device.file.testSaveLocationExists(); }else - if (x == 'testExistence'){ - $('file_status').value = Device.storage.testExistence($('checkfile').value); + if (x == 'testFileExists'){ + $('file_status').value = Device.file.testFileExists($('checkfile').value); + }else + if (x == 'testDirectoryExists'){ + $('file_status').value = Device.file.testDirectoryExists($('checkdir').value); }else if (x == 'createDir'){ - $('file_status').value = Device.storage.createDir($('createfile').value); + $('file_status').value = Device.file.createDirectory($('createfile').value); }else if (x == 'delFile'){ - $('file_status').value = Device.storage.delFile($('delfile').value); + $('file_status').value = Device.file.deleteFile($('delfile').value); }else if (x == 'delDir'){ - $('file_status').value = Device.storage.delDir($('deldir').value); + $('file_status').value = Device.file.deleteDirectory($('deldir').value); } } @@ -191,7 +194,7 @@ addLoadEvent(initGap);
  • Audio...
  • Notification...
  • HTTP...
  • -
  • External Storage
  • +
  • File IO...
  • Phone Info...
  • About
  • @@ -341,19 +344,23 @@ addLoadEvent(initGap); -
    -

    Storage Management

    +
    +

    file IO

    - +
    +
    Create Directory @@ -374,44 +381,32 @@ addLoadEvent(initGap);

    Audio

    - - + +
    -
    -
    -
    -
    -
    -
    - - + +
    -
    -
    -
    -
    -
    -
    diff --git a/src/com/nitobi/phonegap/AudioHandler.java b/src/com/nitobi/phonegap/AudioHandler.java index ae89ef72..4551596f 100644 --- a/src/com/nitobi/phonegap/AudioHandler.java +++ b/src/com/nitobi/phonegap/AudioHandler.java @@ -134,13 +134,11 @@ public class AudioHandler implements OnCompletionListener, OnPreparedListener, O return duration; } - @Override public void onPrepared(MediaPlayer mPlayer) { if (isPlaying) { mPlayer.setOnCompletionListener(this); mPlayer.setOnBufferingUpdateListener(new OnBufferingUpdateListener() { - @Override public void onBufferingUpdate(MediaPlayer mPlayer, int percent) { /* TODO: call back, e.g. update outer progress bar */ @@ -151,7 +149,6 @@ public class AudioHandler implements OnCompletionListener, OnPreparedListener, O } } - @Override public boolean onError(MediaPlayer mPlayer, int arg1, int arg2) { Log.e("AUDIO onError", "error " + arg1 + " " + arg2); return false; diff --git a/src/com/nitobi/phonegap/PhoneGap.java b/src/com/nitobi/phonegap/PhoneGap.java index 79d1994d..36d0ce73 100644 --- a/src/com/nitobi/phonegap/PhoneGap.java +++ b/src/com/nitobi/phonegap/PhoneGap.java @@ -249,80 +249,56 @@ public class PhoneGap{ HttpHandler http = new HttpHandler(); http.get(url, file); } + + -<<<<<<< HEAD:android/src/com/nitobi/phonegap/PhoneGap.java - /* - * TODO: FIX! These should not be returning arbitrary Strings! - */ - public String testSaveLocationExists(){ -======= - /** - * Check if SD card is ready and already mounted - * TODO: JavaScript Call backs for success and error handling - */ + public int testSaveLocationExists(){ ->>>>>>> 6959002f1187829f33e279633e0446cc750ab6d3:android/src/com/nitobi/phonegap/PhoneGap.java if (fileManager.testSaveLocationExists()) return 0; else return 1; } -<<<<<<< HEAD:android/src/com/nitobi/phonegap/PhoneGap.java - public String testFileExists(String file){ + + public int testFileExists(String file){ if (fileManager.testFileExists(file)) - return "File exists"; -======= - - /** - * Check if a specific directory of file exists - * TODO: JavaScript Call backs for success and error handling - */ - public int testDirOrFileExists(String file){ - if (fileManager.isDirtoryOrFileExists(file)) return 0; ->>>>>>> 6959002f1187829f33e279633e0446cc750ab6d3:android/src/com/nitobi/phonegap/PhoneGap.java else return 1; } -<<<<<<< HEAD:android/src/com/nitobi/phonegap/PhoneGap.java - public String deleteDirectory (String dir){ - if (fileManager.deleteDirectory(dir)) - return "Completed"; -======= + public int testDirectoryExists(String file){ + if (fileManager.testFileExists(file)) + return 0; + else + return 1; + } + /** * Delete a specific directory. * Everyting in side the directory would be gone. * TODO: JavaScript Call backs for success and error handling */ public int deleteDirectory (String dir){ - if (fileManager.deleteDir(dir)) + if (fileManager.deleteDirectory(dir)) return 0; ->>>>>>> 6959002f1187829f33e279633e0446cc750ab6d3:android/src/com/nitobi/phonegap/PhoneGap.java else return 1; } -<<<<<<< HEAD:android/src/com/nitobi/phonegap/PhoneGap.java - public String deleteFile (String file){ -======= + /** * Delete a specific file. * TODO: JavaScript Call backs for success and error handling */ public int deleteFile (String file){ ->>>>>>> 6959002f1187829f33e279633e0446cc750ab6d3:android/src/com/nitobi/phonegap/PhoneGap.java if (fileManager.deleteFile(file)) return 0; else return 1; } -<<<<<<< HEAD:android/src/com/nitobi/phonegap/PhoneGap.java - public String createDirectory(String dir){ - if (fileManager.createDirectory(dir)) - return "Completed"; -======= + /** * Create a new directory. * TODO: JavaScript Call backs for success and error handling @@ -330,11 +306,11 @@ public class PhoneGap{ public int createDirectory(String dir){ if (fileManager.createDirectory(dir)) return 0; ->>>>>>> 6959002f1187829f33e279633e0446cc750ab6d3:android/src/com/nitobi/phonegap/PhoneGap.java else return 1; } + /** * AUDIO * TODO: Basic functions done but needs more work on error handling and call backs, remove record hack