pocorall/scaloid — pull request #38 by guersam (2013-05-25 04:54:09+00:00)
Title: Initial refactoring with constructor extraction

Major changes
---
- Extract every constructors preserving parameter names.
- Top-level widgets with a lot of new ones

Constuctor extraction
---
1. Now we have every constructor with corresponding parameter names extracted from source jar. Unfortunately, because in Scala we can use only one constructor of super class for concrete class inheritance, I needed to follow [this StackOverflow answer](http://stackoverflow.com/a/3299832) as you can see at [this commit](https://github.com/guersam/scaloid/blob/3dc65a9261d6a93c779fa227af0f2527f395a71f/src/main/scala/org/scaloid/common/Widget.scala#L602-L629).

2. It seemed to work at the first time, however, it was impossible to write an anonymous constructor when instantiating via companion object so I reverted it. Need more discussion.

Widgets as top-level classes
---
1. Now `trait WidgetFamily` are gone and all widgets are top-level classes. Implicit conversions for rich classes are grouped into separate trait in `Implicits.scala`. I have a plan to move other implicits in `package.scala` into `Implicits.scala`.

2. [This template](https://github.com/guersam/scaloid/blob/873dbaa5751e98fdfe6bcdfe7e347ec5680b959d/src/main/st/org/scaloid/common/Implicits.scala#L13) generates implicit conversions for **every** class under specific package, so I needed to add a lot more widgets to make it compile and that's why `Widgets.scala` has become that huge.

3. `SArrayAdapter` is moved into `Widget.scala`. To keep it compatible, I needed to make template a bit more complicated due to that it has certain default value `android.R.layout.simple_spinner_item` in construction. It works great as a convenient shortcut, but we also need to keep the API consistent and flexible. This issue might be related to constructor generation.

4. Added `Widgets.scala.stg` for custom bodies of enriched classes, so that someday we can specify only package and additional classes in `Widgets.scala`, not every class to wrap.

Minor changes
---
1. Wrap invalid method names with backtick, so it's possible to use properties like timePicker.\`24HourView\` or remoteView.\`package\` if someone _really_ want to.

2. Renamed/moved `src/main/st/_helpers.scala.stg` to `project/st/base.scala.stg`.

3. Minor cleanups.