<commit_before># HdAsync

**A android asynchronous communication library based on Handler**

`HandlerThread/Handler` emebed in Andorid framework makes UI thread and background thread communication easily.But when chained or hierarchical invoke happens,callbak logic is harder to handle.It turns out to be either callback inside callback or original  "continuous" logic being divided into a mess. Meanwhile because callback usually implemented as a innner static class which is likely leading to memory leak in Android enviroment.

`HdAync` is not a standanlone lib,it depends on handler and encapsulate some functions below:
* Refrencing common used `promise-future` modle in async communication,HdAsync can combine chained or hierachical invoke as easily as you can image.On the coding level,this lib can shorten the 'logical distance' between asyncronous invokes.Though there is still a gap in achieving the effect of coroutine in some language, this libwill make  callback constucion as `compack` as possible.
* Instead of providing a thread to execute the code explicitly, choose a looper at every single step in chains, HdAync will do the rest for you and accomplish the whole combined task between different thread.
* User can choose whether connitue the task or not after a step finished.
* HdAsync can be returned or transfered to another caller to be combined or invoked.
* Through  mthods as  `weak reference`,`static innner class` and `lifecycle` management HdAsync minimize the posibility of memory leak.

## For example

Initialize a synchronous Activity

``` Java
public class SampleActivity extends Activity {
<commit_msg>modify readme.md<commit_after># HdAsync

**A android asynchronous communication library based on Handler**

`HandlerThread/Handler` emebed in Andorid framework makes UI thread and background thread communication easily.But when chained or hierarchical invoke happens,callbak logic is harder to handle.It turns out to be either callback inside callback or original  "continuous" logic being divided into a mess. Meanwhile because callback usually implemented as a innner static class which is likely leading to memory leak in Android enviroment.

`HdAsync` is not a standanlone lib,it depends on handler and encapsulate some functions below:
* Refrencing common used `promise-future` modle in async communication,HdAsync can combine chained or hierachical invoke as easily as you can image.On the coding level,this lib can shorten the 'logical distance' between asyncronous invokes.Though there is still a gap in achieving the effect of coroutine in some language, this libwill make  callback constucion as `compack` as possible.
* Instead of providing a thread to execute the code explicitly, choose a looper at every single step in chains, HdAync will do the rest for you and accomplish the whole combined task between different thread.
* User can choose whether connitue the task or not after a step finished.
* HdAsync can be returned or transfered to another caller to be combined or invoked.
* Through  mthods as  `weak reference`,`static innner class` and `lifecycle` management HdAsync minimize the posibility of memory leak.

## For example

Initialize a synchronous Activity

``` Java
public class SampleActivity extends Activity {

{'fraction_non_alphanumeric': 0.0363026235509457, 'fraction_numerical': 0.0, 'mean_word_length': 5.222011385199241, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3449441', 'n_tokens_mistral': 783, 'n_tokens_neox': 762, 'n_words': 463}