public void moveToLeft() { if (DEBUG) LogHelper.LOGD(TAG, "moveToLeft"); if (!mStartAnimation) { if (DEBUG) LogHelper.LOGD(TAG, "moveLeftIn----mScroller.getCurrX()=" + mScroller.getCurrX()); mStartAnimation = true; isLeft = true; /** dx是移动距离。。。 */ mScroller.startScroll(-mTheme.getScreenWidth(), 0, mTheme.getScreenWidth(), 0, 300); invalidate(); } }
@Override public void computeScroll() { super.computeScroll(); if (mScroller.computeScrollOffset()) { scrollTo(mScroller.getCurrX(), 0); if (DEBUG) LogHelper.LOGD(TAG, "mScroller.getCurrX()=" + mScroller.getCurrX()); postInvalidate(); } else if (mStartAnimation && mScroller.isFinished()) { // 结束动画 if (mFinishListener != null) { mFinishListener.finishAnimation(isLeft); } if (DEBUG) LogHelper.LOGD(TAG, "mStartAnimation && mScroller.isFinished()=" + mScroller.getCurrX()); mStartAnimation = false; } }
public void updateTheme() { background = getResources().getDrawable(mTheme.getThemeId()); background.setCallback(null); background.setBounds(0, 0, mTheme.getScreenWidth(), mTheme.getScreenHeight()); if (DEBUG) LogHelper.LOGD(TAG, "---------------setTheme---------"); /*if(first) updateTheme();*/ }
public void leftmoveIn() { if (!mStartAnimation) { if (DEBUG) LogHelper.LOGD(TAG, "moveLeftIn" + "mScroller.getCurrX()=" + mScroller.getCurrX()); mStartAnimation = true; isLeft = false; mScroller.startScroll(mTheme.getScreenWidth(), 0, -mTheme.getScreenWidth(), 0, 300); invalidate(); } }