@Override public void onPageStarted(WebView view, String url, Bitmap favicon) { mIsPageOnload = false; if (view == null) { return; } EBrowserView target = (EBrowserView) view; target.onPageStarted(target, url); if (null != mParms) { target.setQuery(mParms); } mParms = null; ESystemInfo info = ESystemInfo.getIntence(); if (info.mFinished) { info.mScaled = true; } if (url != null) { mReferenceUrl = url; if (url.startsWith("http")) { EBrowserWindow bWindow = target.getBrowserWindow(); if (bWindow != null && 1 == bWindow.getWidget().m_webapp) { bWindow.showProgress(); } } } }
@Override public void onPageFinished(WebView view, String url) { EBrowserView target = (EBrowserView) view; if (url.startsWith("http")) { EBrowserWindow bWindow = target.getBrowserWindow(); WWidgetData wgt = bWindow.getWidget(); if (1 == wgt.m_webapp) { bWindow.hiddenProgress(); } } String oUrl = view.getOriginalUrl(); if (!mReferenceUrl.equals(url) || target.beDestroy() || !url.equals(oUrl)) { return; } ESystemInfo info = ESystemInfo.getIntence(); int versionA = Build.VERSION.SDK_INT; if (!target.isWebApp()) { // 4.3及4.3以下手机 if (!info.mScaled) { float nowScale = 1.0f; if (versionA <= 18) { nowScale = target.getScale(); } info.mDefaultFontSize = (int) (info.mDefaultFontSize / nowScale); info.mScaled = true; } target.setDefaultFontSize(info.mDefaultFontSize); } if (!info.mFinished) { ((EBrowserActivity) target.getContext()).setContentViewVisible(); } info.mFinished = true; target.loadUrl(EUExScript.F_UEX_SCRIPT); target.onPageFinished(target, url); EBrowserWindow win = target.getBrowserWindow(); WWidgetData wgt = win.getWidget(); if (wgt.m_appdebug == 1) { String debugUrlString = "http://" + wgt.m_logServerIp + ":30060/target/target-script-min.js#anonymous"; String weinreString = "javascript:var x = document.createElement(\"SCRIPT\");x.setAttribute('src',\"" + debugUrlString + "\"" + ");document.body.appendChild(x);"; target.loadUrl(weinreString); } CookieSyncManager.getInstance().sync(); }
public void setLevelText(String value) { levelText = value; RelativeLayout.LayoutParams parmMsg = new LayoutParams(-2, -2); parmMsg.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE); mContent.setLayoutParams(parmMsg); mContent.setTextSize( TypedValue.COMPLEX_UNIT_DIP, (float) (ESystemInfo.getIntence().mDefaultNatvieFontSize)); mLevelContent.setTextSize( TypedValue.COMPLEX_UNIT_DIP, (float) (ESystemInfo.getIntence().mDefaultNatvieFontSize * 0.6)); mLevelContent.setText(levelText); mLevelContent.setVisibility(VISIBLE); }
public EBounceView(Context context) { super(context); mContext = context; mScroller = new Scroller(mContext); mRefrshHeight = ESystemInfo.getIntence().mDefaultBounceHeight; mBounceViewHeight = (ESystemInfo.getIntence().mHeightPixels / 3) * 2; setAnimationCacheEnabled(false); setAlwaysDrawnWithCacheEnabled(false); setOrientation(VERTICAL); mTopBund = -mRefrshHeight; mBotomBund = mRefrshHeight; mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop() / 2; }
@Override public void onPageStarted(WebView view, String url, Bitmap favicon) { EBrowserView target = (EBrowserView) view; mReferenceUrl = url; target.onPageStarted(target, url); if (null != mParms) { target.setQuery(mParms); } mParms = null; ESystemInfo info = ESystemInfo.getIntence(); if (info.mFinished) { info.mScaled = true; } if (url.startsWith("http")) { EBrowserWindow bWindow = target.getBrowserWindow(); WWidgetData wgt = bWindow.getWidget(); if (1 == wgt.m_webapp) { bWindow.showProgress(); } } }
private boolean onTracker(int velocityX, int velocityY) { boolean trigger = false; if (isSupportSwipeCallback) { final int absY = (velocityY < 0) ? -velocityY : velocityY; final int absX = (velocityX < 0) ? -velocityX : velocityX; int rate = ESystemInfo.getIntence().mSwipeRate; if ((velocityX > rate) && (absX > absY)) { mBrwView.loadUrl(EUExScript.F_UEX_SCRIPT_SWIPE_RIGHT); trigger = true; } else if ((velocityX < -rate) && (absX > absY)) { mBrwView.loadUrl(EUExScript.F_UEX_SCRIPT_SWIPE_LEFT); trigger = true; } } return trigger; }
public EBounceViewHeader(Context context, int type) { super(context); setWillNotDraw(true); setBackgroundColor(0); setFocusable(false); ESystemInfo intence = ESystemInfo.getIntence(); int height = intence.mDefaultBounceHeight; RelativeLayout wapper = new RelativeLayout(context); wapper.setWillNotDraw(true); wapper.setBackgroundColor(0); wapper.setFocusable(false); RelativeLayout.LayoutParams wParm = new LayoutParams(-1, height); if (type == EViewEntry.F_BOUNCE_TYPE_TOP) { wParm.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); } else { wParm.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE); } wapper.setLayoutParams(wParm); addView(wapper); wap = new RelativeLayout(context); wap.setId(F_WAP_ID); RelativeLayout.LayoutParams wm = new LayoutParams(-2, height); wm.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE); wm.leftMargin = 30; wap.setLayoutParams(wm); mContent = new TextView(context); mContent.setId(F_CONTENT_ID); RelativeLayout.LayoutParams parmMsg = new LayoutParams(-2, -2); parmMsg.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE); mContent.setLayoutParams(parmMsg); mContent.setTextColor(textColor); mContent.setText(pullToReloadText); mContent.setTextSize(TypedValue.COMPLEX_UNIT_DIP, (float) (intence.mDefaultNatvieFontSize)); mContent.setVisibility(GONE); wap.addView(mContent); mLevelContent = new TextView(context); RelativeLayout.LayoutParams parml = new LayoutParams(-2, -2); parml.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE); parml.addRule(RelativeLayout.BELOW, F_CONTENT_ID); mLevelContent.setLayoutParams(parml); mLevelContent.setTextColor(textColor); mLevelContent.setTextSize( TypedValue.COMPLEX_UNIT_DIP, (float) (intence.mDefaultNatvieFontSize * 0.6)); mLevelContent.setVisibility(GONE); wap.addView(mLevelContent); wapper.addView(wap); mProgress = new ProgressBar(context); mProgress.setIndeterminate(true); int use = height - 12; RelativeLayout.LayoutParams parmPro = new LayoutParams(use, use); parmPro.addRule(RelativeLayout.LEFT_OF, F_WAP_ID); parmPro.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE); mProgress.setLayoutParams(parmPro); mProgress.setVisibility(GONE); wapper.addView(mProgress); mYAxisProgress = new YAxisImageView(context); int useY = height - 12; RelativeLayout.LayoutParams parmProY = new LayoutParams(useY, useY); parmProY.addRule(RelativeLayout.LEFT_OF, F_WAP_ID); parmProY.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE); mYAxisProgress.setLayoutParams(parmProY); mYAxisProgress.setVisibility(GONE); wapper.addView(mYAxisProgress); mArrowImage = new ImageView(context); int useA = height - 12; RelativeLayout.LayoutParams parmImage = new LayoutParams(useA, useA); parmImage.addRule(RelativeLayout.LEFT_OF, F_WAP_ID); parmImage.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE); mArrowImage.setLayoutParams(parmImage); Drawable icon = context.getResources().getDrawable(EResources.platform_myspace_pulltorefresh_arrow); mArrowImage.setImageDrawable(icon); mArrowImage.setVisibility(GONE); wapper.addView(mArrowImage); mAnimationUp = new RotateAnimation( 0, -180, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f); mAnimationUp.setInterpolator(new AccelerateInterpolator()); mAnimationUp.setDuration(250); mAnimationUp.setFillAfter(true); mAnimationDown = new RotateAnimation( -180, 0, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f); mAnimationDown.setInterpolator(new AccelerateInterpolator()); mAnimationDown.setDuration(250); mAnimationDown.setFillAfter(true); }
public class EBounceView extends LinearLayout { private int mLastY; private Context mContext; private Scroller mScroller; public EBrowserView mBrwView; private EBounceViewHeader mTailView; private EBounceViewHeader mHeaderView; private int mRefrshHeight; private int mBounceViewHeight; private boolean mShowTopView; private boolean mShowBottomView; private boolean mBounce; private boolean mIsTop; private boolean mIsBottom; private boolean mTopLoading; private boolean mBottomLoading; private boolean mTopNotify; private boolean mBottomNotify; private boolean mTopAutoRefresh = false; private boolean isSupportSwipeCallback = false; // is need callback,set by API interface. private int mTopState; private int mBottomState; private int mTopBund; private int mBotomBund; private int mTouchSlop; public String mPullStr; public String mPullingStr; public String mReleaseStr; static final int F_VIEW_STATE_DRAG = 0; static final int F_VIEW_STATE_RELEASE = 1; static final int F_BOUNCEVIEW_STATE_PULL_RELOAD = 0; static final int F_BOUNCEVIEW_STATE_RELEASE_RELOAD = 1; static final int F_BOUNCEVIEW_STATE_LOADING = 2; public static final int F_SET_BOUNCEVIEW_TYPE_STR1 = 0; public static final int F_SET_BOUNCEVIEW_TYPE_STR2 = 1; public static final int F_SET_BOUNCEVIEW_TYPE_STR3 = 2; public static final int F_SET_BOUNCEVIEW_TYPE_STR4 = 3; public static final int F_SET_BOUNCEVIEW_TYPE_STR5 = 4; private float mDensity = ESystemInfo.getIntence().mDensity; public EBounceView(Context context) { super(context); mContext = context; mScroller = new Scroller(mContext); mRefrshHeight = ESystemInfo.getIntence().mDefaultBounceHeight; mBounceViewHeight = (ESystemInfo.getIntence().mHeightPixels / 3) * 2; setAnimationCacheEnabled(false); setAlwaysDrawnWithCacheEnabled(false); setOrientation(VERTICAL); mTopBund = -mRefrshHeight; mBotomBund = mRefrshHeight; mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop() / 2; } @Override public void addView(View child) { mHeaderView = new EBounceViewHeader(mContext, EViewEntry.F_BOUNCE_TYPE_TOP); LayoutParams hlp = new LinearLayout.LayoutParams(Compat.FILL, mBounceViewHeight); hlp.topMargin = -mBounceViewHeight; hlp.gravity = Gravity.CENTER; addView(mHeaderView, hlp); mHeaderView.setVisibility(GONE); mBrwView = (EBrowserView) child; LayoutParams wlp = new LinearLayout.LayoutParams(Compat.FILL, Compat.FILL); wlp.weight = 1.0f; addView(mBrwView, wlp); mTailView = new EBounceViewHeader(mContext, EViewEntry.F_BOUNCE_TYPE_BOTTOM); LayoutParams tlp = new LinearLayout.LayoutParams(Compat.FILL, mBounceViewHeight); tlp.bottomMargin = -mBounceViewHeight; tlp.gravity = Gravity.CENTER; addView(mTailView, tlp); mTailView.setVisibility(GONE); } private VelocityTracker mVelocityTracker; @Override public boolean onInterceptTouchEvent(MotionEvent e) { int action = e.getAction(); if (mVelocityTracker == null) { mVelocityTracker = VelocityTracker.obtain(); } mVelocityTracker.addMovement(e); if (!mBounce) { switch (action) { case MotionEvent.ACTION_UP: handlerTracker(); break; } return false; } int y = (int) e.getRawY(); switch (action) { case MotionEvent.ACTION_DOWN: mLastY = y; break; case MotionEvent.ACTION_MOVE: int m = y - mLastY; boolean can = (m >= 0 ? m : -m) > mTouchSlop; if (m > 0 && !mBottomLoading && can && !mTopAutoRefresh) { if (topCanBounce()) { mIsTop = true; if (mTopNotify) { mBrwView.onBounceStateChange( EViewEntry.F_BOUNCE_TYPE_TOP, F_BOUNCEVIEW_STATE_PULL_RELOAD); } return true; } } else if (m < 0 && !mTopLoading && can) { if (bottomCanBounce()) { mIsBottom = true; if (mBottomNotify) { mBrwView.onBounceStateChange( EViewEntry.F_BOUNCE_TYPE_BOTTOM, F_BOUNCEVIEW_STATE_PULL_RELOAD); } return true; } } mLastY = y; break; case MotionEvent.ACTION_UP: handlerTracker(); break; } return false; } @Override public boolean onTouchEvent(MotionEvent event) { if (mVelocityTracker == null) { mVelocityTracker = VelocityTracker.obtain(); } mVelocityTracker.addMovement(event); int y = (int) event.getRawY(); int action = event.getAction(); switch (action) { case MotionEvent.ACTION_DOWN: mLastY = y; break; case MotionEvent.ACTION_MOVE: int m = y - mLastY; if (mIsTop) { moveDown(m); } else if (mIsBottom) { moveUp(m); } mLastY = y; break; case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: case MotionEvent.ACTION_OUTSIDE: reverse(); handlerTracker(); break; } return true; } private boolean handlerTracker() { final VelocityTracker velocityTracker = mVelocityTracker; velocityTracker.computeCurrentVelocity(1000); int velocityX = (int) (velocityTracker.getXVelocity() / mDensity); int velocityY = (int) (velocityTracker.getYVelocity() / mDensity); endDrag(); return onTracker(velocityX, velocityY); } private void endDrag() { if (mVelocityTracker != null) { mVelocityTracker.recycle(); mVelocityTracker = null; } } private boolean onTracker(int velocityX, int velocityY) { boolean trigger = false; if (isSupportSwipeCallback) { final int absY = (velocityY < 0) ? -velocityY : velocityY; final int absX = (velocityX < 0) ? -velocityX : velocityX; int rate = ESystemInfo.getIntence().mSwipeRate; if ((velocityX > rate) && (absX > absY)) { mBrwView.loadUrl(EUExScript.F_UEX_SCRIPT_SWIPE_RIGHT); trigger = true; } else if ((velocityX < -rate) && (absX > absY)) { mBrwView.loadUrl(EUExScript.F_UEX_SCRIPT_SWIPE_LEFT); trigger = true; } } return trigger; } private void moveDown(int moveY) { int f1 = getScrollY(); int f2 = 0; if (moveY > 0) { f2 = (int) (moveY * 0.5F); } else { f2 = (int) (moveY * 0.7F); int bound = f1 - f2; if (bound >= 0) { f2 = f2 + bound; scrollBy(0, -f2); return; } } scrollBy(0, -f2); if (f1 <= mTopBund && mTopState == F_VIEW_STATE_DRAG) { if (mShowTopView && mTopNotify) { mHeaderView.setArrowVisibility(VISIBLE); mHeaderView.setProgressBarVisibility(GONE); mHeaderView.showReleaseToReloadText(); mHeaderView.rotateArrowImage(EBounceViewHeader.F_ROTATE_UP); } if (mTopLoading) { mTopLoading = false; } mTopState = F_VIEW_STATE_RELEASE; } else if (f1 > mTopBund && mTopState == F_VIEW_STATE_RELEASE) { if (mShowTopView && mTopNotify) { mHeaderView.setArrowVisibility(VISIBLE); mHeaderView.setProgressBarVisibility(GONE); mHeaderView.showPullToReloadText(); mHeaderView.rotateArrowImage(EBounceViewHeader.F_ROTATE_DOWN); } mTopState = F_VIEW_STATE_DRAG; } return; } private void moveUp(int moveY) { int f1 = getScrollY(); int f2 = 0; if (moveY < 0) { f2 = (int) (moveY * 0.5F); } else { f2 = (int) (moveY * 0.7F); int bound = f1 - f2; if (bound <= 0) { f2 = f2 + bound; scrollBy(0, -f2); return; } } scrollBy(0, -f2); if (f1 >= mBotomBund && mBottomState == F_VIEW_STATE_DRAG) { if (mShowBottomView && mBottomNotify) { mTailView.setArrowVisibility(VISIBLE); mTailView.setProgressBarVisibility(GONE); mTailView.showReleaseToReloadText(); mTailView.rotateArrowImage(EBounceViewHeader.F_ROTATE_DOWN); } if (mBottomLoading) { mBottomLoading = false; } mBottomState = F_VIEW_STATE_RELEASE; } else if (f1 < mBotomBund && mBottomState == F_VIEW_STATE_RELEASE) { if (mShowBottomView && mBottomNotify) { mTailView.setArrowVisibility(VISIBLE); mTailView.setProgressBarVisibility(GONE); mTailView.showPullToReloadText(); mTailView.rotateArrowImage(EBounceViewHeader.F_ROTATE_UP); } mBottomState = F_VIEW_STATE_DRAG; } return; } private void reverse() { int sy = getScrollY(); if (mIsTop) { if (sy <= mTopBund && mTopNotify) { topRefreshing(); } else { backToTop(); } } else if (mIsBottom) { if (sy >= mBotomBund && mBottomNotify) { bottomRefreshing(); } else { backToBottom(); } } } public void topBounceViewRefresh() { if (!mTopLoading) { scrollTo(0, mTopBund); if (mShowTopView) { mHeaderView.setArrowVisibility(GONE); mHeaderView.setProgressBarVisibility(VISIBLE); mHeaderView.setTextVisibility(VISIBLE); mHeaderView.showLoadingText(); } mTopAutoRefresh = true; mTopLoading = true; if (mTopNotify) { mBrwView.onBounceStateChange(EViewEntry.F_BOUNCE_TYPE_TOP, F_BOUNCEVIEW_STATE_LOADING); } } } private void topRefreshing() { if (mTopNotify) { mBrwView.onBounceStateChange(EViewEntry.F_BOUNCE_TYPE_TOP, F_BOUNCEVIEW_STATE_RELEASE_RELOAD); } mTopLoading = true; mTopState = F_VIEW_STATE_DRAG; int sy = getScrollY(); int dist = mTopBund - sy; if (mShowTopView) { mHeaderView.setArrowVisibility(GONE); mHeaderView.setProgressBarVisibility(VISIBLE); mHeaderView.setTextVisibility(VISIBLE); mHeaderView.showLoadingText(); } mScroller.startScroll(0, sy, 0, dist); postInvalidate(); if (mTopNotify) { mBrwView.onBounceStateChange(EViewEntry.F_BOUNCE_TYPE_TOP, F_BOUNCEVIEW_STATE_LOADING); } } private void bottomRefreshing() { if (mBottomNotify) { mBrwView.onBounceStateChange( EViewEntry.F_BOUNCE_TYPE_BOTTOM, F_BOUNCEVIEW_STATE_RELEASE_RELOAD); } mBottomLoading = true; mBottomState = F_VIEW_STATE_DRAG; int sy = getScrollY(); int dist = sy - mBotomBund; if (mShowBottomView) { mTailView.setArrowVisibility(GONE); mTailView.setProgressBarVisibility(VISIBLE); mTailView.setTextVisibility(VISIBLE); mTailView.showLoadingText(); } mScroller.startScroll(0, -sy, 0, dist); postInvalidate(); if (mBottomNotify) { mBrwView.onBounceStateChange(EViewEntry.F_BOUNCE_TYPE_BOTTOM, F_BOUNCEVIEW_STATE_LOADING); } } private void backToTop() { if (mTopAutoRefresh) { scrollTo(0, 0); mTopAutoRefresh = false; } else { int sy = getScrollY(); int dist = 0 - sy; mScroller.startScroll(0, sy, 0, dist); postInvalidate(); } } private void backToBottom() { int sy = getScrollY(); int dist = sy; mScroller.startScroll(0, -sy, 0, dist); postInvalidate(); } @Override public void computeScroll() { if (mScroller.computeScrollOffset()) { int sy = mScroller.getCurrY(); if (mIsTop) { scrollTo(0, sy); } else if (mIsBottom) { scrollTo(0, -sy); } postInvalidate(); if (sy == 0) { mIsTop = false; mIsBottom = false; // mTopLoading = false; // mBottomLoading = false; } } } private void finishRefresh(int type) { switch (type) { case EViewEntry.F_BOUNCE_TYPE_TOP: if (!mTopLoading) { return; } if (mShowTopView) { mHeaderView.setArrowVisibility(VISIBLE); mHeaderView.setProgressBarVisibility(GONE); mHeaderView.showPullToReloadText(); mHeaderView.rotateArrowImage(EBounceViewHeader.F_ROTATE_DOWN); } backToTop(); break; case EViewEntry.F_BOUNCE_TYPE_BOTTOM: if (!mBottomLoading) { return; } if (mShowBottomView) { mTailView.setArrowVisibility(VISIBLE); mTailView.setProgressBarVisibility(GONE); mTailView.showPullToReloadText(); mTailView.rotateArrowImage(EBounceViewHeader.F_ROTATE_UP); } backToBottom(); break; } clear(); } private void clear() { mTopLoading = false; mBottomLoading = false; } private boolean topCanBounce() { boolean b1 = mBrwView.getScrollYWrap() == 0; if (b1) { return true; } else { return false; } } private boolean bottomCanBounce() { float nowScale = mBrwView.getScaleWrap(); int h1 = (int) (mBrwView.getContentHeight() * nowScale); int h2 = mBrwView.getScrollYWrap() + mBrwView.getHeightWrap(); if (h1 <= h2 + 5) { return true; } else { return false; } } public int getBounce() { int result = mBounce ? 1 : 0; mBrwView.cbBounceState(result); return result; } public void setBounce(boolean flag) { mBounce = flag; mHeaderView.setVisibility(VISIBLE); mTailView.setVisibility(VISIBLE); } public void showBounceView(int inType, int inColor, int inFlag) { switch (inType) { case EViewEntry.F_BOUNCE_TYPE_TOP: mShowTopView = inFlag != 1 ? false : true; if (!mShowTopView) { mHeaderView.componentsDisable(); } mHeaderView.setBackgroundColor(inColor); break; case EViewEntry.F_BOUNCE_TYPE_BOTTOM: mShowBottomView = inFlag != 1 ? false : true; if (!mShowBottomView) { mTailView.componentsDisable(); } mTailView.setBackgroundColor(inColor); break; } } public void resetBounceView(int inType) { finishRefresh(inType); } public void release() { finishRefresh(EViewEntry.F_BOUNCE_TYPE_TOP); finishRefresh(EViewEntry.F_BOUNCE_TYPE_BOTTOM); } public void hiddenBounceView(int inType) { switch (inType) { case EViewEntry.F_BOUNCE_TYPE_TOP: mHeaderView.setVisibility(INVISIBLE); mTopNotify = false; break; case EViewEntry.F_BOUNCE_TYPE_BOTTOM: mTailView.setVisibility(INVISIBLE); mBottomNotify = false; break; } } public void notifyBounceEvent(int inType, int inStatus) { switch (inType) { case EViewEntry.F_BOUNCE_TYPE_TOP: mTopNotify = inStatus != 1 ? false : true; if (mTopNotify) { mHeaderView.componentsEnable(); } break; case EViewEntry.F_BOUNCE_TYPE_BOTTOM: mBottomNotify = inStatus != 1 ? false : true; if (mBottomNotify) { mTailView.componentsEnable(); } break; } } 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; } } /** * @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); } } public void setIsSupportSwipeCallback(boolean isSupport) { isSupportSwipeCallback = isSupport; } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(null); if (!EResources.init(this)) { loadResError(); return; } Intent intent = new Intent(EBrowserActivity.this, TempActivity.class); intent.putExtra("isTemp", true); startActivity(intent); overridePendingTransition( EUExUtil.getResAnimID("platform_myspace_no_anim"), EUExUtil.getResAnimID("platform_myspace_no_anim")); mVisable = true; Window activityWindow = getWindow(); ESystemInfo.getIntence().init(this); mBrowser = new EBrowser(this); mEHandler = new EHandler(Looper.getMainLooper()); View splash = initEngineUI(); mBrowserAround = new EBrowserAround(splash); // mScreen.setVisibility(View.INVISIBLE); setContentView(mScreen); initInternalBranch(); ACEDes.setContext(this); Message loadDelayMsg = mEHandler.obtainMessage(EHandler.F_MSG_LOAD_HIDE_SH); long delay = 3 * 1000L; if (mSipBranch) { delay = 1000L; } mEHandler.sendMessageDelayed(loadDelayMsg, delay); Message initAppMsg = mEHandler.obtainMessage(EHandler.F_MSG_INIT_APP); WidgetOneApplication app = (WidgetOneApplication) getApplication(); app.initApp(this, initAppMsg); EUtil.printeBackup(savedInstanceState, "onCreate"); // EUtil.checkAndroidProxy(getBaseContext()); handleIntent(getIntent()); PushRecieveMsgReceiver.setContext(this); globalSlidingMenu = new SlidingMenu(this); globalSlidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN); // globalSlidingMenu.setShadowWidthRes(EUExUtil.getResDimenID("shadow_width")); // globalSlidingMenu.setShadowDrawable(EUExUtil.getResDrawableID("shadow")); // globalSlidingMenu.setShadowWidthRes(R.dimen.shadow_width); // globalSlidingMenu.setShadowDrawable(R.drawable.shadow); // globalSlidingMenu.setBehindOffsetRes(R.dimen.slidingmenu_offset); // globalSlidingMenu.setFadeDegree(0.35f); // globalSlidingMenu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT); // globalSlidingMenu.setMenu(R.layout.menu_frame); // globalSlidingMenu.setMode(SlidingMenu.LEFT_RIGHT); // // globalSlidingMenu.setSecondaryMenu(R.layout.menu_frame_two); // globalSlidingMenu.setSecondaryShadowDrawable(R.drawable.shadowright); // globalSlidingMenu.setBehindWidthRes(R.dimen.slidingmenu_width); // globalSlidingMenu.setBehindWidthRes(0); reflectionPluginMethod("onActivityCreate"); try { activityWindow.clearFlags( WindowManager.LayoutParams.class.getField("FLAG_NEEDS_MENU_KEY").getInt(null)); } catch (Exception e) { e.printStackTrace(); } }