public void changeProxyUrl(String url) { getProxy().setProperty("url", url); if (!TiC.URL_ANDROID_ASSET_RESOURCES.equals(url)) { reloadMethod = reloadTypes.URL; reloadData = url; } }
@Override public void propertySet(String key, Object newValue, Object oldValue, boolean changedProperty) { switch (key) { case TiC.PROPERTY_SCALES_PAGE_TO_FIT: getWebView().getSettings().setLoadWithOverviewMode(TiConvert.toBoolean(newValue)); break; case TiC.PROPERTY_CACHE_MODE: getWebView() .getSettings() .setCacheMode(TiConvert.toInt(newValue, AndroidModule.WEBVIEW_LOAD_DEFAULT)); break; case TiC.PROPERTY_URL: if (!TiC.URL_ANDROID_ASSET_RESOURCES.equals(TiConvert.toString(newValue))) { setUrl(TiConvert.toString(newValue)); } else { setUrl(null); } break; case TiC.PROPERTY_HTML: setHtml( TiConvert.toString(newValue), (HashMap<String, Object>) (proxy.getProperty(WebViewProxy.OPTIONS_IN_SETHTML))); break; case TiC.PROPERTY_DATA: if (newValue instanceof TiBlob) { setData((TiBlob) newValue); } else { setData(null); } break; case TiC.PROPERTY_LIGHT_TOUCH_ENABLED: getWebView().getSettings().setLightTouchEnabled(TiConvert.toBoolean(newValue)); break; case TiC.PROPERTY_PLUGIN_STATE: setPluginState(TiConvert.toInt(newValue)); break; case TiC.PROPERTY_SHOW_SCROLLBARS: boolean value = TiConvert.toBoolean(newValue); getWebView().setVerticalScrollBarEnabled(value); getWebView().setHorizontalScrollBarEnabled(value); break; case TiC.PROPERTY_OVER_SCROLL_MODE: nativeView.setOverScrollMode(TiConvert.toInt(newValue, View.OVER_SCROLL_ALWAYS)); break; case TiC.PROPERTY_SCROLLING_ENABLED: setScrollingEnabled(newValue); break; case TiC.PROPERTY_SHOW_HORIZONTAL_SCROLL_INDICATOR: nativeView.setHorizontalScrollBarEnabled(TiConvert.toBoolean(newValue)); break; case TiC.PROPERTY_SHOW_VERTICAL_SCROLL_INDICATOR: nativeView.setVerticalScrollBarEnabled(TiConvert.toBoolean(newValue)); break; case TiC.PROPERTY_ENABLE_JAVASCRIPT_INTERFACE: boolean enableJavascriptInterface = TiConvert.toBoolean(newValue, true); if (Build.VERSION.SDK_INT > 16 || enableJavascriptInterface) { client.getBinding().addJavascriptInterfaces(); } else { client.getBinding().removeJavascriptInterfaces(); } break; default: super.propertySet(key, newValue, oldValue, changedProperty); break; } if (changedProperty) { // If TiUIView's propertyChanged ended up making a TiBackgroundDrawable // for the background, we must set the WebView background color to transparent // in order to see any of it. boolean isBgRelated = (key.startsWith(TiC.PROPERTY_BACKGROUND_PREFIX) || key.startsWith(TiC.PROPERTY_BORDER_PREFIX)); if (isBgRelated && nativeView != null && nativeView.getBackground() instanceof TiBackgroundDrawable) { nativeView.setBackgroundColor(Color.TRANSPARENT); } } }