Closed taku0 closed 11 years ago
This is nice. Maybe it should be something simple like LoginActivity extends Activity with Layout.Login
.
I merged this into master. There was a bug in the camel-case code that was fixed, and I changed the naming around. Please let me know what you think!
Here is a gist illustrating the changes I made: https://gist.github.com/appamatto/6253667
I wrote another typed resources task. This utilize lazy val for more natural interface. For example, suppose we have the following layout: login.xml:
An activity using conventional typed resources may be like this:
With new typed resources, we can write it more concisely:
Note that we do not have to call
setContentView
.Views such as
views.loginButton
are defined withlazy val
.Since
typed_resource.layout.Login.Activity
is a trait rather than a class, we can use custom base activities:We can also define dialogs in a similar way:
Moreover, we also have wrappers suitable for use with
LayoutInflater
orSimplerAdapter.ViewBinder
:I will enhance this task to generate other value resources (e.g. strings, ints, colors).
I named it
TypedResources2
provisionally, but more appropriate name is wanted. Are there any better names?