@Override public void onClick(View v) { if (!mBuilder.mIsShowing) { return; } if (mNewTab == v) { if (mUiController.getTabControl().canCreateNewTab()) { callBackNewTabAnim(); } else { boolean isShow = mUi.isShowMaxTabsDialog( new AlertDialog.OnClickListener() { public void onClick(DialogInterface d, int which) { mUi.closeTheLeastUsedTab(); mUi.updateCheckPrompt(); callBackNewTabAnim(); mBuilder.mIsShowing = false; } }, new AlertDialog.OnClickListener() { public void onClick(DialogInterface d, int which) { mBuilder.mIsShowing = true; } }); if (!isShow) { mUi.closeTheLeastUsedTab(); callBackNewTabAnim(); mBuilder.mIsShowing = false; return; } mBuilder.mIsShowing = true; return; } } else if (mClearAllTab == v) { clearAllTabs(); } else if (mFullScreen == v) { if (!mUi.mNavScreenShowing) { callBackFullScreenAnim(); } else { mBuilder.mIsShowing = true; return; } } mBuilder.mIsShowing = false; }
public void callBackNewTabAnim() { // mApplication.setmThumbnailPosition(mBuilder.mCurrentConfigPosition); int endPosition = mBuilder.getList().size() - 1; Browser application = (Browser) mActivity.getApplication(); int startPosition = application.getmThumbnailPosition(); if (startPosition < 0 || startPosition >= mBuilder.getList().size()) startPosition = 0; AnimatorSet moveAnim = null; int width = getWidth(); int animTime = getResources().getInteger(R.integer.config_shortAnimTime); if (endPosition == startPosition) { mUi.openNewTab(); } else { ObjectAnimator oTran; ArrayList<Animator> animList = new ArrayList<Animator>(); for (int i = startPosition; i <= endPosition; i++) { if (i != endPosition) { oTran = ObjectAnimator.ofFloat( mBuilder.getList().get(i), "translationX", 0, -(i - startPosition + 1) * width); oTran.setStartDelay(DELAYTIME * (i - startPosition)); oTran.setDuration(animTime * (i - startPosition + 1)); } else { oTran = ObjectAnimator.ofFloat( mBuilder.getList().get(i), "translationX", 0, -(endPosition - startPosition) * width); oTran.setStartDelay(DELAYTIME * (endPosition - startPosition)); oTran.setDuration(animTime * (endPosition - startPosition)); } animList.add(oTran); } moveAnim = new AnimatorSet(); moveAnim.playTogether(animList); moveAnim.addListener( new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mUi.openNewTab(); reverse(animation, 0); super.onAnimationEnd(animation); } }); moveAnim.start(); } }
private void switchToTab(Tab tab) { if (tab != mUi.getActiveTab()) { mUiController.setActiveTab(tab); } }
protected void close(int position, boolean animate) { mUi.hideNavScreen(position, animate); }
public void callBackFullScreenAnim() { // mApplication.setmThumbnailPosition(mBuilder.mCurrentConfigPosition); int endPosition = mUiController.getTabControl().getCurrentPosition() / 4; Browser application = (Browser) mActivity.getApplication(); int startPosition = application.getmThumbnailPosition(); AnimatorSet moveAnim = null; int animTime = getResources().getInteger(R.integer.config_shortAnimTime); if (endPosition >= mBuilder.getList().size()) endPosition = mBuilder.getList().size() - 1; if (endPosition < 0) endPosition = 0; int width = getWidth(); if (endPosition == startPosition) { mUi.hideNavScreen(mUiController.getTabControl().getTabPosition(mUi.getActiveTab()), true); } else if (endPosition > startPosition) { ObjectAnimator oTran; ArrayList<Animator> animList = new ArrayList<Animator>(); for (int i = startPosition; i <= endPosition; i++) { if (i != endPosition) { oTran = ObjectAnimator.ofFloat( mBuilder.getList().get(i), "translationX", 0, -(i - startPosition + 1) * width); oTran.setStartDelay(DELAYTIME * (i - startPosition)); oTran.setDuration(animTime * (i - startPosition + 1)); } else { oTran = ObjectAnimator.ofFloat( mBuilder.getList().get(i), "translationX", 0, -(endPosition - startPosition) * width); oTran.setStartDelay(DELAYTIME * (endPosition - startPosition)); oTran.setDuration(animTime * (endPosition - startPosition)); } animList.add(oTran); } moveAnim = new AnimatorSet(); moveAnim.playTogether(animList); } else { ObjectAnimator oTran; ArrayList<Animator> animList = new ArrayList<Animator>(); for (int i = startPosition; i >= endPosition; i--) { if (i != endPosition) { oTran = ObjectAnimator.ofFloat( mBuilder.getList().get(i), "translationX", 0, (startPosition - i + 1) * width); oTran.setStartDelay(DELAYTIME * (startPosition - i)); oTran.setDuration(animTime * (startPosition - i + 1)); } else { oTran = ObjectAnimator.ofFloat( mBuilder.getList().get(i), "translationX", 0, (startPosition - endPosition) * width); oTran.setStartDelay(DELAYTIME * (startPosition - endPosition)); oTran.setDuration(animTime * (startPosition - endPosition)); } animList.add(oTran); } moveAnim = new AnimatorSet(); moveAnim.playTogether(animList); } if (moveAnim != null) { moveAnim.addListener( new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { // TODO Auto-generated method stub mUi.hideNavScreen( mUiController.getTabControl().getTabPosition(mUi.getActiveTab()), true, animation); super.onAnimationEnd(animation); } }); moveAnim.start(); } }