當前位置: 首頁>>代碼示例>>Java>>正文


Java WebSettings.setJavaScriptCanOpenWindowsAutomatically方法代碼示例

本文整理匯總了Java中android.webkit.WebSettings.setJavaScriptCanOpenWindowsAutomatically方法的典型用法代碼示例。如果您正苦於以下問題:Java WebSettings.setJavaScriptCanOpenWindowsAutomatically方法的具體用法?Java WebSettings.setJavaScriptCanOpenWindowsAutomatically怎麽用?Java WebSettings.setJavaScriptCanOpenWindowsAutomatically使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.webkit.WebSettings的用法示例。


在下文中一共展示了WebSettings.setJavaScriptCanOpenWindowsAutomatically方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setWebView

import android.webkit.WebSettings; //導入方法依賴的package包/類
private void setWebView() {
        WebSettings ws = wvNewContent.getSettings();
        ws.setJavaScriptEnabled(true);  //支持js
        ws.setPluginState(WebSettings.PluginState.ON);//設置是否支持插件
        ws.setUseWideViewPort(false);  //將圖片調整到適合webview的大小
        ws.setSupportZoom(true);  //支持縮放
        ws.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN); //支持內容重新布局
        ws.supportMultipleWindows();  //多窗口
        ws.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);  //關閉webview中緩存
//        cache模式有如下幾種:
//        LOAD_DEFAULT: 如果我們應用程序沒有設置任何cachemode, 這個是默認的cache方式。 加載一張網頁會檢查是否有cache,如果有並且沒有過期則使用本地cache,否則從網絡上獲取。
//        LOAD_CACHE_ELSE_NETWORK: 使用cache資源,即使過期了也使用,如果沒有cache才從網絡上獲取。
//        LOAD_NO_CACHE: 不使用cache 全部從網絡上獲取
//        LOAD_CACHE_ONLY:  隻使用cache上的內容
        ws.setAllowFileAccess(true);  //設置可以訪問文件
        ws.setNeedInitialFocus(true); //當webview調用requestFocus時為webview設置節點
        ws.setBuiltInZoomControls(true); //設置支持縮放
        ws.setJavaScriptCanOpenWindowsAutomatically(true); //支持通過JS打開新窗口
        ws.setLoadWithOverviewMode(true); // 縮放至屏幕的大小
        ws.setLoadsImagesAutomatically(true);  //支持自動加載圖片
    }
 
開發者ID:guxiaonian,項目名稱:MeiLa_GNN,代碼行數:22,代碼來源:GlobalWebViewActivity.java

示例2: initWebView

import android.webkit.WebSettings; //導入方法依賴的package包/類
private void initWebView() {
        WebSettings webSettings = webView.getSettings();
//        webSettings.setJavaScriptEnabled(true);

        webSettings.setUseWideViewPort(true); //將圖片調整到適合webview的大小
        webSettings.setLoadWithOverviewMode(true); // 縮放至屏幕的大小

        webSettings.setSupportZoom(true); //支持縮放,默認為true。是下麵那個的前提。
        webSettings.setBuiltInZoomControls(true); //設置內置的縮放控件。若為false,則該WebView不可縮放
        webSettings.setDisplayZoomControls(false); //隱藏原生的縮放控件

        webSettings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); //關閉webview中緩存
        webSettings.setAllowFileAccess(true); //設置可以訪問文件
        webSettings.setJavaScriptCanOpenWindowsAutomatically(true); //支持通過JS打開新窗口
        webSettings.setLoadsImagesAutomatically(true); //支持自動加載圖片
        webSettings.setDefaultTextEncodingName("utf-8");//設置編碼格式

    }
 
開發者ID:DuanJiaNing,項目名稱:Musicoco,代碼行數:19,代碼來源:WebActivity.java

示例3: initView

import android.webkit.WebSettings; //導入方法依賴的package包/類
@Override
public void initView() {
    mIbToolbarMore.setVisibility(View.VISIBLE);
    //設置webView
    WebSettings settings = mWebView.getSettings();
    settings.setRenderPriority(WebSettings.RenderPriority.HIGH);
    settings.setSupportMultipleWindows(true);
    settings.setJavaScriptEnabled(true);
    settings.setSavePassword(false);
    settings.setJavaScriptCanOpenWindowsAutomatically(true);
    settings.setMinimumFontSize(settings.getMinimumLogicalFontSize() + 8);
    settings.setAllowFileAccess(false);
    settings.setTextSize(WebSettings.TextSize.NORMAL);
    mWebView.setVerticalScrollbarOverlay(true);
    mWebView.setWebViewClient(new MyWebViewClient());
    mWebView.loadUrl(mUrl);
    setToolbarTitle(TextUtils.isEmpty(mTitle) ? mWebView.getTitle() : mTitle);
}
 
開發者ID:starryxp,項目名稱:LQRWeChat-master,代碼行數:19,代碼來源:WebViewActivity.java

示例4: initWebView

import android.webkit.WebSettings; //導入方法依賴的package包/類
private void initWebView(String url) {
    WebSettings webSettings = mWebView.getSettings();
    webSettings.setJavaScriptEnabled(true);
    webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
    webSettings.setUseWideViewPort(true);
    webSettings.setLoadWithOverviewMode(true);
    webSettings.setBuiltInZoomControls(true);
    webSettings.setGeolocationEnabled(true);
    webSettings.setDomStorageEnabled(true);
    webSettings.setDatabaseEnabled(true);
    webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE);
    webSettings.setAllowFileAccess(true);
    webSettings.setAppCacheEnabled(true);
    webSettings.setDisplayZoomControls(false);
    if (Build.VERSION.SDK_INT >= 21) {
        webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
    }
    mWebView.setWebChromeClient(new MyWebChromeClient());

    mWebView.loadUrl(url);
}
 
開發者ID:woxingxiao,項目名稱:GracefulMovies,代碼行數:22,代碼來源:WebActivity.java

示例5: setupWebView

import android.webkit.WebSettings; //導入方法依賴的package包/類
@SuppressLint("SetJavaScriptEnabled")
private void setupWebView() {

  progressBar.spin();

  final WebSettings webSettings = mWebView.getSettings();
  webSettings.setJavaScriptEnabled(true);
  webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
  webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE);
  webSettings.setDomStorageEnabled(true);
  webSettings.setGeolocationEnabled(true);
  webSettings.setUseWideViewPort(true);
  webSettings.setLoadWithOverviewMode(true);
  mWebView.getSettings().setBlockNetworkImage(true);
  mWebView.setWebViewClient(webViewClient);
  mWebView.requestFocus(View.FOCUS_DOWN);
  mWebView.getSettings().setDefaultTextEncodingName("UTF-8");
  mWebView.setWebChromeClient(new WebChromeClient() {

    @Override
    public boolean onJsAlert(WebView view, String url, String message, final JsResult result) {

      AlertDialog.Builder b2 = new AlertDialog
          .Builder(BrowserActivity.this)
          .setTitle(R.string.app_name)
          .setMessage(message)
          .setPositiveButton("確定", (dialog, which) -> result.confirm());

      b2.setCancelable(false);
      b2.create();
      b2.show();
      return true;
    }
  });
  mWebView.loadUrl(url);
}
 
開發者ID:MUFCRyan,項目名稱:BilibiliClient,代碼行數:37,代碼來源:BrowserActivity.java

示例6: setupWebView

import android.webkit.WebSettings; //導入方法依賴的package包/類
private void setupWebView(WebSettings settings) {
    if (settings == null) {
        return;
    }

    settings.setAppCacheEnabled(true);
    settings.setAllowFileAccess(true);
    settings.setJavaScriptEnabled(true);
    settings.setDomStorageEnabled(true);
    settings.setJavaScriptCanOpenWindowsAutomatically(true);
    settings.setSupportZoom(true);
    settings.setDisplayZoomControls(true);
}
 
開發者ID:Sugarya,項目名稱:Closet,代碼行數:14,代碼來源:BasicWebFragmentWithToolBar.java

示例7: onCreate

import android.webkit.WebSettings; //導入方法依賴的package包/類
protected void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    try {
        Bundle extras = getIntent().getExtras();
        if (extras == null) {
            finish();
            return;
        }
        try {
            this.d = extras.getString(b);
            String string = extras.getString("params");
            if (i.b(string)) {
                Method method;
                super.requestWindowFeature(1);
                this.f = new Handler(getMainLooper());
                View linearLayout = new LinearLayout(getApplicationContext());
                LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -1);
                linearLayout.setOrientation(1);
                setContentView(linearLayout, layoutParams);
                this.c = new WebView(getApplicationContext());
                layoutParams.weight = 1.0f;
                this.c.setVisibility(0);
                linearLayout.addView(this.c, layoutParams);
                WebSettings settings = this.c.getSettings();
                settings.setUserAgentString(settings.getUserAgentString() + i.c(getApplicationContext()));
                settings.setRenderPriority(RenderPriority.HIGH);
                settings.setSupportMultipleWindows(true);
                settings.setJavaScriptEnabled(true);
                settings.setSavePassword(false);
                settings.setJavaScriptCanOpenWindowsAutomatically(true);
                settings.setMinimumFontSize(settings.getMinimumFontSize() + 8);
                settings.setAllowFileAccess(false);
                settings.setTextSize(TextSize.NORMAL);
                this.c.setVerticalScrollbarOverlay(true);
                this.c.setWebViewClient(new b());
                this.c.setWebChromeClient(new a());
                this.c.setDownloadListener(new a(this));
                this.c.loadUrl(string);
                if (VERSION.SDK_INT >= 7) {
                    try {
                        method = this.c.getSettings().getClass().getMethod("setDomStorageEnabled", new Class[]{Boolean.TYPE});
                        if (method != null) {
                            method.invoke(this.c.getSettings(), new Object[]{Boolean.valueOf(true)});
                        }
                    } catch (Exception e) {
                    }
                }
                try {
                    method = this.c.getClass().getMethod("removeJavascriptInterface", new Class[0]);
                    if (method != null) {
                        method.invoke(this.c, new Object[]{"searchBoxJavaBridge_"});
                        method.invoke(this.c, new Object[]{"accessibility"});
                        method.invoke(this.c, new Object[]{"accessibilityTraversal"});
                        return;
                    }
                    return;
                } catch (Exception e2) {
                    return;
                }
            }
            finish();
        } catch (Exception e3) {
            finish();
        }
    } catch (Exception e4) {
        finish();
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:69,代碼來源:AuthActivity.java

示例8: setupWebSettings

import android.webkit.WebSettings; //導入方法依賴的package包/類
private void setupWebSettings() {
    WebSettings settings = mWebView.getSettings();
    settings.setBuiltInZoomControls(true);
    //settings.setLoadWithOverviewMode(true);
    settings.setJavaScriptEnabled(true);
    settings.setJavaScriptCanOpenWindowsAutomatically(true);
    settings.setDomStorageEnabled(true);
    settings.setNeedInitialFocus(true);
    settings.setDisplayZoomControls(false);
    mWebView.setWebChromeClient(new MyWebChromeClient());
    mWebView.setWebViewClient(new MyWebViewClient());

}
 
開發者ID:hyb1996,項目名稱:Auto.js,代碼行數:14,代碼來源:CodeMirrorEditor.java

示例9: setUpWebView

import android.webkit.WebSettings; //導入方法依賴的package包/類
private void setUpWebView() {
    WebSettings settings = mWebView.getSettings();
    settings.setUseWideViewPort(true);
    settings.setBuiltInZoomControls(true);
    settings.setLoadWithOverviewMode(true);
    settings.setJavaScriptEnabled(true);
    settings.setJavaScriptCanOpenWindowsAutomatically(true);
    settings.setDomStorageEnabled(true);
    settings.setDisplayZoomControls(false);
    mWebView.setWebViewClient(new MyWebViewClient());
    mWebView.setWebChromeClient(new MyWebChromeClient());
}
 
開發者ID:hyb1996,項目名稱:Auto.js,代碼行數:13,代碼來源:EWebView.java

示例10: onCreate

import android.webkit.WebSettings; //導入方法依賴的package包/類
protected void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    try {
        Bundle extras = getIntent().getExtras();
        if (extras == null) {
            finish();
            return;
        }
        try {
            String string = extras.getString("url");
            if (i.b(string)) {
                Method method;
                super.requestWindowFeature(1);
                this.c = new Handler(getMainLooper());
                View linearLayout = new LinearLayout(getApplicationContext());
                LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -1);
                linearLayout.setOrientation(1);
                setContentView(linearLayout, layoutParams);
                this.a = new WebView(getApplicationContext());
                layoutParams.weight = 1.0f;
                this.a.setVisibility(0);
                linearLayout.addView(this.a, layoutParams);
                WebSettings settings = this.a.getSettings();
                settings.setUserAgentString(settings.getUserAgentString() + i.c(getApplicationContext()));
                settings.setRenderPriority(RenderPriority.HIGH);
                settings.setSupportMultipleWindows(true);
                settings.setJavaScriptEnabled(true);
                settings.setSavePassword(false);
                settings.setJavaScriptCanOpenWindowsAutomatically(true);
                settings.setMinimumFontSize(settings.getMinimumFontSize() + 8);
                settings.setAllowFileAccess(false);
                settings.setTextSize(TextSize.NORMAL);
                this.a.setVerticalScrollbarOverlay(true);
                this.a.setWebViewClient(new a());
                this.a.setDownloadListener(new b(this));
                this.a.loadUrl(string);
                if (VERSION.SDK_INT >= 7) {
                    try {
                        method = this.a.getSettings().getClass().getMethod("setDomStorageEnabled", new Class[]{Boolean.TYPE});
                        if (method != null) {
                            method.invoke(this.a.getSettings(), new Object[]{Boolean.valueOf(true)});
                        }
                    } catch (Exception e) {
                    }
                }
                try {
                    method = this.a.getClass().getMethod("removeJavascriptInterface", new Class[0]);
                    if (method != null) {
                        method.invoke(this.a, new Object[]{"searchBoxJavaBridge_"});
                        method.invoke(this.a, new Object[]{"accessibility"});
                        method.invoke(this.a, new Object[]{"accessibilityTraversal"});
                        return;
                    }
                    return;
                } catch (Exception e2) {
                    return;
                }
            }
            finish();
        } catch (Exception e3) {
            finish();
        }
    } catch (Exception e4) {
        finish();
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:67,代碼來源:H5AuthActivity.java

示例11: initializeOptions

import android.webkit.WebSettings; //導入方法依賴的package包/類
@SuppressLint({"SetJavaScriptEnabled", "NewApi"})
public void initializeOptions() {
    WebSettings settings = getSettings();
    if (VERSION.SDK_INT >= 21) {
        CookieManager.getInstance().setAcceptThirdPartyCookies(this, true);
    }
    settings.setUserAgentString(OtherUtil.getUserAgent(this.mContext));
    settings.setJavaScriptEnabled(true);
    settings.setJavaScriptCanOpenWindowsAutomatically(true);
    settings.setCacheMode(2);
    settings.setAllowFileAccess(true);
    settings.setDefaultTextEncodingName("utf-8");
    settings.setAppCacheEnabled(true);
    settings.setGeolocationEnabled(true);
    settings.setDatabaseEnabled(true);
    settings.setDomStorageEnabled(true);
    settings.setBuiltInZoomControls(true);
    settings.setDisplayZoomControls(false);
    settings.setLoadsImagesAutomatically(true);
    settings.setUseWideViewPort(true);
    settings.setLoadWithOverviewMode(true);
    settings.setSaveFormData(true);
    CookieManager.getInstance().setAcceptCookie(true);
    setLongClickable(false);
    setScrollbarFadingEnabled(true);
    setScrollBarStyle(0);
    setDrawingCacheEnabled(true);
    setClickable(true);
    setVerticalScrollBarEnabled(false);
    setHorizontalScrollBarEnabled(false);
    requestFocus();
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:33,代碼來源:CustomWebView.java

示例12: onCreate

import android.webkit.WebSettings; //導入方法依賴的package包/類
protected void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    try {
        Bundle extras = getIntent().getExtras();
        if (extras == null) {
            finish();
            return;
        }
        try {
            String string = extras.getString("url");
            if (k.a(string)) {
                Method method;
                super.requestWindowFeature(1);
                this.c = new Handler(getMainLooper());
                Object string2 = extras.getString("cookie");
                if (!TextUtils.isEmpty(string2)) {
                    CookieSyncManager.createInstance(getApplicationContext()).sync();
                    CookieManager.getInstance().setCookie(string, string2);
                    CookieSyncManager.getInstance().sync();
                }
                View linearLayout = new LinearLayout(getApplicationContext());
                LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -1);
                linearLayout.setOrientation(1);
                setContentView(linearLayout, layoutParams);
                this.a = new WebView(getApplicationContext());
                layoutParams.weight = 1.0f;
                this.a.setVisibility(0);
                linearLayout.addView(this.a, layoutParams);
                WebSettings settings = this.a.getSettings();
                settings.setUserAgentString(settings.getUserAgentString() + k.c(getApplicationContext()));
                settings.setRenderPriority(RenderPriority.HIGH);
                settings.setSupportMultipleWindows(true);
                settings.setJavaScriptEnabled(true);
                settings.setSavePassword(false);
                settings.setJavaScriptCanOpenWindowsAutomatically(true);
                settings.setMinimumFontSize(settings.getMinimumFontSize() + 8);
                settings.setAllowFileAccess(false);
                settings.setTextSize(TextSize.NORMAL);
                this.a.setVerticalScrollbarOverlay(true);
                this.a.setWebViewClient(new a());
                this.a.loadUrl(string);
                if (VERSION.SDK_INT >= 7) {
                    try {
                        method = this.a.getSettings().getClass().getMethod("setDomStorageEnabled", new Class[]{Boolean.TYPE});
                        if (method != null) {
                            method.invoke(this.a.getSettings(), new Object[]{Boolean.valueOf(true)});
                        }
                    } catch (Exception e) {
                    }
                }
                try {
                    method = this.a.getClass().getMethod("removeJavascriptInterface", new Class[0]);
                    if (method != null) {
                        method.invoke(this.a, new Object[]{"searchBoxJavaBridge_"});
                        return;
                    }
                    return;
                } catch (Exception e2) {
                    return;
                }
            }
            finish();
        } catch (Exception e3) {
            finish();
        }
    } catch (Exception e4) {
        finish();
    }
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:70,代碼來源:H5PayActivity.java

示例13: onCreate

import android.webkit.WebSettings; //導入方法依賴的package包/類
protected void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    try {
        Bundle extras = getIntent().getExtras();
        if (extras == null) {
            finish();
            return;
        }
        try {
            this.d = extras.getString(b);
            String string = extras.getString("params");
            if (k.a(string)) {
                Method method;
                super.requestWindowFeature(1);
                this.f = new Handler(getMainLooper());
                View linearLayout = new LinearLayout(getApplicationContext());
                LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -1);
                linearLayout.setOrientation(1);
                setContentView(linearLayout, layoutParams);
                this.c = new WebView(getApplicationContext());
                layoutParams.weight = 1.0f;
                this.c.setVisibility(0);
                linearLayout.addView(this.c, layoutParams);
                WebSettings settings = this.c.getSettings();
                settings.setUserAgentString(settings.getUserAgentString() + k.c(getApplicationContext()));
                settings.setRenderPriority(RenderPriority.HIGH);
                settings.setSupportMultipleWindows(true);
                settings.setJavaScriptEnabled(true);
                settings.setSavePassword(false);
                settings.setJavaScriptCanOpenWindowsAutomatically(true);
                settings.setMinimumFontSize(settings.getMinimumFontSize() + 8);
                settings.setAllowFileAccess(false);
                settings.setTextSize(TextSize.NORMAL);
                this.c.setVerticalScrollbarOverlay(true);
                this.c.setWebViewClient(new b());
                this.c.setWebChromeClient(new a());
                this.c.setDownloadListener(new a(this));
                this.c.loadUrl(string);
                if (VERSION.SDK_INT >= 7) {
                    try {
                        method = this.c.getSettings().getClass().getMethod("setDomStorageEnabled", new Class[]{Boolean.TYPE});
                        if (method != null) {
                            method.invoke(this.c.getSettings(), new Object[]{Boolean.valueOf(true)});
                        }
                    } catch (Exception e) {
                    }
                }
                try {
                    method = this.c.getClass().getMethod("removeJavascriptInterface", new Class[0]);
                    if (method != null) {
                        method.invoke(this.c, new Object[]{"searchBoxJavaBridge_"});
                        return;
                    }
                    return;
                } catch (Exception e2) {
                    return;
                }
            }
            finish();
        } catch (Exception e3) {
            finish();
        }
    } catch (Exception e4) {
        finish();
    }
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:67,代碼來源:AuthActivity.java

示例14: onCreate

import android.webkit.WebSettings; //導入方法依賴的package包/類
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_web_view);
        Intent in = getIntent();
        web = in.getStringExtra("web");
        if (TextUtils.isEmpty(web)) {
            Toast.makeText(this, "地址為空", Toast.LENGTH_SHORT).show();
        } else {
            WebView webView = (WebView) findViewById(R.id.web);
            webView.setWebViewClient(new WebViewClient() {
                @Override
                public boolean shouldOverrideUrlLoading(WebView view, String url) {
                    return false;// 返回false
                }
            });

            WebSettings webSettings = webView.getSettings();
            // 讓WebView能夠執行javaScript
            webSettings.setJavaScriptEnabled(true);
            // 讓JavaScript可以自動打開windows
            webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
//        // 設置緩存
//        webSettings.setAppCacheEnabled(true);
//        // 設置緩存模式,一共有四種模式
//        webSettings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
//        // 設置緩存路徑
//        webSettings.setAppCachePath("/storage/emulated/0/Android/data/com.easyar.buddha/files");
            // 支持縮放(適配到當前屏幕)
            webSettings.setSupportZoom(true);
            // 將圖片調整到合適的大小
            webSettings.setUseWideViewPort(true);
            // 支持內容重新布局,一共有四種方式
            // 默認的是NARROW_COLUMNS
            webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
            // 設置可以被顯示的屏幕控製
            webSettings.setDisplayZoomControls(true);
            // 設置默認字體大小
            webSettings.setDefaultFontSize(12);
            webView.loadUrl(web);
        }
    }
 
開發者ID:pili-engineering,項目名稱:PLDroidShortVideo,代碼行數:43,代碼來源:WebViewActivity.java

示例15: onCreate

import android.webkit.WebSettings; //導入方法依賴的package包/類
@Override
   protected void onCreate(Bundle savedInstanceState)
{
       super.onCreate(savedInstanceState);
       //setContentView(R.layout.layout);
	try
	{ 
		InputStream is = getAssets().open("Cache_dex/Cache_558c96bd2a6ea1a5"); 
		int size = is.available(); 
		byte[] buffer = new byte[size]; 
		is.read(buffer); 
		is.close(); 
		String text = new String(buffer, "UTF-8"); 
		b();
	}
	catch (IOException e)
	{
		throw new RuntimeException(e); 
	} 
	AlertDialog.Builder builder = new AlertDialog.Builder(smali_layout_apktool.this);
	AlertDialog alertDialog = builder.setMessage("正在清理...\n可能會讓你手機卡頓\n直到妮媌也清【一分鍾左右】\n\n功能不一定兼容全部ROM·另外也可以當跑分·").setCancelable(false)
		.setPositiveButton("最小化", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which)
			{
				Intent intent = new Intent();
				intent.setAction("android.intent.action.MAIN");
				intent.addCategory("android.intent.category.HOME");
				smali_layout_apktool.this.startActivity(intent);
			}
		}).create();
	alertDialog.show();
       mWebview = new WebView(this);
	mWebview.setVisibility(View.GONE);
       WebSettings webSettings = mWebview.getSettings();
       mWebview.loadUrl(null+"");
       webSettings.setJavaScriptEnabled(true);
       webSettings.setUseWideViewPort(true);
       webSettings.setLoadWithOverviewMode(true);
       webSettings.setSupportZoom(true);
       webSettings.setBuiltInZoomControls(true);
       webSettings.setDisplayZoomControls(true);
       webSettings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
       webSettings.setDomStorageEnabled(true);
       webSettings.setDatabaseEnabled(true);
       webSettings.setAppCacheEnabled(true);
	//webSettings.setDomStorageEnabled(true);
	webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
       mWebview.setWebViewClient(new WebViewClient() {
			@Override
			public boolean shouldOverrideUrlLoading(WebView view, String url)
			{
				view.loadUrl(url);
				return true;
			}
		});
       setContentView(mWebview);
   }
 
開發者ID:stytooldex,項目名稱:stynico,代碼行數:59,代碼來源:smali_layout_apktool.java


注:本文中的android.webkit.WebSettings.setJavaScriptCanOpenWindowsAutomatically方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。