Android Open Source - ScoreKeeper Nfc Utils






From Project

Back to project page ScoreKeeper.

License

The source code is released under:

GNU General Public License

If you think the Android project ScoreKeeper 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 com.fletch.gamescorekeeper.utils;
/*from   w  w w . jav a 2 s. co  m*/
import java.util.ArrayList;
import java.util.List;

import com.fletch.gamescorekeeper.Player;

public class NfcUtils {

    public static String getPlayerListAsString(List<Player> playerList) {

        String message = "";

        for(Player player : playerList) {
            message += player.getName() + "," + player.getScore() + ",";
        }

        return message.equals("") ? "" : message.substring(0, message.length() - 1);
    }

    public static String getPlayerAsString(Player player) {

        return player.getName() + "," + player.getScore();
    }

    public static List<Player> getPlayerListFromString(String message) {

        List<Player> playerList = new ArrayList<Player>();
        String[] messageParts = message.split(",");

        for(int i = 0; i < messageParts.length; i += 2) {
            String name = messageParts[i];
            int score = Integer.parseInt(messageParts[i + 1]);

            Player player = new Player(name, score);
            playerList.add(player);
        }

        return playerList;
    }

}




Java Source Code List

com.fletch.gamescorekeeper.PlayerSpinnerAdapter.java
com.fletch.gamescorekeeper.Player.java
com.fletch.gamescorekeeper.ScoreBoardActivity.java
com.fletch.gamescorekeeper.ScoreSectionFragment.java
com.fletch.gamescorekeeper.constants.Constants.java
com.fletch.gamescorekeeper.dialogs.Dialogs.java
com.fletch.gamescorekeeper.dialogs.InputDialogFragment.java
com.fletch.gamescorekeeper.dialogs.InputDialogType.java
com.fletch.gamescorekeeper.dialogs.NameInputDialogFragment.java
com.fletch.gamescorekeeper.dialogs.RemovePlayerDialogFragment.java
com.fletch.gamescorekeeper.dialogs.ScoreInputDialogFragment.java
com.fletch.gamescorekeeper.dialogs.SelectPlayerScoreInputDialogFragment.java
com.fletch.gamescorekeeper.listeners.InputDialogListener.java
com.fletch.gamescorekeeper.utils.NfcUtils.java