package com.erakk.lnreader.helper;

import com.erakk.lnreader.Constants;
import com.erakk.lnreader.DisplayImageActivity;

import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;

public class BakaTsukiWebViewClient extends WebViewClient {
	@Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) {
//        if (Uri.parse(url).getHost().equals("www.example.com")) {
//            // This is my web site, so do not override; let my WebView load the page
//            return false;
//        }

		Log.d("shouldOverrideUrlLoading", url);
		
		Context context = view.getContext();
		
		// if image file
		if(url.contains("title=File:")) {
			Intent intent = new Intent(context, DisplayImageActivity.class);
			intent.putExtra(Constants.EXTRA_IMAGE_URL, url);
			context.startActivity(intent);
		}
		else {
			Toast.makeText(context, "Url: " + url, Toast.LENGTH_SHORT).show();
		}
        return true;
    }	
}

@@ -33,94 +33,8 @@
 r;%0A%0A
-import com.erakk.lnreader.Constants;%0Aimport com.erakk.lnreader.DisplayImageActivity;%0A%0A
 impo
@@ -61,16 +61,16 @@
 ontext;%0A
+
 import a
@@ -88,24 +88,48 @@
 ent.Intent;%0A
+import android.net.Uri;%0A
 import andro
@@ -213,35 +213,92 @@
 nt;%0A
+%0A
 import 
-android.widget.Toast
+com.erakk.lnreader.Constants;%0Aimport com.erakk.lnreader.DisplayImageActivity
 ;%0A%0Ap
@@ -947,16 +947,18 @@
 se %7B%0A%09%09%09
+//
 Toast.ma
@@ -1016,16 +1016,147 @@
 show();%0A
+%09%09%09Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));%0A%09%09%09context.startActivity(browserIntent);%0A%09%09%09return true;%0A
 %09%09%7D%0A    

Handle other links in content view to browser