What is Actionbarsherlock for Android?

Asked

Viewed 98 times

1

A former colleague used this framework/lib I do not know in a company project for Android and restricted the version to android 4.0+, but we need to run on Android version 2.3+... so I see no option if not withdraw this business. I noticed that all activities have a second class called NomeActivity_, terrible that.

I’m using some annotations that seem to me to be theirs with @click to assign a function to a button, nothing that a method returning a Listener does not solve.

So what is this framework for? What is it good for the project? on the Site I saw that it would be just a way to add actionBar to the project, but even that we use... has some utility this business?

1 answer

4


Those notes aren’t from Actionbarsherlock and yes of the Android Annotations.

To Actionbarsherlock is responsible for providing an implementation of ActionBar for devices with Android version less than 3.0. Currently the library appcompat already provides this compatibility implementation, it is no longer necessary to use the Actionbarsherlock. Besides ActionBar is going into disuse in favor of the Toolbar version 5.0, which the appcompat also provides compatibility.


The library Android Annotations adds some annotations, which serve as shortcuts for certain actions, functionalities and declarations, which generally reduce the amount of redundant and repetitive written code ("Boilerplate"). The biggest advantage dictated by the creators of the library would be the increase in productivity.

Example:

@ViewById -> chama o findViewById da Activity após o setContentView
@EActivity -> chama o setContentView com o id especificado na anotação

The use of this library has its advantages and disadvantages, it depends a lot on each project/team.

The suffix _ in NomeActivity_ is a side effect because for each class noted, for example NomeActivity, generates a new class with this suffix, with all the auto-generated code corresponding to each of these annotations.

These functions in principle do not impact performance, because all extra code is generated at compile time, but it may be that the code is not the most optimized (sometimes it doesn’t even matter for legibility/productivity).

You can look in the folder gen of Eclipse or search it using the Ctrl-R or Ctrl-T and view the auto-generated code.

In the case of Android Studio, I believe you need to go target/generated-sources/annotations and see the generated code.

For more details: http://androidannotations.org


About the version, the two libraries support Android 2.3. I suggest you survey which libraries the project has and check on their Androidmanifest which versions they put as a minimum.

If you don’t have any, I recommend doing a very thorough test/analysis of the code as there may be calls to the API for newer versions that will generate error at runtime (some lint may be alert at compile time). E.g: Animation API (Objectanimator, Valueanimator, Viewpropertyanimator and etc...).

Browser other questions tagged

You are not signed in. Login or sign up in order to post.