Skip to content

Commit

Permalink
[android] don't use broken (in 1.9) getContext
Browse files Browse the repository at this point in the history
  • Loading branch information
alunny committed Jul 18, 2012
1 parent ef23ec2 commit cd459d6
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/android/ChildBrowser.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public String openExternal(String url, boolean usePhoneGap) {
try {
Intent intent = null;
if (usePhoneGap) {
intent = new Intent().setClass(cordova.getActivity(), org.apache.cordova.DroidGap.class);
intent = new Intent().setClass((Context) cordova.getActivity(), org.apache.cordova.DroidGap.class);
intent.setData(Uri.parse(url)); // This line will be removed in future.
intent.putExtra("url", url);

Expand Down Expand Up @@ -209,7 +209,7 @@ public String showWebPage(final String url, JSONObject options) {
// Create dialog in new thread
Runnable runnable = new Runnable() {
public void run() {
dialog = new Dialog(cordova.getContext());
dialog = new Dialog((Context) cordova.getActivity());

dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setCancelable(true);
Expand Down Expand Up @@ -238,13 +238,13 @@ public void onDismiss(DialogInterface dialog) {
closeParams = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT, 1.0f);
}

LinearLayout main = new LinearLayout(cordova.getActivity());
LinearLayout main = new LinearLayout((Context) cordova.getActivity());
main.setOrientation(LinearLayout.VERTICAL);

LinearLayout toolbar = new LinearLayout(cordova.getActivity());
LinearLayout toolbar = new LinearLayout((Context) cordova.getActivity());
toolbar.setOrientation(LinearLayout.HORIZONTAL);

ImageButton back = new ImageButton(cordova.getActivity());
ImageButton back = new ImageButton((Context) cordova.getActivity());
back.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
goBack();
Expand All @@ -258,7 +258,7 @@ public void onClick(View v) {
}
back.setLayoutParams(backParams);

ImageButton forward = new ImageButton(cordova.getActivity());
ImageButton forward = new ImageButton((Context) cordova.getActivity());
forward.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
goForward();
Expand All @@ -272,7 +272,7 @@ public void onClick(View v) {
}
forward.setLayoutParams(forwardParams);

edittext = new EditText(cordova.getActivity());
edittext = new EditText((Context) cordova.getActivity());
edittext.setOnKeyListener(new View.OnKeyListener() {
public boolean onKey(View v, int keyCode, KeyEvent event) {
// If the event is a key-down event on the "enter" button
Expand Down Expand Up @@ -302,7 +302,7 @@ public void onClick(View v) {
}
close.setLayoutParams(closeParams);

webview = new WebView(cordova.getActivity());
webview = new WebView((Context) cordova.getActivity());
webview.getSettings().setJavaScriptEnabled(true);
webview.getSettings().setBuiltInZoomControls(true);
WebViewClient client = new ChildBrowserClient(ctx, edittext);
Expand Down

0 comments on commit cd459d6

Please sign in to comment.