Moving to new computer, committing what I have in the branch

This commit is contained in:
Joe Bowser 2009-03-27 14:27:49 -07:00
parent 08691b73c2
commit 745e550815
6 changed files with 68 additions and 16 deletions

View File

@ -89,8 +89,10 @@ public class DroidGap extends Activity {
private void bindBrowser(WebView appView)
{
// The PhoneGap class handles the Notification and Android Specific crap
PhoneGap gap = new PhoneGap(this, mHandler, appView);
appView.addJavascriptInterface(gap, "DroidGap");
appView.addJavascriptInterface(gap, "Droid");
}
/**

View File

@ -0,0 +1,19 @@
package com.nitobi.phonegap;
import android.webkit.WebView;
public class GeoBroker {
private WebView mAppView;
public String start(int freq, String success, String failure)
{
return null;
}
public void stop(String key)
{
}
}

View File

@ -0,0 +1,37 @@
package com.nitobi.phonegap;
import android.content.Context;
import android.webkit.WebView;
public class GeoListener {
String id;
String successCallback;
String failCallback;
GpsListener mGps;
NetworkListener mNetwork;
Context mCtx;
private WebView mAppView;
int interval;
GeoListener(String key, Context ctx, int time, String succ, String fail)
{
id = key;
interval = time;
mCtx = ctx;
mGps = new GpsListener(mCtx, interval, this);
mNetwork = new NetworkListener(mCtx, interval, this);
}
void success()
{
/*
* We only need to figure out what we do when we succeed!
*/
mAppView.loadUrl("javascript:geoLocation.success(" + ")");
}
void fail()
{
}
}

View File

@ -34,12 +34,14 @@ public class GpsListener implements LocationListener {
private Location cLoc;
private LocationManager mLocMan;
private static final String LOG_TAG = "PhoneGap";
private GeoListener owner;
public GpsListener(Context ctx)
public GpsListener(Context ctx, int interval, GeoListener m)
{
owner = m;
mCtx = ctx;
mLocMan = (LocationManager) mCtx.getSystemService(Context.LOCATION_SERVICE);
mLocMan.requestLocationUpdates(LocationManager.GPS_PROVIDER, 60000, 0, this);
mLocMan.requestLocationUpdates(LocationManager.GPS_PROVIDER, interval, 0, this);
cLoc = mLocMan.getLastKnownLocation(LocationManager.GPS_PROVIDER);
}

View File

@ -34,12 +34,14 @@ public class NetworkListener implements LocationListener {
private Location cLoc;
private LocationManager mLocMan;
private static final String LOG_TAG = "PhoneGap";
GeoListener owner;
public NetworkListener(Context ctx)
public NetworkListener(Context ctx, int interval, GeoListener m)
{
owner = m;
mCtx = ctx;
mLocMan = (LocationManager) mCtx.getSystemService(Context.LOCATION_SERVICE);
mLocMan.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 60000, 0, this);
mLocMan.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, interval, 0, this);
cLoc = mLocMan.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
}

View File

@ -57,8 +57,7 @@ public class PhoneGap{
this.mCtx = ctx;
this.mHandler = handler;
this.mAppView = appView;
mGps = new GpsListener(ctx);
mNetwork = new NetworkListener(ctx);
mSmsListener = new SmsListener(ctx,mAppView);
fileManager = new DirectoryManager();
audio = new AudioHandler("/sdcard/tmprecording.mp3", ctx);
@ -90,8 +89,6 @@ public class PhoneGap{
vibrator.vibrate(pattern);
}
public void getLocation( ){
mHandler.post(new Runnable() {
public void run() {
@ -113,13 +110,6 @@ public class PhoneGap{
}
});
}
public String outputText(){
String test = "<p>Test</p>";
return test;
}
public String getUuid()
{