本文整理汇总了Java中android.view.animation.AnimationUtils.loadAnimation方法的典型用法代码示例。如果您正苦于以下问题:Java AnimationUtils.loadAnimation方法的具体用法?Java AnimationUtils.loadAnimation怎么用?Java AnimationUtils.loadAnimation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.animation.AnimationUtils
的用法示例。
在下文中一共展示了AnimationUtils.loadAnimation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: show
import android.view.animation.AnimationUtils; //导入方法依赖的package包/类
void show(@Nullable final InternalVisibilityChangedListener listener, boolean fromUser) {
if (this.mView.getVisibility() != 0 || this.mIsHiding) {
this.mView.clearAnimation();
this.mView.internalSetVisibility(0, fromUser);
Animation anim = AnimationUtils.loadAnimation(this.mView.getContext(), R.anim.design_fab_in);
anim.setDuration(200);
anim.setInterpolator(AnimationUtils.LINEAR_OUT_SLOW_IN_INTERPOLATOR);
anim.setAnimationListener(new AnimationListenerAdapter() {
public void onAnimationEnd(Animation animation) {
if (listener != null) {
listener.onShown();
}
}
});
this.mView.startAnimation(anim);
} else if (listener != null) {
listener.onShown();
}
}
示例2: allAnimation
import android.view.animation.AnimationUtils; //导入方法依赖的package包/类
private void allAnimation() {
//Animation
final Animation myAnim = AnimationUtils.loadAnimation(this, R.anim.bounce);
// Use bounce interpolator with amplitude 0.2 and frequency 20
MyBounceInterpolator interpolator = new MyBounceInterpolator(0.11, 10);
myAnim.setInterpolator(interpolator);
tvQ.startAnimation(myAnim);
final Handler handler = new Handler();
Runnable runnable = new Runnable() {
public void run() {
master.startAnimation(inFromLeftAnimation());
master.setVisibility(View.VISIBLE); //for interval...
}
};
handler.postDelayed(runnable, 150); //for initial delay..*//*
for (int i = 0; i < 20; i++) {
textViewArrayAbove[i].startAnimation(myAnim);
}
}
示例3: displayViews
import android.view.animation.AnimationUtils; //导入方法依赖的package包/类
private void displayViews(ViewGroup mainView) {
if(null != viewGroup){
viewGroup.setVisibility(View.VISIBLE);
viewGroup.addView(mainView);
}
else{
LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
activity.addContentView(mainView, params);
}
Animation fadeInAnimation = AnimationUtils.loadAnimation(activity, android.R.anim.fade_in);
mainView.startAnimation(fadeInAnimation);
if (onShowListener != null) onShowListener.onRateAppShowing();
}
示例4: onCreate
import android.view.animation.AnimationUtils; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_start);
view = findViewById(android.R.id.content);
Animation mLoadAnimation = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.fade_in);
mLoadAnimation.setDuration(2000);
view.startAnimation(mLoadAnimation);
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
Intent intent = new Intent(StartActivity.this, MainActivity.class);
startActivity(intent);
overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
}
},4000);
}
示例5: onPasscodeError
import android.view.animation.AnimationUtils; //导入方法依赖的package包/类
protected void onPasscodeError() {
Encryptor.snackPeak(mActivity,getString(R.string.passcode_wrong));
Thread thread = new Thread() {
public void run() {
Animation animation = AnimationUtils.loadAnimation(
LockActivity.this, R.anim.shake);
findViewById(R.id.ll_applock).startAnimation(animation);
codeField1.setText("");
codeField2.setText("");
codeField3.setText("");
codeField4.setText("");
codeField1.requestFocus();
}
};
runOnUiThread(thread);
}
示例6: showError
import android.view.animation.AnimationUtils; //导入方法依赖的package包/类
@Override public void showError() {
viewState.setShowError();
setFormEnabled(true);
loginButton.setProgress(0);
if (!isRestoringViewState()) {
// Enable animations only if not restoring view state
loginForm.clearAnimation();
Animation shake = AnimationUtils.loadAnimation(getActivity(), R.anim.shake);
loginForm.startAnimation(shake);
}
errorView.setVisibility(View.VISIBLE);
}
示例7: SlidingPanelLinear
import android.view.animation.AnimationUtils; //导入方法依赖的package包/类
/**
* Default constructor for this custom view class.
*
* @param context - activity or application context for obtaining custom attributes.
* @param attrs - AttributeSet parameter which allows to obtain attributes and use them in java code.
*/
public SlidingPanelLinear(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
TypedArray typedArray = context.obtainStyledAttributes(attrs,
R.styleable.SettingsPanel,
0, 0);
attrSpeed = typedArray.getInt(R.styleable.SettingsPanel_speed, Utilities.DEFAULT_ANIMATION_SPEED);
attrInterpolator = typedArray.getNonResourceString(R.styleable.SettingsPanel_interpolator);
attrDirection = typedArray.getNonResourceString(R.styleable.SettingsPanel_direction);
typedArray.recycle();
fadeAnimation = AnimationUtils.loadAnimation(context, R.anim.fade);
}
示例8: animateFadeShow
import android.view.animation.AnimationUtils; //导入方法依赖的package包/类
public static void animateFadeShow(Context context, View view) {
if (view.getVisibility() != View.VISIBLE) {
Animation animFadeIn = AnimationUtils.loadAnimation(context, R.anim.fade_in);
view.startAnimation(animFadeIn);
view.setVisibility(View.VISIBLE);
}
}
示例9: onCreate
import android.view.animation.AnimationUtils; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sign_up);
ButterKnife.bind(this);
setSupportActionBar(toolbar);
mAuth = FirebaseAuth.getInstance();
shake = AnimationUtils.loadAnimation(this, R.anim.shake);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
示例10: IndicatorLayout
import android.view.animation.AnimationUtils; //导入方法依赖的package包/类
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);
}
示例11: switchEmptyView
import android.view.animation.AnimationUtils; //导入方法依赖的package包/类
/**
* 切换视图
*/
private void switchEmptyView() {
switch (mCurrentStatus) {
case STATUS_LOADING:
setVisibility(VISIBLE);
mEmptyContainer.setVisibility(GONE);
mLoadingView.setVisibility(VISIBLE);
Animation animation = AnimationUtils.loadAnimation(mContext, R.anim.anim_rotate);
mIvLoading.startAnimation(animation);
break;
case STATUS_NO_DATA:
setVisibility(VISIBLE);
mIvLoading.clearAnimation();
mLoadingView.setVisibility(GONE);
mEmptyContainer.setVisibility(VISIBLE);
mTvEmptyMessage.setText("暂无数据");
Drawable drawableNoData=getResources().getDrawable(R.drawable.ic_no_data);
drawableNoData.setBounds(0, 0, drawableNoData.getMinimumWidth(), drawableNoData.getMinimumHeight());
mTvEmptyMessage.setCompoundDrawables(null, drawableNoData, null, null);
break;
case STATUS_NO_NET:
setVisibility(VISIBLE);
mIvLoading.clearAnimation();
mLoadingView.setVisibility(GONE);
mEmptyContainer.setVisibility(VISIBLE);
mTvEmptyMessage.setText("网络异常,点击重试");
Drawable drawableNoNet=getResources().getDrawable(R.drawable.ic_net_error);
drawableNoNet.setBounds(0, 0, drawableNoNet.getMinimumWidth(), drawableNoNet.getMinimumHeight());
mTvEmptyMessage.setCompoundDrawables(null, drawableNoNet,null, null);
break;
case STATUS_HIDE:
setVisibility(GONE);
mIvLoading.clearAnimation();
break;
}
}
示例12: getDismissAnimation
import android.view.animation.AnimationUtils; //导入方法依赖的package包/类
private Animation getDismissAnimation(CFAlertStyle style) {
switch (style) {
case NOTIFICATION:
return AnimationUtils.loadAnimation(params.context, R.anim.dialog_dismiss_top);
case ALERT:
return AnimationUtils.loadAnimation(params.context, R.anim.dialog_dismiss_center);
case BOTTOM_SHEET:
return AnimationUtils.loadAnimation(params.context, R.anim.dialog_dismiss_bottom);
default:
return AnimationUtils.loadAnimation(params.context, R.anim.dialog_dismiss_center);
}
}
示例13: loadAnimation
import android.view.animation.AnimationUtils; //导入方法依赖的package包/类
/**
* Load anim and set duration
*
* @param anim
* @param duration
* @return
*/
public static Animation loadAnimation(Context context, int anim, int duration)
{
Animation animation = AnimationUtils.loadAnimation(context, anim);
animation.setDuration(duration);
return animation;
}
示例14: hideProgressBars
import android.view.animation.AnimationUtils; //导入方法依赖的package包/类
private void hideProgressBars(IcsProgressBar horizontalProgressBar, IcsProgressBar spinnyProgressBar) {
final int features = mFeatures;//getLocalFeatures();
Animation anim = AnimationUtils.loadAnimation(mActivity, android.R.anim.fade_out);
anim.setDuration(1000);
if ((features & (1 << Window.FEATURE_INDETERMINATE_PROGRESS)) != 0 &&
spinnyProgressBar.getVisibility() == View.VISIBLE) {
spinnyProgressBar.startAnimation(anim);
spinnyProgressBar.setVisibility(View.INVISIBLE);
}
if ((features & (1 << Window.FEATURE_PROGRESS)) != 0 &&
horizontalProgressBar.getVisibility() == View.VISIBLE) {
horizontalProgressBar.startAnimation(anim);
horizontalProgressBar.setVisibility(View.INVISIBLE);
}
}
示例15: AnimUtil
import android.view.animation.AnimationUtils; //导入方法依赖的package包/类
public AnimUtil(Context context, int resId) {
this.animation = AnimationUtils.loadAnimation(context, resId);
this.animation.setAnimationListener(this);
}