fixed some merge problems

This commit is contained in:
Ray Vahey 2009-03-09 09:45:35 +07:00
parent a463aa2400
commit dfa2f0a802
4 changed files with 69 additions and 97 deletions

View File

@ -308,27 +308,31 @@ var Device = {
} }
}, },
storage: { file: {
result: "", result: "",
testSDCard: function(){ testSaveLocationExists: function(){
Device.storage.result = window.DroidGap.testSaveLocationExists(); Device.file.result = window.DroidGap.testSaveLocationExists();
return Device.storage.result; return Device.file.result;
}, },
testExistence: function(file){ testFileExists: function(file){
Device.storage.result = window.DroidGap.testFileExists(file); Device.file.result = window.DroidGap.testFileExists(file);
return Device.storage.result; return Device.file.result;
}, },
delFile: function(file){ testDirectoryExists: function(file){
Device.storage.result = window.DroidGap.deleteFile(file); Device.file.result = window.DroidGap.testFileExists(file);
return Device.storage.result; return Device.file.result;
}, },
delDir: function(file){ deleteFile: function(file){
Device.storage.result = window.DroidGap.deleteDirectory(file); Device.file.result = window.DroidGap.deleteFile(file);
return Device.storage.result; return Device.file.result;
}, },
createDir: function(file){ deleteDirectory: function(file){
Device.storage.result = window.DroidGap.createDirectory(file); Device.file.result = window.DroidGap.deleteDirectory(file);
return Device.storage.result; return Device.file.result;
},
createDirectory: function(file){
Device.file.result = window.DroidGap.createDirectory(file);
return Device.file.result;
} }
}, },

View File

@ -111,19 +111,22 @@ http = function(func)
fileManagement = function(x){ fileManagement = function(x){
if (x == 'testSDCard'){ if (x == 'testSDCard'){
$('file_status').value = Device.storage.testSDCard(); $('file_status').value = Device.file.testSaveLocationExists();
}else }else
if (x == 'testExistence'){ if (x == 'testFileExists'){
$('file_status').value = Device.storage.testExistence($('checkfile').value); $('file_status').value = Device.file.testFileExists($('checkfile').value);
}else
if (x == 'testDirectoryExists'){
$('file_status').value = Device.file.testDirectoryExists($('checkdir').value);
}else }else
if (x == 'createDir'){ if (x == 'createDir'){
$('file_status').value = Device.storage.createDir($('createfile').value); $('file_status').value = Device.file.createDirectory($('createfile').value);
}else }else
if (x == 'delFile'){ if (x == 'delFile'){
$('file_status').value = Device.storage.delFile($('delfile').value); $('file_status').value = Device.file.deleteFile($('delfile').value);
}else }else
if (x == 'delDir'){ 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);
<li><a href="#audio" onclick="audio();">Audio...</a></li> <li><a href="#audio" onclick="audio();">Audio...</a></li>
<li><a href="#notification" onclick="notification();">Notification...</a></li> <li><a href="#notification" onclick="notification();">Notification...</a></li>
<li><a href="#http" onclick="http();">HTTP...</a></li> <li><a href="#http" onclick="http();">HTTP...</a></li>
<li><a href="#esm" onclick="">External Storage</a></li> <li><a href="#file" onclick="">File IO...</a></li>
<li><a href="#pi" onclick="phInformation();">Phone Info...</a></li> <li><a href="#pi" onclick="phInformation();">Phone Info...</a></li>
<li><a href="http://phonegap.com/" target="_self">About</a></li> <li><a href="http://phonegap.com/" target="_self">About</a></li>
</ul> </ul>
@ -341,19 +344,23 @@ addLoadEvent(initGap);
</fieldset> </fieldset>
</div> </div>
<div id="esm" title="Storage" class="panel" > <div id="file" title="file IO" class="panel" >
<h2>Storage Management</h2> <h2>file IO</h2>
<fieldset> <fieldset>
<div class="row"> <div class="row">
<label>File Status</label> <label>File IO</label>
<input disabled="enabled" name="file_status" id="file_status" value="" type="text"></input> <input disabled="enabled" name="file_status" id="file_status" value="" type="text"></input>
</div> </div>
<div class="row"> <div class="row">
<a class="button leftButton" type="submit" onclick="fileManagement('testSDCard');">Check Status</a> <a class="button leftButton" type="submit" onclick="fileManagement('testSDCard');">testSaveLocation</a>
</div> </div>
<div class="row"> <div class="row">
<a class="button leftButton" type="submit" onclick="fileManagement('testExistence')">Check File</a> <a class="button leftButton" type="submit" onclick="fileManagement('testFileExists')">testFileExists</a>
<input type=text name="checkfile" id="checkfile" size=60 maxlength=2048 value="" style="width: 30ex"></input> <input type=text name="checkfile" id="checkfile" size=60 maxlength=2048 value="" style="width: 30ex"></input>
</div>
<div class="row">
<a class="button leftButton" type="submit" onclick="fileManagement('testDirectoryExists')">testDirExists</a>
<input type=text name="checkdir" id="checkdir" size=60 maxlength=2048 value="" style="width: 30ex"></input>
</div> </div>
<div class="row"> <div class="row">
<a class="button leftButton" type="submit" onclick="fileManagement('createDir');">Create Directory</a> <a class="button leftButton" type="submit" onclick="fileManagement('createDir');">Create Directory</a>
@ -377,40 +384,28 @@ addLoadEvent(initGap);
<label>AudioFile:</label> <label>AudioFile:</label>
<input type=text name="audioFile" id="audioFile" size=60 maxlength=2048 value="/hullophonegap.mp3" style="width: 30ex"></input> <input type=text name="audioFile" id="audioFile" size=60 maxlength=2048 value="/hullophonegap.mp3" style="width: 30ex"></input>
</div> </div>
</fieldset>
<fieldset>
<div class="row"> <div class="row">
<a class="button leftButton" type="submit" onclick="audio('startRecording');">startRecording</a> <a class="button leftButton" type="submit" onclick="audio('startRecording');">startRecording</a>
<a class="button blueButton" type="submit" onclick="audio('stopRecording');">stopRecording</a> <a class="button blueButton" type="submit" onclick="audio('stopRecording');">stopRecording</a>
</div> </div>
</fieldset>
<fieldset>
<div class="row"> <div class="row">
<a class="button leftButton" type="submit" onclick="audio('startPlaying');">startPlaying</a> <a class="button leftButton" type="submit" onclick="audio('startPlaying');">startPlaying</a>
<a class="button blueButton" type="submit" onclick="audio('stopPlaying');">stopPlaying</a> <a class="button blueButton" type="submit" onclick="audio('stopPlaying');">stopPlaying</a>
</div> </div>
</fieldset>
<fieldset>
<div class="row"> <div class="row">
<label>info:</label> <label>info:</label>
<input disabled="enabled" id="posdur" type="text" /> <input disabled="enabled" id="posdur" type="text" />
</div> </div>
</fieldset>
<fieldset>
<div class="row"> <div class="row">
<a class="button leftButton" type="submit" onclick="audio('getDuration');">getDuration</a> <a class="button leftButton" type="submit" onclick="audio('getDuration');">getDuration</a>
<a class="button blueButton" type="submit" onclick="audio('getCurrentPosition');">getPosition</a> <a class="button blueButton" type="submit" onclick="audio('getCurrentPosition');">getPosition</a>
</div> </div>
</fieldset>
<fieldset>
<div class="row"> <div class="row">
<a class="button leftButton" type="submit" onclick="audio('setEarpiece');">Earpiece</a> <a class="button leftButton" type="submit" onclick="audio('setEarpiece');">Earpiece</a>
<a class="button blueButton" type="submit" onclick="audio('setSpeaker');">Speaker</a> <a class="button blueButton" type="submit" onclick="audio('setSpeaker');">Speaker</a>
</div> </div>
</fieldset>
<fieldset>
<div class="row"> <div class="row">
<a class="button leftButton" type="submit" onclick="audio('getAudioOutputDevice');">Audio Output</a> <a class="button leftButton" type="submit" onclick="audio('getAudioOutputDevice');">getAudioDevice</a>
<input disabled="enabled" id="audoutput" type="text" style="width: 30ex"/> <input disabled="enabled" id="audoutput" type="text" style="width: 30ex"/>
</div> </div>
</fieldset> </fieldset>

View File

@ -134,13 +134,11 @@ public class AudioHandler implements OnCompletionListener, OnPreparedListener, O
return duration; return duration;
} }
@Override
public void onPrepared(MediaPlayer mPlayer) { public void onPrepared(MediaPlayer mPlayer) {
if (isPlaying) { if (isPlaying) {
mPlayer.setOnCompletionListener(this); mPlayer.setOnCompletionListener(this);
mPlayer.setOnBufferingUpdateListener(new OnBufferingUpdateListener() mPlayer.setOnBufferingUpdateListener(new OnBufferingUpdateListener()
{ {
@Override
public void onBufferingUpdate(MediaPlayer mPlayer, int percent) public void onBufferingUpdate(MediaPlayer mPlayer, int percent)
{ {
/* TODO: call back, e.g. update outer progress bar */ /* 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) { public boolean onError(MediaPlayer mPlayer, int arg1, int arg2) {
Log.e("AUDIO onError", "error " + arg1 + " " + arg2); Log.e("AUDIO onError", "error " + arg1 + " " + arg2);
return false; return false;

View File

@ -250,79 +250,55 @@ public class PhoneGap{
http.get(url, file); 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(){ public int testSaveLocationExists(){
>>>>>>> 6959002f1187829f33e279633e0446cc750ab6d3:android/src/com/nitobi/phonegap/PhoneGap.java
if (fileManager.testSaveLocationExists()) if (fileManager.testSaveLocationExists())
return 0; return 0;
else else
return 1; return 1;
} }
<<<<<<< HEAD:android/src/com/nitobi/phonegap/PhoneGap.java
public String testFileExists(String file){
if (fileManager.testFileExists(file))
return "File exists";
=======
/** public int testFileExists(String file){
* Check if a specific directory of file exists if (fileManager.testFileExists(file))
* TODO: JavaScript Call backs for success and error handling return 0;
*/ else
public int testDirOrFileExists(String file){ return 1;
if (fileManager.isDirtoryOrFileExists(file)) }
public int testDirectoryExists(String file){
if (fileManager.testFileExists(file))
return 0; return 0;
>>>>>>> 6959002f1187829f33e279633e0446cc750ab6d3:android/src/com/nitobi/phonegap/PhoneGap.java
else else
return 1; return 1;
} }
<<<<<<< HEAD:android/src/com/nitobi/phonegap/PhoneGap.java
public String deleteDirectory (String dir){
if (fileManager.deleteDirectory(dir))
return "Completed";
=======
/** /**
* Delete a specific directory. * Delete a specific directory.
* Everyting in side the directory would be gone. * Everyting in side the directory would be gone.
* TODO: JavaScript Call backs for success and error handling * TODO: JavaScript Call backs for success and error handling
*/ */
public int deleteDirectory (String dir){ public int deleteDirectory (String dir){
if (fileManager.deleteDir(dir)) if (fileManager.deleteDirectory(dir))
return 0; return 0;
>>>>>>> 6959002f1187829f33e279633e0446cc750ab6d3:android/src/com/nitobi/phonegap/PhoneGap.java
else else
return 1; return 1;
} }
<<<<<<< HEAD:android/src/com/nitobi/phonegap/PhoneGap.java
public String deleteFile (String file){
=======
/** /**
* Delete a specific file. * Delete a specific file.
* TODO: JavaScript Call backs for success and error handling * TODO: JavaScript Call backs for success and error handling
*/ */
public int deleteFile (String file){ public int deleteFile (String file){
>>>>>>> 6959002f1187829f33e279633e0446cc750ab6d3:android/src/com/nitobi/phonegap/PhoneGap.java
if (fileManager.deleteFile(file)) if (fileManager.deleteFile(file))
return 0; return 0;
else else
return 1; 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. * Create a new directory.
* TODO: JavaScript Call backs for success and error handling * TODO: JavaScript Call backs for success and error handling
@ -330,11 +306,11 @@ public class PhoneGap{
public int createDirectory(String dir){ public int createDirectory(String dir){
if (fileManager.createDirectory(dir)) if (fileManager.createDirectory(dir))
return 0; return 0;
>>>>>>> 6959002f1187829f33e279633e0446cc750ab6d3:android/src/com/nitobi/phonegap/PhoneGap.java
else else
return 1; return 1;
} }
/** /**
* AUDIO * AUDIO
* TODO: Basic functions done but needs more work on error handling and call backs, remove record hack * TODO: Basic functions done but needs more work on error handling and call backs, remove record hack