Advertisement
Guest User

Untitled

a guest
Apr 29th, 2015
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 2.06 KB | None | 0 0
  1. package scaloid.example
  2.  
  3. import org.scaloid.common._
  4. import android.graphics.Color
  5. import android.bluetooth.BluetoothAdapter
  6. // import android.bluetooth.BluetoothDevice;
  7. // import android.bluetooth.BluetoothSocket;
  8.  
  9. class HelloScaloid extends SActivity {
  10.  
  11.   val ba = BluetoothAdapter.getDefaultAdapter
  12.  
  13.   onCreate {
  14.     contentView = new SVerticalLayout {
  15.       style {
  16.         case b: SButton => b.textColor(Color.RED).onClick(toast("Bang!"))
  17.         case t: STextView => t textSize 10.dip
  18.         case e: SEditText => e.backgroundColor(Color.YELLOW).textColor(Color.BLACK)
  19.       }
  20.       STextView("I am 10 dip tall")
  21.       STextView("Me too")
  22.       STextView("I am 15 dip tall") textSize 15.dip // overriding
  23.       this += new SLinearLayout {
  24.         STextView("Button: ")
  25.         SButton(R.string.red)
  26.       }.wrap
  27.       SEditText("Yellow input field fills the space!").fill
  28.     } padding 20.dip
  29.   }
  30.  
  31. }
  32. // ~/programming/android/hello-scaloid-sbt $ sbt android:run
  33. // [info] Loading global plugins from /home/cody/.sbt/0.13/plugins
  34. // [info] Loading project definition from /home/cody/source/hello-scaloid-sbt/project
  35. // [info] Set current project to hello-scaloid-sbt (in build file:/home/cody/source/hello-scaloid-sbt/)
  36. // [info] Processing resources
  37. // [info] Compiling 1 Scala source to /home/cody/source/hello-scaloid-sbt/bin/classes...
  38. // [warn] UPDATE: A newer android-sdk-plugin is available: 1.3.22, currently running: 1.3.21
  39. // [warn] UPDATE: A newer android-sdk-plugin is available: 1.3.22, currently running: 1.3.21
  40. // [error] /home/cody/source/hello-scaloid-sbt/src/scaloid/example/HelloScaloid.scala:52: expected class or object definition
  41. // [error] ~/programming/android/hello-scaloid-sbt $ sbt android:run
  42. // [error] ^
  43. // [error] /home/cody/source/hello-scaloid-sbt/src/scaloid/example/HelloScaloid.scala:62: expected class or object definition
  44. // [error] [error]            ^
  45. // [error] ^
  46. // [error] two errors found
  47. // [error] (compile:compileIncremental) Compilation failed
  48. // [error] Total time: 5 s, completed Apr 29, 2015 5:32:58 PM
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement