Permalink
Browse files

Merge pull request #708 from Patrick64/patch-2

[WebIntent Android] update for phonegap 2.0 compatibility
  • Loading branch information...
2 parents fc1805f + 73b39b0 commit 034727bcb6b9ceb16d0e9e705002317c45f2e5f4 @macdonst macdonst committed Aug 13, 2012
Showing with 7 additions and 7 deletions.
  1. +7 −7 Android/WebIntent/WebIntent.java
@@ -13,8 +13,8 @@
import android.util.Log;
import android.text.Html;
-import com.phonegap.api.Plugin;
-import com.phonegap.api.PluginResult;
+import org.apache.cordova.api.Plugin;
+import org.apache.cordova.api.PluginResult;
/**
* WebIntent is a PhoneGap plugin that bridges Android intents and web
@@ -73,15 +73,15 @@ public PluginResult execute(String action, JSONArray args, String callbackId) {
if (args.length() != 1) {
return new PluginResult(PluginResult.Status.INVALID_ACTION);
}
- Intent i = ((DroidGap) this.ctx).getIntent();
+ Intent i = ((DroidGap)this.cordova.getContext()).getIntent();
String extraName = args.getString(0);
return new PluginResult(PluginResult.Status.OK, i.hasExtra(extraName));
} else if (action.equals("getExtra")) {
if (args.length() != 1) {
return new PluginResult(PluginResult.Status.INVALID_ACTION);
}
- Intent i = ((DroidGap) this.ctx).getIntent();
+ Intent i = ((DroidGap)this.cordova.getContext()).getIntent();
String extraName = args.getString(0);
if (i.hasExtra(extraName)) {
return new PluginResult(PluginResult.Status.OK, i.getStringExtra(extraName));
@@ -93,7 +93,7 @@ public PluginResult execute(String action, JSONArray args, String callbackId) {
return new PluginResult(PluginResult.Status.INVALID_ACTION);
}
- Intent i = ((DroidGap) this.ctx).getIntent();
+ Intent i = ((DroidGap)this.cordova.getContext()).getIntent();
String uri = i.getDataString();
return new PluginResult(PluginResult.Status.OK, uri);
} else if (action.equals("onNewIntent")) {
@@ -173,7 +173,7 @@ void startActivity(String action, Uri uri, String type, Map<String, String> extr
i.putExtra(key, value);
}
}
- this.ctx.startActivity(i);
+ this.cordova.getActivity().startActivity(i);
}
void sendBroadcast(String action, Map<String, String> extras) {
@@ -184,6 +184,6 @@ void sendBroadcast(String action, Map<String, String> extras) {
intent.putExtra(key, value);
}
- ((DroidGap) this.ctx).sendBroadcast(intent);
+ ((DroidGap)this.cordova.getContext()).sendBroadcast(intent);
}
}

0 comments on commit 034727b

Please sign in to comment.