use of android.view.animation.RotateAnimation in project QLibrary by DragonsQC.
the class AnimationUtils method getRotateAnimation.
/**
* 获取一个旋转动画
*
* @param fromDegrees 开始角度
* @param toDegrees 结束角度
* @param pivotXType 旋转中心点X轴坐标相对类型
* @param pivotXValue 旋转中心点X轴坐标
* @param pivotYType 旋转中心点Y轴坐标相对类型
* @param pivotYValue 旋转中心点Y轴坐标
* @param durationMillis 持续时间
* @param animationListener 动画监听器
* @return 一个旋转动画
*/
public static RotateAnimation getRotateAnimation(float fromDegrees, float toDegrees, int pivotXType, float pivotXValue, int pivotYType, float pivotYValue, long durationMillis, AnimationListener animationListener) {
RotateAnimation rotateAnimation = new RotateAnimation(fromDegrees, toDegrees, pivotXType, pivotXValue, pivotYType, pivotYValue);
rotateAnimation.setDuration(durationMillis);
if (animationListener != null) {
rotateAnimation.setAnimationListener(animationListener);
}
return rotateAnimation;
}
use of android.view.animation.RotateAnimation in project WordPress-Android by wordpress-mobile.
the class StatsUIHelper method setGroupChevron.
/*
* shows the correct up/down chevron for the passed group
*/
private static void setGroupChevron(final boolean isGroupExpanded, View groupView, int groupPosition, boolean animate) {
final ImageView chevron = (ImageView) groupView.findViewById(R.id.stats_list_cell_chevron);
if (chevron == null) {
return;
}
if (isGroupExpanded) {
// change the background of the parent
setViewBackgroundWithoutResettingPadding(groupView, R.drawable.stats_list_item_expanded_background);
} else {
setViewBackgroundWithoutResettingPadding(groupView, groupPosition == 0 ? 0 : R.drawable.stats_list_item_background);
}
// Remove any other prev animations set on the chevron
chevron.clearAnimation();
if (animate) {
// make sure we start with the correct chevron for the prior state before animating it
chevron.setImageResource(isGroupExpanded ? R.drawable.ic_chevron_right_blue_wordpress_24dp : R.drawable.ic_chevron_down_blue_wordpress_24dp);
float start = (isGroupExpanded ? 0.0f : 0.0f);
float end = (isGroupExpanded ? 90.0f : -90.0f);
Animation rotate = new RotateAnimation(start, end, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
rotate.setDuration(ANIM_DURATION);
rotate.setInterpolator(getInterpolator());
rotate.setFillAfter(true);
chevron.startAnimation(rotate);
} else {
chevron.setImageResource(isGroupExpanded ? R.drawable.ic_chevron_down_blue_wordpress_24dp : R.drawable.ic_chevron_right_blue_wordpress_24dp);
}
}
use of android.view.animation.RotateAnimation in project CloudReader by youlookwhat.
the class EverydayFragment method onActivityCreated.
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
// showLoading();
showContentView();
bindingView.llLoading.setVisibility(View.VISIBLE);
animation = new RotateAnimation(0f, 360f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
//设置动画持续时间
animation.setDuration(3000);
//不停顿
animation.setInterpolator(new LinearInterpolator());
animation.setRepeatCount(10);
bindingView.ivLoading.setAnimation(animation);
animation.startNow();
maCache = ACache.get(getContext());
mEverydayModel = new EverydayModel();
mBannerImages = (ArrayList<String>) maCache.getAsObject(Constants.BANNER_PIC);
// mLists = (ArrayList<List<AndroidBean>>) maCache.getAsObject(Constants.EVERYDAY_CONTENT);
DebugUtil.error("----mBannerImages: " + (mBannerImages == null));
DebugUtil.error("----mLists: " + (mLists == null));
mHeaderBinding = DataBindingUtil.inflate(LayoutInflater.from(getContext()), R.layout.header_item_everyday, null, false);
// 设置本地数据点击事件等
initLocalSetting();
initRecyclerView();
mIsPrepared = true;
/**
* 因为启动时先走loadData()再走onActivityCreated,
* 所以此处要额外调用load(),不然最初不会加载内容
*/
loadData();
}
use of android.view.animation.RotateAnimation in project ABPlayer by winkstu.
the class MultiColumnPullToRefreshListView method init.
private void init() {
setVerticalFadingEdgeEnabled(false);
headerContainer = (LinearLayout) LayoutInflater.from(getContext()).inflate(R.layout.ptr_header, null);
header = (RelativeLayout) headerContainer.findViewById(R.id.ptr_id_header);
text = (TextView) header.findViewById(R.id.ptr_id_text);
lastUpdatedTextView = (TextView) header.findViewById(R.id.ptr_id_last_updated);
image = (ImageView) header.findViewById(R.id.ptr_id_image);
refreshingIcon = header.findViewById(R.id.ptr_id_spinner);
pullToRefreshText = getContext().getString(R.string.ptr_pull_to_refresh);
releaseToRefreshText = getContext().getString(R.string.ptr_release_to_refresh);
refreshingText = getContext().getString(R.string.ptr_refreshing);
lastUpdatedText = getContext().getString(R.string.ptr_last_updated);
flipAnimation = new RotateAnimation(0, -180, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f);
flipAnimation.setInterpolator(new LinearInterpolator());
flipAnimation.setDuration(ROTATE_ARROW_ANIMATION_DURATION);
flipAnimation.setFillAfter(true);
reverseFlipAnimation = new RotateAnimation(-180, 0, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f);
reverseFlipAnimation.setInterpolator(new LinearInterpolator());
reverseFlipAnimation.setDuration(ROTATE_ARROW_ANIMATION_DURATION);
reverseFlipAnimation.setFillAfter(true);
refreshingAnimation = new RotateAnimation(0, 720, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f);
refreshingAnimation.setDuration(1200);
refreshingAnimation.setInterpolator(new LinearInterpolator());
refreshingAnimation.setRepeatCount(Integer.MAX_VALUE);
refreshingAnimation.setRepeatMode(Animation.RESTART);
addHeaderView(headerContainer);
setState(State.PULL_TO_REFRESH);
scrollbarEnabled = isVerticalScrollBarEnabled();
ViewTreeObserver vto = header.getViewTreeObserver();
vto.addOnGlobalLayoutListener(new PTROnGlobalLayoutListener());
//super.setOnItemClickListener(new PTROnItemClickListener());
//super.setOnItemLongClickListener(new PTROnItemLongClickListener());
}
use of android.view.animation.RotateAnimation in project UltimateAndroid by cymcsg.
the class RayLayout method createShrinkAnimation.
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;
}
Aggregations