Removing the GapViewClient handler, since it breaks PhoneGap, reverting. Rather have every other URI working except for sms:

This commit is contained in:
Joe Bowser 2010-07-06 11:43:25 -07:00
parent 310766180f
commit c75e66a2fc

View File

@ -106,8 +106,6 @@ public class DroidGap extends Activity {
appView.setWebChromeClient(new GapClient(this));
}
appView.setWebViewClient(new GapViewClient(this));
appView.setInitialScale(100);
appView.setVerticalScrollBarEnabled(false);
@ -182,63 +180,6 @@ public class DroidGap extends Activity {
appView.loadUrl(url);
}
public class GapViewClient extends WebViewClient {
Context mCtx;
public GapViewClient(Context ctx)
{
mCtx = ctx;
}
/*
* (non-Javadoc)
* @see android.webkit.WebViewClient#shouldOverrideUrlLoading(android.webkit.WebView, java.lang.String)
*
* Note: Since we override it to make sure that we are using PhoneGap and not some other bullshit
* viewer that may or may not exist, we need to make sure that http:// and tel:// still work.
*
*/
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
// TODO: See about using a switch statement
if (url.startsWith("http://"))
{
Intent browse = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(browse);
return true;
}
else if(url.startsWith("tel://"))
{
Intent dial = new Intent(Intent.ACTION_DIAL, Uri.parse(url));
startActivity(dial);
return true;
}
else if(url.startsWith("sms:"))
{
Uri smsUri = Uri.parse(url);
Intent intent = new Intent(Intent.ACTION_VIEW, smsUri);
intent.setType("vnd.android-dir/mms-sms");
startActivity(intent);
return true;
}
else if(url.startsWith("mailto:"))
{
Intent mail = new Intent(Intent.ACTION_SENDTO, Uri.parse(url));
startActivity(mail);
return true;
}
else
{
//We clear the back button state
mKey.reset();
view.loadUrl(url);
return false;
}
}
}
/**
* Provides a hook for calling "alert" from javascript. Useful for