Android Open Source - boardgame-app Session






From Project

Back to project page boardgame-app.

License

The source code is released under:

Copyright (c) 2014 Hal?sz G?bor Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Sof...

If you think the Android project boardgame-app 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 hu.level14.boardgameapp.remote;
// w ww.  j a  v  a2  s. co m
import java.util.ArrayList;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import android.app.ListFragment;

public class Session {
    private final GameServer server;
    private final String nick;
    private final String key;
    private final String address;
    private final int socketPort;
    
    Session(GameServer server, String nick, String key,  String address, int socketPort) {
        this.server = server;
        this.nick = nick;
        this.key = key;
        this.address = address;
        this.socketPort = socketPort;
    }

    public String getNick() {
        return nick;
    }
    public String getKey() {
        return key;
    }
    public int getSocketPort() {
        return socketPort;
    }
    public String getAddress() {
        return address;
    }
    
    public List<String> queryGameTypes() {
        try {
            JSONArray list = (JSONArray)server.DoRequest("/gametypes", null);
            int length = list.length();
            List<String> ret = new ArrayList<String>();
            for (int i = 0; i < length; i++) {
                ret.add(list.getString(i));
            }
            return ret;
        } catch (JSONException e) {
            throw new RuntimeException(e); // Terminate
        }
    }
}




Java Source Code List

hu.level14.boardgameapp.GameTypesFragment.java
hu.level14.boardgameapp.MainActivity.java
hu.level14.boardgameapp.StatefulFragment.java
hu.level14.boardgameapp.StatelessFragment.java
hu.level14.boardgameapp.WaitingForPlayersFragment.java
hu.level14.boardgameapp.XmlClickable.java
hu.level14.boardgameapp.remote.GameServer.java
hu.level14.boardgameapp.remote.RequestTask.java
hu.level14.boardgameapp.remote.Session.java
hu.level14.boardgameapp.remote.SocketListener.java