Fork me on GitHub

IckleBot  for Android

/'ikəl'bôt/ noun.

1.  A boilerplate code generator with a simplified threading and event model.

2.  A runtime dependency injection framework with model-view binding.


Usage
Setup
Wiki
License

"For quick and maintainable Android development"

Injecting components, binding event listeners or spinning off threads is a breeze.


Usage


Leverage features by extending IckleActivity.

public class LoginActivity extends IckleActivity {	
    ...
}


Manage activity configuration.

@Fullscreen
@Layout(R.layout.act_login)
public class LoginActivity extends IckleActivity {
    ...
}


Inject views and resources.

@Fullscreen
@Layout(R.layout.act_login)
public class LoginActivity extends IckleActivity {

    @InjectView(R.id.edt_username)
    private EditText username;

    @InjectView(R.id.btn_login)
    private Button login;
	
    @InjectDrawable(R.drawable.form_incomplete)
    private Drawable form_incomplete;
	
    ...
}


...or let IckleBot figure it out.

@InjectAll
@Fullscreen
@Layout(R.layout.act_login)
public class LoginActivity extends IckleActivity {

    private EditText edt_username;
    private Button btn_login;
    private Drawable form_incomplete;
	
    ...
}

Notice that the variable names now assume the id.


Preserve instance state.

@InjectAll
@Fullscreen
@Layout(R.layout.act_tokens)
public class LoginActivity extends IckleActivity {

    @Stateful 
    private Integer loginAttempts;
    
    ...
}


Bind an event listener.

@Layout(R.layout.act_messenger)
@Title(R.string.ttl_act_messenger)
public class MessengerActivity extends IckleActivity {

    @InjectView(R.id.btn_send)
    private Button btnSend;

    @Click(R.id.btn_send)
    protected void submit() {

        btnSend.setText("Sending...");
        
        ...
    }
}


Run a background task.

@Layout(R.layout.act_news)
@Title(R.string.ttl_act_news)
public class NewsActivity extends IckleActivity {

    private static final int ASYNC_SYNC_NEWS = 0;

    @Override
    protected void onResume() {

        super.onResume();
        runAsyncTask(ASYNC_SYNC_NEWS);
    }

    @Async(ASYNC_SYNC_NEWS)
    private void refreshNews() { 
        
        ...
    }
}


Bind models to views.

@Layout(R.layout.act_home)
@Title(R.string.ttl_act_home)
public class HomeActivity extends IckleActivity {

    @InjectIckleService
    private BindManager bindManager;
	
    @InjectPojo
    private AccountService accountService;

    @Override
    protected void onPostCreate(Bundle savedInstanceState) {
	
        super.onPostCreate(savedInstanceState);
        	
        User user = accountService.getCurrentUser();
        bindManager.bind(profileSection, user);
    }
}


Respond to network state changes.

@Layout(R.layout.act_mail)
@Title(R.string.ttl_act_mail)
public class MailActivity extends IckleActivity {

    @Override
    protected void onNetworkConnected() {

        inbox.refresh();
    }
}


Setup


For Maven Based Android Projects dd the following dependency in your project's pom.xml.

<dependency>
   <groupId>com.lonepulse</groupId>
   <artifactId>icklebot</artifactId>
   <version>1.2.0</version>
   <type>jar</type>
</dependency>


For standard Android projects, download the IckleBot + Android-Support jars and add them to your libs folder.


Wiki


Read the wiki for more information on dependency injection or the simplified event model.

  1. Quickstart

  2. Manage Activity Configuration

  3. Inject Views and Resources

  4. Inject Services, Application Instances and POJOs

  5. Leverage Implicit Injection

  6. Employ Ickle Services

  7. Use IckleBot's Threading Model

  8. Use IckleBot's Event Model

  9. Handle Changes in Network State

  10. Bind Models to Views

  11. Working with Fragments and the Support Library

  12. Activate Features Selectively

  13. Avoid Coupling with IckleActivity

  14. Avoid Coupling with IckleFragment


License


This library is licensed under Apache License, Version 2.0.