本文整理汇总了Java中android.graphics.drawable.AnimationDrawable.getNumberOfFrames方法的典型用法代码示例。如果您正苦于以下问题:Java AnimationDrawable.getNumberOfFrames方法的具体用法?Java AnimationDrawable.getNumberOfFrames怎么用?Java AnimationDrawable.getNumberOfFrames使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.graphics.drawable.AnimationDrawable
的用法示例。
在下文中一共展示了AnimationDrawable.getNumberOfFrames方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: tileifyIndeterminate
import android.graphics.drawable.AnimationDrawable; //导入方法依赖的package包/类
/**
* Convert a AnimationDrawable for use as a barberpole animation.
* Each frame of the animation is wrapped in a ClipDrawable and
* given a tiling BitmapShader.
*/
private Drawable tileifyIndeterminate(Drawable drawable) {
if (drawable instanceof AnimationDrawable) {
AnimationDrawable background = (AnimationDrawable) drawable;
final int N = background.getNumberOfFrames();
AnimationDrawable newBg = new AnimationDrawable();
newBg.setOneShot(background.isOneShot());
for (int i = 0; i < N; i++) {
Drawable frame = tileify(background.getFrame(i), true);
frame.setLevel(10000);
newBg.addFrame(frame, background.getDuration(i));
}
newBg.setLevel(10000);
drawable = newBg;
}
return drawable;
}
示例2: tileifyIndeterminate
import android.graphics.drawable.AnimationDrawable; //导入方法依赖的package包/类
private Drawable tileifyIndeterminate(Drawable drawable) {
if (!(drawable instanceof AnimationDrawable)) {
return drawable;
}
AnimationDrawable background = (AnimationDrawable) drawable;
int N = background.getNumberOfFrames();
Drawable newBg = new AnimationDrawable();
newBg.setOneShot(background.isOneShot());
for (int i = 0; i < N; i++) {
Drawable frame = tileify(background.getFrame(i), true);
frame.setLevel(10000);
newBg.addFrame(frame, background.getDuration(i));
}
newBg.setLevel(10000);
return newBg;
}
示例3: 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));
}
}
}
示例4: 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);
}
}
示例5: 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;
}