コード例 #1
0
 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;
   }
 }
コード例 #2
0
 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();
 }
コード例 #3
0
 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;
   }
 }
コード例 #4
0
 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);
     }
   }
 }
コード例 #5
0
 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;
   }
 }
コード例 #6
0
 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);
   }
 }
コード例 #7
0
  @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);
  }
コード例 #8
0
 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);
   }
 }
コード例 #9
0
 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;
 }
コード例 #10
0
 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;
 }
コード例 #11
0
  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;
    }
  }
コード例 #12
0
 public void setBounce(boolean flag) {
   mBounce = flag;
   mHeaderView.setVisibility(VISIBLE);
   mTailView.setVisibility(VISIBLE);
 }