package eic.beike.projectx.handlers;

import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.util.Log;

import eic.beike.projectx.activities.GameActivity;

/**
 * @author Adam
 */
public class GameHandler extends Handler {

    GameActivity game;

    public GameHandler(Looper looper, GameActivity activity) {
        super(looper);
        game = activity;
    }

    @Override
    public void handleMessage(Message msg) {
        Log.d("Score", Thread.currentThread().getName() + ":handleMessage");

        Bundle data = msg.getData();
        int totalScore = data.getInt("score");
        int latestScore = data.getInt("latest_score");

        game.showScore(latestScore, totalScore);
    }

}

@@ -213,16 +213,58 @@
 ctivity;
+%0Aimport eic.beike.projectx.util.Constants;
 %0A%0A/**%0A *
@@ -277,16 +277,32 @@
 or Adam%0A
+ * @author Alex%0A
  */%0Apubl
@@ -656,16 +656,978 @@
 tData();
+%0A%0A        //See what operation to perform.%0A        String operation = data.getString(%22operation%22);%0A        switch (operation) %7B%0A            case Constants.UPDATESCORE:%0A                updateScore(data);%0A                break;%0A            case Constants.SELECTBUTTON:%0A                selectButton(data);%0A                break;%0A            case Constants.DESELECTBUTTON:%0A                deselectButton(data);%0A                break;%0A            case Constants.UPDATEBOARD:%0A                updateBoard(data);%0A                break;%0A            default:%0A                if(operation != null) %7B%0A                    Log.d(getClass().getSimpleName(), %22Tried to perform unknown operation!%22);%0A                    break;%0A                %7D else %7B%0A                    Log.d(getClass().getSimpleName(), %22Malformed operation message!%22);%0A                    break;%0A                %7D%0A        %7D%0A    %7D%0A%0A%0A    private void updateScore(Bundle data)%7B%0A        //TODO: Add sanity checks!
 %0A       
@@ -1717,24 +1717,76 @@
 st_score%22);%0A
+        int bonusScore = data.getInt(%22bonus_score%22);
 %0A        gam
@@ -1791,12 +1791,14 @@
 ame.
-show
+update
 Scor
@@ -1811,16 +1811,28 @@
 stScore,
+ bonusScore,
  totalSc
@@ -1844,10 +1844,274 @@
 %0A    %7D%0A%0A
+    private void selectButton(Bundle data)%7B%0A        //TODO: Implement this stub!%0A    %7D%0A%0A    private void deselectButton(Bundle data)%7B%0A        //TODO: Implement this stub!%0A    %7D%0A%0A    private void updateBoard(Bundle data)%7B%0A        //TODO: Implement this stub!%0A    %7D%0A
 %7D%0A

Update handler to allow new operations.