mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-20 23:56:20 +08:00
fixed some merge problems
This commit is contained in:
parent
a463aa2400
commit
dfa2f0a802
@ -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;
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -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);
|
||||
<li><a href="#audio" onclick="audio();">Audio...</a></li>
|
||||
<li><a href="#notification" onclick="notification();">Notification...</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="http://phonegap.com/" target="_self">About</a></li>
|
||||
</ul>
|
||||
@ -341,19 +344,23 @@ addLoadEvent(initGap);
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div id="esm" title="Storage" class="panel" >
|
||||
<h2>Storage Management</h2>
|
||||
<div id="file" title="file IO" class="panel" >
|
||||
<h2>file IO</h2>
|
||||
<fieldset>
|
||||
<div class="row">
|
||||
<label>File Status</label>
|
||||
<label>File IO</label>
|
||||
<input disabled="enabled" name="file_status" id="file_status" value="" type="text"></input>
|
||||
</div>
|
||||
<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 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>
|
||||
</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 class="row">
|
||||
<a class="button leftButton" type="submit" onclick="fileManagement('createDir');">Create Directory</a>
|
||||
@ -374,44 +381,32 @@ addLoadEvent(initGap);
|
||||
<h2>Audio</h2>
|
||||
<fieldset>
|
||||
<div class="row">
|
||||
<label>AudioFile:</label>
|
||||
<input type=text name="audioFile" id="audioFile" size=60 maxlength=2048 value="/hullophonegap.mp3" style="width: 30ex"></input>
|
||||
<label>AudioFile:</label>
|
||||
<input type=text name="audioFile" id="audioFile" size=60 maxlength=2048 value="/hullophonegap.mp3" style="width: 30ex"></input>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<div class="row">
|
||||
<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 leftButton" type="submit" onclick="audio('startRecording');">startRecording</a>
|
||||
<a class="button blueButton" type="submit" onclick="audio('stopRecording');">stopRecording</a>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<div class="row">
|
||||
<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 leftButton" type="submit" onclick="audio('startPlaying');">startPlaying</a>
|
||||
<a class="button blueButton" type="submit" onclick="audio('stopPlaying');">stopPlaying</a>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<div class="row">
|
||||
<label>info:</label>
|
||||
<input disabled="enabled" id="posdur" type="text" />
|
||||
<label>info:</label>
|
||||
<input disabled="enabled" id="posdur" type="text" />
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<div class="row">
|
||||
<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 leftButton" type="submit" onclick="audio('getDuration');">getDuration</a>
|
||||
<a class="button blueButton" type="submit" onclick="audio('getCurrentPosition');">getPosition</a>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<div class="row">
|
||||
<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 leftButton" type="submit" onclick="audio('setEarpiece');">Earpiece</a>
|
||||
<a class="button blueButton" type="submit" onclick="audio('setSpeaker');">Speaker</a>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<div class="row">
|
||||
<a class="button leftButton" type="submit" onclick="audio('getAudioOutputDevice');">Audio Output</a>
|
||||
<input disabled="enabled" id="audoutput" type="text" style="width: 30ex"/>
|
||||
<a class="button leftButton" type="submit" onclick="audio('getAudioOutputDevice');">getAudioDevice</a>
|
||||
<input disabled="enabled" id="audoutput" type="text" style="width: 30ex"/>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user