//usage: PlayAnimation(animationfile, Qicontext);
// https://qisdk.softbankrobotics.com/sdk/doc/pepper-sdk/ch4_api/movement/reference/animation.html

package com.example.fitbot.util;

import com.aldebaran.qi.sdk.QiContext;
import com.aldebaran.qi.sdk.builder.AnimateBuilder;
import com.aldebaran.qi.sdk.builder.AnimationBuilder;
import com.aldebaran.qi.sdk.object.actuation.Animate;
import com.aldebaran.qi.sdk.object.actuation.Animation;

public class Animations {

    public static void Animate(String AnimationFile, QiContext ctx) {
        int resId = ctx.getResources().getIdentifier(AnimationFile, "raw", ctx.getPackageName());

        Animation animation = AnimationBuilder.with(ctx)
                .withResources(resId)
                .build();

        Animate animate = AnimateBuilder.with(ctx)
                .withAnimation(animation)
                .build();

        animate.async().run();
    }
}
