Ejemplo n.º 1
0
 public void setView(DogMood mood) {
   if (mood.equals(DogMood.DIRTY)) {
     view.setDirty();
     view.setSprite(DogMood.HAPPY);
   } else if (mood.equals(DogMood.BARKING)) {
     view.setSprite(mood);
     new Thread(
             new Runnable() {
               @Override
               public void run() {
                 try {
                   DogService.INSTANCE.playMusic(R.raw.hondschors, true);
                   Thread.sleep(2500);
                 } catch (InterruptedException e) {
                   Log.e(
                       "InterruptedException",
                       "setBarking innerclass has thrown an InterruptedException: "
                           + e.getMessage());
                 }
                 DogService.INSTANCE.setBarking(false);
                 DogService.INSTANCE.stopMusic();
               }
             })
         .start();
   } else {
     view.setSprite(mood);
   }
 }
Ejemplo n.º 2
0
 public void setDirty() {
   view.setDirty();
 }