More concise intentsIntents often has a long list of extra attributes. Your code assigning these attributes should looks like this:
This is a shame. Using Scala macros, I made a new function
new Intent().putExtra("valueA", valueA).putExtra("valueB", valueB).putExtra("valueC", valueC)
Intent, that can be used like this:
new Intent().put(valueA, valueB, valueC)
Intents can be startedTo start an activity from the intent above, we are writing like this:
This is concise, but not really readable. From this version, we can rewrite it:
startActivity(SIntent[MyActivity].put(valueA, valueB, valueC))
This looks more natural because it can be translated one-to-one in plain English:
new Intent().put(valueA, valueB, valueC).start[MyActivity]
Create a new Intent, and put values A, B, and C. Then, start the MyActivity.
Wrap or fillI found that I am using layout properties
fillvery frequently. Because layout properties should written in
<<...>>blocks, we have a lot of
<<.fill.>>in our code. This is completely valid, but not very pleasing. Because Scaloid is not stingy with providing shorthands, I dropped out
Now we can specify 'wrap-ness' of a TextView like this:
This looks trivial at first. However, think about how many times you are using it.
Additionally, we provide functions
wf, that is equivalent to
Drops support Scala 2.10Scaloid 3.6 is built on Scala 2.11.3, so you can use it with other Scala 2.11.x versions. From this version, I drops Scala 2.10 support to use full potential of recent improvements on macros.
Building Scala 2.11.3 on AndroidI've found that building Android apps with Scala 2.11.3 (and 2.11.4) results more proguard warning, that prevents Android projects from being built. The error messages are:
Warning: scala.collection.SeqLike$$anon$1: can't find enclosing method 'scala.collection.mutable.Map occCounts(scala.collection.SeqLike,scala.collection.Seq)' in program class scala.collection.SeqLike Warning: scala.collection.immutable.MapProxy$$anon$1: can't find enclosing method 'scala.collection.immutable.MapProxy newProxy(scala.collection.immutable.MapProxy,scala.collection.immutable.Map)' in program class scala.collection.immutable.MapProxy Warning: scala.collection.immutable.SetProxy$$anon$1: can't find enclosing method 'scala.collection.immutable.SetProxy newProxy(scala.collection.immutable.SetProxy,scala.collection.immutable.Set)' in program class scala.collection.immutable.SetProxy Warning: scala.collection.parallel.ParMapLike$$anon$3: can't find enclosing method 'scala.collection.parallel.IterableSplitter scala$collection$parallel$ParMapLike$$keysIterator(scala.collection.parallel.ParMapLike,scala.collection.parallel.IterableSplitter)' in program class scala.collection.parallel.ParMapLike Warning: scala.collection.parallel.ParMapLike$$anon$4: can't find enclosing method 'scala.collection.parallel.IterableSplitter scala$collection$parallel$ParMapLike$$valuesIterator(scala.collection.parallel.ParMapLike,scala.collection.parallel.IterableSplitter)' in program class scala.collection.parallel.ParMapLike Note: there were 1 references to unknown classes. You should check your configuration for typos. (http://proguard.sourceforge.net/manual/troubleshooting.html#unknownclass) Note: there were 2 classes trying to access generic signatures using reflection. You should consider keeping the signature attributes (using '-keepattributes Signature'). (http://proguard.sourceforge.net/manual/troubleshooting.html#attributes) Warning: there were 5 unresolved references to program class members. Your input classes appear to be inconsistent. You may need to recompile the code. (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedprogramclassmember) [trace] Stack trace suppressed: run last android:proguard for the full output.To build it successfully, add
"-keepattributes Signature", "-dontwarn scala.collection.**"to your proguard options. Please refer to this commit log on hello-scaloid-git project that illustrates this patch.
Using Scaloid 3.6Scaloid is released to central maven repository.
For a maven project:
or for an sbt project:
<dependency> <groupId>org.scaloid</groupId> <artifactId>scaloid_2.11</artifactId> <version>3.6-10</version> </dependency>
libraryDependencies += "org.scaloid" %% "scaloid" % "3.6-10"