Java 类android.webkit.WebSettings.LayoutAlgorithm 实例源码

项目:boohee_v5.6    文件:ScaleIntroActivity.java   
private void initView() {
    this.tvBind.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            MobclickAgent.onEvent(ScaleIntroActivity.this, Event.bingo_clickBindingScalse);
            ScaleBindActivity.startActivity(ScaleIntroActivity.this);
        }
    });
    this.webView.getSettings().setJavaScriptEnabled(true);
    this.webView.getSettings().setLayoutAlgorithm(LayoutAlgorithm.NORMAL);
    this.webView.getSettings().setPluginState(PluginState.ON);
    this.webView.getSettings().setUserAgentString(this.webView.getSettings()
            .getUserAgentString() + " App/boohee");
    this.webView.getSettings().setDomStorageEnabled(true);
    this.webView.setWebViewClient(createWebViewClient());
    this.webView.loadUrl(UrlUtils.handleUrl(URL));
}
项目:boohee_v5.6    文件:GoodsHomeFragment.java   
@SuppressLint({"SetJavaScriptEnabled"})
private void initWebView() {
    this.webview.getSettings().setJavaScriptEnabled(true);
    this.webview.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
    this.webview.setVerticalScrollBarEnabled(false);
    this.webview.setVerticalScrollbarOverlay(false);
    this.webview.setHorizontalScrollBarEnabled(false);
    this.webview.setHorizontalScrollbarOverlay(false);
    this.webview.loadUrl(UrlUtils.handleUrl(BooheeClient.build(BooheeClient.ONE)
            .getDefaultURL(String.format(URL_GOODS, new Object[]{Integer.valueOf(this.mGoods
                    .id)}))));
    this.webview.setWebViewClient(new WebViewClient() {
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            if (TextUtils.isEmpty(url) || GoodsHomeFragment.this.mGoods == null) {
                return false;
            }
            if (url.contains("boohee://channel_posts")) {
                GoodsHomeFragment.this.onGoodsPageChangeListener.onGoodsPageChange(GoodsTab
                        .POST.getPosition());
            } else {
                BooheeScheme.handleUrl(GoodsHomeFragment.this.getActivity(), url);
            }
            return true;
        }
    });
}
项目:boohee_v5.6    文件:NiceIntroduceFragment.java   
@SuppressLint({"SetJavaScriptEnabled"})
private void initWebView() {
    this.webview.getSettings().setJavaScriptEnabled(true);
    this.webview.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
    this.webview.setVerticalScrollBarEnabled(false);
    this.webview.setVerticalScrollbarOverlay(false);
    this.webview.setHorizontalScrollBarEnabled(false);
    this.webview.setHorizontalScrollbarOverlay(false);
    this.webview.loadUrl(UrlUtils.handleUrl(BooheeClient.build(BooheeClient.ONE)
            .getDefaultURL(NICE_URL)));
    this.webview.setWebViewClient(new WebViewClient() {
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            if (TextUtils.isEmpty(url)) {
                return false;
            }
            BooheeScheme.handleUrl(NiceIntroduceFragment.this.getActivity(), url);
            return true;
        }
    });
}
项目:AppBajarLIB    文件:WebViewFormatter.java   
@SuppressWarnings("deprecation")
public static WebView formatWebView(WebView web, boolean isFitScreen) {

  //  web.setWebChromeClient(new WebChromeClient());

    web.setBackgroundColor(Color.parseColor("#00000000"));
    web.getSettings().setJavaScriptEnabled(true);
    web.getSettings().setJavaScriptCanOpenWindowsAutomatically(false);
    web.getSettings().setSupportMultipleWindows(false);
    web.getSettings().setSupportZoom(true);
    web.setVerticalScrollBarEnabled(false);
    web.setHorizontalScrollBarEnabled(true);


    web.getSettings().setUserAgentString("Mozilla/5.0 (Linux; Android 4.4; Nexus 4 Build/KRT16H) AppleWebKit/537.36(KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Mobile Safari/537.36");


    if (isFitScreen) {
        web.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
    }

    return web;
}
项目:AppBajarLIB    文件:WebViewFormatter.java   
public static WebView formatWebViewWithClient(WebView web,
                                              boolean isFitScreen, boolean enableCLient) {

  //  web.setWebChromeClient(new WebChromeClient());

    web.setBackgroundColor(Color.parseColor("#00000000"));
    web.getSettings().setJavaScriptEnabled(true);
    web.getSettings().setJavaScriptCanOpenWindowsAutomatically(false);
    web.getSettings().setSupportMultipleWindows(false);
    web.getSettings().setSupportZoom(true);
    web.setVerticalScrollBarEnabled(false);
    web.setHorizontalScrollBarEnabled(true);

    web.getSettings().setUserAgentString("Mozilla/5.0 (Linux; Android 4.4; Nexus 4 Build/KRT16H) AppleWebKit/537.36(KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Mobile Safari/537.36");


    if (isFitScreen) {
        web.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
    }

    if (enableCLient) {

        web.setWebViewClient(new MyWebViewClient(true));
    }
    return web;
}
项目:AppBajarLIB    文件:WebViewFormatter.java   
public static WebView formatWebViewWithClient(WebView web,
                                              boolean isFitScreen, boolean enableCLient, boolean loadWithinApp) {

 //   web.setWebChromeClient(new WebChromeClient());

    web.setBackgroundColor(Color.parseColor("#00000000"));
    web.getSettings().setJavaScriptEnabled(true);
    web.getSettings().setJavaScriptCanOpenWindowsAutomatically(false);
    web.getSettings().setSupportMultipleWindows(false);
    web.getSettings().setSupportZoom(true);
    web.setVerticalScrollBarEnabled(false);
    web.setHorizontalScrollBarEnabled(true);

    web.getSettings().setUserAgentString("Mozilla/5.0 (Linux; Android 4.4; Nexus 4 Build/KRT16H) AppleWebKit/537.36(KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Mobile Safari/537.36");


    if (isFitScreen) {
        web.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
    }

    if (enableCLient) {

        web.setWebViewClient(new MyWebViewClient(loadWithinApp));
    }
    return web;
}
项目:AppBajarLIB    文件:WebViewFormatter.java   
@SuppressWarnings("deprecation")
public static WebView formatWebView(WebView web, boolean isFitScreen,
                                    int BGColor) {

   // web.setWebChromeClient(new WebChromeClient());

    web.setBackgroundColor(BGColor);
    web.getSettings().setJavaScriptEnabled(true);
    web.getSettings().setJavaScriptCanOpenWindowsAutomatically(false);
    web.getSettings().setSupportMultipleWindows(false);
    web.getSettings().setSupportZoom(true);
    web.setVerticalScrollBarEnabled(false);
    web.setHorizontalScrollBarEnabled(true);

    web.getSettings().setUserAgentString("Mozilla/5.0 (Linux; Android 4.4; Nexus 4 Build/KRT16H) AppleWebKit/537.36(KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Mobile Safari/537.36");


    if (isFitScreen) {
        web.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
    }

    return web;
}
项目:EntboostIM    文件:BroadcastDetailActivity.java   
@SuppressLint("SetJavaScriptEnabled")
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setAbContentView(R.layout.activity_broadcast_detail);
    msg = (BroadcastMessage) getIntent().getSerializableExtra(
            "broadcastMessage");
    WebView webView = (WebView) findViewById(R.id.webView);
    webView.setBackgroundColor(0x00000000); // 透明背景
    WebSettings webSettings = webView.getSettings();
    webSettings.setJavaScriptEnabled(true);
    webSettings.setLayoutAlgorithm(LayoutAlgorithm.NARROW_COLUMNS);
    if (msg != null) {
        ((TextView) findViewById(R.id.msg_name)).setText(msg.getMsg_name());
        ((TextView) findViewById(R.id.msg_time)).setText(AbDateUtil
                .formatDateStr2Desc(AbDateUtil.getStringByFormat(
                        msg.getSendTime(), AbDateUtil.dateFormatYMDHMS),
                        AbDateUtil.dateFormatYMDHMS));
        webView.loadDataWithBaseURL(null, msg.getMsg_content(), "text/html",
                "utf-8", null);
    }

}
项目:taijiquanwang    文件:DetailsActivity.java   
private void initWebView() {
        webView = (WebView)findViewById(R.id.wb_details);
        LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT);
        if (!TextUtils.isEmpty(news_url)) {
            WebSettings settings = webView.getSettings();
            settings.setJavaScriptEnabled(true);//设置可以运行JS脚本
//          settings.setTextZoom(120);//Sets the text zoom of the page in percent. The default is 100.
            settings.setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
//          settings.setUseWideViewPort(true); //打开页面时, 自适应屏幕 
//          settings.setLoadWithOverviewMode(true);//打开页面时, 自适应屏幕 
            settings.setSupportZoom(false);// 用于设置webview放大
            settings.setBuiltInZoomControls(false);
            webView.setBackgroundResource(R.color.transparent);
            // 添加js交互接口类,并起别名 imagelistner
            webView.addJavascriptInterface(new JavascriptInterface(getApplicationContext()),"imagelistner");
            webView.setWebChromeClient(new MyWebChromeClient());
            webView.setWebViewClient(new MyWebViewClient());
            new MyAsnycTask().execute(news_url, news_title, news_source + " " +news_date);
        }
    }
项目:Android_Tian_Project_Chabaike    文件:ContentActivity.java   
private void initUI() {
    viewHolder = new ViewHolder();
    viewHolder.txTitle = (TextView) findViewById(R.id.tx_title);
    viewHolder.txAuthor = (TextView) findViewById(R.id.tx_author);
    viewHolder.txCreateTime = (TextView) findViewById(R.id.tx_create_time);
    viewHolder.wvContent = (WebView) findViewById(R.id.wv_wap_content);
    WebSettings settings = viewHolder.wvContent.getSettings();
    settings.setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);

    viewHolder.btnBack = (Button) findViewById(R.id.btn_back);
    viewHolder.btnBack.setOnClickListener(this);
    viewHolder.btnShare = (Button) findViewById(R.id.btn_share);
    viewHolder.btnShare.setOnClickListener(this);
    viewHolder.btnFavorite = (Button) findViewById(R.id.btn_favorite);
    viewHolder.btnFavorite.setOnClickListener(this);
}
项目:Android-TeaWiki    文件:ContentActivity.java   
private void getIndexContent(String id_) {
    HttpUtils.getPostResult(appURLFinal.CONTENT_URL,
            appURLFinal.getCONTENT(id_), new getResultCallback() {

                @Override
                public void getMessage(String message) {
                    // TODO Auto-generated method stub
                    condatalist = JSON_Parser.parseJSONContent(message);
                    System.out.println(condatalist.getContentData()
                            .getTitle());
                    tv_contenttitle.setText(condatalist.getContentData()
                            .getTitle());
                    textView_content_create_time.setText(condatalist
                            .getContentData().getCreate_time());
                    textView_content_source.setText(condatalist
                            .getContentData().getSource());
                    wv_contet.loadDataWithBaseURL(null, condatalist
                            .getContentData().getWap_content(),
                            "text/html", "utf-8", null);
                    // ���ò��ֹ�����,ʹ�ؼ�����Ӧ�ֻ���Ļ,ʹ�������ݵȿ���ʾ,���Խ��ͼƬ��������,�����п�����ҳ��������ʧЧ.
                    wv_contet.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
                    pd_content.dismiss();
                }
            });
}
项目:Android-TeaWiki    文件:ContentActivity.java   
private void getBodyContent(String id_) {
    HttpUtils.getPostResult(appURLFinal.CONTENT_URL,
            appURLFinal.getCONTENT(id_), new getResultCallback() {

                @Override
                public void getMessage(String message) {
                    // TODO Auto-generated method stub
                    condatalist = JSON_Parser.parseJSONContent(message);
                    System.out.println(condatalist.getContentData()
                            .getTitle());
                    tv_contenttitle.setText(condatalist.getContentData()
                            .getTitle());
                    textView_content_create_time.setText(condatalist
                            .getContentData().getCreate_time());
                    textView_content_source.setText(condatalist
                            .getContentData().getSource());
                    wv_contet.loadDataWithBaseURL(null, condatalist
                            .getContentData().getWap_content(),
                            "text/html", "utf-8", null);
                    // ���ò��ֹ�����,ʹ�ؼ�����Ӧ�ֻ���Ļ,ʹ�������ݵȿ���ʾ,���Խ��ͼƬ��������,�����п�����ҳ��������ʧЧ.
                    wv_contet.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
                    pd_content.dismiss();
                }
            });
}
项目:Impeller    文件:StandardObjectFragment.java   
private View createHTMLVideoPlayer(String url, JSONObject obj, JSONObject stream) {
    WebView wv = new WebView(getActivity());
    wv.setHorizontalScrollBarEnabled(false);
    wv.setWebChromeClient(new BrowserChrome(getMainActivity()));
    wv.getSettings().setLoadWithOverviewMode(true);
    wv.getSettings().setUseWideViewPort(true);
    wv.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
    wv.getSettings().setJavaScriptEnabled(true);

    Integer width = null;
    if(stream != null && stream.has("width"))
        width = stream.optInt("width");

    String html = Utils.formatHtmlFragment(obj.optString("embedCode", ""), width);
    Log.d(TAG, "HTML is " + html);
    wv.loadDataWithBaseURL(url, html, "text/html", "utf-8", null);
    m_webViews.add(wv);
    return wv;
}
项目:AcFun-Area63    文件:ArticleActivity.java   
@Override
protected void onPostExecute(Boolean result) {
    isDocBuilding.set(false);
    if(isFinishing()) return;
    setSupportProgressBarIndeterminateVisibility(false);
    if (result) {
        if(cacheFile.exists()){
            mWeb.loadUrl(Uri.fromFile(cacheFile).toString());
        }else
        mWeb.loadDataWithBaseURL(getBaseUrl(), mDoc.html(), "text/html", "UTF-8",
                null);

        if (hasUseMap)
            mWeb.getSettings().setLayoutAlgorithm(LayoutAlgorithm.NARROW_COLUMNS);
        else
            mWeb.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
        if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){
            try {
                mWeb.getSettings().setLayoutAlgorithm(LayoutAlgorithm.TEXT_AUTOSIZING);
            } catch (IllegalArgumentException ignored) {
            }
        }
    }
}
项目:kidsm_for_android    文件:SeeMentoryActivity.java   
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_seementory);
    getActionBar().setHomeButtonEnabled(true);
    getActionBar().setIcon(R.drawable.general_actionbar_back_btnset);
    getActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.general_actionbar_bg));
    webView = (WebView)findViewById(R.id.mentory_web);
    webView.getSettings().setJavaScriptEnabled(true);
    webView.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);

    String content = getIntent().getStringExtra("mentoring_text");
    String subject = getIntent().getStringExtra("mentoring_subject");
    Log.d("SeeMentory", content);

    setTitle(subject);

    webView.loadDataWithBaseURL(null, content, "text/html", "utf-8", null);
    //webView.loadUrl(getIntent().getStringExtra("mentoring_srl"));
    webView.setWebViewClient(new WebViewClientClass());
    this.localyticsSession = new LocalyticsSession(this.getApplicationContext());  // Context used to access device resources
    this.localyticsSession.open();                // open the session
    this.localyticsSession.upload();      // upload any data
}
项目:kidsm_for_android    文件:DoctypeErrorActivity.java   
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_doctypeerror);
    webView = (WebView)findViewById(R.id.error_view);
    webView.getSettings().setJavaScriptEnabled(true);
    webView.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);

    String error = getIntent().getStringExtra("error");
    String uri = getIntent().getStringExtra("uri");
    String params = getIntent().getStringExtra("params");
    webView.loadDataWithBaseURL(null, error, "text/html", "utf-8", null);
    webView.setWebViewClient(new WebViewClientClass());

    TextView textView = (TextView)findViewById(R.id.error_text);
    textView.setText("uri:"+uri+"\n"+"params:"+params+"\n�� ��ư�� ������ ȭ������ ���ư��ϴ�.");
    this.localyticsSession = new LocalyticsSession(this.getApplicationContext());  // Context used to access device resources
    this.localyticsSession.open();                // open the session
    this.localyticsSession.upload();      // upload any data
}
项目:boohee_v5.6    文件:BrowserActivity.java   
private void initView() {
    this.mProgressBar = (ProgressBar) findViewById(R.id.progress_bar);
    this.webView = (WebView) findViewById(R.id.wv_content);
    this.webView.getSettings().setJavaScriptEnabled(true);
    this.webView.getSettings().setLayoutAlgorithm(LayoutAlgorithm.NORMAL);
    this.webView.getSettings().setPluginState(PluginState.ON);
    this.webView.getSettings().setUserAgentString(this.webView.getSettings()
            .getUserAgentString() + " App/boohee");
    this.webView.getSettings().setDomStorageEnabled(true);
    this.webView.addJavascriptInterface(new JSInterface(), "jsObj");
    this.webView.setWebViewClient(createChromeClient());
    this.webView.setWebChromeClient(new MyWebClient());
}
项目:BigApp_Discuz_Android    文件:WebViewUtils.java   
public static void loadContentAdaptiveScreen(Context mContext,
                                             WebView webview, String content) {
    final String mimeType = "text/html";
    final String encoding = "UTF-8";
    webview.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);

    webview.loadDataWithBaseURL("", content, mimeType, encoding, "");
}
项目:Travis-Jr    文件:BuildInfoActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    runUITask(UI_SYNC);

    logs = new TreeMap<String, StringBuilder>();

    ownerName = getIntent().getStringExtra(EXTRA_OWNER_NAME);
    repoName = getIntent().getStringExtra(EXTRA_REPO_NAME);
    buildId = getIntent().getLongExtra(EXTRA_BUILD_ID, 0);

    slug.setText(ownerName + "/" + repoName);

    WebSettings settings = log.getSettings();

    settings.setDefaultZoom(WebSettings.ZoomDensity.FAR);
    settings.setLayoutAlgorithm(LayoutAlgorithm.NORMAL);
    settings.setUseWideViewPort(true);
    settings.setBuiltInZoomControls(true);
    settings.setDisplayZoomControls(false);
    settings.setRenderPriority(RenderPriority.HIGH);
    settings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);

    loadLogData(ASCII_ART.toString());
}
项目:q-mail    文件:MessageWebView.java   
/**
 * Configure a {@link WebView} to display a Message. This method takes into account a user's
 * preferences when configuring the view. This message is used to view a message and to display a message being
 * replied to.
 */
public void configure() {
    this.setVerticalScrollBarEnabled(true);
    this.setVerticalScrollbarOverlay(true);
    this.setScrollBarStyle(SCROLLBARS_INSIDE_OVERLAY);
    this.setLongClickable(true);

    if (QMail.getK9MessageViewTheme() == Theme.DARK) {
        // Black theme should get a black webview background
        // we'll set the background of the messages on load
        this.setBackgroundColor(0xff000000);
    }

    final WebSettings webSettings = this.getSettings();

    webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE);

    /* TODO this might improve rendering smoothness when webview is animated into view
    if (VERSION.SDK_INT >= VERSION_CODES.M) {
        webSettings.setOffscreenPreRaster(true);
    }
    */

    webSettings.setSupportZoom(true);
    webSettings.setBuiltInZoomControls(true);
    webSettings.setUseWideViewPort(true);
    if (QMail.autofitWidth()) {
        webSettings.setLoadWithOverviewMode(true);
    }

    disableDisplayZoomControls();

    webSettings.setJavaScriptEnabled(false);
    webSettings.setLoadsImagesAutomatically(true);
    webSettings.setRenderPriority(RenderPriority.HIGH);

    // TODO:  Review alternatives.  NARROW_COLUMNS is deprecated on KITKAT
    webSettings.setLayoutAlgorithm(LayoutAlgorithm.NARROW_COLUMNS);

    setOverScrollMode(OVER_SCROLL_NEVER);

    webSettings.setTextZoom(QMail.getFontSizes().getMessageViewContentAsPercent());

    // Disable network images by default.  This is overridden by preferences.
    blockNetworkData(true);
}
项目:boohee_v5.6    文件:j.java   
private boolean b() {
    this.b = (WebView) this.d.findViewById(ResContainer.getResourceId(this.k, ResType.ID,
            "webView"));
    this.b.setWebViewClient(c());
    this.b.setWebChromeClient(new p(this));
    this.b.requestFocusFromTouch();
    this.b.setVerticalScrollBarEnabled(false);
    this.b.setHorizontalScrollBarEnabled(false);
    this.b.setScrollBarStyle(0);
    this.b.getSettings().setCacheMode(2);
    WebSettings settings = this.b.getSettings();
    settings.setJavaScriptEnabled(true);
    if (VERSION.SDK_INT >= 8) {
        settings.setPluginState(PluginState.ON);
    }
    settings.setSupportZoom(true);
    settings.setBuiltInZoomControls(true);
    settings.setAllowFileAccess(true);
    settings.setLayoutAlgorithm(LayoutAlgorithm.NORMAL);
    settings.setUseWideViewPort(true);
    if (VERSION.SDK_INT >= 8) {
        settings.setLoadWithOverviewMode(true);
        settings.setDatabaseEnabled(true);
        settings.setDomStorageEnabled(true);
        settings.setGeolocationEnabled(true);
        settings.setAppCacheEnabled(true);
    }
    if (VERSION.SDK_INT >= 11) {
        try {
            Method declaredMethod = WebSettings.class.getDeclaredMethod
                    ("setDisplayZoomControls", new Class[]{Boolean.TYPE});
            declaredMethod.setAccessible(true);
            declaredMethod.invoke(settings, new Object[]{Boolean.valueOf(false)});
        } catch (Exception e) {
        }
    }
    try {
        if (this.m == SHARE_MEDIA.RENREN) {
            CookieSyncManager.createInstance(this.k);
            CookieManager.getInstance().removeAllCookie();
        }
    } catch (Exception e2) {
    }
    return true;
}
项目:K9-MailClient    文件:MessageWebView.java   
/**
 * Configure a {@link WebView} to display a Message. This method takes into account a user's
 * preferences when configuring the view. This message is used to view a message and to display a message being
 * replied to.
 */
public void configure() {
    this.setVerticalScrollBarEnabled(true);
    this.setVerticalScrollbarOverlay(true);
    this.setScrollBarStyle(SCROLLBARS_INSIDE_OVERLAY);
    this.setLongClickable(true);

    if (K9.getK9MessageViewTheme() == Theme.DARK) {
        // Black theme should get a black webview background
        // we'll set the background of the messages on load
        this.setBackgroundColor(0xff9e9e9e);
    }

    final WebSettings webSettings = this.getSettings();

    webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE);

    /* TODO this might improve rendering smoothness when webview is animated into view
    if (VERSION.SDK_INT >= VERSION_CODES.M) {
        webSettings.setOffscreenPreRaster(true);
    }
    */

    webSettings.setSupportZoom(true);
    webSettings.setBuiltInZoomControls(true);
    webSettings.setUseWideViewPort(true);
    if (K9.autofitWidth()) {
        webSettings.setLoadWithOverviewMode(true);
    }

    disableDisplayZoomControls();

    webSettings.setJavaScriptEnabled(false);
    webSettings.setLoadsImagesAutomatically(true);
    webSettings.setRenderPriority(RenderPriority.HIGH);

    // TODO:  Review alternatives.  NARROW_COLUMNS is deprecated on KITKAT
    webSettings.setLayoutAlgorithm(LayoutAlgorithm.NARROW_COLUMNS);

    setOverScrollMode(OVER_SCROLL_NEVER);

    webSettings.setTextZoom(K9.getFontSizes().getMessageViewContentAsPercent());

    // Disable network images by default.  This is overridden by preferences.
    blockNetworkData(true);
}
项目:TankMMBaseNew    文件:StrategyDetailActivity.java   
@SuppressLint("NewApi")
@Override
public void initView() {
    // TODO Auto-generated method stub

    setHomeAction(false);
    wv_show = (WebView) findViewById(R.id.wv_show);
    tv_show = (TextView) findViewById(R.id.tv_show);

    WebSettings webSettings = wv_show.getSettings();
    // // 关闭缩放
    // webSettings.setBuiltInZoomControls(false);
    // webSettings.setSupportZoom(false);
    // webSettings.setDisplayZoomControls(false);
    webSettings.setDefaultTextEncodingName("UTF-8");
    wv_show.setBackgroundColor(0); // 设置背景色  
    wv_show.getBackground().setAlpha(0); // 设置填充透明度 范围:0-255 
    // 支持javascript
    webSettings.setJavaScriptEnabled(true);
    // 设置可以支持缩放
    webSettings.setSupportZoom(true);
    // 设置出现缩放工具
    webSettings.setBuiltInZoomControls(true);
    // 扩大比例的缩放
    webSettings.setUseWideViewPort(true);
    // 自适应屏幕
    webSettings.setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
    webSettings.setLoadWithOverviewMode(true);
    mLoadingDialog = new CustomDialog(this, LayoutInflater.from(this).inflate(R.layout.dialog_loading, null));

    mTipsWorkerTask = new TipsWorkerTask(wv_show, mLoadingDialog, tip);

    if (tip != null) {
        if (TextUtils.isEmpty(tip.getTipName())) {
            setTitle(R.string.cap_database_category_tips);
        } else {
            setTitle(tip.getTipName());
        }
        mTipsWorkerTask.execute(tip.getUrl());
        // wv_show.loadUrl(tip.getUrl());
    } else {
        finish();
    }
}
项目:Android_Skin_3.x    文件:WebInitCompat.java   
@SuppressLint("SetJavaScriptEnabled")
@Override
public void setDefaultSetting(WebView view) {
    WebSettingsCompat settings = WebSettingsCompat.get(view);

    // JavaScript 支持
    settings.setJavaScriptEnabled(true);
    settings.setJavaScriptCanOpenWindowsAutomatically(true); // 允许 JavaScript 弹出窗口

    // web 图片
    settings.setLoadsImagesAutomatically(true);

    // WebView 去除缩放功能但隐藏缩放控件
    settings.setSupportZoom(false);
    settings.setBuiltInZoomControls(false);
    settings.setDisplayZoomControls(false);

    // 自适应屏幕
    settings.setUseWideViewPort(true);

    // 加载模式
    settings.setLoadWithOverviewMode(true);

    // 保持表单和密码
    settings.setSaveFormData(false);
    settings.setSavePassword(false);

    // 线程优先级调整
    settings.setRenderPriority(RenderPriority.HIGH);

    // 用WebView显示图片,可使用这个参数
    settings.setLayoutAlgorithm(LayoutAlgorithm.NORMAL);

    settings.setSupportMultipleWindows(true);

    // LOAD_CACHE_ONLY: 不使用网络,只读取本地缓存数据
    // LOAD_DEFAULT: 根据cache-control决定是否从网络上取数据
    // LOAD_CACHE_NORMAL: API level 17中已经废弃, 从API level
    // 11开始作用同LOAD_DEFAULT模式
    // LOAD_NO_CACHE: 不使用缓存,只从网络获取数据
    // LOAD_CACHE_ELSE_NETWORK: 只要本地有,无论是否过期、或者no-cache,都使用缓存中的数据

    // www.taobao.com的cache-control为no-cache,在模式LOAD_DEFAULT下,无论如何都会从网络上取数据,如果没有网络,就会出现错误页面;
    // 在LOAD_CACHE_ELSE_NETWORK模式下,无论是否有网络,只要本地有缓存,都使用缓存。本地没有缓存时才从网络上获取
    settings.setCacheMode(WebSettings.LOAD_DEFAULT);
    // 开启 DOM storage API 功能
    settings.setDomStorageEnabled(true);
    // 开启 database storage API 功能
    settings.setDatabaseEnabled(true);
    // 开启 Application Caches 功能
    settings.setAppCacheEnabled(true);
    // 设置最大缓存值 8M
    settings.setAppCacheMaxSize(8 * 1024 * 1024);

    settings.setPluginState(PluginStateCompat.ON_DEMAND);

    // 可以读取内容缓存
    settings.setAllowContentAccess(true);
    // 可以读取文件缓存(manifest生效)
    settings.setAllowFileAccess(true);
    settings.setAllowFileAccessFromFileURLs(true);
    settings.setAllowUniversalAccessFromFileURLs(true);
}
项目:Android_Skin_3.x    文件:WebSettingsCompat.java   
@Override
public void setLayoutAlgorithm(WebSettings settings, LayoutAlgorithm l) {
    settings.setLayoutAlgorithm(l);
}
项目:Android_Skin_3.x    文件:WebSettingsCompat.java   
public void setLayoutAlgorithm(LayoutAlgorithm l) {
    impl.setLayoutAlgorithm(settings, l);
}
项目:Android_Skin_2.0    文件:WebInitCompat.java   
@SuppressLint("SetJavaScriptEnabled")
@Override
public void setDefaultSetting(WebView view) {
    WebSettingsCompat settings = WebSettingsCompat.get(view);

    // JavaScript 支持
    settings.setJavaScriptEnabled(true);
    settings.setJavaScriptCanOpenWindowsAutomatically(true); // 允许 JavaScript 弹出窗口

    // web 图片
    settings.setLoadsImagesAutomatically(true);

    // WebView 去除缩放功能但隐藏缩放控件
    settings.setSupportZoom(false);
    settings.setBuiltInZoomControls(false);
    settings.setDisplayZoomControls(false);

    // 自适应屏幕
    settings.setUseWideViewPort(true);

    // 加载模式
    settings.setLoadWithOverviewMode(true);

    // 保持表单和密码
    settings.setSaveFormData(false);
    settings.setSavePassword(false);

    // 线程优先级调整
    settings.setRenderPriority(RenderPriority.HIGH);

    // 用WebView显示图片,可使用这个参数
    settings.setLayoutAlgorithm(LayoutAlgorithm.NORMAL);

    settings.setSupportMultipleWindows(true);

    // LOAD_CACHE_ONLY: 不使用网络,只读取本地缓存数据
    // LOAD_DEFAULT: 根据cache-control决定是否从网络上取数据
    // LOAD_CACHE_NORMAL: API level 17中已经废弃, 从API level
    // 11开始作用同LOAD_DEFAULT模式
    // LOAD_NO_CACHE: 不使用缓存,只从网络获取数据
    // LOAD_CACHE_ELSE_NETWORK: 只要本地有,无论是否过期、或者no-cache,都使用缓存中的数据

    // www.taobao.com的cache-control为no-cache,在模式LOAD_DEFAULT下,无论如何都会从网络上取数据,如果没有网络,就会出现错误页面;
    // 在LOAD_CACHE_ELSE_NETWORK模式下,无论是否有网络,只要本地有缓存,都使用缓存。本地没有缓存时才从网络上获取
    settings.setCacheMode(WebSettings.LOAD_DEFAULT);
    // 开启 DOM storage API 功能
    settings.setDomStorageEnabled(true);
    // 开启 database storage API 功能
    settings.setDatabaseEnabled(true);
    // 开启 Application Caches 功能
    settings.setAppCacheEnabled(true);
    // 设置最大缓存值 8M
    settings.setAppCacheMaxSize(8 * 1024 * 1024);

    settings.setPluginState(PluginStateCompat.ON_DEMAND);

    // 可以读取内容缓存
    settings.setAllowContentAccess(true);
    // 可以读取文件缓存(manifest生效)
    settings.setAllowFileAccess(true);
    settings.setAllowFileAccessFromFileURLs(true);
    settings.setAllowUniversalAccessFromFileURLs(true);
}
项目:Android_Skin_2.0    文件:WebSettingsCompat.java   
@Override
public void setLayoutAlgorithm(WebSettings settings, LayoutAlgorithm l) {
    settings.setLayoutAlgorithm(l);
}
项目:Android_Skin_2.0    文件:WebSettingsCompat.java   
public void setLayoutAlgorithm(LayoutAlgorithm l) {
    impl.setLayoutAlgorithm(settings, l);
}
项目:12306-android-Decompile    文件:CordovaWebView.java   
@SuppressLint({"NewApi"})
private void setup()
{
  setInitialScale(0);
  setVerticalScrollBarEnabled(false);
  requestFocusFromTouch();
  WebSettings localWebSettings = getSettings();
  localWebSettings.setJavaScriptEnabled(true);
  localWebSettings.setJavaScriptCanOpenWindowsAutomatically(true);
  localWebSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NORMAL);
  try
  {
    Class[] arrayOfClass = new Class[1];
    arrayOfClass[0] = Boolean.TYPE;
    Method localMethod = WebSettings.class.getMethod("setNavDump", arrayOfClass);
    if (Build.VERSION.SDK_INT < 11)
    {
      Object[] arrayOfObject = new Object[1];
      arrayOfObject[0] = Boolean.valueOf(true);
      localMethod.invoke(localWebSettings, arrayOfObject);
    }
    localWebSettings.setSaveFormData(false);
    localWebSettings.setSavePassword(false);
    if (Build.VERSION.SDK_INT > 15)
      Level16Apis.enableUniversalAccess(localWebSettings);
    String str = this.cordova.getActivity().getApplicationContext().getDir("database", 0).getPath();
    if (Build.VERSION.SDK_INT < 11)
    {
      localWebSettings.setDatabaseEnabled(true);
      localWebSettings.setDatabasePath(str);
    }
    localWebSettings.setGeolocationDatabasePath(str);
    localWebSettings.setDomStorageEnabled(true);
    localWebSettings.setGeolocationEnabled(true);
    localWebSettings.setAppCacheMaxSize(5242880L);
    localWebSettings.setAppCachePath(this.cordova.getActivity().getApplicationContext().getDir("database", 0).getPath());
    localWebSettings.setAppCacheEnabled(true);
    updateUserAgentString();
    IntentFilter localIntentFilter = new IntentFilter();
    localIntentFilter.addAction("android.intent.action.CONFIGURATION_CHANGED");
    if (this.receiver == null)
    {
      this.receiver = new BroadcastReceiver()
      {
        public void onReceive(Context paramContext, Intent paramIntent)
        {
          CordovaWebView.this.updateUserAgentString();
        }
      };
      this.cordova.getActivity().registerReceiver(this.receiver, localIntentFilter);
    }
    this.pluginManager = new PluginManager(this, this.cordova);
    this.jsMessageQueue = new NativeToJsMessageQueue(this, this.cordova);
    this.exposedJsApi = new ExposedJsApi(this.pluginManager, this.jsMessageQueue);
    exposeJsInterface();
    return;
  }
  catch (NoSuchMethodException localNoSuchMethodException)
  {
    while (true)
      Log.d("CordovaWebView", "We are on a modern version of Android, we will deprecate HTC 2.3 devices in 2.8");
  }
  catch (IllegalArgumentException localIllegalArgumentException)
  {
    while (true)
      Log.d("CordovaWebView", "Doing the NavDump failed with bad arguments");
  }
  catch (IllegalAccessException localIllegalAccessException)
  {
    while (true)
      Log.d("CordovaWebView", "This should never happen: IllegalAccessException means this isn't Android anymore");
  }
  catch (InvocationTargetException localInvocationTargetException)
  {
    while (true)
      Log.d("CordovaWebView", "This should never happen: InvocationTargetException means this isn't Android anymore.");
  }
}
项目:TorrentFreak-Reader    文件:ArticleContentFragment.java   
public void onActivityCreated(final Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    // set a colour filter to change the progress bar colour to pink
    progressBar.getIndeterminateDrawable().setColorFilter(
        getResources().getColor(R.color.progress_bar_filter), Mode.MULTIPLY);

    // determine whether a saved instance state exists, indicating the fragment has existed
    // previously
    if (savedInstanceState == null) {
        // retrieve the fragment arguments and set the url
        final Bundle bundle = getArguments();
        url = bundle.getString(EXTRA_URL);
    } else {
        // retrieve the retained article details
        url = savedInstanceState.getString(SAVED_STATE_URL);
        title = savedInstanceState.getString(SAVED_STATE_TITLE);
        author = savedInstanceState.getString(SAVED_STATE_AUTHOR);
        date = savedInstanceState.getString(SAVED_STATE_DATE);
        content = savedInstanceState.getString(SAVED_STATE_CONTENT);
    }

    // setup the web view settings
    final WebSettings webSettings = webView.getSettings();
    webSettings.setJavaScriptEnabled(true);
    webSettings.setBuiltInZoomControls(true);
    webSettings.setSupportZoom(true);

    // setDisplayZoomControls only exists on honeycomb and above
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        webSettings.setDisplayZoomControls(false);
    }

    webSettings.setPluginsEnabled(true);
    webSettings.setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);

    webView.setBackgroundColor(getResources().getColor(R.color.article_content_background));
    webView.setWebChromeClient(new WebChromeClient());

    // determine whether the article details have been set
    if (title == null || author == null || date == null || content == null) {
        // fetch the article contents
        final ArticleContentProvider provider = new ArticleContentProvider(this, url);
        provider.fetch();
    } else {
        // view the article contents as the article has already been retrieved
        viewArticle();
    }
}
项目:12306-android-Decompile    文件:CordovaWebView.java   
@SuppressLint({"NewApi"})
private void setup()
{
  setInitialScale(0);
  setVerticalScrollBarEnabled(false);
  requestFocusFromTouch();
  WebSettings localWebSettings = getSettings();
  localWebSettings.setJavaScriptEnabled(true);
  localWebSettings.setJavaScriptCanOpenWindowsAutomatically(true);
  localWebSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NORMAL);
  try
  {
    Class[] arrayOfClass = new Class[1];
    arrayOfClass[0] = Boolean.TYPE;
    Method localMethod = WebSettings.class.getMethod("setNavDump", arrayOfClass);
    if (Build.VERSION.SDK_INT < 11)
    {
      Object[] arrayOfObject = new Object[1];
      arrayOfObject[0] = Boolean.valueOf(true);
      localMethod.invoke(localWebSettings, arrayOfObject);
    }
    localWebSettings.setSaveFormData(false);
    localWebSettings.setSavePassword(false);
    if (Build.VERSION.SDK_INT > 15)
      Level16Apis.enableUniversalAccess(localWebSettings);
    String str = this.cordova.getActivity().getApplicationContext().getDir("database", 0).getPath();
    if (Build.VERSION.SDK_INT < 11)
    {
      localWebSettings.setDatabaseEnabled(true);
      localWebSettings.setDatabasePath(str);
    }
    localWebSettings.setGeolocationDatabasePath(str);
    localWebSettings.setDomStorageEnabled(true);
    localWebSettings.setGeolocationEnabled(true);
    localWebSettings.setAppCacheMaxSize(5242880L);
    localWebSettings.setAppCachePath(this.cordova.getActivity().getApplicationContext().getDir("database", 0).getPath());
    localWebSettings.setAppCacheEnabled(true);
    updateUserAgentString();
    IntentFilter localIntentFilter = new IntentFilter();
    localIntentFilter.addAction("android.intent.action.CONFIGURATION_CHANGED");
    if (this.receiver == null)
    {
      this.receiver = new BroadcastReceiver()
      {
        public void onReceive(Context paramContext, Intent paramIntent)
        {
          CordovaWebView.this.updateUserAgentString();
        }
      };
      this.cordova.getActivity().registerReceiver(this.receiver, localIntentFilter);
    }
    this.pluginManager = new PluginManager(this, this.cordova);
    this.jsMessageQueue = new NativeToJsMessageQueue(this, this.cordova);
    this.exposedJsApi = new ExposedJsApi(this.pluginManager, this.jsMessageQueue);
    exposeJsInterface();
    return;
  }
  catch (NoSuchMethodException localNoSuchMethodException)
  {
    while (true)
      Log.d("CordovaWebView", "We are on a modern version of Android, we will deprecate HTC 2.3 devices in 2.8");
  }
  catch (IllegalArgumentException localIllegalArgumentException)
  {
    while (true)
      Log.d("CordovaWebView", "Doing the NavDump failed with bad arguments");
  }
  catch (IllegalAccessException localIllegalAccessException)
  {
    while (true)
      Log.d("CordovaWebView", "This should never happen: IllegalAccessException means this isn't Android anymore");
  }
  catch (InvocationTargetException localInvocationTargetException)
  {
    while (true)
      Log.d("CordovaWebView", "This should never happen: InvocationTargetException means this isn't Android anymore.");
  }
}
项目:Android_Skin_3.x    文件:WebSettingsCompat.java   
/**
 * 用WebView显示图片,可使用这个参数
 */
public void setLayoutAlgorithm(WebSettings settings, LayoutAlgorithm l);
项目:Android_Skin_2.0    文件:WebSettingsCompat.java   
/**
 * 用WebView显示图片,可使用这个参数
 */
public void setLayoutAlgorithm(WebSettings settings, LayoutAlgorithm l);
项目:cordova-android-chromium    文件:ChromiumSettings.java   
/**
 * Sets the underlying layout algorithm. This will cause a relayout of the
 * WebView. The default is {@link LayoutAlgorithm#NARROW_COLUMNS}.
 *
 * @param l the layout algorithm to use, as a {@link LayoutAlgorithm} value
 */
public abstract void setLayoutAlgorithm(LayoutAlgorithm l);
项目:cordova-android-chromium    文件:ChromiumSettings.java   
/**
 * Gets the current layout algorithm.
 *
 * @return the layout algorithm in use, as a {@link LayoutAlgorithm} value
 * @see #setLayoutAlgorithm
 */
public abstract LayoutAlgorithm getLayoutAlgorithm();