本文整理汇总了Java中com.nineoldandroids.animation.ObjectAnimator.addListener方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectAnimator.addListener方法的具体用法?Java ObjectAnimator.addListener怎么用?Java ObjectAnimator.addListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.nineoldandroids.animation.ObjectAnimator
的用法示例。
在下文中一共展示了ObjectAnimator.addListener方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createCircularReveal
import com.nineoldandroids.animation.ObjectAnimator; //导入方法依赖的package包/类
/**
* Returns an Animator which can animate a clipping circle.
* <p/>
* Any shadow cast by the View will respect the circular clip from this animator.
* <p/>
* Only a single non-rectangular clip can be applied on a View at any time.
* Views clipped by a circular reveal animation take priority over
* {@link View#setClipToOutline(boolean) View Outline clipping}.
* <p/>
* Note that the animation returned here is a one-shot animation. It cannot
* be re-used, and once started it cannot be paused or resumed.
*
* @param view The View will be clipped to the animating circle.
* @param centerX The x coordinate of the center of the animating circle.
* @param centerY The y coordinate of the center of the animating circle.
* @param startRadius The starting radius of the animating circle.
* @param endRadius The ending radius of the animating circle.
*/
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public static SupportAnimator createCircularReveal(View view,
int centerX, int centerY,
float startRadius, float endRadius) {
if (!(view.getParent() instanceof RevealAnimator)) {
throw new IllegalArgumentException("View must be inside RevealFrameLayout or RevealLinearLayout.");
}
RevealAnimator revealLayout = (RevealAnimator) view.getParent();
revealLayout.attachRevealInfo(new RevealInfo(centerX, centerY, startRadius, endRadius,
new WeakReference<>(view)));
if (LOLLIPOP_PLUS) {
return new SupportAnimatorLollipop(android.view.ViewAnimationUtils
.createCircularReveal(view, centerX, centerY, startRadius, endRadius), revealLayout);
}
ObjectAnimator reveal = ObjectAnimator.ofFloat(revealLayout, CLIP_RADIUS,
startRadius, endRadius);
reveal.addListener(getRevealFinishListener(revealLayout));
return new SupportAnimatorPreL(reveal, revealLayout);
}
示例2: dismissShowdown
import com.nineoldandroids.animation.ObjectAnimator; //导入方法依赖的package包/类
/**
* 隐藏模糊背景
*/
protected void dismissShowdown() {
ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(mBg, "alpha", 1, 0);
objectAnimator.setDuration(400);
objectAnimator.start();
objectAnimator.addListener(new SimpleAnimationListener() {
@Override
public void onAnimationEnd(Animator animation) {
mParentVG.removeView(mBg);
}
});
}
示例3: anim
import com.nineoldandroids.animation.ObjectAnimator; //导入方法依赖的package包/类
private void anim(final View v) {
ObjectAnimator animator = ObjectAnimator.ofFloat(v, "rotationX", 0.0F, 360.0F)
.setDuration(200);
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (!Utils.login()) {
return;
}
switch (v.getId()) {
case R.id.fun_all:
v.getContext().startActivity(new Intent(v.getContext(), CategoryActivity.class));
break;
case R.id.fun_combo:
v.getContext().startActivity(new Intent(v.getContext(), CloudTcActivity.class));
break;
case R.id.fun_charge:
v.getContext().startActivity(new Intent(v.getContext(), PhoneChargeActivity.class));
break;
case R.id.fun_wolrdgo:
v.getContext().startActivity(new Intent(v.getContext(), CloudWorldGoActivity.class));
break;
case R.id.fun_cloud_p:
v.getContext().startActivity(new Intent(v.getContext(), CloudPointActivity.class));
break;
case R.id.fun_omyo:
v.getContext().startActivity(new Intent(v.getContext(), OMYOActivity.class));
break;
case R.id.fun_cloud_club:
v.getContext().startActivity(new Intent(v.getContext(), CloudClubActivity.class));
break;
case R.id.fun_aboutus:
v.getContext().startActivity(new Intent(v.getContext(), AboutUsActivity.class));
break;
}
}
});
animator.start();
}
示例4: toggleNoTextInput
import com.nineoldandroids.animation.ObjectAnimator; //导入方法依赖的package包/类
protected void toggleNoTextInput(InputType type) {
mPanelLayout.setVisibility(View.VISIBLE);
if (type != null && type != InputType.Text) {
View dropView = getCurrentNoTextInput();
mInputType = type;
View popUpView = null;
switch (type) {
case Voice:
checkBoxEmoji.setChecked(false);
popUpView = voiceLayout;
if (!mEnterLayoutStatus) {
voiceLayout.setVisibility(View.VISIBLE);
emojiKeyboardLayout.setVisibility(View.GONE);
}
break;
case Emoji:
checkBoxEmoji.setChecked(true);
popUpView = emojiKeyboardLayout;
if (!mEnterLayoutStatus) {
emojiKeyboardLayout.setVisibility(View.VISIBLE);
voiceLayout.setVisibility(View.GONE);
}
break;
}
mEnterLayoutStatus = mEnterLayoutAnimSupportContainer.isPanelLauoutOpen();
if (mEnterLayoutStatus) {
final View dropTarget = dropView;
final View popUpTarget = popUpView;
ViewHelper.setTranslationY(popUpView, panelHeight);
ObjectAnimator drop = ObjectAnimator.ofFloat(dropView, "translationY", 0, panelHeight);
drop.setDuration(180);
drop.setInterpolator(new AccelerateInterpolator());
drop.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
dropTarget.setVisibility(View.GONE);
popUpTarget.setVisibility(View.VISIBLE);
ObjectAnimator popUp = ObjectAnimator.ofFloat(popUpTarget, "translationY", panelHeight, 0);
popUp.setDuration(180);
popUp.setInterpolator(new DecelerateInterpolator());
popUp.start();
}
});
drop.start();
} else {
popUpView.setVisibility(View.VISIBLE);
animEnterLayoutStatusChanaged(true);
}
}
}
示例5: initView
import com.nineoldandroids.animation.ObjectAnimator; //导入方法依赖的package包/类
@Override
public void initView() {
/*set it to be no title*/
// requestWindowFeature(Window.FEATURE_NO_TITLE);
/*set it to be full screen*/
/*全屏显示*/
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
//mReBg = (RelativeLayout) findViewById(R.id.activity_splash);
View target = findViewById(R.id.activity_splash);
//请求数据
OkGo.post(splash_img_url)
.execute(new BitmapCallback(){
@Override
public void onSuccess(Bitmap bitmap, Call call, Response response) {
target.setBackgroundDrawable(new BitmapDrawable(bitmap));
}
});
requestBitmap();
ObjectAnimator animator = ObjectAnimator.ofFloat(target,"alpha",0.0f,1.0f);
animator.setDuration(2000);//动画执行的时间
animator.start();
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
SharedPreferences sp = getPreferences(MODE_PRIVATE);
boolean isFirst = sp.getBoolean(Contants.IS_FIRST_RUNNING, true);
String username = PreferencesUtils.getString(SplashActivity.this
, Contants.USER_NAME);
String password = PreferencesUtils.getString(SplashActivity.this,
Contants.USER_PASSWORD);
//感觉不是最好的办法,Bmob官网说有个getCurrentUser()方法
//来判断是否之前登录过,但是我尝试了,获取到的User对象都是为空,就想到这个方法进行弥补
//这个方法也是可以进行登录的,但是貌似对其他登录有点影响,这个后期遇到更好的办法就在去优化
BmobUser.loginByAccount(username, password, new LogInListener<MyUser>() {
@Override
public void done(MyUser user, BmobException e) {
if(user!=null){
Log.i("smile","用户登陆成功");
EventBus.getDefault().post(new LoginEvent(user));
PreferencesUtils.putBoolean(SplashActivity.this
,Contants.IS_LOGIN,true);
}
}
});
Intent intent = new Intent();
if (isFirst) {
sp.edit().putBoolean(Contants.IS_FIRST_RUNNING, false).commit();
intent.setClass(SplashActivity.this, GuideActivity.class);
} else {
intent.setClass(SplashActivity.this, MainActivityDrawerLayout.class);
}
startActivity(intent);
finish();
}
});
}
示例6: initView
import com.nineoldandroids.animation.ObjectAnimator; //导入方法依赖的package包/类
@Override
public void initView() {
/*set it to be no title*/
// requestWindowFeature(Window.FEATURE_NO_TITLE);
/*set it to be full screen*/
/*全屏显示*/
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
location();
//mReBg = (RelativeLayout) findViewById(R.id.activity_splash);
View target = findViewById(R.id.activity_splash);
//请求数据
OkGo.post(splash_img_url)
.execute(new BitmapCallback() {
@Override
public void onSuccess(Bitmap bitmap, Call call, Response response) {
// target.setBackgroundDrawable(new BitmapDrawable(bitmap));
}
});
requestBitmap();
ObjectAnimator animator = ObjectAnimator.ofFloat(target, "alpha", 0.0f, 1.0f);
animator.setDuration(2000);//动画执行的时间
animator.start();
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
SharedPreferences sp = getPreferences(MODE_PRIVATE);
boolean isFirst = sp.getBoolean(Contants.IS_FIRST_RUNNING, true);
String username = PreferencesUtils.getString(SplashActivity.this
, Contants.USER_NAME);
String password = PreferencesUtils.getString(SplashActivity.this,
Contants.USER_PASSWORD);
//感觉不是最好的办法,Bmob官网说有个getCurrentUser()方法
//来判断是否之前登录过,但是我尝试了,获取到的User对象都是为空,就想到这个方法进行弥补
//这个方法也是可以进行登录的,但是貌似对其他登录有点影响,这个后期遇到更好的办法就在去优化
// BmobUser.loginByAccount(username, password, new LogInListener<MyUser>() {
//
// @Override
// public void done(MyUser user, BmobException e) {
// if (user != null) {
// Log.i("smile", "用户登陆成功");
// EventBus.getDefault().post(new LoginEvent(user));
// PreferencesUtils.putBoolean(SplashActivity.this
// , Contants.IS_LOGIN, true);
// }
// }
// });
Intent intent = new Intent();
if (isFirst) {
sp.edit().putBoolean(Contants.IS_FIRST_RUNNING, false).commit();
intent.setClass(SplashActivity.this, GuideActivity.class);
} else {
intent.setClass(SplashActivity.this, MainActivity.class);
intent.putExtra("cityname",cityName);
intent.putExtra("latitude",latitude);
intent.putExtra("longitude",longitude);
}
startActivity(intent);
finish();
}
});
}