forked from github/cordova-android
Changes from today
This commit is contained in:
parent
649ed86d50
commit
7b0d978082
@ -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>
|
||||||
|
@ -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();
|
||||||
|
@ -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 = "";
|
||||||
|
|
||||||
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());
|
} while (cur.moveToNext());
|
||||||
|
if (all)
|
||||||
|
mView.loadUrl("javascript:navigator.ContactManager.droidDone()");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -176,7 +200,8 @@ public class ContactManager {
|
|||||||
mView.loadUrl("javascript:navigator.AddressBook.fail('Not found')");
|
mView.loadUrl("javascript:navigator.AddressBook.fail('Not found')");
|
||||||
}
|
}
|
||||||
} while (cur.moveToNext());
|
} while (cur.moveToNext());
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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 {
|
||||||
@ -63,9 +64,10 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user