Manage Activity Configuration
Traditionally activities are configuration in the `AndroidManifest.xml` or in `onCreate()`. `IckleActivity` instances isolate the configuration on the activity definition itself using annotations.
####1. Specify Title and Layout
Use @Title
to specify the action bar title and @Layout
to set the content view.
@Layout(R.layout.act_home)
@Title(R.string.ttl_act_home)
public class HomeActivity extends IckleActivity {
}
####2. Enable Fullscreen
Use @Fullscreen
to hide the action and status bars.
@Fullscreen
@Layout(R.layout.act_home)
public class HomeActivity extends IckleActivity {
}
####3. Request Window Features
Use @WindowFeatures
to request further configuration.
@Layout(R.layout.act_home)
@Title(R.string.ttl_act_home)
@WindowFeatures({Window.FEATURE_ACTION_BAR_OVERLAY})
public class HomeActivity extends IckleActivity {
}
####4. Save and Restore Instance State
Use @Stateful
to save and restore state without having to use onSaveInstanceState(Bundle)
and
onRestoreInstanceState(Bundle)
.
@Layout(R.layout.act_login)
@Title(R.string.ttl_act_login)
public class LoginActivity extends IckleActivity {
@Stateful
private int loginAttempts;
...
}
####5. Activate Features Selectively
A segregated activation of IckelBot's features is possible by using the concept of profiles on an IckleActivity
. A single profile offers a feature such as injection or event handling. To activate a set of profiles use the @Profiles
annotation and specify the profiles to be activated.
@Profiles({PROFILE.THREADING, PROFILE.EVENT})
public class ContactActivity extends IckleActivity {
...
}
In the above example, other features such as dependency injection will fail.