/** * @param flag * @param bgColor * @param baseUrl * @param mEBrowserView * @author wanglei * @createAt 20151124 * @ps 与原EBrowserView的setBrwViewBackground类似,原方法只设置EBrowserView的背景 * 当网页设置弹动效果后,上下滑动到边缘后,会露出EBrowserView下面的网页,故应给EBrowserView 父对象EBounceView设置背景, * EBrowserView背景设成透明。 */ public void setBounceViewBackground( boolean flag, String bgColor, String baseUrl, EBrowserView mEBrowserView) { if (flag) { if (bgColor.startsWith("#") || bgColor.startsWith("rgb")) { int color = BUtility.parseColor(bgColor); setBackgroundColor(color); } else { String path = BUtility.makeRealPath( BUtility.makeUrl(mEBrowserView.getCurrentUrl(baseUrl), bgColor), mEBrowserView.getCurrentWidget().m_widgetPath, mEBrowserView.getCurrentWidget().m_wgtType); Bitmap bitmap = BUtility.getLocalImg(mContext, path); Drawable d = null; if (bitmap != null) { d = new BitmapDrawable(mContext.getResources(), bitmap); } int version = Build.VERSION.SDK_INT; if (version < 16) { setBackgroundDrawable(d); setBackgroundColor(Color.argb(0, 0, 0, 0)); } else { setBackground(d); setBackgroundColor(Color.argb(0, 0, 0, 0)); } } } else { setBackgroundColor(Color.TRANSPARENT); } }
@Override public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { EBrowserView errorView = (EBrowserView) view; errorView.receivedError(errorCode, description, failingUrl); WWidgetData wgt = errorView.getCurrentWidget(); printError(errorCode, description, failingUrl, wgt); }
public void setBounceParms(int type, JSONObject json, String guestId) { String imagePath = null; String textColor = null; String levelText = null; String pullToReloadText = null; String releaseToReloadText = null; String loadingText = null; String loadingImagePath = null; imagePath = json.optString("imagePath"); if (null != imagePath) { imagePath = BUtility.makeRealPath( imagePath, mBrwView.getCurrentWidget().m_widgetPath, mBrwView.getCurrentWidget().m_wgtType); } textColor = json.optString("textColor"); levelText = json.optString("levelText"); pullToReloadText = json.optString("pullToReloadText"); releaseToReloadText = json.optString("releaseToReloadText"); loadingText = json.optString("loadingText"); if (null != guestId && guestId.equals("donghang")) { loadingImagePath = json.optString("loadingImagePath"); if (null != loadingImagePath) { loadingImagePath = BUtility.makeRealPath( loadingImagePath, mBrwView.getCurrentWidget().m_widgetPath, mBrwView.getCurrentWidget().m_wgtType); } } switch (type) { case EViewEntry.F_BOUNCE_TYPE_TOP: if (null != imagePath && 0 != imagePath.trim().length()) { mHeaderView.setArrowhead(imagePath); } if (null != loadingImagePath && 0 != loadingImagePath.trim().length()) { mHeaderView.setLoadingPic(loadingImagePath); } if ((null == textColor || 0 == textColor.trim().length()) && (null == pullToReloadText || 0 == pullToReloadText.trim().length()) && (null == releaseToReloadText || 0 == releaseToReloadText.trim().length()) && (null == loadingText || 0 == loadingText.trim().length())) { mHeaderView.setContentEmpty(true); } else { if (null != textColor && 0 != textColor.trim().length()) { int color = mBrwView.parseColor(textColor); mHeaderView.setTextColor(color); } if (null != levelText && 0 != levelText.trim().length()) { mHeaderView.setLevelText(levelText); } if (null != releaseToReloadText && 0 != releaseToReloadText.trim().length()) { mHeaderView.setReleaseToReloadText(releaseToReloadText); } if (null != loadingText && 0 != loadingText.trim().length()) { mHeaderView.setLoadingText(loadingText); } if (null != pullToReloadText && 0 != pullToReloadText.trim().length()) { mHeaderView.setPullToReloadText(pullToReloadText); } } break; case EViewEntry.F_BOUNCE_TYPE_BOTTOM: if (null != imagePath && 0 != imagePath.trim().length()) { mTailView.setArrowhead(imagePath); } if (null != loadingImagePath && 0 != loadingImagePath.trim().length()) { mTailView.setLoadingPic(loadingImagePath); } if ((null == textColor || 0 == textColor.trim().length()) && (null == pullToReloadText || 0 == pullToReloadText.trim().length()) && (null == releaseToReloadText || 0 == releaseToReloadText.trim().length()) && (null == loadingText || 0 == loadingText.trim().length())) { mTailView.setContentEmpty(true); } else { if (null != textColor && 0 != textColor.trim().length()) { int color = mBrwView.parseColor(textColor); mTailView.setTextColor(color); } if (null != levelText && 0 != levelText.trim().length()) { mTailView.setLevelText(levelText); } if (null != releaseToReloadText && 0 != releaseToReloadText.trim().length()) { mTailView.setReleaseToReloadText(releaseToReloadText); } if (null != loadingText && 0 != loadingText.trim().length()) { mTailView.setLoadingText(loadingText); } if (null != pullToReloadText && 0 != pullToReloadText.trim().length()) { mTailView.setPullToReloadText(pullToReloadText); } } break; } }