Open rxx opened 11 years ago
The approach that Scaloid advocate is ui-layout-without-xml, not replacing every kind of xml descriptions. Use your resources as described in Android developer guide.
Although I suggest that marking up layout with normal Scala code, Scaloid is fully compatible with xml layout. If your project's layouts are already written in xml, you can freely access it from Scala code:
val button = find[Button](R.id.mybutton)
@pocorall But we could create some template engine for resources. It will be compiled to xml on runtime or on request. Crazy idea, of course.
Every great ideas is looked crazy at first. I think your idea is worthwhile. I will reopen this issue until I rewrite this idea to be more detailed.
Before completely replace all of the XMLs, I will firstly focus on "supporting multiple devices". Because Scaloid layout is ordinary Scala code, there are almost nothing to do to adapt multiple devices, except some if
statements.
However, because many peoples requested explicit example about this, I will write some helper doing this.
@pocorall I requested too :smile: I just think we must separate resources variables and layouts with other code
@pocorall One more thing for dsl - support IDE. For now, eclipse and intellij idea help us with build android resources and write xml-layouts. If we will use only dynamic resources, we will have to build all for ourselves. If we have some standard rules for build layouts with scala we can create custom plugins for idea and eclipse for example. It is a not first-priority goal but we can look out it
For statical analysis purpose, declarative language (e.g. XML and JSON) is better than procedural language (e.g. Java and Scala). For some alternative methods replacing XMLs, such as SBT and Spring Java Config, difficulty of IDE support is a major weakness.
As we don't have much workforce, plugin development will be an issue of someday in the future.
Hello, I've looked on scaloid layouts without xml and I have some questions: