package fr.free.nrw.commons.auth;

import android.os.Bundle;
import android.app.Activity;
import android.util.Log;
import android.webkit.WebView;

import fr.free.nrw.commons.R;

public class SignupActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Log.d("SignupActivity", "Signup Activity started");

        WebView webView = new WebView(this);
        setContentView(webView);
        //myWebView.loadUrl("https://commons.wikimedia.org/w/index.php?title=Special:CreateAccount&returnto=Main+Page");

        //Mobile page, looks better than the above
        webView.loadUrl("https://commons.m.wikimedia.org/w/index.php?title=Special:CreateAccount&returnto=Main+Page&returntoquery=welcome%3Dyes");

        //After Create Account button is pressed within WebView, it brings user to https://commons.wikimedia.org/wiki/Main_Page. So can we just override that URL?
        //Do we NEED to enable JS? Validation seems to work fine here
    }

}

@@ -28,16 +28,71 @@
 .auth;%0A%0A
+import android.content.Intent;%0Aimport android.net.Uri;%0A
 import a
@@ -193,16 +193,53 @@
 WebView;
+%0Aimport android.webkit.WebViewClient;
 %0A%0Aimport
@@ -564,16 +564,74 @@
 ebView);
+%0A%0A        webView.setWebViewClient(new MyWebViewClient());
 %0A       
@@ -740,25 +740,24 @@
 ain+Page%22);%0A
-%0A
         //Mo
@@ -1034,32 +1034,34 @@
 https://commons.
+m.
 wikimedia.org/wi
@@ -1063,21 +1063,46 @@
 rg/w
-iki/Main_Page
+/index.php?title=Main_Page&welcome=yes
 . So
@@ -1210,10 +1210,627 @@
 %0A    %7D%0A%0A
+    private class MyWebViewClient extends WebViewClient %7B%0A        @Override%0A        public boolean shouldOverrideUrlLoading(WebView view, String url) %7B%0A            if (Uri.parse(url).getHost().equals(%22www.example.com%22)) %7B%0A                // This is my web site, so do not override; let my WebView load the page%0A                return false;%0A            %7D%0A            // Otherwise, the link is not for a page on my site, so launch another Activity that handles URLs%0A            Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));%0A            startActivity(intent);%0A            return true;%0A        %7D%0A    %7D%0A
 %7D%0A

Change URLs and add MyWebViewClient