aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore6
-rw-r--r--.idea/.name1
-rw-r--r--.idea/compiler.xml23
-rw-r--r--.idea/copyright/profiles_settings.xml3
-rw-r--r--.idea/encodings.xml5
-rw-r--r--.idea/gradle.xml18
-rw-r--r--.idea/misc.xml26
-rw-r--r--.idea/modules.xml10
-rw-r--r--.idea/scopes/scope_settings.xml5
-rw-r--r--.idea/vcs.xml7
-rw-r--r--RushHour.iml19
-rw-r--r--app/.gitignore1
-rw-r--r--app/app.iml93
-rw-r--r--app/build.gradle26
-rw-r--r--app/proguard-rules.pro17
-rw-r--r--app/src/androidTest/java/com/camilstaps/rushhour/ApplicationTest.java13
-rw-r--r--app/src/main/AndroidManifest.xml24
-rw-r--r--app/src/main/java/com/camilstaps/rushhour/Board.java55
-rw-r--r--app/src/main/java/com/camilstaps/rushhour/Car.java159
-rw-r--r--app/src/main/java/com/camilstaps/rushhour/Coordinate.java33
-rw-r--r--app/src/main/java/com/camilstaps/rushhour/FullscreenActivity.java42
-rw-r--r--app/src/main/java/com/camilstaps/rushhour/MoveListener.java8
-rw-r--r--app/src/main/java/com/camilstaps/rushhour/util/SystemUiHider.java172
-rw-r--r--app/src/main/java/com/camilstaps/rushhour/util/SystemUiHiderBase.java63
-rw-r--r--app/src/main/java/com/camilstaps/rushhour/util/SystemUiHiderHoneycomb.java141
-rw-r--r--app/src/main/res/layout/activity_fullscreen.xml14
-rw-r--r--app/src/main/res/mipmap-hdpi/ic_launcher.pngbin0 -> 3418 bytes
-rw-r--r--app/src/main/res/mipmap-mdpi/ic_launcher.pngbin0 -> 2206 bytes
-rw-r--r--app/src/main/res/mipmap-xhdpi/ic_launcher.pngbin0 -> 4842 bytes
-rw-r--r--app/src/main/res/mipmap-xxhdpi/ic_launcher.pngbin0 -> 7718 bytes
-rw-r--r--app/src/main/res/values-v11/styles.xml15
-rw-r--r--app/src/main/res/values/attrs.xml12
-rw-r--r--app/src/main/res/values/colors.xml5
-rw-r--r--app/src/main/res/values/strings.xml3
-rw-r--r--app/src/main/res/values/styles.xml27
-rw-r--r--build.gradle19
-rw-r--r--gradle.properties18
-rw-r--r--gradle/wrapper/gradle-wrapper.jarbin0 -> 49896 bytes
-rw-r--r--gradle/wrapper/gradle-wrapper.properties6
-rwxr-xr-xgradlew164
-rw-r--r--gradlew.bat90
-rw-r--r--settings.gradle1
42 files changed, 1344 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..afbdab3
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,6 @@
+.gradle
+/local.properties
+/.idea/workspace.xml
+/.idea/libraries
+.DS_Store
+/build
diff --git a/.idea/.name b/.idea/.name
new file mode 100644
index 0000000..383b391
--- /dev/null
+++ b/.idea/.name
@@ -0,0 +1 @@
+The Setting Sun \ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..217af47
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="CompilerConfiguration">
+ <option name="DEFAULT_COMPILER" value="Javac" />
+ <resourceExtensions />
+ <wildcardResourcePatterns>
+ <entry name="!?*.java" />
+ <entry name="!?*.form" />
+ <entry name="!?*.class" />
+ <entry name="!?*.groovy" />
+ <entry name="!?*.scala" />
+ <entry name="!?*.flex" />
+ <entry name="!?*.kt" />
+ <entry name="!?*.clj" />
+ </wildcardResourcePatterns>
+ <annotationProcessing>
+ <profile default="true" name="Default" enabled="false">
+ <processorPath useClasspath="true" />
+ </profile>
+ </annotationProcessing>
+ </component>
+</project>
+
diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml
new file mode 100644
index 0000000..e7bedf3
--- /dev/null
+++ b/.idea/copyright/profiles_settings.xml
@@ -0,0 +1,3 @@
+<component name="CopyrightManager">
+ <settings default="" />
+</component> \ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..e206d70
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
+</project>
+
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
new file mode 100644
index 0000000..736c7b5
--- /dev/null
+++ b/.idea/gradle.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="GradleSettings">
+ <option name="linkedExternalProjectsSettings">
+ <GradleProjectSettings>
+ <option name="distributionType" value="DEFAULT_WRAPPED" />
+ <option name="externalProjectPath" value="$PROJECT_DIR$" />
+ <option name="modules">
+ <set>
+ <option value="$PROJECT_DIR$" />
+ <option value="$PROJECT_DIR$/app" />
+ </set>
+ </option>
+ </GradleProjectSettings>
+ </option>
+ </component>
+</project>
+
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..58ff01f
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="EntryPointsManager">
+ <entry_points version="2.0" />
+ </component>
+ <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" assert-keyword="true" jdk-15="true" project-jdk-name="1.7" project-jdk-type="JavaSDK">
+ <output url="file://$PROJECT_DIR$/build/classes" />
+ </component>
+ <component name="masterDetails">
+ <states>
+ <state key="ProjectJDKs.UI">
+ <settings>
+ <last-edited>1.7</last-edited>
+ <splitter-proportions>
+ <option name="proportions">
+ <list>
+ <option value="0.2" />
+ </list>
+ </option>
+ </splitter-proportions>
+ </settings>
+ </state>
+ </states>
+ </component>
+</project>
+
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..f11cb72
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="ProjectModuleManager">
+ <modules>
+ <module fileurl="file://$PROJECT_DIR$/RushHour.iml" filepath="$PROJECT_DIR$/RushHour.iml" />
+ <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
+ </modules>
+ </component>
+</project>
+
diff --git a/.idea/scopes/scope_settings.xml b/.idea/scopes/scope_settings.xml
new file mode 100644
index 0000000..922003b
--- /dev/null
+++ b/.idea/scopes/scope_settings.xml
@@ -0,0 +1,5 @@
+<component name="DependencyValidationManager">
+ <state>
+ <option name="SKIP_IMPORT_STATEMENTS" value="false" />
+ </state>
+</component> \ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..def6a6a
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="VcsDirectoryMappings">
+ <mapping directory="" vcs="" />
+ </component>
+</project>
+
diff --git a/RushHour.iml b/RushHour.iml
new file mode 100644
index 0000000..7bb5e90
--- /dev/null
+++ b/RushHour.iml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
+ <component name="FacetManager">
+ <facet type="java-gradle" name="Java-Gradle">
+ <configuration>
+ <option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/../../RenD/Android/TheSettingSun/build" />
+ </configuration>
+ </facet>
+ </component>
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$">
+ <excludeFolder url="file://$MODULE_DIR$/.gradle" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ </component>
+</module>
+
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/app/app.iml b/app/app.iml
new file mode 100644
index 0000000..17204f1
--- /dev/null
+++ b/app/app.iml
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="TheSettingSun" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
+ <component name="FacetManager">
+ <facet type="android-gradle" name="Android-Gradle">
+ <configuration>
+ <option name="GRADLE_PROJECT_PATH" value=":app" />
+ </configuration>
+ </facet>
+ <facet type="android" name="Android">
+ <configuration>
+ <option name="SELECTED_BUILD_VARIANT" value="debug" />
+ <option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
+ <option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
+ <option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
+ <option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugAndroidTest" />
+ <option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
+ <option name="TEST_SOURCE_GEN_TASK_NAME" value="generateDebugAndroidTestSources" />
+ <option name="ALLOW_USER_CONFIGURATION" value="false" />
+ <option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
+ <option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
+ <option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/../../../RenD/Android/TheSettingSun/app/src/main/res" />
+ <option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
+ </configuration>
+ </facet>
+ </component>
+ <component name="NewModuleRootManager" inherit-compiler-output="false">
+ <output url="file://$MODULE_DIR$/../../../RenD/Android/TheSettingSun/app/build/intermediates/classes/debug" />
+ <output-test url="file://$MODULE_DIR$/../../../RenD/Android/TheSettingSun/app/build/intermediates/classes/androidTest/debug" />
+ <exclude-output />
+ <content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
+ <sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
+ <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
+ <sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
+ <sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
+ <sourceFolder url="file://$MODULE_DIR$/../../../RenD/Android/TheSettingSun/app/build/generated/res/generated/debug" type="java-resource" />
+ <sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
+ <sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
+ <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
+ <sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
+ <sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
+ <sourceFolder url="file://$MODULE_DIR$/../../../RenD/Android/TheSettingSun/app/build/generated/res/generated/androidTest/debug" type="java-test-resource" />
+ <sourceFolder url="file://$MODULE_DIR$/../../../RenD/Android/TheSettingSun/app/src/debug/res" type="java-resource" />
+ <sourceFolder url="file://$MODULE_DIR$/../../../RenD/Android/TheSettingSun/app/src/debug/resources" type="java-resource" />
+ <sourceFolder url="file://$MODULE_DIR$/../../../RenD/Android/TheSettingSun/app/src/debug/assets" type="java-resource" />
+ <sourceFolder url="file://$MODULE_DIR$/../../../RenD/Android/TheSettingSun/app/src/debug/aidl" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/../../../RenD/Android/TheSettingSun/app/src/debug/java" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/../../../RenD/Android/TheSettingSun/app/src/debug/jni" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/../../../RenD/Android/TheSettingSun/app/src/debug/rs" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
+ <sourceFolder url="file://$MODULE_DIR$/../../../RenD/Android/TheSettingSun/app/src/main/resources" type="java-resource" />
+ <sourceFolder url="file://$MODULE_DIR$/../../../RenD/Android/TheSettingSun/app/src/main/assets" type="java-resource" />
+ <sourceFolder url="file://$MODULE_DIR$/../../../RenD/Android/TheSettingSun/app/src/main/aidl" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/../../../RenD/Android/TheSettingSun/app/src/main/jni" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/../../../RenD/Android/TheSettingSun/app/src/main/rs" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/../../../RenD/Android/TheSettingSun/app/src/androidTest/res" type="java-test-resource" />
+ <sourceFolder url="file://$MODULE_DIR$/../../../RenD/Android/TheSettingSun/app/src/androidTest/resources" type="java-test-resource" />
+ <sourceFolder url="file://$MODULE_DIR$/../../../RenD/Android/TheSettingSun/app/src/androidTest/assets" type="java-test-resource" />
+ <sourceFolder url="file://$MODULE_DIR$/../../../RenD/Android/TheSettingSun/app/src/androidTest/aidl" isTestSource="true" />
+ <sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
+ <sourceFolder url="file://$MODULE_DIR$/../../../RenD/Android/TheSettingSun/app/src/androidTest/jni" isTestSource="true" />
+ <sourceFolder url="file://$MODULE_DIR$/../../../RenD/Android/TheSettingSun/app/src/androidTest/rs" isTestSource="true" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
+ <excludeFolder url="file://$MODULE_DIR$/../../../RenD/Android/TheSettingSun/app/build/intermediates/bundles" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
+ <excludeFolder url="file://$MODULE_DIR$/../../../RenD/Android/TheSettingSun/app/build/intermediates/coverage-instrumented-classes" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
+ <excludeFolder url="file://$MODULE_DIR$/../../../RenD/Android/TheSettingSun/app/build/intermediates/dex-cache" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
+ <excludeFolder url="file://$MODULE_DIR$/../../../RenD/Android/TheSettingSun/app/build/intermediates/jacoco" />
+ <excludeFolder url="file://$MODULE_DIR$/../../../RenD/Android/TheSettingSun/app/build/intermediates/javaResources" />
+ <excludeFolder url="file://$MODULE_DIR$/../../../RenD/Android/TheSettingSun/app/build/intermediates/libs" />
+ <excludeFolder url="file://$MODULE_DIR$/../../../RenD/Android/TheSettingSun/app/build/intermediates/lint" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
+ <excludeFolder url="file://$MODULE_DIR$/../../../RenD/Android/TheSettingSun/app/build/intermediates/ndk" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
+ <excludeFolder url="file://$MODULE_DIR$/../../../RenD/Android/TheSettingSun/app/build/intermediates/proguard" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
+ <excludeFolder url="file://$MODULE_DIR$/build/outputs" />
+ <excludeFolder url="file://$MODULE_DIR$/build/tmp" />
+ </content>
+ <orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="library" exported="" name="support-v4-22.0.0" level="project" />
+ <orderEntry type="library" exported="" name="support-annotations-22.0.0" level="project" />
+ <orderEntry type="library" exported="" name="appcompat-v7-22.0.0" level="project" />
+ </component>
+</module>
+
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..b26ce22
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,26 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 21
+ buildToolsVersion "21.1.2"
+
+ defaultConfig {
+ applicationId "com.camilstaps.thesettingsun"
+ minSdkVersion 14
+ targetSdkVersion 21
+ versionCode 1
+ versionName "1.0"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+}
+
+dependencies {
+ compile fileTree(dir: 'libs', include: ['*.jar'])
+ compile 'com.android.support:appcompat-v7:22.0.0'
+ compile 'com.android.support:support-v4:22.0.0'
+}
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..966ccb1
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,17 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in /home/camilstaps/Android/Sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
diff --git a/app/src/androidTest/java/com/camilstaps/rushhour/ApplicationTest.java b/app/src/androidTest/java/com/camilstaps/rushhour/ApplicationTest.java
new file mode 100644
index 0000000..d0f75ca
--- /dev/null
+++ b/app/src/androidTest/java/com/camilstaps/rushhour/ApplicationTest.java
@@ -0,0 +1,13 @@
+package com.camilstaps.rushhour;
+
+import android.app.Application;
+import android.test.ApplicationTestCase;
+
+/**
+ * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
+ */
+public class ApplicationTest extends ApplicationTestCase<Application> {
+ public ApplicationTest() {
+ super(Application.class);
+ }
+} \ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..391a9fd
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.camilstaps.rushhour" >
+
+ <application
+ android:allowBackup="true"
+ android:icon="@mipmap/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@style/AppTheme" >
+ <activity
+ android:name=".FullscreenActivity"
+ android:configChanges="orientation|keyboardHidden|screenSize"
+ android:label="@string/app_name"
+ android:theme="@style/FullscreenTheme"
+ android:screenOrientation="portrait">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+
+</manifest>
diff --git a/app/src/main/java/com/camilstaps/rushhour/Board.java b/app/src/main/java/com/camilstaps/rushhour/Board.java
new file mode 100644
index 0000000..7ea52de
--- /dev/null
+++ b/app/src/main/java/com/camilstaps/rushhour/Board.java
@@ -0,0 +1,55 @@
+package com.camilstaps.rushhour;
+
+import android.content.Context;
+import android.util.Log;
+import android.widget.RelativeLayout;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * Created by camilstaps on 16-4-15.
+ */
+public class Board {
+
+ Set<Car> cars = new HashSet<>();
+
+ public static final int DIMENSION = 6;
+
+ private MoveListener moveListener = new MoveListener() {
+ @Override
+ public void onMove(Car car, int offset) {
+ Coordinate newC = car.wouldMoveTo(offset);
+ if (newC.getY() > DIMENSION - 1 || newC.getX() > DIMENSION - 1 || newC.getX() < 0 || newC.getY() < 0) return;
+ for (Car iter : cars) {
+ if (iter.occupies(newC)) {
+ Log.d("Board", "Can't move");
+ return;
+ }
+ }
+ car.move(offset);
+ }
+ };
+
+ public Board() {
+ this(new HashSet<Car>());
+ }
+
+ public Board(Set<Car> cars) {
+ for (Car car : cars) {
+ add(car);
+ }
+ }
+
+ public void add(Car car) {
+ car.setMoveListener(moveListener);
+ cars.add(car);
+ }
+
+ public void addToLayout(Context context, RelativeLayout layout) {
+ for (Car car : cars) {
+ layout.addView(car.getImageView(context));
+ }
+ }
+
+}
diff --git a/app/src/main/java/com/camilstaps/rushhour/Car.java b/app/src/main/java/com/camilstaps/rushhour/Car.java
new file mode 100644
index 0000000..9d2c45a
--- /dev/null
+++ b/app/src/main/java/com/camilstaps/rushhour/Car.java
@@ -0,0 +1,159 @@
+package com.camilstaps.rushhour;
+
+import android.content.Context;
+import android.graphics.Color;
+import android.view.GestureDetector;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.RelativeLayout;
+
+/**
+ * Created by camilstaps on 16-4-15.
+ */
+public class Car {
+
+ //private int startCoordinate.getX(), startCoordinate.getY(), endCoordinate.getX(), endCoordinate.getY();
+ private Coordinate startCoordinate, endCoordinate;
+ private final int colour;
+
+ private static final int SIZE = 50;
+ private static final int MARGIN = 5;
+
+ private MoveListener moveListener;
+
+ ImageView iv;
+
+ public Car(Coordinate start, Coordinate end) {
+ startCoordinate = start;
+ endCoordinate = end;
+ this.colour = Color.BLACK;
+ }
+
+ public Car(Coordinate start, Coordinate end, int colour) {
+ startCoordinate = start;
+ endCoordinate = end;
+ this.colour = colour;
+ }
+
+ public int getColour() { return colour; }
+
+ public void setMoveListener(MoveListener listener) {
+ moveListener = listener;
+ }
+
+ private int getWidth() {
+ return (SIZE + MARGIN) * (endCoordinate.getX() - startCoordinate.getX()) + SIZE;
+ }
+
+ private int getHeight() {
+ return (SIZE + MARGIN) * (endCoordinate.getY() - startCoordinate.getY()) + SIZE;
+ }
+
+ public void setImageViewMargins() {
+ ViewGroup.MarginLayoutParams marginParams = new ViewGroup.MarginLayoutParams(getWidth(), getHeight());
+ marginParams.setMargins(startCoordinate.getX() * (SIZE + MARGIN), startCoordinate.getY() * (SIZE + MARGIN), MARGIN, MARGIN);
+ RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(marginParams);
+ iv.setLayoutParams(layoutParams);
+ }
+
+ public ImageView getImageView(Context context) {
+
+ iv = new ImageView(context);
+ iv.setBackgroundColor(colour);
+ int width = getWidth();
+ int height = getHeight();
+ iv.setMinimumWidth(width);
+ iv.setMinimumHeight(height);
+
+ setImageViewMargins();
+
+ final GestureDetector gdt = new GestureDetector(new GestureListener());
+ iv.setOnTouchListener(new View.OnTouchListener() {
+ @Override
+ public boolean onTouch(View v, MotionEvent event) {
+ gdt.onTouchEvent(event);
+ return true;
+ }
+ });
+
+ return iv;
+ }
+
+ public boolean canMoveHorizontally() {
+ return startCoordinate.getY() == endCoordinate.getY();
+ }
+
+ public boolean canMoveVertically() {
+ return startCoordinate.getX() == endCoordinate.getX();
+ }
+
+ public void move(int offset) {
+ if (canMoveHorizontally()) {
+ moveHorizontally(offset);
+ } else {
+ moveVertically(offset);
+ }
+ }
+
+ public void moveHorizontally(int offset) {
+ startCoordinate.move(offset, 0);
+ endCoordinate.move(offset, 0);
+
+ setImageViewMargins();
+ }
+
+ public void moveVertically(int offset) {
+ startCoordinate.move(0, offset);
+ endCoordinate.move(0, offset);
+
+ setImageViewMargins();
+ }
+
+ public Coordinate wouldMoveTo(int offset) {
+ Coordinate movedCoordinate;
+ if (offset < 0) {
+ movedCoordinate = new Coordinate(startCoordinate);
+ } else {
+ movedCoordinate = new Coordinate(endCoordinate);
+ }
+ if (canMoveHorizontally()) {
+ movedCoordinate.move(offset, 0);
+ } else {
+ movedCoordinate.move(0, offset);
+ }
+ return movedCoordinate;
+ }
+
+ public boolean occupies(Coordinate c) {
+ return c.getX() >= startCoordinate.getX() && c.getX() <= endCoordinate.getX() && c.getY() >= startCoordinate.getY() && c.getY() <= endCoordinate.getY();
+ }
+
+ private class GestureListener extends GestureDetector.SimpleOnGestureListener {
+ private static final int SWIPE_MIN_DISTANCE = SIZE;
+ private static final int SWIPE_THRESHOLD_VELOCITY = SIZE;
+
+ @Override
+ public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
+ if (Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY && canMoveHorizontally()) {
+ if (e1.getX() - e2.getX() > SWIPE_MIN_DISTANCE) {
+ moveListener.onMove(Car.this, -1);
+ } else if (e2.getX() - e1.getX() > SWIPE_MIN_DISTANCE) {
+ moveListener.onMove(Car.this, 1);
+ }
+ }
+
+ if (Math.abs(velocityY) > SWIPE_THRESHOLD_VELOCITY && canMoveVertically()) {
+ if (e1.getY() - e2.getY() > SWIPE_MIN_DISTANCE) {
+ moveListener.onMove(Car.this, -1);
+ } else if (e2.getY() - e1.getY() > SWIPE_MIN_DISTANCE) {
+ moveListener.onMove(Car.this, 1);
+ }
+ }
+
+ return true;
+ }
+ }
+
+}
diff --git a/app/src/main/java/com/camilstaps/rushhour/Coordinate.java b/app/src/main/java/com/camilstaps/rushhour/Coordinate.java
new file mode 100644
index 0000000..fb794a2
--- /dev/null
+++ b/app/src/main/java/com/camilstaps/rushhour/Coordinate.java
@@ -0,0 +1,33 @@
+package com.camilstaps.rushhour;
+
+/**
+ * Created by camilstaps on 16-4-15.
+ */
+public class Coordinate {
+
+ private int x, y;
+
+ public Coordinate(int x, int y) {
+ this.x = x;
+ this.y = y;
+ }
+
+ public Coordinate(Coordinate c) {
+ this.x = c.x;
+ this.y = c.y;
+ }
+
+ public void move(int offsetX, int offsetY) {
+ this.x += offsetX;
+ this.y += offsetY;
+ }
+
+ public int getX() {
+ return x;
+ }
+
+ public int getY() {
+ return y;
+ }
+
+}
diff --git a/app/src/main/java/com/camilstaps/rushhour/FullscreenActivity.java b/app/src/main/java/com/camilstaps/rushhour/FullscreenActivity.java
new file mode 100644
index 0000000..e5366f7
--- /dev/null
+++ b/app/src/main/java/com/camilstaps/rushhour/FullscreenActivity.java
@@ -0,0 +1,42 @@
+package com.camilstaps.rushhour;
+
+import android.app.Activity;
+import android.graphics.Color;
+import android.os.Bundle;
+import android.widget.RelativeLayout;
+
+import com.camilstaps.rushhour.util.SystemUiHider;
+
+/**
+ * An example full-screen activity that shows and hides the system UI (i.e.
+ * status bar and navigation/system bar) with user interaction.
+ *
+ * @see SystemUiHider
+ */
+public class FullscreenActivity extends Activity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ setContentView(R.layout.activity_fullscreen);
+
+ RelativeLayout boardLayout = (RelativeLayout) findViewById(R.id.board);
+
+ Board board = new Board();
+ board.add(new Car(new Coordinate(0,0), new Coordinate(2,0), Color.YELLOW));
+ board.add(new Car(new Coordinate(3,0), new Coordinate(3,1), Color.rgb(128,223,182)));
+ board.add(new Car(new Coordinate(4,0), new Coordinate(4,2), Color.rgb(198, 134,221)));
+ board.add(new Car(new Coordinate(0,2), new Coordinate(1,2), Color.RED));
+ board.add(new Car(new Coordinate(5,2), new Coordinate(5,3), Color.rgb(255,165,0)));
+ board.add(new Car(new Coordinate(0,3), new Coordinate(0,4), Color.rgb(158,231,246)));
+ board.add(new Car(new Coordinate(1,3), new Coordinate(2,3), Color.rgb(245,158,246)));
+ board.add(new Car(new Coordinate(3,3), new Coordinate(4,3), Color.rgb(150,126,196)));
+ board.add(new Car(new Coordinate(1,4), new Coordinate(2,4), Color.GREEN));
+ board.add(new Car(new Coordinate(3,4), new Coordinate(3,5), Color.BLACK));
+ board.add(new Car(new Coordinate(5,4), new Coordinate(5,5), Color.rgb(219,202,161)));
+ board.add(new Car(new Coordinate(0,5), new Coordinate(2,5), Color.rgb(25,195,167)));
+
+ board.addToLayout(this, boardLayout);
+ }
+}
diff --git a/app/src/main/java/com/camilstaps/rushhour/MoveListener.java b/app/src/main/java/com/camilstaps/rushhour/MoveListener.java
new file mode 100644
index 0000000..06e0b4a
--- /dev/null
+++ b/app/src/main/java/com/camilstaps/rushhour/MoveListener.java
@@ -0,0 +1,8 @@
+package com.camilstaps.rushhour;
+
+/**
+ * Created by camilstaps on 16-4-15.
+ */
+public abstract class MoveListener {
+ public abstract void onMove(Car car, int offset);
+}
diff --git a/app/src/main/java/com/camilstaps/rushhour/util/SystemUiHider.java b/app/src/main/java/com/camilstaps/rushhour/util/SystemUiHider.java
new file mode 100644
index 0000000..e3eaf77
--- /dev/null
+++ b/app/src/main/java/com/camilstaps/rushhour/util/SystemUiHider.java
@@ -0,0 +1,172 @@
+package com.camilstaps.rushhour.util;
+
+import android.app.Activity;
+import android.os.Build;
+import android.view.View;
+
+/**
+ * A utility class that helps with showing and hiding system UI such as the
+ * status bar and navigation/system bar. This class uses backward-compatibility
+ * techniques described in <a href=
+ * "http://developer.android.com/training/backward-compatible-ui/index.html">
+ * Creating Backward-Compatible UIs</a> to ensure that devices running any
+ * version of ndroid OS are supported. More specifically, there are separate
+ * implementations of this abstract class: for newer devices,
+ * {@link #getInstance} will return a {@link SystemUiHiderHoneycomb} instance,
+ * while on older devices {@link #getInstance} will return a
+ * {@link SystemUiHiderBase} instance.
+ * <p/>
+ * For more on system bars, see <a href=
+ * "http://developer.android.com/design/get-started/ui-overview.html#system-bars"
+ * > System Bars</a>.
+ *
+ * @see android.view.View#setSystemUiVisibility(int)
+ * @see android.view.WindowManager.LayoutParams#FLAG_FULLSCREEN
+ */
+public abstract class SystemUiHider {
+ /**
+ * When this flag is set, the
+ * {@link android.view.WindowManager.LayoutParams#FLAG_LAYOUT_IN_SCREEN}
+ * flag will be set on older devices, making the status bar "float" on top
+ * of the activity layout. This is most useful when there are no controls at
+ * the top of the activity layout.
+ * <p/>
+ * This flag isn't used on newer devices because the <a
+ * href="http://developer.android.com/design/patterns/actionbar.html">action
+ * bar</a>, the most important structural element of an Android app, should
+ * be visible and not obscured by the system UI.
+ */
+ public static final int FLAG_LAYOUT_IN_SCREEN_OLDER_DEVICES = 0x1;
+
+ /**
+ * When this flag is set, {@link #show()} and {@link #hide()} will toggle
+ * the visibility of the status bar. If there is a navigation bar, show and
+ * hide will toggle low profile mode.
+ */
+ public static final int FLAG_FULLSCREEN = 0x2;
+
+ /**
+ * When this flag is set, {@link #show()} and {@link #hide()} will toggle
+ * the visibility of the navigation bar, if it's present on the device and
+ * the device allows hiding it. In cases where the navigation bar is present
+ * but cannot be hidden, show and hide will toggle low profile mode.
+ */
+ public static final int FLAG_HIDE_NAVIGATION = FLAG_FULLSCREEN | 0x4;
+
+ /**
+ * The activity associated with this UI hider object.
+ */
+ protected Activity mActivity;
+
+ /**
+ * The view on which {@link View#setSystemUiVisibility(int)} will be called.
+ */
+ protected View mAnchorView;
+
+ /**
+ * The current UI hider flags.
+ *
+ * @see #FLAG_FULLSCREEN
+ * @see #FLAG_HIDE_NAVIGATION
+ * @see #FLAG_LAYOUT_IN_SCREEN_OLDER_DEVICES
+ */
+ protected int mFlags;
+
+ /**
+ * The current visibility callback.
+ */
+ protected OnVisibilityChangeListener mOnVisibilityChangeListener = sDummyListener;
+
+ /**
+ * Creates and returns an instance of {@link SystemUiHider} that is
+ * appropriate for this device. The object will be either a
+ * {@link SystemUiHiderBase} or {@link SystemUiHiderHoneycomb} depending on
+ * the device.
+ *
+ * @param activity The activity whose window's system UI should be
+ * controlled by this class.
+ * @param anchorView The view on which
+ * {@link View#setSystemUiVisibility(int)} will be called.
+ * @param flags Either 0 or any combination of {@link #FLAG_FULLSCREEN},
+ * {@link #FLAG_HIDE_NAVIGATION}, and
+ * {@link #FLAG_LAYOUT_IN_SCREEN_OLDER_DEVICES}.
+ */
+ public static SystemUiHider getInstance(Activity activity, View anchorView, int flags) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
+ return new SystemUiHiderHoneycomb(activity, anchorView, flags);
+ } else {
+ return new SystemUiHiderBase(activity, anchorView, flags);
+ }
+ }
+
+ protected SystemUiHider(Activity activity, View anchorView, int flags) {
+ mActivity = activity;
+ mAnchorView = anchorView;
+ mFlags = flags;
+ }
+
+ /**
+ * Sets up the system UI hider. Should be called from
+ * {@link Activity#onCreate}.
+ */
+ public abstract void setup();
+
+ /**
+ * Returns whether or not the system UI is visible.
+ */
+ public abstract boolean isVisible();
+
+ /**
+ * Hide the system UI.
+ */
+ public abstract void hide();
+
+ /**
+ * Show the system UI.
+ */
+ public abstract void show();
+
+ /**
+ * Toggle the visibility of the system UI.
+ */
+ public void toggle() {
+ if (isVisible()) {
+ hide();
+ } else {
+ show();
+ }
+ }
+
+ /**
+ * Registers a callback, to be triggered when the system UI visibility
+ * changes.
+ */
+ public void setOnVisibilityChangeListener(OnVisibilityChangeListener listener) {
+ if (listener == null) {
+ listener = sDummyListener;
+ }
+
+ mOnVisibilityChangeListener = listener;
+ }
+
+ /**
+ * A dummy no-op callback for use when there is no other listener set.
+ */
+ private static OnVisibilityChangeListener sDummyListener = new OnVisibilityChangeListener() {
+ @Override
+ public void onVisibilityChange(boolean visible) {
+ }
+ };
+
+ /**
+ * A callback interface used to listen for system UI visibility changes.
+ */
+ public interface OnVisibilityChangeListener {
+ /**
+ * Called when the system UI visibility has changed.
+ *
+ * @param visible True if the system UI is visible.
+ */
+ public void onVisibilityChange(boolean visible);
+ }
+}
diff --git a/app/src/main/java/com/camilstaps/rushhour/util/SystemUiHiderBase.java b/app/src/main/java/com/camilstaps/rushhour/util/SystemUiHiderBase.java
new file mode 100644
index 0000000..bc8615b
--- /dev/null
+++ b/app/src/main/java/com/camilstaps/rushhour/util/SystemUiHiderBase.java
@@ -0,0 +1,63 @@
+package com.camilstaps.rushhour.util;
+
+import android.app.Activity;
+import android.view.View;
+import android.view.WindowManager;
+
+/**
+ * A base implementation of {@link SystemUiHider}. Uses APIs available in all
+ * API levels to show and hide the status bar.
+ */
+public class SystemUiHiderBase extends SystemUiHider {
+ /**
+ * Whether or not the system UI is currently visible. This is a cached value
+ * from calls to {@link #hide()} and {@link #show()}.
+ */
+ private boolean mVisible = true;
+
+ /**
+ * Constructor not intended to be called by clients. Use
+ * {@link SystemUiHider#getInstance} to obtain an instance.
+ */
+ protected SystemUiHiderBase(Activity activity, View anchorView, int flags) {
+ super(activity, anchorView, flags);
+ }
+
+ @Override
+ public void setup() {
+ if ((mFlags & FLAG_LAYOUT_IN_SCREEN_OLDER_DEVICES) == 0) {
+ mActivity.getWindow().setFlags(
+ WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
+ | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
+ WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
+ | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
+ }
+ }
+
+ @Override
+ public boolean isVisible() {
+ return mVisible;
+ }
+
+ @Override
+ public void hide() {
+ if ((mFlags & FLAG_FULLSCREEN) != 0) {
+ mActivity.getWindow().setFlags(
+ WindowManager.LayoutParams.FLAG_FULLSCREEN,
+ WindowManager.LayoutParams.FLAG_FULLSCREEN);
+ }
+ mOnVisibilityChangeListener.onVisibilityChange(false);
+ mVisible = false;
+ }
+
+ @Override
+ public void show() {
+ if ((mFlags & FLAG_FULLSCREEN) != 0) {
+ mActivity.getWindow().setFlags(
+ 0,
+ WindowManager.LayoutParams.FLAG_FULLSCREEN);
+ }
+ mOnVisibilityChangeListener.onVisibilityChange(true);
+ mVisible = true;
+ }
+}
diff --git a/app/src/main/java/com/camilstaps/rushhour/util/SystemUiHiderHoneycomb.java b/app/src/main/java/com/camilstaps/rushhour/util/SystemUiHiderHoneycomb.java
new file mode 100644
index 0000000..d689923
--- /dev/null
+++ b/app/src/main/java/com/camilstaps/rushhour/util/SystemUiHiderHoneycomb.java
@@ -0,0 +1,141 @@
+package com.camilstaps.rushhour.util;
+
+import android.annotation.TargetApi;
+import android.app.Activity;
+import android.os.Build;
+import android.view.View;
+import android.view.WindowManager;
+
+/**
+ * An API 11+ implementation of {@link SystemUiHider}. Uses APIs available in
+ * Honeycomb and later (specifically {@link View#setSystemUiVisibility(int)}) to
+ * show and hide the system UI.
+ */
+@TargetApi(Build.VERSION_CODES.HONEYCOMB)
+public class SystemUiHiderHoneycomb extends SystemUiHiderBase {
+ /**
+ * Flags for {@link View#setSystemUiVisibility(int)} to use when showing the
+ * system UI.
+ */
+ private int mShowFlags;
+
+ /**
+ * Flags for {@link View#setSystemUiVisibility(int)} to use when hiding the
+ * system UI.
+ */
+ private int mHideFlags;
+
+ /**
+ * Flags to test against the first parameter in
+ * {@link android.view.View.OnSystemUiVisibilityChangeListener#onSystemUiVisibilityChange(int)}
+ * to determine the system UI visibility state.
+ */
+ private int mTestFlags;
+
+ /**
+ * Whether or not the system UI is currently visible. This is cached from
+ * {@link android.view.View.OnSystemUiVisibilityChangeListener}.
+ */
+ private boolean mVisible = true;
+
+ /**
+ * Constructor not intended to be called by clients. Use
+ * {@link SystemUiHider#getInstance} to obtain an instance.
+ */
+ protected SystemUiHiderHoneycomb(Activity activity, View anchorView, int flags) {
+ super(activity, anchorView, flags);
+
+ mShowFlags = View.SYSTEM_UI_FLAG_VISIBLE;
+ mHideFlags = View.SYSTEM_UI_FLAG_LOW_PROFILE;
+ mTestFlags = View.SYSTEM_UI_FLAG_LOW_PROFILE;
+
+ if ((mFlags & FLAG_FULLSCREEN) != 0) {
+ // If the client requested fullscreen, add flags relevant to hiding
+ // the status bar. Note that some of these constants are new as of
+ // API 16 (Jelly Bean). It is safe to use them, as they are inlined
+ // at compile-time and do nothing on pre-Jelly Bean devices.
+ mShowFlags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
+ mHideFlags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
+ | View.SYSTEM_UI_FLAG_FULLSCREEN;
+ }
+
+ if ((mFlags & FLAG_HIDE_NAVIGATION) != 0) {
+ // If the client requested hiding navigation, add relevant flags.
+ mShowFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
+ mHideFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
+ | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
+ mTestFlags |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setup() {
+ mAnchorView.setOnSystemUiVisibilityChangeListener(mSystemUiVisibilityChangeListener);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void hide() {
+ mAnchorView.setSystemUiVisibility(mHideFlags);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void show() {
+ mAnchorView.setSystemUiVisibility(mShowFlags);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isVisible() {
+ return mVisible;
+ }
+
+ private View.OnSystemUiVisibilityChangeListener mSystemUiVisibilityChangeListener
+ = new View.OnSystemUiVisibilityChangeListener() {
+ @Override
+ public void onSystemUiVisibilityChange(int vis) {
+ // Test against mTestFlags to see if the system UI is visible.
+ if ((vis & mTestFlags) != 0) {
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
+ // Pre-Jelly Bean, we must manually hide the action bar
+ // and use the old window flags API.
+ mActivity.getActionBar().hide();
+ mActivity.getWindow().setFlags(
+ WindowManager.LayoutParams.FLAG_FULLSCREEN,
+ WindowManager.LayoutParams.FLAG_FULLSCREEN);
+ }
+
+ // Trigger the registered listener and cache the visibility
+ // state.
+ mOnVisibilityChangeListener.onVisibilityChange(false);
+ mVisible = false;
+
+ } else {
+ mAnchorView.setSystemUiVisibility(mShowFlags);
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
+ // Pre-Jelly Bean, we must manually show the action bar
+ // and use the old window flags API.
+ mActivity.getActionBar().show();
+ mActivity.getWindow().setFlags(
+ 0,
+ WindowManager.LayoutParams.FLAG_FULLSCREEN);
+ }
+
+ // Trigger the registered listener and cache the visibility
+ // state.
+ mOnVisibilityChangeListener.onVisibilityChange(true);
+ mVisible = true;
+ }
+ }
+ };
+}
diff --git a/app/src/main/res/layout/activity_fullscreen.xml b/app/src/main/res/layout/activity_fullscreen.xml
new file mode 100644
index 0000000..fe85e97
--- /dev/null
+++ b/app/src/main/res/layout/activity_fullscreen.xml
@@ -0,0 +1,14 @@
+<RelativeLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:id="@+id/board"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="#eeeeee"
+ tools:context=".FullscreenActivity"
+ android:paddingLeft="50dp"
+ android:paddingRight="50dp"
+ android:paddingBottom="50dp"
+ android:paddingTop="80dp">
+
+</RelativeLayout>
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000..cde69bc
--- /dev/null
+++ b/app/src/main/res/mipmap-hdpi/ic_launcher.png
Binary files differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 0000000..c133a0c
--- /dev/null
+++ b/app/src/main/res/mipmap-mdpi/ic_launcher.png
Binary files differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..bfa42f0
--- /dev/null
+++ b/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Binary files differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..324e72c
--- /dev/null
+++ b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/app/src/main/res/values-v11/styles.xml b/app/src/main/res/values-v11/styles.xml
new file mode 100644
index 0000000..f72515d
--- /dev/null
+++ b/app/src/main/res/values-v11/styles.xml
@@ -0,0 +1,15 @@
+<resources>
+
+ <style name="FullscreenTheme" parent="android:Theme.Holo">
+ <item name="android:actionBarStyle">@style/FullscreenActionBarStyle</item>
+ <item name="android:windowActionBarOverlay">true</item>
+ <item name="android:windowBackground">@null</item>
+ <item name="metaButtonBarStyle">?android:attr/buttonBarStyle</item>
+ <item name="metaButtonBarButtonStyle">?android:attr/buttonBarButtonStyle</item>
+ </style>
+
+ <style name="FullscreenActionBarStyle" parent="android:Widget.Holo.ActionBar">
+ <item name="android:background">@color/black_overlay</item>
+ </style>
+
+</resources>
diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml
new file mode 100644
index 0000000..7ce840e
--- /dev/null
+++ b/app/src/main/res/values/attrs.xml
@@ -0,0 +1,12 @@
+<resources>
+
+ <!-- Declare custom theme attributes that allow changing which styles are
+ used for button bars depending on the API level.
+ ?android:attr/buttonBarStyle is new as of API 11 so this is
+ necessary to support previous API levels. -->
+ <declare-styleable name="ButtonBarContainerTheme">
+ <attr name="metaButtonBarStyle" format="reference" />
+ <attr name="metaButtonBarButtonStyle" format="reference" />
+ </declare-styleable>
+
+</resources>
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
new file mode 100644
index 0000000..327c060
--- /dev/null
+++ b/app/src/main/res/values/colors.xml
@@ -0,0 +1,5 @@
+<resources>
+
+ <color name="black_overlay">#66000000</color>
+
+</resources>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..6597eec
--- /dev/null
+++ b/app/src/main/res/values/strings.xml
@@ -0,0 +1,3 @@
+<resources>
+ <string name="app_name">Rush Hour</string>
+</resources>
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
new file mode 100644
index 0000000..8d8c40e
--- /dev/null
+++ b/app/src/main/res/values/styles.xml
@@ -0,0 +1,27 @@
+<resources>
+
+ <!-- Base application theme. -->
+ <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
+ <!-- Customize your theme here. -->
+ </style>
+
+ <style name="FullscreenTheme" parent="android:Theme.NoTitleBar">
+ <item name="android:windowContentOverlay">@null</item>
+ <item name="android:windowBackground">@null</item>
+ <item name="metaButtonBarStyle">@style/ButtonBar</item>
+ <item name="metaButtonBarButtonStyle">@style/ButtonBarButton</item>
+ </style>
+
+ <!-- Backward-compatible version of ?android:attr/buttonBarStyle -->
+ <style name="ButtonBar">
+ <item name="android:paddingLeft">2dp</item>
+ <item name="android:paddingTop">5dp</item>
+ <item name="android:paddingRight">2dp</item>
+ <item name="android:paddingBottom">0dp</item>
+ <item name="android:background">@android:drawable/bottom_bar</item>
+ </style>
+
+ <!-- Backward-compatible version of ?android:attr/buttonBarButtonStyle -->
+ <style name="ButtonBarButton" />
+
+</resources>
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000..d3ff69d
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,19 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+ repositories {
+ jcenter()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:1.1.0'
+
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+}
+
+allprojects {
+ repositories {
+ jcenter()
+ }
+}
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 0000000..1d3591c
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1,18 @@
+# Project-wide Gradle settings.
+
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+# Default value: -Xmx10248m -XX:MaxPermSize=256m
+# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
+
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true \ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..8c0fb64
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.jar
Binary files differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..0c71e76
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Wed Apr 10 15:27:10 PDT 2013
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
diff --git a/gradlew b/gradlew
new file mode 100755
index 0000000..91a7e26
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,164 @@
+#!/usr/bin/env bash
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+ echo "$*"
+}
+
+die ( ) {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+esac
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched.
+if $cygwin ; then
+ [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+fi
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >&-
+APP_HOME="`pwd -P`"
+cd "$SAVED" >&-
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+ JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 0000000..aec9973
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,90 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windowz variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/settings.gradle b/settings.gradle
new file mode 100644
index 0000000..e7b4def
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1 @@
+include ':app'