Java Code Examples for android.view.animation.Animation#RELATIVE_TO_SELF
The following examples show how to use
android.view.animation.Animation#RELATIVE_TO_SELF .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RayLayout.java From UltimateAndroid with Apache License 2.0 | 6 votes |
private static Animation createShrinkAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta, long startOffset, long duration, Interpolator interpolator) { AnimationSet animationSet = new AnimationSet(false); animationSet.setFillAfter(true); final long preDuration = duration / 2; Animation rotateAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); rotateAnimation.setStartOffset(startOffset); rotateAnimation.setDuration(preDuration); rotateAnimation.setInterpolator(new LinearInterpolator()); rotateAnimation.setFillAfter(true); animationSet.addAnimation(rotateAnimation); Animation translateAnimation = new RotateAndTranslateAnimation(0, toXDelta, 0, toYDelta, 360, 720); translateAnimation.setStartOffset(startOffset + preDuration); translateAnimation.setDuration(duration - preDuration); translateAnimation.setInterpolator(interpolator); translateAnimation.setFillAfter(true); animationSet.addAnimation(translateAnimation); return animationSet; }
Example 2
Source File: Compass.java From VistArrow with MIT License | 6 votes |
private void adjustArrow() { if (arrowView == null) { Log.i(TAG, "arrow view is not set"); return; } Log.i(TAG, "will set rotation from " + currectAzimuth + " to " + azimuth); Animation an = new RotateAnimation(-currectAzimuth, -azimuth, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); currectAzimuth = azimuth; an.setDuration(500); an.setRepeatCount(0); an.setFillAfter(true); arrowView.startAnimation(an); }
Example 3
Source File: RotateLoadingLayout.java From PullToRefreshLibrary with Apache License 2.0 | 6 votes |
public RotateLoadingLayout(Context context, Mode mode, Orientation scrollDirection, TypedArray attrs) { super(context, mode, scrollDirection, attrs); mRotateDrawableWhilePulling = attrs.getBoolean(R.styleable.PullToRefresh_ptrRotateDrawableWhilePulling, true); mHeaderImage.setScaleType(ScaleType.MATRIX); mHeaderImageMatrix = new Matrix(); mHeaderImage.setImageMatrix(mHeaderImageMatrix); mRotateAnimation = new RotateAnimation(0, 720, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); mRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR); mRotateAnimation.setDuration(ROTATION_ANIMATION_DURATION); mRotateAnimation.setRepeatCount(Animation.INFINITE); mRotateAnimation.setRepeatMode(Animation.RESTART); }
Example 4
Source File: XListViewHeader.java From myapplication with Apache License 2.0 | 6 votes |
private void initView(Context context) { // 初始情况,设置下拉刷新view高度为0 LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams( LayoutParams.FILL_PARENT, 0); mContainer = (LinearLayout) LayoutInflater.from(context).inflate( R.layout.xlistview_header, null); addView(mContainer, lp); setGravity(Gravity.BOTTOM); mArrowImageView = (ImageView) findViewById(R.id.xlistview_header_arrow); mHintTextView = (TextView) findViewById(R.id.xlistview_header_hint_textview); mProgressBar = (ProgressBar) findViewById(R.id.xlistview_header_progressbar); mRotateUpAnim = new RotateAnimation(0.0f, -180.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); mRotateUpAnim.setDuration(ROTATE_ANIM_DURATION); mRotateUpAnim.setFillAfter(true); mRotateDownAnim = new RotateAnimation(-180.0f, 0.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); mRotateDownAnim.setDuration(ROTATE_ANIM_DURATION); mRotateDownAnim.setFillAfter(true); }
Example 5
Source File: UVideoMainView.java From UCDMediaPlayer_Android with MIT License | 5 votes |
private void doHideSettingMenuView() { if (settingMenuView != null && isSuccess) { settingMenuView.setVisibility(View.GONE); TranslateAnimation ta = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 1f, Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0f); ta.setDuration(MENU_VIEW_ANIMATION_DURATION); settingMenuView.startAnimation(ta); } }
Example 6
Source File: SubjectBookListActivity.java From fangzhuishushenqi with Apache License 2.0 | 5 votes |
private void showTagGroup() { if (mTagList.isEmpty()) { ToastUtils.showToast(getString(R.string.network_error_tips)); return; } Animation mShowAction = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, -1.0f, Animation.RELATIVE_TO_SELF, 0.0f); mShowAction.setDuration(400); rsvTags.startAnimation(mShowAction); rsvTags.setVisibility(View.VISIBLE); }
Example 7
Source File: MicrophoneRecorderView.java From deltachat-android with GNU General Public License v3.0 | 5 votes |
public void hide(float x) { this.lastPositionX = x; float offset = getOffset(x); AnimationSet animation = new AnimationSet(false); Animation scaleAnimation = new ScaleAnimation(1, 0.5f, 1, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); Animation translateAnimation = new TranslateAnimation(Animation.ABSOLUTE, offset, Animation.ABSOLUTE, 0, Animation.RELATIVE_TO_SELF, -.25f, Animation.RELATIVE_TO_SELF, -.25f); scaleAnimation.setInterpolator(new AnticipateOvershootInterpolator(1.5f)); translateAnimation.setInterpolator(new DecelerateInterpolator()); animation.addAnimation(scaleAnimation); animation.addAnimation(translateAnimation); animation.setDuration(ANIMATION_DURATION); animation.setFillBefore(true); animation.setFillAfter(false); animation.setInterpolator(new AnticipateOvershootInterpolator(1.5f)); recordButtonFab.setVisibility(View.GONE); recordButtonFab.clearAnimation(); recordButtonFab.startAnimation(animation); }
Example 8
Source File: ScannerFragment.java From Bluefruit_LE_Connect_Android_V2 with MIT License | 5 votes |
@SuppressWarnings("SameParameterValue") private void openMultiConnectPanel(final boolean isOpen, boolean animated) { // Check if already in the right position if ((mMultiConnectPanelView.getVisibility() == View.VISIBLE && isOpen) || (mMultiConnectPanelView.getVisibility() == View.GONE && !isOpen)) { return; } // Animate changes final long animationDuration = animated ? 300 : 0; RotateAnimation rotate = new RotateAnimation(isOpen ? -90 : 0, isOpen ? 0 : -90, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); rotate.setDuration(animationDuration); rotate.setInterpolator(new LinearInterpolator()); rotate.setFillAfter(true); mMultiConnectExpandImageView.startAnimation(rotate); mMultiConnectPanelView.setVisibility(isOpen ? View.VISIBLE : View.GONE); mMultiConnectPanelView.animate() .alpha(isOpen ? 1.0f : 0) .setDuration(isOpen ? animationDuration : 0) .setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); mMultiConnectPanelView.setVisibility(isOpen ? View.VISIBLE : View.GONE); } }); }
Example 9
Source File: NormalListDialog.java From SprintNBA with Apache License 2.0 | 5 votes |
private void init() { widthScale(0.8f); /** LayoutAnimation */ TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 2f, Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0); animation.setInterpolator(new DecelerateInterpolator()); animation.setDuration(550); mLac = new LayoutAnimationController(animation, 0.12f); mLac.setInterpolator(new DecelerateInterpolator()); }
Example 10
Source File: RotateImageView.java From SprintNBA with Apache License 2.0 | 5 votes |
/** * 设置动画效果 */ private void setRotateAnimation() { if (mIsHasAnimation == false && getWidth() > 0 && getVisibility() == View.VISIBLE) { mIsHasAnimation = true; mAnimation = new RotateAnimation(0f, 359f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); mAnimation.setDuration(1000L); mAnimation.setInterpolator(new LinearInterpolator()); mAnimation.setRepeatCount(-1); mAnimation.setRepeatMode(Animation.RESTART); setAnimation(mAnimation); } }
Example 11
Source File: PlatformPage.java From GithubApp with Apache License 2.0 | 5 votes |
private void initAnims() { animShow = new TranslateAnimation( Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 1, Animation.RELATIVE_TO_SELF, 0); animShow.setDuration(300); animHide = new TranslateAnimation( Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 1); animHide.setDuration(300); }
Example 12
Source File: PlatformListPage.java From BigApp_WordPress_Android with Apache License 2.0 | 5 votes |
private void initAnim() { animShow = new TranslateAnimation( Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 1, Animation.RELATIVE_TO_SELF, 0); animShow.setDuration(300); animHide = new TranslateAnimation( Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 1); animHide.setDuration(300); }
Example 13
Source File: DSListView.java From direct-select-android with MIT License | 5 votes |
private void showListView() { if (animationInProgress || scrollInProgress || listViewIsShown) return; listView.setEnabled(true); animationInProgress = true; this.setVisibility(View.VISIBLE); this.bringToFront(); this.readyToHide = false; // Scale picker box if animations enabled if (selectorAnimationsEnabled && null != this.pickerBox) { ScaleAnimation scaleAnimation = new ScaleAnimation(1f, 1f + scaleFactorDelta, 1f, 1f + scaleFactorDelta, Animation.RELATIVE_TO_SELF, selectorAnimationCenterPivot ? 0.5f : 0f, Animation.RELATIVE_TO_SELF, 0.5f); scaleAnimation.setInterpolator(new AccelerateInterpolator()); scaleAnimation.setDuration(100); scaleAnimation.setFillAfter(true); this.pickerBox.getCellRoot().startAnimation(scaleAnimation); } // Show picker view animation AlphaAnimation showAnimation = new AlphaAnimation(0f, 1f); showAnimation.setDuration(200); showAnimation.setInterpolator(new AccelerateInterpolator()); showAnimation.setAnimationListener(new AnimationListenerAdapter() { @Override public void onAnimationEnd(Animation animation) { animationInProgress = false; listViewIsShown = true; hideListView(); } }); this.startAnimation(showAnimation); }
Example 14
Source File: WriteWeiboWithAppSrcActivity.java From iBeebo with GNU General Public License v3.0 | 5 votes |
private void showViewWithAnim(View view) { mSmileyPicker.setVisibility(View.VISIBLE); Animation animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 1, Animation.RELATIVE_TO_SELF, 0); animation.setDuration(150); // animation.setFillAfter(true); view.startAnimation(animation); }
Example 15
Source File: EasyRecyclerView.java From fangzhuishushenqi with Apache License 2.0 | 5 votes |
public void showTipView(String tip) { tipView.setText(tip); Animation mShowAction = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, -1.0f, Animation.RELATIVE_TO_SELF, 0.0f); mShowAction.setDuration(500); tipView.startAnimation(mShowAction); tipView.setVisibility(View.VISIBLE); }
Example 16
Source File: IndicatorLayout.java From sctalk with Apache License 2.0 | 4 votes |
public IndicatorLayout(Context context, PullToRefreshBase.Mode mode) { super(context); mArrowImageView = new ImageView(context); // Drawable arrowD = getResources().getDrawable(R.drawable.indicator_arrow); Drawable arrowD = new Drawable() { @Override public void setColorFilter(ColorFilter cf) { // TODO Auto-generated method stub } @Override public void setAlpha(int alpha) { // TODO Auto-generated method stub } @Override public int getOpacity() { // TODO Auto-generated method stub return 0; } @Override public void draw(Canvas canvas) { // TODO Auto-generated method stub } }; mArrowImageView.setImageDrawable(arrowD); // final int padding = getResources().getDimensionPixelSize(R.dimen.indicator_internal_padding); final int padding = 0; mArrowImageView.setPadding(padding, padding, padding, padding); // addView(mArrowImageView); int inAnimResId, outAnimResId; switch (mode) { case PULL_FROM_END: inAnimResId = R.anim.slide_in_from_bottom; outAnimResId = R.anim.slide_out_to_bottom; setBackgroundResource(R.drawable.indicator_bg_bottom); // Rotate Arrow so it's pointing the correct way mArrowImageView.setScaleType(ScaleType.MATRIX); Matrix matrix = new Matrix(); matrix.setRotate(180f, arrowD.getIntrinsicWidth() / 2f, arrowD.getIntrinsicHeight() / 2f); mArrowImageView.setImageMatrix(matrix); break; default: case PULL_FROM_START: inAnimResId = R.anim.slide_in_from_top; outAnimResId = R.anim.slide_out_to_top; setBackgroundResource(R.drawable.indicator_bg_top); break; } mInAnim = AnimationUtils.loadAnimation(context, inAnimResId); mInAnim.setAnimationListener(this); mOutAnim = AnimationUtils.loadAnimation(context, outAnimResId); mOutAnim.setAnimationListener(this); final Interpolator interpolator = new LinearInterpolator(); mRotateAnimation = new RotateAnimation(0, -180, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); mRotateAnimation.setInterpolator(interpolator); mRotateAnimation.setDuration(DEFAULT_ROTATION_ANIMATION_DURATION); mRotateAnimation.setFillAfter(true); mResetRotateAnimation = new RotateAnimation(-180, 0, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); mResetRotateAnimation.setInterpolator(interpolator); mResetRotateAnimation.setDuration(DEFAULT_ROTATION_ANIMATION_DURATION); mResetRotateAnimation.setFillAfter(true); }
Example 17
Source File: IndicatorLayout.java From NetEasyNews with GNU General Public License v3.0 | 4 votes |
public IndicatorLayout(Context context, PullToRefreshBase.Mode mode) { super(context); mArrowImageView = new ImageView(context); Drawable arrowD = getResources().getDrawable(R.drawable.indicator_arrow); mArrowImageView.setImageDrawable(arrowD); final int padding = getResources().getDimensionPixelSize(R.dimen.indicator_internal_padding); mArrowImageView.setPadding(padding, padding, padding, padding); addView(mArrowImageView); int inAnimResId, outAnimResId; switch (mode) { case PULL_FROM_END: inAnimResId = R.anim.slide_in_from_bottom; outAnimResId = R.anim.slide_out_to_bottom; setBackgroundResource(R.drawable.indicator_bg_bottom); // Rotate Arrow so it's pointing the correct way mArrowImageView.setScaleType(ScaleType.MATRIX); Matrix matrix = new Matrix(); matrix.setRotate(180f, arrowD.getIntrinsicWidth() / 2f, arrowD.getIntrinsicHeight() / 2f); mArrowImageView.setImageMatrix(matrix); break; default: case PULL_FROM_START: inAnimResId = R.anim.slide_in_from_top; outAnimResId = R.anim.slide_out_to_top; setBackgroundResource(R.drawable.indicator_bg_top); break; } mInAnim = AnimationUtils.loadAnimation(context, inAnimResId); mInAnim.setAnimationListener(this); mOutAnim = AnimationUtils.loadAnimation(context, outAnimResId); mOutAnim.setAnimationListener(this); final Interpolator interpolator = new LinearInterpolator(); mRotateAnimation = new RotateAnimation(0, -180, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); mRotateAnimation.setInterpolator(interpolator); mRotateAnimation.setDuration(DEFAULT_ROTATION_ANIMATION_DURATION); mRotateAnimation.setFillAfter(true); mResetRotateAnimation = new RotateAnimation(-180, 0, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); mResetRotateAnimation.setInterpolator(interpolator); mResetRotateAnimation.setDuration(DEFAULT_ROTATION_ANIMATION_DURATION); mResetRotateAnimation.setFillAfter(true); }
Example 18
Source File: UIListView.java From Auie with GNU General Public License v2.0 | 4 votes |
private void initView() { mContainer = new LinearLayout(getContext()); mContainer.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, 0)); mContainer.setGravity(Gravity.BOTTOM); mContent = new LinearLayout(getContext()); mContent.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, UEMethod.dp2px(getContext(), 60))); mContent.setOrientation(LinearLayout.HORIZONTAL); mContent.setGravity(Gravity.CENTER); RelativeLayout imageLayout = new RelativeLayout(getContext()); imageLayout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT)); int size = UEMethod.dp2px(getContext(), 36); RelativeLayout.LayoutParams params1 = new RelativeLayout.LayoutParams(size, size); params1.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE); mArrowImageView = new ImageView(getContext()); mArrowImageView.setLayoutParams(params1); mProgressBar = new UILoadingBar(getContext()); mProgressBar.setLayoutParams(params1); mProgressBar.setType(UILoadingBar.TYPE_SECTORE_THREE); LinearLayout.LayoutParams params2 = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); params2.setMargins(UEMethod.dp2px(getContext(), 10), 0, 0, 0); LinearLayout textLayout = new LinearLayout(getContext()); textLayout.setLayoutParams(params2); textLayout.setGravity(Gravity.CENTER_VERTICAL); textLayout.setOrientation(LinearLayout.VERTICAL); LinearLayout.LayoutParams params3 = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); mHintTextView = new TextView(getContext()); mHintTextView.setLayoutParams(params3); mHintTextView.setTextSize(12); mHintTextView.setText(STRING_NORMAL); mHintTextView.setTextColor(Color.parseColor("#777777")); mTimeTextView = new TextView(getContext()); mTimeTextView.setLayoutParams(params3); mTimeTextView.setTextSize(10); mTimeTextView.setTextColor(Color.parseColor("#777777")); textLayout.addView(mHintTextView); textLayout.addView(mTimeTextView); imageLayout.addView(mArrowImageView); imageLayout.addView(mProgressBar); mContent.addView(imageLayout); mContent.addView(textLayout); mContainer.addView(mContent); addView(mContainer); setState(STATE_NORMAL); mRotateUpAnim = new RotateAnimation(0.0f, -180.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); mRotateUpAnim.setDuration(ROTATE_ANIM_DURATION); mRotateUpAnim.setFillAfter(true); mRotateDownAnim = new RotateAnimation(-180.0f, 0.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); mRotateDownAnim.setDuration(ROTATE_ANIM_DURATION); mRotateDownAnim.setFillAfter(true); }
Example 19
Source File: IndicatorLayout.java From bmob-android-demo-paging with GNU General Public License v3.0 | 4 votes |
public IndicatorLayout(Context context, PullToRefreshBase.Mode mode) { super(context); mArrowImageView = new ImageView(context); Drawable arrowD = getResources().getDrawable(R.drawable.indicator_arrow); mArrowImageView.setImageDrawable(arrowD); final int padding = getResources().getDimensionPixelSize(R.dimen.indicator_internal_padding); mArrowImageView.setPadding(padding, padding, padding, padding); addView(mArrowImageView); int inAnimResId, outAnimResId; switch (mode) { case PULL_FROM_END: inAnimResId = R.anim.slide_in_from_bottom; outAnimResId = R.anim.slide_out_to_bottom; setBackgroundResource(R.drawable.indicator_bg_bottom); // Rotate Arrow so it's pointing the correct way mArrowImageView.setScaleType(ScaleType.MATRIX); Matrix matrix = new Matrix(); matrix.setRotate(180f, arrowD.getIntrinsicWidth() / 2f, arrowD.getIntrinsicHeight() / 2f); mArrowImageView.setImageMatrix(matrix); break; default: case PULL_FROM_START: inAnimResId = R.anim.slide_in_from_top; outAnimResId = R.anim.slide_out_to_top; setBackgroundResource(R.drawable.indicator_bg_top); break; } mInAnim = AnimationUtils.loadAnimation(context, inAnimResId); mInAnim.setAnimationListener(this); mOutAnim = AnimationUtils.loadAnimation(context, outAnimResId); mOutAnim.setAnimationListener(this); final Interpolator interpolator = new LinearInterpolator(); mRotateAnimation = new RotateAnimation(0, -180, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); mRotateAnimation.setInterpolator(interpolator); mRotateAnimation.setDuration(DEFAULT_ROTATION_ANIMATION_DURATION); mRotateAnimation.setFillAfter(true); mResetRotateAnimation = new RotateAnimation(-180, 0, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); mResetRotateAnimation.setInterpolator(interpolator); mResetRotateAnimation.setDuration(DEFAULT_ROTATION_ANIMATION_DURATION); mResetRotateAnimation.setFillAfter(true); }
Example 20
Source File: IndicatorLayout.java From RefreashTabView with Apache License 2.0 | 4 votes |
public IndicatorLayout(Context context, PullToRefreshBase.Mode mode) { super(context); mArrowImageView = new ImageView(context); Drawable arrowD = getResources().getDrawable(R.drawable.indicator_arrow); mArrowImageView.setImageDrawable(arrowD); final int padding = getResources().getDimensionPixelSize(R.dimen.indicator_internal_padding); mArrowImageView.setPadding(padding, padding, padding, padding); addView(mArrowImageView); int inAnimResId, outAnimResId; switch (mode) { case PULL_FROM_END: inAnimResId = R.anim.slide_in_from_bottom; outAnimResId = R.anim.slide_out_to_bottom; setBackgroundResource(R.drawable.indicator_bg_bottom); // Rotate Arrow so it's pointing the correct way mArrowImageView.setScaleType(ScaleType.MATRIX); Matrix matrix = new Matrix(); matrix.setRotate(180f, arrowD.getIntrinsicWidth() / 2f, arrowD.getIntrinsicHeight() / 2f); mArrowImageView.setImageMatrix(matrix); break; default: case PULL_FROM_START: inAnimResId = R.anim.slide_in_from_top; outAnimResId = R.anim.slide_out_to_top; setBackgroundResource(R.drawable.indicator_bg_top); break; } mInAnim = AnimationUtils.loadAnimation(context, inAnimResId); mInAnim.setAnimationListener(this); mOutAnim = AnimationUtils.loadAnimation(context, outAnimResId); mOutAnim.setAnimationListener(this); final Interpolator interpolator = new LinearInterpolator(); mRotateAnimation = new RotateAnimation(0, -180, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); mRotateAnimation.setInterpolator(interpolator); mRotateAnimation.setDuration(DEFAULT_ROTATION_ANIMATION_DURATION); mRotateAnimation.setFillAfter(true); mResetRotateAnimation = new RotateAnimation(-180, 0, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); mResetRotateAnimation.setInterpolator(interpolator); mResetRotateAnimation.setDuration(DEFAULT_ROTATION_ANIMATION_DURATION); mResetRotateAnimation.setFillAfter(true); }