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"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<string name="app_name">PhoneGap</string> <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> <string name="go">Snap</string>
</resources> </resources>

View File

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

View File

@ -32,7 +32,26 @@ public class ContactManager {
mView = view; 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) public void search(String name, String npa, String email)
{ {
@ -107,7 +126,7 @@ public class ContactManager {
try{ try{
Cursor myCursor = mApp.managedQuery(mPeople, projection, Cursor myCursor = mApp.managedQuery(mPeople, projection,
conditions, variables , People.NAME + " ASC"); conditions, variables , People.NAME + " ASC");
processResults(myCursor); processResults(myCursor, false);
} }
catch (SQLiteException ex) 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()) { if (cur.moveToFirst()) {
@ -139,10 +158,15 @@ public class ContactManager {
else else
email = ""; email = "";
// Code for backwards compatibility with the OLD Contacts API
if (all)
mView.loadUrl("javascript:navigator.AddressBook.droidFoundContact('" + name + "','" + phoneNumber + "','" + email +"')"); mView.loadUrl("javascript:navigator.AddressBook.droidFoundContact('" + name + "','" + phoneNumber + "','" + email +"')");
else
mView.loadUrl("javascript:navigator.ContactManager.droidAddContact('" + name + "','" + phoneNumber + "','" + email +"')");
} while (cur.moveToNext()); } while (cur.moveToNext());
if (all)
mView.loadUrl("javascript:navigator.ContactManager.droidDone()");
} }
else else
{ {
@ -177,6 +201,7 @@ public class ContactManager {
} }
} while (cur.moveToNext()); } while (cur.moveToNext());
} }
} }

View File

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