Mam problem z efektywnym załadowanie i odpaleniem animation-list, animacja jest typu drawable animation, poszczegłólne klatki animacji znajdują się w animation list.
int sp=this.speed;
this.speed=0;
int oldId=this.getImageResources();
String animation=this.name;
animation=animation.replaceAll("\\s+","");
animation=animation.toLowerCase();
animation+="_animation";
BitmapFactory.Options dimensions = new BitmapFactory.Options();
dimensions.inJustDecodeBounds = true;
int h1;
int w1;
if(irrealWidth!=0&&irrealHeight!=0) {
h1 = this.irrealHeight;
w1 = this.irrealWidth;
}
else
{
h1=this.getDrawable().getIntrinsicHeight();
w1=this.getDrawable().getIntrinsicWidth();
}
Dimension oldDimension= new Dimension(getLayoutParams().width,getLayoutParams().height);
int id=this.getResources().getIdentifier(animation,"drawable",this.getContext().getPackageName());
((Game) this.getContext()).changeResourceForAnimation(this,id,oldId);
AnimationDrawable trembley=(AnimationDrawable) this.getDrawable();
int ha= trembley.getFrame(1).getIntrinsicHeight();
int wa = trembley.getFrame(1).getIntrinsicWidth();
int realwa=wa*this.getLayoutParams().width/w1;
int realha=ha*this.getLayoutParams().height/h1;
this.getLayoutParams().width=realwa;
this.getLayoutParams().height=realha;
trembley.start();
checkIfAnimationDone(trembley,sp,oldId,oldDimension);
Większość kodu dotyczy ustawiania parametrów wielkośći okna. Najważniejsze linijki to
((Game) this.getContext()).changeResourceForAnimation(this,id,oldId);
AnimationDrawable trembley=(AnimationDrawable) this.getDrawable();
trembley.start();