<commit_before>package com.rhomobile.rhodes.webview;

import java.io.File;
import java.io.FileOutputStream;

import com.rhomobile.rhodes.LocalFileProvider;
import com.rhomobile.rhodes.Logger;
import com.rhomobile.rhodes.RhodesActivity;
import com.rhomobile.rhodes.extmanager.IRhoWebView;
import com.rhomobile.rhodes.extmanager.IRhoWebViewConfig;
import com.rhomobile.rhodes.extmanager.RhoExtManager;
import com.rhomobile.rhodes.osfunctionality.AndroidFunctionalityManager;
import com.rhomobile.rhodes.osfunctionality.OsVersionManager;
import com.rhomobile.rhodes.util.PerformOnUiThread;
import com.rhomobile.rhodes.RhoConf;

import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Picture;
import android.net.Uri;
import android.os.Build;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.URLUtil;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebViewClient;

public class GoogleWebView implements IRhoWebView {
    private static final String TAG = GoogleWebView.class.getSimpleName(); 

    private WebChromeClient mChromeClient;
    private WebViewClient mWebViewClient;
    private static Boolean mInitialized = false;

    private android.webkit.WebView mWebView;
    private ViewGroup mContainerView;
    private TextZoom mTextZoom = TextZoom.NORMAL;
    private IRhoWebViewConfig mConfig;

    public GoogleWebView(Activity activity) {
        mWebView = new android.webkit.WebView(activity);
        synchronized(mInitialized) {
            if (!mInitialized) {
                mWebView.clearCache(true);
                initWebStuff(activity);
            }
        }
        mWebViewClient = new RhoWebViewClient(this);
        mChromeClient = new RhoWebChromeClient(activity, this);
    }

    private static void initWebStuff(Activity activity) {

        Logger.I(TAG, "Initialize Google WEbView staff");
        
        OsVersionManager.registerSelector(IWebSettingsProvider.class, WebSettingsProviderBase.class.getCanonicalName());
        OsVersionManager.registerSelector(Build.VERSION_CODES.ECLAIR, IWebSettingsProvider.class, WebSettingsProviderEclair.class.getCanonicalName());
        OsVersionManager.registerSelector(Build.VERSION_CODES.ECLAIR_MR1, IWebSettingsProvider.class, WebSettingsProviderEclairMR1.class.getCanonicalName());
        OsVersionManager.registerSelector(Build.VERSION_CODES.FROYO, IWebSettingsProvider.class, WebSettingsProviderFroyo.class.getCanonicalName());
        OsVersionManager.registerSelector(Build.VERSION_CODES.JELLY_BEAN, IWebSettingsProvider.class, WebSettingsProviderJellyBean.class.getCanonicalName());
        OsVersionManager.registerSelector(Build.VERSION_CODES.KITKAT, IWebSettingsProvider.class, WebSettingsProviderKitKat.class.getCanonicalName());

        mInitialized = true;
    }
    
    public void applyWebSettings() {
        Logger.T(TAG, "applyWebSettings");
        PerformOnUiThread.exec(new Runnable() {
            @Override
            public void run() {
                Logger.T(TAG, "Web settings is applying now");
                
                float z=(float) 1.5;
                try{
                z=Float.parseFloat(RhoConf.getString("PageZoom"));
                }
                catch(NumberFormatException ex)
                {
                	Logger.E(TAG, "NumberFormatException,message="+ex.getMessage());
                	z=(float) 1.5;
                }
               mWebView.setInitialScale((int)(z*150));<commit_msg>Update GoogleWebView.java<commit_after>package com.rhomobile.rhodes.webview;

import java.io.File;
import java.io.FileOutputStream;

import com.rhomobile.rhodes.LocalFileProvider;
import com.rhomobile.rhodes.Logger;
import com.rhomobile.rhodes.RhodesActivity;
import com.rhomobile.rhodes.extmanager.IRhoWebView;
import com.rhomobile.rhodes.extmanager.IRhoWebViewConfig;
import com.rhomobile.rhodes.extmanager.RhoExtManager;
import com.rhomobile.rhodes.osfunctionality.AndroidFunctionalityManager;
import com.rhomobile.rhodes.osfunctionality.OsVersionManager;
import com.rhomobile.rhodes.util.PerformOnUiThread;
import com.rhomobile.rhodes.RhoConf;

import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Picture;
import android.net.Uri;
import android.os.Build;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.URLUtil;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebViewClient;

public class GoogleWebView implements IRhoWebView {
    private static final String TAG = GoogleWebView.class.getSimpleName(); 

    private WebChromeClient mChromeClient;
    private WebViewClient mWebViewClient;
    private static Boolean mInitialized = false;

    private android.webkit.WebView mWebView;
    private ViewGroup mContainerView;
    private TextZoom mTextZoom = TextZoom.NORMAL;
    private IRhoWebViewConfig mConfig;

    public GoogleWebView(Activity activity) {
        mWebView = new android.webkit.WebView(activity);
        synchronized(mInitialized) {
            if (!mInitialized) {
                mWebView.clearCache(true);
                initWebStuff(activity);
            }
        }
        mWebViewClient = new RhoWebViewClient(this);
        mChromeClient = new RhoWebChromeClient(activity, this);
    }

    private static void initWebStuff(Activity activity) {

        Logger.I(TAG, "Initialize Google WEbView staff");
        
        OsVersionManager.registerSelector(IWebSettingsProvider.class, WebSettingsProviderBase.class.getCanonicalName());
        OsVersionManager.registerSelector(Build.VERSION_CODES.ECLAIR, IWebSettingsProvider.class, WebSettingsProviderEclair.class.getCanonicalName());
        OsVersionManager.registerSelector(Build.VERSION_CODES.ECLAIR_MR1, IWebSettingsProvider.class, WebSettingsProviderEclairMR1.class.getCanonicalName());
        OsVersionManager.registerSelector(Build.VERSION_CODES.FROYO, IWebSettingsProvider.class, WebSettingsProviderFroyo.class.getCanonicalName());
        OsVersionManager.registerSelector(Build.VERSION_CODES.JELLY_BEAN, IWebSettingsProvider.class, WebSettingsProviderJellyBean.class.getCanonicalName());
        OsVersionManager.registerSelector(Build.VERSION_CODES.KITKAT, IWebSettingsProvider.class, WebSettingsProviderKitKat.class.getCanonicalName());

        mInitialized = true;
    }
    
    public void applyWebSettings() {
        Logger.T(TAG, "applyWebSettings");
        PerformOnUiThread.exec(new Runnable() {
            @Override
            public void run() {
                Logger.T(TAG, "Web settings is applying now");
                
                float z=(float) 0.0;
                try{
                z=Float.parseFloat(RhoConf.getString("PageZoom"));
                }
                catch(NumberFormatException ex)
                {
                	Logger.E(TAG, "NumberFormatException,message="+ex.getMessage());
                	z=(float) 0.0;
                }
               mWebView.setInitialScale((int)(z*150));
{'fraction_non_alphanumeric': 0.08723046765611873, 'fraction_numerical': 0.002520302436292355, 'mean_word_length': 3.6113621691413815, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4942506', 'n_tokens_mistral': 2046, 'n_tokens_neox': 1995, 'n_words': 322}