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);
}
java类android.view.animation.RotateAnimation的实例源码
RotateLoadingLayout.java 文件源码
项目:CustomAndroidOneSheeld
阅读 31
收藏 0
点赞 0
评论 0
HeaderLoadingLayout.java 文件源码
项目:RefreshWithAppBarLayout
阅读 24
收藏 0
点赞 0
评论 0
/**
* 初始化
*
* @param context context
*/
private void init(Context context) {
mHeaderContainer = (RelativeLayout) findViewById(R.id.pull_to_refresh_header_content);
mArrowImageView = (ImageView) findViewById(R.id.pull_to_refresh_header_arrow);
mHintTextView = (TextView) findViewById(R.id.pull_to_refresh_header_hint_textview);
mProgressBar = (ProgressBar) findViewById(R.id.pull_to_refresh_header_progressbar);
mHeaderTimeView = (TextView) findViewById(R.id.pull_to_refresh_header_time);
mHeaderTimeViewTitle = (TextView) findViewById(R.id.pull_to_refresh_last_update_time_text);
float pivotValue = 0.5f; // SUPPRESS CHECKSTYLE
float toDegree = -180f; // SUPPRESS CHECKSTYLE
// 初始化旋转动画
mRotateUpAnim = new RotateAnimation(0.0f, toDegree, Animation.RELATIVE_TO_SELF, pivotValue,
Animation.RELATIVE_TO_SELF, pivotValue);
mRotateUpAnim.setDuration(ROTATE_ANIM_DURATION);
mRotateUpAnim.setFillAfter(true);
mRotateDownAnim = new RotateAnimation(toDegree, 0.0f, Animation.RELATIVE_TO_SELF, pivotValue,
Animation.RELATIVE_TO_SELF, pivotValue);
mRotateDownAnim.setDuration(ROTATE_ANIM_DURATION);
mRotateDownAnim.setFillAfter(true);
}
PullToRefreshView.java 文件源码
项目:Huochexing12306
阅读 30
收藏 0
点赞 0
评论 0
/**
* init
*
* @description
* @param context
* hylin 2012-7-26上午10:08:33
*/
private void init() {
// Load all of the animations we need in code rather than through XML
mFlipAnimation = new RotateAnimation(0, -180,
RotateAnimation.RELATIVE_TO_SELF, 0.5f,
RotateAnimation.RELATIVE_TO_SELF, 0.5f);
mFlipAnimation.setInterpolator(new LinearInterpolator());
mFlipAnimation.setDuration(250);
mFlipAnimation.setFillAfter(true);
mReverseFlipAnimation = new RotateAnimation(-180, 0,
RotateAnimation.RELATIVE_TO_SELF, 0.5f,
RotateAnimation.RELATIVE_TO_SELF, 0.5f);
mReverseFlipAnimation.setInterpolator(new LinearInterpolator());
mReverseFlipAnimation.setDuration(250);
mReverseFlipAnimation.setFillAfter(true);
mInflater = LayoutInflater.from(getContext());
// header view 在此添加,保证是第一个添加到linearlayout的最上端
addHeaderView();
}
WelcomeActivity.java 文件源码
项目:Pocket-Plays-for-Twitch
阅读 33
收藏 0
点赞 0
评论 0
private AnimationSet startShowContinueIconAnimations() {
Animation mScaleAnimation = new ScaleAnimation(0, 1, 0, 1, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
Animation mRotateAnimation = new RotateAnimation(
0, 360,
Animation.RELATIVE_TO_SELF, 0.5f,
Animation.RELATIVE_TO_SELF, 0.5f
);
mRotateAnimation.setRepeatCount(0);
AnimationSet mAnimations = new AnimationSet(true);
mAnimations.setDuration(REVEAL_ANIMATION_DURATION);
mAnimations.setFillAfter(true);
mAnimations.setInterpolator(new OvershootInterpolator(1.5f));
mAnimations.addAnimation(mScaleAnimation);
mAnimations.addAnimation(mRotateAnimation);
mContinueIcon.startAnimation(mAnimations);
return mAnimations;
}
a.java 文件源码
项目:boohee_v5.6
阅读 29
收藏 0
点赞 0
评论 0
protected final void onCreate(Bundle bundle) {
super.onCreate(bundle);
Context context = getContext();
View linearLayout = new LinearLayout(context);
LayoutParams layoutParams = new FrameLayout.LayoutParams(-2, a(context, (float) IntFloatWheelView.DEFAULT_VALUE));
layoutParams.gravity = 17;
linearLayout.setOrientation(0);
linearLayout.setLayoutParams(layoutParams);
Drawable gradientDrawable = new GradientDrawable();
gradientDrawable.setColor(-450944201);
gradientDrawable.setCornerRadius((float) a(context, 5.0f));
linearLayout.setBackgroundDrawable(gradientDrawable);
View imageView = new ImageView(context);
layoutParams = new LinearLayout.LayoutParams(a(context, 20.0f), a(context, 20.0f));
layoutParams.gravity = 16;
layoutParams.setMargins(a(this.a.f, 17.0f), a(this.a.f, 10.0f), a(this.a.f, 8.0f), a(this.a.f, 10.0f));
imageView.setLayoutParams(layoutParams);
imageView.setScaleType(ScaleType.FIT_CENTER);
imageView.setImageDrawable(a(context, a.d));
Animation rotateAnimation = new RotateAnimation(0.0f, 359.0f, 1, 0.5f, 1, 0.5f);
rotateAnimation.setRepeatCount(-1);
rotateAnimation.setDuration(900);
rotateAnimation.setInterpolator(new LinearInterpolator());
imageView.startAnimation(rotateAnimation);
View textView = new TextView(context);
textView.setText(TextUtils.isEmpty(this.a.g) ? a.a : this.a.g);
textView.setTextSize(16.0f);
textView.setTextColor(-1);
layoutParams = new LinearLayout.LayoutParams(-2, -2);
layoutParams.gravity = 16;
layoutParams.setMargins(0, 0, a(context, 17.0f), 0);
textView.setLayoutParams(layoutParams);
linearLayout.addView(imageView);
linearLayout.addView(textView);
setContentView(linearLayout);
setCancelable(false);
}
StateFragment.java 文件源码
项目:Coder
阅读 20
收藏 0
点赞 0
评论 0
/**
* 加载中
*/
@DoMain
public void onLoadingState() {
FrameLayout contains = (FrameLayout) rootView.findViewById(R.id.state_contains);
contains.removeAllViews();
View loading = View.inflate(this.getContext(), R.layout.view_loading, null);
contains.addView(loading);
ImageView loading_img = (ImageView) loading.findViewById(R.id.loading_icon);
RotateAnimation rotateAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
rotateAnimation.setDuration(500);
rotateAnimation.setRepeatMode(RotateAnimation.RESTART);
rotateAnimation.setRepeatCount(-1);
loading_img.setAnimation(rotateAnimation);
}
StateActivity.java 文件源码
项目:Coder
阅读 28
收藏 0
点赞 0
评论 0
/**
* 加载中
*/
@DoMain
public void onLoadingState() {
FrameLayout contains = (FrameLayout) findViewById(R.id.state_contains);
contains.removeAllViews();
View loading = View.inflate(this, R.layout.view_loading, null);
contains.addView(loading);
ImageView loading_img = (ImageView) loading.findViewById(R.id.loading_icon);
RotateAnimation rotateAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
rotateAnimation.setDuration(500);
rotateAnimation.setRepeatMode(RotateAnimation.RESTART);
rotateAnimation.setRepeatCount(-1);
loading_img.setAnimation(rotateAnimation);
}
ArrowRefreshHeader.java 文件源码
项目:ImitateZHRB
阅读 24
收藏 0
点赞 0
评论 0
private void initView() {
// 初始情况,设置下拉刷新view高度为0
mContainer = (LinearLayout) LayoutInflater.from(getContext()).inflate(
R.layout.listview_header, null);
LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
lp.setMargins(0, 0, 0, 0);
this.setLayoutParams(lp);
this.setPadding(0, 0, 0, 0);
addView(mContainer, new LayoutParams(LayoutParams.MATCH_PARENT, 0));
setGravity(Gravity.BOTTOM);
mArrowImageView = (ImageView)findViewById(R.id.listview_header_arrow);
mStatusTextView = (TextView)findViewById(R.id.refresh_status_textview);
//init the progress view
mProgressBar = (SimpleViewSwitcher)findViewById(R.id.listview_header_progressbar);
AVLoadingIndicatorView progressView = new AVLoadingIndicatorView(getContext());
progressView.setIndicatorColor(0xffB5B5B5);
progressView.setIndicatorId(ProgressStyle.BallSpinFadeLoader);
mProgressBar.setView(progressView);
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);
mHeaderTimeView = (TextView)findViewById(R.id.last_refresh_time);
measure(ViewGroup.LayoutParams.WRAP_CONTENT,ViewGroup.LayoutParams.WRAP_CONTENT);
mMeasuredHeight = getMeasuredHeight();
}
EverydayFragment.java 文件源码
项目:ClouldReader
阅读 23
收藏 0
点赞 0
评论 0
@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);
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();
}
EverydayFragment.java 文件源码
项目:GitHub
阅读 21
收藏 0
点赞 0
评论 0
@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);
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();
}