ATuin

Hadaly simple sample

Jul 20th, 2013
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 1.19 KB | None | 0 0
  1. package com.monoiz.matchismo
  2.  
  3. import com.monoiz.hadaly.ViewM._
  4. import com.monoiz.hadaly.MonadReader.MonadReader._
  5. import com.monoiz.hadaly.Implicits._
  6. import ViewM._
  7. import Views._
  8.  
  9. import org.scaloid.common._
  10. import org.scaloid.common._
  11. import _root_.android.os.Bundle
  12. import android.graphics.Color
  13. import android.widget.{Button, TextView, LinearLayout}
  14. import android.view.View
  15. import android.content.Context
  16. //import com.monoiz.hadaly.ViewM.{S, VTypeGroup}
  17.  
  18. class Matchismo extends SActivity {
  19.   type ViewSM = List[TraitViewGroup[_]]
  20.  
  21.   override def onCreate(savedState: Bundle) {
  22.     super.onCreate(savedState)
  23.  
  24.     val prefs = Preferences()
  25.     val card = textViewV("Ð") <+| (Background -> Color.RED) |+>
  26.     val cardRow = sequence((1 to 5).map(_ => textViewV("Ð")))
  27.     val cardRows = (1 to 4) map(_ => linearLayoutV <+ cardRow)
  28.     val cardsUI = verticalLayoutV <+ sequence(cardRows map (_.asViewM))
  29.     val rows = (for {
  30.       i <- 1 to 4
  31.       j <- 1 to 4
  32.     } yield buttonV(s"Btn$i$j")).grouped(4).map(linearLayoutV <+ sequence(_)).toSeq
  33.  
  34.     val layoutVL1 = verticalLayoutV <+ sequence(rows map (_.asViewM))
  35.  
  36.     val k = cardsUI.render
  37.     setContentView(k)
  38.   }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment