Soujanya
Lurker
Making applications for Android is pretty a tough project. inside the technique we programmers should write hundreds and thousands of strains of code to make someday even easy obligations. but that’s not all! inside the last years, we programmers have struggled with new APIs, and most of them turn out to be out of date in a completely short time frame so we need to keep gaining knowledge of the ones APIs again and again (tremendous point out: Google Play offerings, fb SDK or the Android SDK itself).
I would love to present in this text one of the high-quality capabilities covered in a growing framework that might trade the manner Android improvement is finished.
DecleX is a framework that objectives to get towards a fully Declarative Language for Android improvement. it is completely based on AndroidAnnotations; it enables the writing and the renovation of apps to the highest stage which has no longer been completed thus far.
With it, programmers lessen dramatically the time for coding those packages, being capable of code 4 to 5 times quicker, writing even 90% less code. The renovation of those packages will become away a lot easier, and it opens opportunities to integrate 3rd events libraries in spite of 1 single annotation through its Plugin Mechanism.
Views Injection
Views injection has been assisting programmers to speed up the improvement of packages in the last years in Android development. Libraries like ButterKnife and AndroidAnnotations have made viable to take away the stressful findViewById method…
However have you ever ever suppose that views injections are nevertheless a number of boilerplate code?, when you have a model permit’s say a version describing an consumer, that have the user first name, last name and e-mail.. and also you want to display that statistics inside the display however also permit to the user to regulate the records and positioned that information back to the version, in AndroidAnnotations you would do it like this:
@bean
User_ user;
@ViewById
TextView userFirstName;
@ViewById
TextView userLastName;
@ViewById
TextView userEmail;
@ViewById
ImageView userImage;
@AfterViews
void populateForm() {
userFirstName.setText(user.getFirstName());
userLastName.setText(user.getLastName());
userEmail.setText(user.getEmail());
Picasso.with(this).load(user.getImage()).into(userImage);
}
@Click
void saveUser() {
user.setFirstName(userFirstName.getText().toString());
user.setLastName(userLastName.getText().toString());
user.setEmail(userEmail.getText().toString());
}
It is a massive development, especially in comparison with the stressful calls to “findViewById”. In uncooked Android, the amount of traces of code to write down these strategies might be a whole lot longer (and obfuscated).
but, isn’t by some means redundant to should get the views from the pastime or Fragment, and then fill those with the version facts?, I imply, after all, this is an one-to-one relation among this version and the user interface…
Coping with this question I were given to the concept of Populating and Recollecting perspectives with DecleX, what if populate a form may be as clean as describing with one phrase what you need: to expose all of the facts of a model within the consumer interface. Getting that facts lower back should be very clean as properly.
Populating and Recollecting
With DecleX that is less difficult than ever, what is wanted is to declare with a @Populate annotation your area:
@model
@Populate
User user;
The framework will automatically read all the data in the model, and will insert all that data in the user interface… See that @model will inject the model from wherever is required (Ex. the SQLite database or it’ll be downloaded from a server).
I would love to present in this text one of the high-quality capabilities covered in a growing framework that might trade the manner Android improvement is finished.
DecleX is a framework that objectives to get towards a fully Declarative Language for Android improvement. it is completely based on AndroidAnnotations; it enables the writing and the renovation of apps to the highest stage which has no longer been completed thus far.
With it, programmers lessen dramatically the time for coding those packages, being capable of code 4 to 5 times quicker, writing even 90% less code. The renovation of those packages will become away a lot easier, and it opens opportunities to integrate 3rd events libraries in spite of 1 single annotation through its Plugin Mechanism.
Views Injection
Views injection has been assisting programmers to speed up the improvement of packages in the last years in Android development. Libraries like ButterKnife and AndroidAnnotations have made viable to take away the stressful findViewById method…
However have you ever ever suppose that views injections are nevertheless a number of boilerplate code?, when you have a model permit’s say a version describing an consumer, that have the user first name, last name and e-mail.. and also you want to display that statistics inside the display however also permit to the user to regulate the records and positioned that information back to the version, in AndroidAnnotations you would do it like this:
@bean
User_ user;
@ViewById
TextView userFirstName;
@ViewById
TextView userLastName;
@ViewById
TextView userEmail;
@ViewById
ImageView userImage;
@AfterViews
void populateForm() {
userFirstName.setText(user.getFirstName());
userLastName.setText(user.getLastName());
userEmail.setText(user.getEmail());
Picasso.with(this).load(user.getImage()).into(userImage);
}
@Click
void saveUser() {
user.setFirstName(userFirstName.getText().toString());
user.setLastName(userLastName.getText().toString());
user.setEmail(userEmail.getText().toString());
}
It is a massive development, especially in comparison with the stressful calls to “findViewById”. In uncooked Android, the amount of traces of code to write down these strategies might be a whole lot longer (and obfuscated).
but, isn’t by some means redundant to should get the views from the pastime or Fragment, and then fill those with the version facts?, I imply, after all, this is an one-to-one relation among this version and the user interface…
Coping with this question I were given to the concept of Populating and Recollecting perspectives with DecleX, what if populate a form may be as clean as describing with one phrase what you need: to expose all of the facts of a model within the consumer interface. Getting that facts lower back should be very clean as properly.
Populating and Recollecting
With DecleX that is less difficult than ever, what is wanted is to declare with a @Populate annotation your area:
@model
@Populate
User user;
The framework will automatically read all the data in the model, and will insert all that data in the user interface… See that @model will inject the model from wherever is required (Ex. the SQLite database or it’ll be downloaded from a server).