]> Pileus Git - ~andy/spades/commitdiff
Initial import
authorAndy Spencer <andy753421@gmail.com>
Sun, 7 Apr 2013 01:26:55 +0000 (01:26 +0000)
committerAndy Spencer <andy753421@gmail.com>
Sun, 7 Apr 2013 08:54:01 +0000 (08:54 +0000)
.gitignore [new file with mode: 0644]
AndroidManifest.xml [new file with mode: 0644]
makefile [new file with mode: 0644]
res/layout/main.xml [new file with mode: 0644]
res/values/strings.xml [new file with mode: 0644]
src/org/pileus/spades/Main.java [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..756a502
--- /dev/null
@@ -0,0 +1,8 @@
+# Vim junk
+*~
+*.swp
+
+# Android junk
+bin/
+gen/
+obj/
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
new file mode 100644 (file)
index 0000000..8646b4b
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+       package="org.pileus.spades"
+       android:versionCode="1"
+       android:versionName="1.0">
+       <application android:label="@string/app_name" >
+               <activity android:name="Main"
+                       android:label="@string/app_name">
+                       <intent-filter>
+                               <action android:name="android.intent.action.MAIN" />
+                               <category android:name="android.intent.category.LAUNCHER" />
+                       </intent-filter>
+               </activity>
+       </application>
+</manifest>
diff --git a/makefile b/makefile
new file mode 100644 (file)
index 0000000..0e800dc
--- /dev/null
+++ b/makefile
@@ -0,0 +1,78 @@
+# Settings
+ANDROID := /opt/android-sdk-update-manager/platforms/android-10/android.jar
+PACKAGE := org.pileus.spades
+OUTPUT  := bin/Spades.apk
+
+# Sources
+RES     := $(shell find res -name '*.xml')
+SRC     := $(shell find src -name '*.java')
+
+# Objects
+GEN     := gen/$(subst .,/,$(PACKAGE))/R.java
+OBJ     := $(subst .java,.class,   \
+                $(SRC:src/%=obj/%) \
+                $(GEN:gen/%=obj/%))
+
+# Targets
+default: run
+
+compile: $(OBJ)
+
+debug: $(OUTPUT)
+
+clean:
+       rm -rf bin gen obj
+
+logcat:
+       adb logcat Spades:D '*:S'
+
+run: bin/install.stamp
+       adb shell am start -W -a android.intent.action.MAIN -n $(PACKAGE)/.Main
+       
+
+install bin/install.stamp: $(OUTPUT)
+       adb uninstall $(PACKAGE)
+       adb install -r $+
+       touch bin/install.stamp
+
+# Rules
+%.apk: %.dex %.res | bin
+       @echo "APK    $@.in"
+       @apkbuilder $@.in -f $*.dex -z $*.res
+       @echo ALIGN $@
+       @zipalign -f 4 $@.in $@
+
+%.dex: $(OBJ) | bin
+       @echo "DEX    $@ "
+       @dx --dex --output $@ obj
+
+%.res: AndroidManifest.xml $(RES) | bin
+       @echo "RES    $@"
+       @aapt package -f -m               \
+               -I $(ANDROID)             \
+               -M AndroidManifest.xml    \
+               -S res                    \
+               -F $*.res
+
+$(OBJ): $(SRC) $(GEN) | obj
+       @echo "JAVAC  $@"
+       @javac -g                         \
+               -bootclasspath $(ANDROID) \
+               -encoding      UTF-8      \
+               -source        1.5        \
+               -target        1.5        \
+               -classpath     obj        \
+               -d             obj        \
+               $+
+
+$(GEN): AndroidManifest.xml $(RES) | gen
+       @echo "GEN    $@"
+       @aapt package -f -m               \
+               -I $(ANDROID)             \
+               -M AndroidManifest.xml    \
+               -S res                    \
+               -J gen
+
+# Directories
+bin gen obj:
+       @mkdir -p $@
diff --git a/res/layout/main.xml b/res/layout/main.xml
new file mode 100644 (file)
index 0000000..7534108
--- /dev/null
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+       xmlns:android="http://schemas.android.com/apk/res/android"
+       android:orientation="vertical"
+       android:layout_width="fill_parent"
+       android:layout_height="fill_parent">
+       <TextView
+               android:layout_width="fill_parent"
+               android:layout_height="wrap_content"
+               android:text="hello, spades" />
+</LinearLayout>
+
diff --git a/res/values/strings.xml b/res/values/strings.xml
new file mode 100644 (file)
index 0000000..01f0ed9
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+       <string name="app_name">Spades</string>
+</resources>
diff --git a/src/org/pileus/spades/Main.java b/src/org/pileus/spades/Main.java
new file mode 100644 (file)
index 0000000..d8d79b4
--- /dev/null
@@ -0,0 +1,14 @@
+package org.pileus.spades;
+
+import android.app.Activity;
+import android.os.Bundle;
+
+public class Main extends Activity
+{
+       @Override
+       public void onCreate(Bundle savedInstanceState)
+       {
+               super.onCreate(savedInstanceState);
+               setContentView(R.layout.main);
+       }
+}