Typing animation on Android Wear

89 views Asked by At

I've been racking my brain now for a while trying to figure out away to get a typing animation on a watchface. What I'm struggling to do is get it to work as it needs to be printed on a canvas and as it doesn't extend activity some of the standard java solutions just don't work. I've got it working only it's rather slow, jumpy and sometimes will skip letters, I doubt I've done it correctly but this is my solution:

Int textanimation = 0;
String text_1 = "y";
String text_2 = "e";
String text_3 = "s";

Then in the ontap function I've added:

textanimation = 0;
Thread.sleep(100);
textanimation =1;
Thread.sleep(200);
textanimation = 2;
Thread.sleep(300);
textanimation  = 3;

Finally in the canvas void

If(textanimation == 0){
String text_1 = "";
String text_2 = "";
String text_3 = "";   

} else If(textanimation == 1){
String text_1 = "y";
String text_2 = "";
String text_3 = "";   

} else If(textanimation == 2){
String text_1 = "y";
String text_2 = "e";
String text_3 = "";   
  } else If(textanimation == 3){
String text_1 = "y";
String text_2 = "e";
String text_3 = "s";   
}

 String tagtxt = mAmbient 
             ? String.format(text_1+text_2+text_3)
             : String.format(text_1+text_2+text_3);

   Canvas.Drawtext(tagtxt,mxoffset,myoffset,paint);

Is what I'm trying to do actually possible on watchfaces? Or am I stuck with a slow animation. am I looking at this completely wrong (probably) I appreciate any help thank you.

1

There are 1 answers

0
Scott Chambers On BEST ANSWER

Solved my solution was fine. Just the watch face was only allowing seconds not milliseconds.