-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
49 changed files
with
824 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
Aibolit | ||
======= | ||
|
||
Simple lightweight dependency injection implementation for Android | ||
|
||
|
||
|
||
|
||
Scope | ||
===== | ||
Injecting view by id | ||
Injecing application resource: array adapter, drawable, string, animation, boolean, integer, dimension, array, color | ||
Inflating layout | ||
Injecting system services | ||
Injecting custom application services | ||
|
||
|
||
|
||
|
||
Usage | ||
===== | ||
Just put aibolit-*.jar in classpath | ||
|
||
|
||
|
||
|
||
Example | ||
======= | ||
public class AibolitChatActivity extends Activity { | ||
|
||
// annotate fields to be injected... | ||
|
||
@InjectView(R.id.messageEditText) | ||
private EditText messageEditText; | ||
|
||
@InjectView(R.id.historyListView) | ||
private ListView historyListView; | ||
|
||
@InjectResource(R.string.symbols_count) | ||
private String symbolsCountPattern; | ||
|
||
@InjectSystemService(Context.NOTIFICATION_SERVICE) | ||
private NotificationManager notificationManager; | ||
|
||
@InjectService | ||
private HttpManager httpManager; | ||
|
||
@InjectResource(R.layout.content) | ||
private View content; | ||
|
||
... | ||
|
||
@Override | ||
public void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
|
||
setContentView(R.layout.chat_activity); | ||
// initialize annotated fields and methods | ||
Aibolit.doInjections(this); | ||
|
||
// or just Aibolit.setInjectedContentView(this); | ||
|
||
... | ||
} | ||
|
||
// annotate event handlers... | ||
|
||
@InjectOnClickListener(R.id.sendButton) | ||
private void onSendButtonClick(View v) { | ||
// handle onClick event | ||
} | ||
|
||
@InjectOnClickListener(R.id.clearHistoryButton) | ||
private void onClearHistoryButtonClick(View v) { | ||
// handle onClick event | ||
} | ||
|
||
@InjectOnTextChangedListener(R.id.messageEditText) | ||
public void onMessageTextChanged(CharSequence s, int start, int before, int count) { | ||
// handle text changed event | ||
} | ||
|
||
... | ||
|
||
} | ||
|
||
|
||
|
||
|
||
Developed By | ||
=========== | ||
Alexey Danilov - danikula@gmail.com | ||
|
||
|
||
|
||
License | ||
======= | ||
Copyright (C) 2011 Alexey Danilov | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
com.danikula.aibolit/src/com/danikula/aibolit/InjectingException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
com.danikula.aibolit/src/com/danikula/aibolit/InjectionContext.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
com.danikula.aibolit/src/com/danikula/aibolit/InvisibleInjectionContext.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
com.danikula.aibolit/src/com/danikula/aibolit/MethodInvocationHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
com.danikula.aibolit/src/com/danikula/aibolit/ServicesResolver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
com.danikula.aibolit/src/com/danikula/aibolit/Validate.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
com.danikula.aibolit/src/com/danikula/aibolit/VisibleInjectionContext.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
com.danikula.aibolit/src/com/danikula/aibolit/annotation/AibolitSettings.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
com.danikula.aibolit/src/com/danikula/aibolit/annotation/InjectArrayAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
com.danikula.aibolit/src/com/danikula/aibolit/annotation/InjectOnCheckedChangeListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
com.danikula.aibolit/src/com/danikula/aibolit/annotation/InjectOnClickListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
...nikula.aibolit/src/com/danikula/aibolit/annotation/InjectOnCreateContextMenuListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.