ソースを参照

play greeting animation only when the app gets opened

Fabio Arnold 10 年 前
コミット
3737dab089

+ 1 - 1
src/de/tudarmstadt/informatik/hostage/ui2/fragment/opengl/AnimatedMesh.java

@@ -61,7 +61,7 @@ public class AnimatedMesh {
 	
 	public boolean isActionDone() {
 		if (currentAction == null)
-			return false;
+			return true;
 		if (reverseAction)
 			return currentFrame <= 0;
 		else

+ 8 - 1
src/de/tudarmstadt/informatik/hostage/ui2/fragment/opengl/ThreatIndicatorGLRenderer.java

@@ -31,6 +31,8 @@ public class ThreatIndicatorGLRenderer implements Renderer {
 	public static final int kThreatLevelNoThreat = 1;
 	public static final int kThreatLevelPastThreat = 2;
 	public static final int kThreatLevelPersistentThreat = 3;
+
+	private static boolean sPlayGreetingAnimation = true; // greet the first time
 	
 	/**
 	 * Set the threat level which should be indicated
@@ -94,7 +96,12 @@ public class ThreatIndicatorGLRenderer implements Renderer {
 		try {
 			InputStream is = assets.open("meshes/android.amh");
 			androidMesh = new AnimatedMesh(is);
-			androidMesh.startAction("greet", false, false);
+			/* play the greeting animation the first time the gets opened
+			   not each time the threatindicator gets created */
+			if (sPlayGreetingAnimation) {
+				androidMesh.startAction("greet", false, false);
+				sPlayGreetingAnimation = false;
+			}
 		} catch (IOException e) {
 			Log.e("gl", "Couldn't open android mesh");
 		}