Commits

littledot5566  committed 7855d19

First commit

  • Participants

Comments (0)

Files changed (15)

+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="src" path="gen"/>
+	<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
+	<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
+	<classpathentry kind="output" path="bin/classes"/>
+</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>Utils</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>com.android.ide.eclipse.adt.ApkBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

File AndroidManifest.xml

+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="nctuwaterloo.littledot.utils"
+    android:versionCode="1"
+    android:versionName="1.0" >
+
+    <uses-sdk
+        android:minSdkVersion="4"
+        android:targetSdkVersion="15" />
+
+    <application
+        android:icon="@drawable/ic_launcher"
+        android:label="@string/app_name"
+        android:theme="@style/AppTheme" >
+    </application>
+
+</manifest>

File ic_launcher-web.png

Added
New image

File libs/android-support-v4.jar

Binary file added.

File proguard-project.txt

+# To enable ProGuard in your project, edit project.properties
+# to define the proguard.config property as described in that file.
+#
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in ${sdk.dir}/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the ProGuard
+# include property in project.properties.
+#
+# 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 *;
+#}

File project.properties

+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system edit
+# "ant.properties", and override values to adapt the script to your
+# project structure.
+#
+# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
+#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
+
+# Project target.
+target=android-4
+android.library=true

File res/drawable-hdpi/ic_launcher.png

Added
New image

File res/drawable-ldpi/ic_launcher.png

Added
New image

File res/drawable-mdpi/ic_launcher.png

Added
New image

File res/drawable-xhdpi/ic_launcher.png

Added
New image

File res/values/strings.xml

+<resources>
+    <string name="app_name">Utils</string>
+</resources>

File res/values/styles.xml

+<resources>
+
+    <style name="AppTheme" parent="android:Theme.Light" />
+
+</resources>

File src/nctuw/littledot/util/Echo.java

+package nctuw.littledot.util;
+
+import android.content.Context;
+import android.widget.Toast;
+
+public class Echo {
+	public static void i(Context context, String msg) {
+		Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
+		Leg.i(msg);
+	}
+
+	public static void d(Context context, String msg) {
+		Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
+		Leg.d(msg);
+	}
+
+	public static void w(Context context, String msg) {
+		Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
+		Leg.w(msg);
+	}
+
+	public static void e(Context context, String msg) {
+		Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
+		Leg.e(msg);
+	}
+}

File src/nctuw/littledot/util/Leg.java

+package nctuw.littledot.util;
+
+/**
+ * 
+ */
+
+import android.util.Log;
+
+/**
+ * A Log that format messages similar to LogCat
+ * 
+ * @author littledot
+ */
+public class Leg {
+	private static final byte	DEBUG_INFO	= 1;
+	private static final byte	DEBUG_DBUG	= 2;
+	private static final byte	DEBUG_WARN	= 3;
+	private static final byte	DEBUG_EROR	= 4;
+
+	public static String i(String msg) {
+		return log(DEBUG_INFO, msg);
+	}
+
+	public static String d(String msg) {
+		return log(DEBUG_DBUG, msg);
+	}
+
+	public static String w(String msg) {
+		return log(DEBUG_WARN, msg);
+	}
+
+	public static String e(String msg) {
+		return log(DEBUG_EROR, msg);
+	}
+
+	private static String log(byte level, String msg) {
+		/* 
+		for (StackTraceElement e : Thread.currentThread().getStackTrace()) {
+			Log.i("Leg", e.toString());
+		}
+		*/
+
+		StackTraceElement e = Thread.currentThread().getStackTrace()[4];
+
+		String fullClassName = e.getClassName();
+
+		String tag = new StringBuilder(fullClassName.substring(fullClassName
+				.lastIndexOf(".") + 1)).append(":").append(e.getLineNumber())
+				.toString();
+
+		String str = new StringBuilder("[").append(e.getMethodName()).append("]: ")
+				.append(msg).toString();
+
+		switch (level) {
+			case DEBUG_INFO:
+				Log.i(tag, str);
+				break;
+			case DEBUG_DBUG:
+				Log.d(tag, str);
+				break;
+			case DEBUG_WARN:
+				Log.w(tag, str);
+				break;
+			case DEBUG_EROR:
+				Log.e(tag, str);
+				break;
+		}
+		return str;
+	}
+}