Android Open Source - rock-paper-scissors Debug Log






From Project

Back to project page rock-paper-scissors.

License

The source code is released under:

MIT License

If you think the Android project rock-paper-scissors listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package au.com.codeka.rps;
/*  w  w  w.j a va2  s .  c  o  m*/
import android.os.Handler;

import java.util.ArrayList;
import java.util.List;
import java.util.Locale;

/**
 * This class lets us log to a fragment so we can see what's going on live in the app.
 */
public class DebugLog {
    private static ArrayList<String> msgs = new ArrayList<String>();
    private static Runnable onMsgsChangedRunnable;
    private static Handler handler;

    public static void initialize() {
        handler = new Handler();
    }

    public static void setOnMsgsChangedRunnable(Runnable runnable) {
        onMsgsChangedRunnable = runnable;
    }

    public static Runnable getOnMsgsChangedRunnable() {
        return onMsgsChangedRunnable;
    }

    public static List<String> getMessages() {
        return msgs;
    }

    public static void write(String fmt, Object... args) {
        final String msg = String.format(Locale.ENGLISH, fmt, args);
        handler.post(new Runnable() {
            @Override
            public void run() {
                msgs.add(msg);
                if (onMsgsChangedRunnable != null) {
                    onMsgsChangedRunnable.run();
                }
            }
        });
    }
}




Java Source Code List

au.com.codeka.rps.ApplicationTest.java
au.com.codeka.rps.DebugLog.java
au.com.codeka.rps.FindingOpponentFragment.java
au.com.codeka.rps.GameActivity.java
au.com.codeka.rps.GameFragment.java
au.com.codeka.rps.MessageListenerService.java
au.com.codeka.rps.NotificationUpdateService.java
au.com.codeka.rps.PhoneConnection.java
au.com.codeka.rps.ResultFragment.java
au.com.codeka.rps.SplashActivity.java
au.com.codeka.rps.WatchConnection.java
au.com.codeka.rps.game.AwaitingPlayerChoiceState.java
au.com.codeka.rps.game.AwaitingPlayerChoiceState.java
au.com.codeka.rps.game.AwaitingResultState.java
au.com.codeka.rps.game.AwaitingResultState.java
au.com.codeka.rps.game.DisplayingResultState.java
au.com.codeka.rps.game.DisplayingResultState.java
au.com.codeka.rps.game.FindingOpponentState.java
au.com.codeka.rps.game.FindingOpponentState.java
au.com.codeka.rps.game.GameRunningState.java
au.com.codeka.rps.game.GameRunningState.java
au.com.codeka.rps.game.MatchInfo.java
au.com.codeka.rps.game.ResultInfo.java
au.com.codeka.rps.game.StateManager.java
au.com.codeka.rps.game.StateManager.java
au.com.codeka.rps.game.State.java
au.com.codeka.rps.game.State.java