-
Notifications
You must be signed in to change notification settings - Fork 2
TheDroid4mizer
The droid4me framework has been built with the following requirement in mind: make it possible to take legacy code compatible with it. This is especially true when it comes to build an application which also needs to use a library which forces to use basis Activity
and Fragment
classes.
On that purpose, the core of the droid4me Activity
and Fragment
basis classes use the Droid4mizer
component, which is used to instrument those entities, and make them first citizen classes of the framework, so that they are turned into "droid4me-ready" entities.
The framework imposes the following constraints, so that entities benefit from all facets of the framework:
- make them implement the
Smartable
interface. More specifically, theActivity
must implement theSmartableActivity
interface ; - delegate the implementation of the previous interface methods to a
Droid4mizer
interface ; - override the traditional Android
Activity
/Entity
workflow methods: 1.onCreate()
1.onResume()
1.onStart()
1.onPause()
1.onStop()
1.onDestroy()
1.onSaveInstanceState()
The menu-related methods: 1.
onCreateOptionsMenu()
1.onPrepareOptionsMenu()
1.onOptionsItemSelected()
1.onContextItemSelected()
TheActivity
result activity: 1.onActivityResult()
TheActivity
should moreover override the following methods: 1.onNewIntent()
1.onContentChanged()
TheFragment
should moreover override the following method: 1.onAttach()
Those constraints are both true for the
Activity
andFragment
entity classes. Once those methods have been overloaded, plus the one specific to theSmartable
interface, your class is a first-citizen class of the framework, and it benefits all its facets.
Because this process requires a lot of boilerplate code, and because, we have not found another way to achieve those steps another way, copy, pasting & adapting the source code of the SmartActivity
.
...