mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-01 02:12:58 +08:00
Removing the GapViewClient handler, since it breaks PhoneGap, reverting. Rather have every other URI working except for sms:
This commit is contained in:
parent
310766180f
commit
c75e66a2fc
@ -105,9 +105,7 @@ public class DroidGap extends Activity {
|
||||
{
|
||||
appView.setWebChromeClient(new GapClient(this));
|
||||
}
|
||||
|
||||
appView.setWebViewClient(new GapViewClient(this));
|
||||
|
||||
|
||||
appView.setInitialScale(100);
|
||||
appView.setVerticalScrollBarEnabled(false);
|
||||
|
||||
@ -181,63 +179,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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user