本文整理汇总了Java中android.graphics.drawable.AnimationDrawable.getDuration方法的典型用法代码示例。如果您正苦于以下问题:Java AnimationDrawable.getDuration方法的具体用法?Java AnimationDrawable.getDuration怎么用?Java AnimationDrawable.getDuration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.graphics.drawable.AnimationDrawable
的用法示例。
在下文中一共展示了AnimationDrawable.getDuration方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onClick
import android.graphics.drawable.AnimationDrawable; //导入方法依赖的package包/类
@Override
public void onClick(final View v) {
if (currentLookForWid.getText().equals(" ")) {
v.startAnimation(notItAnim);
return;
}
String symv = (String)v.getTag();
TextView wid2 = activeSyms.get(current);
if (wid2==null) return;
String symw = (String)wid2.getTag();
if (symv.equals(symw)) {
Log.d("Doda", "Found " + symv.codePointAt(0));
v.setAlpha(.6f);
v.startAnimation(wasItAnim);
final ImageView blow = new ImageView(this);
blow.setBackgroundResource(R.drawable.explosion);
Point location = symPoints.get((TextView)v);
float fac = 1.25f;
score += Math.max(100, 5000 - (System.currentTimeMillis() - findTime)) * (backgroundImage?1.5:1);
int msize = spToPx((int)(mMode.getMaxIconSize(bsize)*fac));
FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(msize, msize);
lp.setMargins(location.x - (int)(mMode.getMaxIconSize(bsize)*fac/2), location.y - (int)(mMode.getMaxIconSize(bsize)*fac/2), 0, 0);
lp.gravity = Gravity.START | Gravity.TOP;
blow.setLayoutParams(lp);
mSoundEffects.playPlode();
v.clearAnimation();
mMainScreen.removeView(v);
activeSyms.set(current, null);
mMainScreen.addView(blow);
AnimationDrawable ad = ((AnimationDrawable) blow.getBackground());
int time = ad.getNumberOfFrames() * ad.getDuration(0);
ad.start();
showNext(false);
mMainScreen.postDelayed(new Runnable() {
@Override
public void run() {
mMainScreen.removeView(blow);
}
}, time + 20);
} else {
v.startAnimation(notItAnim);
if (mMode.isTimed()) {
startTime -= 5000;
showMessage(getString(R.string.miss_penalty));
}
}
}
示例2: start
import android.graphics.drawable.AnimationDrawable; //导入方法依赖的package包/类
private void start(AnimationDrawable object, final OnPointDragListener removeListener) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
int duration = 0;
for (int i = 0; i < object.getNumberOfFrames(); i++) {
duration += object.getDuration(i);
}
view.postDelayed(new Runnable() {
@Override
public void run() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
view.setBackground(background);
}
end(removeListener);
}
}, duration + 5);
view.setText("");
int drawableL = (view.getWidth() + view.getHeight()) / 2;
ViewGroup.LayoutParams lp = view.getLayoutParams();
lp.height = lp.width = drawableL;
view.setLayoutParams(lp);
view.setBackground(object);
if (object.isRunning())
object.stop();
object.start();
} else {
end(removeListener);
}
}
示例3: getDurationOfAnimationDrawable
import android.graphics.drawable.AnimationDrawable; //导入方法依赖的package包/类
public static int getDurationOfAnimationDrawable(AnimationDrawable ad){
int duration = 0;
for(int i =0 , size = ad.getNumberOfFrames() ; i < size ;i++){
duration += ad.getDuration(i);
}
return duration;
}