Changes from today

This commit is contained in:
Joe Bowser 2009-11-09 17:22:36 -08:00
parent 649ed86d50
commit 7b0d978082
4 changed files with 47 additions and 14 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">PhoneGap</string>
<string name="url">file:///android_asset/www/Tck/home.html</string>
<string name="url">file:///android_asset/www/index.html</string>
<string name="go">Snap</string>
</resources>

View File

@ -64,7 +64,11 @@ public class AudioHandler implements OnCompletionListener, OnPreparedListener, O
recorder.release();
}
moveFile(saveFile);
}catch (Exception e){e.printStackTrace();}
}
catch (Exception e)
{
e.printStackTrace();
}
}
protected void startPlaying(String file) {
@ -87,11 +91,14 @@ public class AudioHandler implements OnCompletionListener, OnPreparedListener, O
mPlayer.prepare();
}
mPlayer.setOnPreparedListener(this);
} catch (Exception e) { e.printStackTrace(); }
} catch (Exception e)
{
e.printStackTrace();
}
}
}
protected void stopPlaying() {
public void stopPlaying() {
if (isPlaying) {
mPlayer.stop();
mPlayer.release();

View File

@ -32,7 +32,26 @@ public class ContactManager {
mView = view;
}
// This is to add backwards compatibility to the OLD Contacts API\
public void getContactsAndSendBack()
{
String[] projection = new String[] {
People._ID,
People.NAME,
People.NUMBER,
People.PRIMARY_EMAIL_ID
};
try{
Cursor myCursor = mApp.managedQuery(mPeople, projection,
null, null , People.NAME + " ASC");
processResults(myCursor, true);
}
catch (SQLiteException ex)
{
Log.d(LOG_TAG, ex.getMessage());
}
}
public void search(String name, String npa, String email)
{
@ -107,7 +126,7 @@ public class ContactManager {
try{
Cursor myCursor = mApp.managedQuery(mPeople, projection,
conditions, variables , People.NAME + " ASC");
processResults(myCursor);
processResults(myCursor, false);
}
catch (SQLiteException ex)
{
@ -116,7 +135,7 @@ public class ContactManager {
}
private void processResults(Cursor cur){
private void processResults(Cursor cur, boolean all){
if (cur.moveToFirst()) {
@ -139,10 +158,15 @@ public class ContactManager {
else
email = "";
mView.loadUrl("javascript:navigator.AddressBook.droidFoundContact('" + name + "','" + phoneNumber + "','" + email +"')");
// Code for backwards compatibility with the OLD Contacts API
if (all)
mView.loadUrl("javascript:navigator.AddressBook.droidFoundContact('" + name + "','" + phoneNumber + "','" + email +"')");
else
mView.loadUrl("javascript:navigator.ContactManager.droidAddContact('" + name + "','" + phoneNumber + "','" + email +"')");
} while (cur.moveToNext());
if (all)
mView.loadUrl("javascript:navigator.ContactManager.droidDone()");
}
else
{
@ -176,7 +200,8 @@ public class ContactManager {
mView.loadUrl("javascript:navigator.AddressBook.fail('Not found')");
}
} while (cur.moveToNext());
}
}

View File

@ -35,6 +35,7 @@ import android.view.Window;
import android.view.WindowManager;
import android.webkit.JsResult;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
public class DroidGap extends Activity {
@ -63,9 +64,10 @@ public class DroidGap extends Activity {
/* This changes the setWebChromeClient to log alerts to LogCat! Important for Javascript Debugging */
appView.setWebChromeClient(new GapClient(this));
appView.getSettings().setJavaScriptEnabled(true);
appView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
appView.setWebChromeClient(new GapClient(this));
WebSettings settings = appView.getSettings();
settings.setJavaScriptEnabled(true);
settings.setJavaScriptCanOpenWindowsAutomatically(true);
/* Bind the appView object to the gap class methods */
@ -139,7 +141,6 @@ public class DroidGap extends Activity {
return true;
}
}