diff --git a/android/src/org/justcheckers/android/GameActivity.java b/android/src/org/justcheckers/android/GameActivity.java deleted file mode 100644 index 704292f..0000000 --- a/android/src/org/justcheckers/android/GameActivity.java +++ /dev/null @@ -1,81 +0,0 @@ -/***************************************************************************** - GameActivity.java - The activity that handles the actual checkers games. - ***************************************************************************** - - ***************************************************************************** - This file is part of justCheckers. - - justCheckers is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - justCheckers is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with justCheckers. If not, see . - *****************************************************************************/ - -package org.justcheckers.android; - -import org.justcheckers.game.Game; -import org.justcheckers.game.Rulebook; - -import android.app.Activity; -import android.os.Bundle; -import android.view.View; -import android.view.View.OnClickListener; - -public class GameActivity extends Activity implements OnClickListener { - - @Override - protected void onCreate(Bundle savedInstanceState) { - - super.onCreate(savedInstanceState); - - // Setup the user interface for the main menu. - - // Weirdness in orientation values in Galaxy Tab. - // http://www.ceveni.com/2009/08/how-to-get-screen-orientation-in.html - int screenOrientation = - this.getWindowManager().getDefaultDisplay().getOrientation(); - - //TODO: Cleaner per device implementation. Developed on Samsung Galaxy S Vibrant. - if (screenOrientation == 1) { - // Counter-clockwise landscape - this.setContentView(R.layout.game_screen_landscape); - } else if (screenOrientation == 3) { - // Clockwise landscape - this.setContentView(R.layout.game_screen_landscape); - } else if (screenOrientation == 0) { - // Portrait for Samsung Galaxy devices. - this.setContentView(R.layout.game_screen_portrait); - } - - } - - public void onClick(View view) { - //TODO: Stub - } - - /** - * Starts a new game with the specified rulebook. - * - * @param rules - * The rules for the new game. - */ - public static void startGame(Rulebook rules) { - Game currentGame = new Game(rules.getCheckersVariant()); - /* Instead of specialized UI commands, just a single method - that updates the UI with the current state of the game. */ -// ui.setCurrentGame(currentGame); -// -// // Current until different game types are added. -// ui.clearBoard(); -// ui.placePieces(); - } - -} diff --git a/android/src/org/justcheckers/android/MenuActivity.java b/android/src/org/justcheckers/android/MenuActivity.java deleted file mode 100644 index bacbf95..0000000 --- a/android/src/org/justcheckers/android/MenuActivity.java +++ /dev/null @@ -1,140 +0,0 @@ -/***************************************************************************** - MenuActivity.java - The activity that provides the main menu for the app. - ***************************************************************************** - - ***************************************************************************** - This file is part of justCheckers. - - justCheckers is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - justCheckers is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with justCheckers. If not, see . - *****************************************************************************/ - -package org.justcheckers.android; - -import org.justcheckers.common.GlobalConstants; -import org.justcheckers.common.LoggingAndStatistics; - -import android.app.Activity; -import android.content.Intent; -import android.net.Uri; -import android.os.Bundle; -import android.view.View; -import android.view.View.OnClickListener; -import android.widget.Button; - -public class MenuActivity extends Activity implements OnClickListener { - - @Override - protected void onCreate(Bundle savedInstanceState) { - - super.onCreate(savedInstanceState); - - // Setup the user interface for the main menu. - this.setContentView(R.layout.main_menu); - - // Link up all the UI elements with their listeners. - Button menuButton = (Button) this.findViewById(R.id.game_button); - menuButton.setOnClickListener(this); - menuButton = (Button) this.findViewById(R.id.game_button); - menuButton.setOnClickListener(this); - menuButton = (Button) this.findViewById(R.id.website_button); - menuButton.setOnClickListener(this); - menuButton = (Button) this.findViewById(R.id.settings_button); - menuButton.setOnClickListener(this); - menuButton = (Button) this.findViewById(R.id.about_us_button); - menuButton.setOnClickListener(this); - menuButton = (Button) this.findViewById(R.id.license_button); - menuButton.setOnClickListener(this); - menuButton = (Button) this.findViewById(R.id.quit_button); - menuButton.setOnClickListener(this); - - // TODO: Move logging info in a better place. -// LoggingAndStatistics.logApplicationInfo(this); - LoggingAndStatistics.logDeviceAndSystemInfo(); - } - - public void onClick(View view) { - // Determine which view fired off this event. - switch (view.getId()) { - case R.id.game_button: - this.startGame(); - break; - case R.id.website_button: - this.launchWebsite(); - break; - case R.id.settings_button: - this.displaySettings(); - break; - case R.id.about_us_button: - this.displayInfo(GlobalConstants.FLAG_INFORMATION_DISPLAY_ABOUT_US); - break; - case R.id.license_button: - this.displayInfo(GlobalConstants.FLAG_INFORMATION_DISPLAY_LICENSE); - break; - case R.id.quit_button: - this.quitApp(); - break; - }; - } - - /** - * Quits the application. - */ - private void quitApp() { - this.finish(); - } - - /** - * Displays an information screen. - */ - private void displayInfo(int infoToDisplay) { - - // Validate info. - if ((infoToDisplay != GlobalConstants.FLAG_INFORMATION_DISPLAY_ABOUT_US) && - (infoToDisplay != GlobalConstants.FLAG_INFORMATION_DISPLAY_LICENSE)) { - infoToDisplay = GlobalConstants.FLAG_INFORMATION_DISPLAY_ABOUT_US; - } - - - Intent launchDisplay = new Intent(this, InfoActivity.class); - launchDisplay.putExtra(GlobalConstants.EXTRA_INFORMATION_DISPLAY_FLAG, - infoToDisplay); - startActivity(launchDisplay); - } - - /** - * Displays the settings for the application. - */ - private void displaySettings() { - Intent launchDisplay = new Intent(this, SettingsActivity.class); - startActivity(launchDisplay); - } - - /** - * Starts an external browser to visit the project's website. - */ - private void launchWebsite() { - String url = this.getString(R.string.project_website); - Intent launcher = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); - startActivity(launcher); - } - - /** - * Starts a new game or continues an existing one. - */ - private void startGame() { - Intent launchDisplay = new Intent(this, GameActivity.class); - startActivity(launchDisplay); - } - -} diff --git a/android/src/org/justcheckers/android/SettingsActivity.java b/android/src/org/justcheckers/android/SettingsActivity.java deleted file mode 100644 index c4aaa25..0000000 --- a/android/src/org/justcheckers/android/SettingsActivity.java +++ /dev/null @@ -1,40 +0,0 @@ -/***************************************************************************** - SettingsActivity.java - The activity for adjustings settings in the app. - ***************************************************************************** - - ***************************************************************************** - This file is part of justCheckers. - - justCheckers is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - justCheckers is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with justCheckers. If not, see . - *****************************************************************************/ - -package org.justcheckers.android; - -import android.graphics.Color; -import android.os.Bundle; -import android.preference.PreferenceActivity; - -public class SettingsActivity extends PreferenceActivity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - - super.onCreate(savedInstanceState); - - this.addPreferencesFromResource(R.layout.settings_screen); - this.getListView().setBackgroundResource(R.drawable.backdrop); - this.getListView().setCacheColorHint(Color.TRANSPARENT); - } - -} diff --git a/core/build.gradle b/core/build.gradle deleted file mode 100755 index 8b0d803..0000000 --- a/core/build.gradle +++ /dev/null @@ -1,61 +0,0 @@ -/* - Gradle Build for justCheckers - Core - --------------------------------------------- - - Author: Dorian Pula (dorian.pula@amber-penguin-software.ca) - License: AGPL v3. - - Gradle docs: - http://www.gradle.org/docs/current/userguide/userguide_single.html -*/ - -apply plugin: 'java' - -sourceCompatibility = 1.6 -targetCompatibility = 1.6 - -// Description of the project -description = 'justcheckers-core' -version = '0.3' - -project.ext { - appName = 'justcheckers-core' -} - -// Setup build script repositories starting with Maven repositories -repositories { - maven { - url 'http://repo1.maven.org/maven2' - } -} - -// Dependency management -dependencies { - compile 'jdom:jdom:0.7' - compile 'org.slf4j:slf4j-api:1.7.5' - testCompile 'org.testng:testng:6.8' -} - -// At the end of day we just need a JAR and a WAR. -ext.sharedManifest = manifest { - - attributes( - 'App-Name' : project.appName, - 'App-Version' : version, - 'Build-User' : System.properties['user.name'], - 'Build-Time' : new Date().format('yyyy-MMMM-dd HH:mm:ss'), - 'Build-OS' : System.properties['os.name'] + ' - version ' + System.properties['os.version'], - 'Build-Sys' : System.properties['os.arch'], - 'Java-Version' : System.properties['java.version'], - 'Java-Vendor' : System.properties['java.vendor'], - 'Java-VM' : - System.properties['java.vm.vendor'] + ' ' + System.properties['java.vm.name'] + ' v' - + System.properties['java.vm.version']) -} - -// Build the JAR. -jar { - enabled = true - includeEmptyDirs = false - manifest = sharedManifest -} \ No newline at end of file diff --git a/core/src/main/java/org/justcheckers/common/GlobalConstants.java b/core/src/main/java/org/justcheckers/common/GlobalConstants.java deleted file mode 100644 index 953c109..0000000 --- a/core/src/main/java/org/justcheckers/common/GlobalConstants.java +++ /dev/null @@ -1,41 +0,0 @@ -/***************************************************************************** - GlobalConstants.java - Constants for the entire application. - ***************************************************************************** - - ***************************************************************************** - This file is part of justCheckers. - - justCheckers is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - justCheckers is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with justCheckers. If not, see . - *****************************************************************************/ - -package org.justcheckers.common; - -/** - * Organizational class to keep all the constants in. - * @author Dorian Pula - * - */ -public class GlobalConstants { - - /** Flag for the information screen to display a "About Us". */ - public final static int FLAG_INFORMATION_DISPLAY_ABOUT_US = 0; - /** Flag for the information screen to display the license of the app. */ - public final static int FLAG_INFORMATION_DISPLAY_LICENSE = 1; - - /** - * The extras key that contains the information screens needs to display - * the right information. - */ - public final static String EXTRA_INFORMATION_DISPLAY_FLAG = "info-display"; -} diff --git a/core/src/main/java/org/justcheckers/xml/ConfigSettings.java b/core/src/main/java/org/justcheckers/xml/ConfigSettings.java deleted file mode 100644 index 774bbe2..0000000 --- a/core/src/main/java/org/justcheckers/xml/ConfigSettings.java +++ /dev/null @@ -1,84 +0,0 @@ -package org.justcheckers.xml; - -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -/** -* Holds the justCheckers configuration settings. -* @author Brinick Simmons (brinick@users.sourceforge.net) -*/ - -final public class ConfigSettings extends Settings{ - - //---------------------------// - // Class Fields // - //---------------------------// - - private static ConfigSettings cs = null; - - //---------------------------// - // Class Methods // - //---------------------------// - - //======= PUBLIC ============// - - /** - * Accessor method for obtaining the one - * and only instance of this class - */ - public static ConfigSettings getInstance(){ - if(cs==null) cs = new ConfigSettings(new DefaultConfigSettings()); - return cs; - } - - /** - * Load the default config settings. - */ - public static void loadDefault(){ - cs = new ConfigSettings(new DefaultConfigSettings()); - } - - //======= PRIVATE CONSTRUCTORS ========// - private ConfigSettings(){ - super(); - } - - private ConfigSettings(DefaultConfigSettings cus){ - super(cus.getTextMap(),cus.getAttributeMap()); - } - - //======= PRIVATE INNER CLASS ============// - - /* The default class from which to get settings */ - private static class DefaultConfigSettings extends Settings.DefaultSettings{ - private String userHome = System.getProperty("user.home"); - private String userDir = System.getProperty("user.dir"); - private String [][] text = - { - {"configsettings.directory.configFile",userDir+"/config.xml"}, - {"configsettings.directory.settings",userHome+"/settings/"}, - {"configsettings.directory.skins",userDir+"/skins/"}, - {"configsettings.directory.sounds",userDir+"/sounds/"}, - {"configsettings.directory.language",userDir+"/language/"}, - }; - - private String [][] attribute = - { - {"configsettings.general.id","3"}, - {"configsettings.general.id2","5"}, - {"configsettings.language.default","english"}, - {"configsettings.appearance.pretty","true"}, - }; - - DefaultConfigSettings(){ - super(); - super.setFields(text,attribute); - } - }//end of default class -} \ No newline at end of file diff --git a/core/src/main/java/org/justcheckers/xml/ConfigSettingsIO.java b/core/src/main/java/org/justcheckers/xml/ConfigSettingsIO.java deleted file mode 100644 index e4b37a8..0000000 --- a/core/src/main/java/org/justcheckers/xml/ConfigSettingsIO.java +++ /dev/null @@ -1,295 +0,0 @@ -package org.justcheckers.xml; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.io.PrintWriter; -import java.net.URL; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.StringTokenizer; - -import org.jdom.Attribute; -import org.jdom.Comment; -import org.jdom.Document; -import org.jdom.Element; -import org.jdom.JDOMException; -import org.jdom.input.SAXBuilder; -import org.jdom.output.XMLOutputter; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -/** -* Concrete child class of the XML_IO class. Use its load() and save() methods -* to write XML into/write out XML from, the associated ConfigSettings object. -* @author Brinick Simmons (brinick@users.sourceforge.net) -*/ -public class ConfigSettingsIO extends XML_IO{ - - //---------------------------// - // Class Methods // - //---------------------------// - - //--------------------------------------------------------------------- - // -- Interface ------------------------------------------------------- - //--------------------------------------------------------------------- - - /** - * Causes the XML data held within the File object referenced by the member - * variable "file" (inherited from XML_IO) to be loaded into the ConfigSettings - * object associated with this class. The reading in of XML data and subsequent - * transformation is dealt with by the inner reader class of this class. - */ - public void load(){ - try{ - SAXBuilder builder = new SAXBuilder(); - Document doc = builder.build(getFile()); - Element rootElement = doc.getRootElement(); - ConfigSettingsIOReader csior = new ConfigSettingsIOReader(); - csior.visit(rootElement); - } -// catch(IOException e){ -// String msg = "Problem : " + e.getMessage(); -// Log.e("ConfigSettingsIO", msg); -// } - catch(JDOMException e){ - String msg = "Problem : " + getFile().toString() - + " is not a well formed XML document"; - - // TODO Clean up... - Logger log = LoggerFactory.getLogger(UserSettingsIO.class); - log.error("ConfigSettingsIO", msg); - } - } - - /** - * Causes the data held within the ConfigSettings object associated with - * this class to be saved as XML format into the File object referenced by - * the member variable "file". Transformation of ConfigSettings data into XML - * format and subsequent writing to file is handled by the inner writer - * class of this class. - */ - public void save(){ - try{ - ConfigSettingsIOWriter csiow = new ConfigSettingsIOWriter(); - Document doc = csiow.createXMLDocument(); - XMLOutputter outputter = new XMLOutputter("",true); - PrintWriter pw = new PrintWriter( - new BufferedWriter( - new FileWriter(getFile()))); - outputter.output(doc,pw); - } - catch(IOException e){ - String msg = "Problem : couldn't output to the given file : " - + getFile().toString(); - // TODO Clean up... - Logger log = LoggerFactory.getLogger(ConfigSettingsIO.class); - log.error("ConfigSettingsIO", msg); - } - } - - //--------------------------------------------------------------------- - // -- Contructors ----------------------------------------------------- - //--------------------------------------------------------------------- - - /** - * The constructor used to initiate the ConfigSettingsIO - * object with a given file object - * @param fileObject The file object with which - * to initiate this ConfigSettingsIO. - */ - public ConfigSettingsIO(File fileObject){ - super(fileObject,ConfigSettings.getInstance()); - } - - public ConfigSettingsIO(File fileObject, ConfigSettings cs){ - super(fileObject,cs); - } - - public ConfigSettingsIO(URL urlObject){ - super(urlObject, ConfigSettings.getInstance()); - } - - public ConfigSettingsIO(URL urlObject, ConfigSettings cs){ - super(urlObject,cs); - } - - /////////////////////////////////// - // INNER CLASS : READER // - /////////////////////////////////// - - private class ConfigSettingsIOReader extends XML_IO.XMLFileReader{ - - /* - * Loads text information held in an Element object - * into the ConfigSettings object - */ - protected void loadElementIntoSettings(Element e){ - String text = e.getTextTrim(); - if(text!=null && text.length()!=0){ - ConfigSettings.getInstance().setElementText(toFullSettingName(e),text); - } - } - - /* - * Loads Attribute information held in an Element object - * into the ConfigSettings object - */ - protected void loadAttributesIntoSettings(Element e){ - List attributes = e.getAttributes(); - ConfigSettings cs = ConfigSettings.getInstance(); - for(int k=0;k