handle mailto: url, and add one. Note that everything about the url

is ignored, just routes to existing Utils.email() method.
This commit is contained in:
Eric House 2013-09-28 10:04:41 -07:00
parent ce9c345aa9
commit f3e41486ca
2 changed files with 17 additions and 3 deletions

View file

@ -12,8 +12,8 @@
individually (and only when open) to the app communicating on behalf
of all games. You should notice only that moves are transmitted
more reliably. But this being new code you may also notice bugs.
If you don't tell me about them (see the "Email author"
menuitem) they will not get fixed.
If you don't <a href="mailto:xwords@eehouse.org">tell me about
them</a> they will not get fixed.
</p>
<h3>New with this release</h3>

View file

@ -23,6 +23,7 @@ package org.eehouse.android.xw4;
import android.app.AlertDialog;
import android.content.Context;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
@ -33,7 +34,7 @@ import java.io.Reader;
*/
public class FirstRunDialog {
public static void show( Context context )
public static void show( final Context context )
{
String page = null;
InputStream inputStream = null;
@ -71,6 +72,19 @@ public class FirstRunDialog {
// This won't support e.g mailto refs. Probably want to
// launch the browser with an intent eventually.
WebView view = new WebView( context );
view.setWebViewClient( new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading( WebView view,
String url ) {
boolean result = false;
if ( url.startsWith("mailto:") ){
Utils.emailAuthor( context );
result = true;
}
return result;
}
});
view.loadData( page, "text/html", "utf-8" );
AlertDialog dialog = new AlertDialog.Builder( context )