Permalink
Browse files

ListenerUtils

  • Loading branch information...
0 parents commit a92cfc14dafa59c3477835063768eb9f9a0a5700 @napthats committed Sep 30, 2012
Showing with 47 additions and 0 deletions.
  1. +4 −0 .gitignore
  2. +12 −0 build.sbt
  3. +1 −0 project/build.properties
  4. +12 −0 src/main/scala/App.scala
  5. +18 −0 src/test/scala/AppSpec.scala
@@ -0,0 +1,4 @@
+*.swp
+target*
+lib*
+
@@ -0,0 +1,12 @@
+name := "android_utils"
+
+organization := "com.napthats"
+
+version := "0.2.0-SNAPSHOT"
+
+scalaVersion := "2.9.1"
+
+libraryDependencies ++= Seq(
+ "org.specs2" %% "specs2" % "1.12" % "test"
+)
+
@@ -0,0 +1 @@
+sbt.version=0.11.3
@@ -0,0 +1,12 @@
+package com.napthats.android
+
+import _root_.android.view.View
+
+object ListenerUtils {
+ implicit def function2ViewOnClickListener(f: View => Unit): View.OnClickListener = {
+ new View.OnClickListener() {
+ def onClick(view: View) { f(view) }
+ }
+ }
+}
+
@@ -0,0 +1,18 @@
+package com.napthats.android_utils
+
+import org.specs2.mutable._
+
+class AppSpec extends Specification {
+
+ "The 'Hello world' string" should {
+ "contain 11 characters" in {
+ "Hello world" must have size(11)
+ }
+ "start with 'Hello'" in {
+ "Hello world" must startWith("Hello")
+ }
+ "end with 'world'" in {
+ "Hello world" must endWith("world")
+ }
+ }
+}

0 comments on commit a92cfc1

Please sign in to comment.