package com.example.fitbot;

import android.support.v7.app.AppCompatActivity;

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 extends AppCompatActivity {


    public static void Animate(String AnimationFile, QiContext ctx)
    {
        PlayAnimation(AnimationFile, ctx);
    }

    public static void PlayAnimation(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();
    }

}
