Toothpick


Source link: https://github.com/stephanenicolas/toothpick

Toothpick (a.k.a T.P. like a teepee)






Visit TP wiki !

What is Toothpick ?

Toothpick is a scope tree based Dependency Injection (DI) library for Java.

It is a full-featured, runtime based, but reflection free, implementation of JSR 330.

What does Toothpick offer ?

//a typical Toothpick scope tree during the execution of an Android app.

@ApplicationSingleton

  /

  |
 \

  /

|
  \

  /

 |

\
 @PresenterSingleton  |
Service 2

 /

  |

 /

Service 1

 /

 Activity 1
  /
\
 /
Fragment 2
/ Fragment 1 

Toothpick is :

Hey, Android Devs, you can use TP to create MVP apps so easily !

Examples

Currently Toothpick has 2 sets of examples :

Setup

For Android :

#android setup using gradle 2.2.3 buildscript {

repositories {

  jcenter()

}

dependencies {

  classpath 'com.android.tools.build:gradle:2.2.3'

}
 
}
  ...  dependencies {

compile 'com.github.stephanenicolas.toothpick:toothpick-runtime:1.1.1'
// and for android -> compile 'com.github.stephanenicolas.toothpick:smoothie:1.1.1'
annotationProcessor 'com.github.stephanenicolas.toothpick:toothpick-compiler:1.1.1'
 //highly recommended
testCompile 'com.github.stephanenicolas.toothpick:toothpick-testing:1.1.1'
testCompile 'mockito or easymock' 
}

For java:

<!--java setup with maven -->
<dependencies>
  <dependency>

 <groupId>com.github.stephanenicolas.toothpick</groupId>

 <artifactId>toothpick-compiler</artifactId>

 <version>1.1.1</version>

 <scope>compile</scope>
  </dependency>
  <dependency>

 <groupId>com.github.stephanenicolas.toothpick</groupId>

 <artifactId>toothpick-runtime</artifactId>

 <version>1.1.1</version>

 <scope>compile</scope>
  </dependency>

 <!-- highly recommended-->
  <dependency>

  <groupId>com.github.stephanenicolas.toothpick</groupId>

 <artifactId>toothpick-testing</artifactId>

 <version>1.1.1</version>

 <scope>test</scope>
  </dependency>
  <dependency>
  <easymock or mockito>
  </dependency>
</dependencies>

Support

TP is actively maintained and we provide support to questions via the Toothpick-di tag on Stack Over Flow.

Ask questions on Stack Over Flow while keeping the GitHub issue board for real issues. Thx in advance !

Talks & Articles

Wanna know more ?

Visit Toothpick's wiki !

Alternative Dependency Injection (DI) engines for Android

Libs using TP

  • Okuki is a simple, hierarchical navigation bus and back stack for Android, with optional Rx bindings, and Toothpick DI integration.
  • KotlinWeather is a simple example of using ToothPick with Kotlin and gradle integration using kapt.

Resources

Useful library for selecting images and videos from sd-card. The library can be used to display images & videos in file view or folder view. File view shows all files whereas Folder view shows files categorized. All items are sorted according to date-time with latest item showing first.

Gmail like pull to refresh implementation.

You can see Teleport as an Android Wear "plugin" you can add to your Activities and Services.

Teleport provides you commodity classes to easily establish a communication between a mobile handheld device and an Android Wear device.

BlurBehind is a library to add blur effect for your Android views.

Before API level 14 there was a Window flag called FLAG_BLUR_BEHIND. It was used for "blurring everything behind a window" and is no longer supported by Android.

BlurBehind provides an easy way to have that effect, with customization, for your window without API level restrictions.

A library for creating Data Access Objects from Android Cursors and converting them back into ContentValues.

Burst is a set of test runners which rely on enums for varying both the instantiation of test classes and the methods inside of them.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes