List of usage examples for android.view View setRotation
public void setRotation(float rotation)
From source file:edward.com.recyclerview.BaseItemAnimator.java
void reset(View v) { v.setAlpha(1);// w w w . ja va 2s .co m v.setScaleY(1); v.setScaleX(1); v.setTranslationY(0); v.setTranslationX(0); v.setRotation(0); v.setRotationY(0); v.setRotationX(0); v.setPivotX(v.getMeasuredWidth() / 2); v.setPivotY(v.getMeasuredHeight() / 2); v.animate().setInterpolator(null); }
From source file:com.github.rubensousa.stackview.StackView.java
private void addViews() { mViews.clear();//from w w w . j a va 2 s. c om for (int i = 0; i < mSize; i++) { mViews.add(null); } mCurrentSize = 0; for (int i = mSize - 1; i >= 0; i--) { View view = LayoutInflater.from(getContext()).inflate(mLayout, this, false); if (mHardwareAccelerationEnabled) { view.setLayerType(View.LAYER_TYPE_HARDWARE, null); } if (mAdapter != null && i < mAdapter.getCount()) { mCurrentSize++; view = mAdapter.getView(i, view, this); } else { // If there's no adapter set or the adapter has less items and the current index, // then hide the view if (!isInEditMode()) { view.setVisibility(View.INVISIBLE); } } mViews.set(i, view); addView(view); setupView(view, i); // Set a random rotation view.setRotation(nextRotation()); } }
From source file:com.hippo.ehviewer.ui.scene.GalleryListScene.java
private void showActionFab() { if (null != mFabLayout && STATE_NORMAL == mState && !mShowActionFab) { mShowActionFab = true;/*from ww w . ja va 2 s .c om*/ View fab = mFabLayout.getPrimaryFab(); fab.setVisibility(View.VISIBLE); fab.setRotation(-45.0f); fab.animate().scaleX(1.0f).scaleY(1.0f).rotation(0.0f).setListener(null).setDuration(ANIMATE_TIME) .setStartDelay(0L).setInterpolator(AnimationUtils.FAST_SLOW_INTERPOLATOR).start(); } }
From source file:com.hippo.ehviewer.ui.scene.GalleryListScene.java
private void selectActionFab(boolean animation) { if (null == mFabLayout || null == mSearchFab) { return;// w ww. ja va2s . co m } mShowActionFab = true; if (animation) { long delay; if (View.INVISIBLE == mSearchFab.getVisibility()) { delay = 0L; } else { delay = ANIMATE_TIME; mSearchFab.animate().scaleX(0.0f).scaleY(0.0f).setListener(mSearchFabAnimatorListener) .setDuration(ANIMATE_TIME).setStartDelay(0L) .setInterpolator(AnimationUtils.SLOW_FAST_INTERPOLATOR).start(); } View fab = mFabLayout.getPrimaryFab(); fab.setVisibility(View.VISIBLE); fab.setRotation(-45.0f); fab.animate().scaleX(1.0f).scaleY(1.0f).rotation(0.0f).setListener(null).setDuration(ANIMATE_TIME) .setStartDelay(delay).setInterpolator(AnimationUtils.FAST_SLOW_INTERPOLATOR).start(); } else { mFabLayout.setExpanded(false, false); View fab = mFabLayout.getPrimaryFab(); fab.setVisibility(View.VISIBLE); fab.setScaleX(1.0f); fab.setScaleY(1.0f); mSearchFab.setVisibility(View.INVISIBLE); mSearchFab.setScaleX(0.0f); mSearchFab.setScaleY(0.0f); } }
From source file:com.comcast.freeflow.core.FreeFlowContainer.java
protected void returnItemToPoolIfNeeded(FreeFlowItem freeflowItem) { View v = freeflowItem.view; v.setTranslationX(0);// w w w.java 2 s . c om v.setTranslationY(0); v.setRotation(0); v.setScaleX(1f); v.setScaleY(1f); v.setAlpha(1); viewpool.returnViewToPool(v); }
From source file:com.marshalchen.common.uimodule.freeflow.core.FreeFlowContainer.java
protected void returnItemToPoolIfNeeded(FreeFlowItem freeflowItem) { View v = freeflowItem.view; v.setTranslationX(0);/*from w w w . j av a2s . c o m*/ v.setTranslationY(0); v.setRotation(0); v.setScaleX(1f); v.setScaleY(1f); v.setAlpha(1); viewpool.returnViewToPool(v); }
From source file:com.geecko.QuickLyric.adapter.IntroScreenSlidePagerAdapter.java
@SuppressWarnings({ "deprecation", "ResourceAsColor" }) @Override//w ww . j a v a2 s . c om public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { View tutorialLayout = mActivity.findViewById(R.id.tutorial_layout); ArgbEvaluator evaluator = new ArgbEvaluator(); Object background = position < getCount() - 1 ? evaluator.evaluate(positionOffset, mActivity.getResources().getColor(colors[position]), mActivity.getResources().getColor(colors[position + 1])) : mActivity.getResources().getColor(colors[position]); tutorialLayout.setBackgroundColor((int) background); MainActivity.setNavBarColor(mActivity.getWindow(), mActivity.getTheme(), (int) evaluator.evaluate(0.5f, mActivity.getResources().getColor(R.color.action_dark), background)); MainActivity.setStatusBarColor(mActivity.getWindow(), mActivity.getTheme(), (int) evaluator.evaluate(0.5f, mActivity.getResources().getColor(R.color.action_dark), background)); View bigFab = tutorialLayout.findViewById(R.id.big_fab); View handImage = tutorialLayout.findViewById(R.id.musicid_demo_hand_image); View soundImage = tutorialLayout.findViewById(R.id.musicid_demo_sound_image); View redKey = tutorialLayout.findViewById(R.id.intro_4_red_key); View yellowKey = tutorialLayout.findViewById(R.id.intro_4_yellow_key); View gearA = tutorialLayout.findViewById(R.id.redGear); View gearB = tutorialLayout.findViewById(R.id.blueGear); BubblePopImageView tableImageView = (BubblePopImageView) tutorialLayout.findViewById(R.id.table); position = rightToLeft ? getCount() - 1 - position : position; if (rightToLeft && positionOffset > 0.0) { position -= 1; positionOffset = 1f - positionOffset; positionOffsetPixels = (int) (positionOffset * mPager.getWidth()); } switch (position) { case 0: if (tableImageView != null) { tableImageView.setProgress(positionOffset); tableImageView.setTranslationX((rightToLeft ? -1f : 1f) * (1f - positionOffset) * (tableImageView.getMeasuredWidth() / 3f)); } break; case 1: if (tableImageView != null) { tableImageView.setProgress(1f); tableImageView.setTranslationX((rightToLeft ? 0.15f : -0.4f) * positionOffsetPixels); } if (bigFab != null) { bigFab.setTranslationX( (rightToLeft ? -1f : 1f) * (1f - positionOffset) * (bigFab.getMeasuredWidth() / 3f)); if (mCurrentPage == 1 ^ rightToLeft) bigFab.setRotation(positionOffset * 360f); else bigFab.setRotation((1f - positionOffset) * 360f); } break; case 2: if (bigFab != null) ((View) bigFab.getParent()).setTranslationX((!rightToLeft ? -0.4f : 0.4f) * positionOffsetPixels); if (soundImage != null && handImage != null) { soundImage.setTranslationX(300f - 300f * positionOffset); handImage.setTranslationX(-400f + 400f * positionOffset); } break; case 3: if (redKey != null && yellowKey != null) { if (redKey.getMeasuredHeight() < redKey.getResources().getDimensionPixelSize(R.dimen.dp) * 15) { redKey.setVisibility(View.INVISIBLE); yellowKey.setVisibility(View.INVISIBLE); break; } else { redKey.setVisibility(View.VISIBLE); yellowKey.setVisibility(View.VISIBLE); } redKey.setTranslationY(330f * (1 - positionOffset)); yellowKey.setTranslationY(290f * Math.min(1.3f * (1 - positionOffset), 1.0f)); yellowKey.setTranslationX(105f * Math.min(1.3f * (1 - positionOffset), 1.0f)); } if (3 == count - 2 && gearA != null && gearB != null) { gearA.setRotation(-180f * positionOffset); gearB.setRotation(180f * positionOffset); } break; case 4: if (gearA != null && gearB != null) { gearA.setRotation(-180f * positionOffset); gearB.setRotation(180f * positionOffset); } break; } }
From source file:us.shandian.launcher.Page.java
public void setTransitionEffect(TransitionEffect effect) { mTransitionEffect = effect;//from w w w. j a v a2 s. co m // Reset if (mScrollTransformsSet) { for (int i = 0; i < getChildCount(); i++) { View v = getPageAt(i); if (v != null) { v.setPivotX(v.getMeasuredWidth() * 0.5f); v.setPivotY(v.getMeasuredHeight() * 0.5f); v.setRotation(0); v.setRotationX(0); v.setRotationY(0); v.setScaleX(1f); v.setScaleY(1f); v.setTranslationX(0f); v.setTranslationY(0f); v.setVisibility(VISIBLE); setChildAlpha(v, 1f); } } } mScrollTransformsSet = false; }
From source file:us.shandian.launcher.Page.java
protected void screenScrolled(int screenCenter) { boolean isInOverscroll = mOverScrollX < 0 || mOverScrollX > mMaxScrollX; if (mFadeInAdjacentScreens || mTransitionEffect != null || mScrollTransformsSet) { for (int i = 0; i < getChildCount(); i++) { View v = getPageAt(i); if (v != null) { float scrollProgress = getScrollProgress(screenCenter, v, i); if (Math.abs(scrollProgress) >= 1f) { v.setCameraDistance(0); }// ww w .j a va 2 s. c om if (mTransitionEffect != null && !isInOverscroll) { mTransitionEffect.screenScrolled(v, i, scrollProgress); } else if (mScrollTransformsSet) { v.setPivotX(v.getMeasuredWidth() * 0.5f); v.setPivotY(v.getMeasuredHeight() * 0.5f); v.setRotation(0); v.setRotationX(0); v.setRotationY(0); v.setScaleX(1f); v.setScaleY(1f); v.setTranslationX(0f); v.setTranslationY(0f); v.setVisibility(VISIBLE); setChildAlpha(v, 1f); } } } mScrollTransformsSet = mTransitionEffect != null && !isInOverscroll; } }
From source file:com.aimfire.demo.CamcorderActivity.java
private void adjustUIControls(int rotation) { RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) mShutterLayout.getLayoutParams(); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, 0); layoutParams.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE); mShutterLayout.setLayoutParams(layoutParams); mShutterLayout.setRotation(rotation); layoutParams = (RelativeLayout.LayoutParams) mPvButton.getLayoutParams(); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, 0); layoutParams.addRule(RelativeLayout.ABOVE, 0); layoutParams.addRule(RelativeLayout.BELOW, R.id.shutter_layout); mPvButton.setLayoutParams(layoutParams); mPvButton.setRotation(rotation);/*from w ww . ja v a 2s .c om*/ /* layoutParams = (RelativeLayout.LayoutParams)mFbButton.getLayoutParams(); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, 0); layoutParams.addRule(RelativeLayout.ABOVE, R.id.shutter_layout); layoutParams.addRule(RelativeLayout.BELOW, 0); mFbButton.setLayoutParams(layoutParams); mFbButton.setRotation(rotation); */ layoutParams = (RelativeLayout.LayoutParams) mExitButton.getLayoutParams(); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, 0); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, RelativeLayout.TRUE); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, 0); mExitButton.setLayoutParams(layoutParams); mExitButton.setRotation(rotation); layoutParams = (RelativeLayout.LayoutParams) mView3DButton.getLayoutParams(); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, 0); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP, 0); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); mView3DButton.setLayoutParams(layoutParams); mView3DButton.setRotation(rotation); View view3DPb = findViewById(R.id.view3D_progress_bar); layoutParams = (RelativeLayout.LayoutParams) view3DPb.getLayoutParams(); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, 0); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP, 0); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); view3DPb.setLayoutParams(layoutParams); view3DPb.setRotation(rotation); layoutParams = (RelativeLayout.LayoutParams) mScanProgView.getLayoutParams(); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, 0); layoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE); layoutParams.addRule(RelativeLayout.LEFT_OF, 0); layoutParams.addRule(RelativeLayout.RIGHT_OF, 0); mScanProgView.setLayoutParams(layoutParams); mScanProgView.setRotation(rotation); layoutParams = (RelativeLayout.LayoutParams) mScanModeButton.getLayoutParams(); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, 0); layoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE); layoutParams.addRule(RelativeLayout.LEFT_OF, 0); layoutParams.addRule(RelativeLayout.RIGHT_OF, 0); mScanModeButton.setLayoutParams(layoutParams); mScanModeButton.setRotation(rotation); layoutParams = (RelativeLayout.LayoutParams) mLevelButton.getLayoutParams(); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, 0); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, 0); mLevelButton.setLayoutParams(layoutParams); mLevelButton.setRotation(rotation); layoutParams = (RelativeLayout.LayoutParams) mTimeCounter.getLayoutParams(); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, 0); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, 0); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, 0); layoutParams.addRule(RelativeLayout.LEFT_OF, R.id.mode_button); layoutParams.addRule(RelativeLayout.RIGHT_OF, 0); layoutParams.addRule(RelativeLayout.ABOVE, 0); layoutParams.addRule(RelativeLayout.BELOW, 0); mTimeCounter.setLayoutParams(layoutParams); if ((rotation == 0) || (rotation == 180)) { mTimeCounter.setTranslationY(0); } else { mTimeCounter.setTranslationY(mTimeCounter.getWidth() / 2); } mTimeCounter.setRotation(rotation); CustomToast.setRotation(rotation); }