Giter VIP home page Giter VIP logo

naraeasynchronous's Introduction

Deprecated

Please use RichUtils.runAsync() in RichUtilsKt, it interop with kotlin and java.

NaraeAsynchronous

NaraeAsynchronous is Easy-Make Main/Background threading and optimized multi-threading working such as getting image from variable request.

I made this library cause AsyncTask's poolsize is too small in various environment, this can be make lack of my application.

Meaning

NaraeAsynchronous is compound word between "๋‚˜๋ž˜"(Narae) which means "Wing" in traditional korean word and Asynchronous.

Now, I'll give you wings on your Thread!

Features

Generate Main Thread

cannot be use as a UI Thread, use runOnUIThread instead.

NaraeMain naraeMain = new NaraeMain(new Runnable() {
    @Override
    public void run() {
         // TODO: Do something!
    }
});
naraeMain.execute();

Do you want simple-code?

new NaraeMain(new Runnable() {
    @Override
    public void run() {
         // TODO: Do something!
    }
}).execute();

NaraeMain class has one methods, execute().

Generate Background Thread

NaraeAsync naraeAsync = new NaraeAsync(new Runnable() {
   @Override
   public void run() {
       // TODO: Do something!
   } 
});
naraeAsync.execute();

Do you want simple-code?

new NaraeAsync(new Runnable() {
    @Override
    public void run() {
        //TODO: Do something!
    }
}).execute();

This features has Compatibility code of AsyncTask.

new NaraeAsync(new Runnable() {
    @Override
    public void run() {
        //TODO: Do something!
    }
}).executeOnExecutor();

Constructor

  • Runnable runnable : Compulsory Object, Runnable object to run
  • int poolSize : Optional Object, Pool size to execute multi-threading. Default value provided.
    • Basic Mode: Core Count + 1;
    • AsyncTask compatibility mode: Available Core Count + 1;
  • String taskType : Optional Object, Task type. Default value provided.

License

NaraAsync Task have Compatibility code of AsyncTask.

 Copyright (C) 2008 The Android Open Source Project

 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.

Combining Background threading + Main threading

This features provide you to execute background thread and execute main thread after executing background thread.

NaraeTask naraeTask = new NaraeTask(new NaraeInterface() {
    @Override
    public Object doInBackground() {
        return null;
    }

    @Override
    public void onPostExecute(Object o) {

    }
});
naraeTask.execute();

also, you can use simple-code.

 new NaraeTask(new NaraeInterface() {
    @Override
    public Object doInBackground() {
        return null;
    }

    @Override
    public void onPostExecute(Object o) {

    }
}).execute();

also, you can give specific return type.

new NaraeTask(new NaraeInterface<String>() {
    @Override
    public String doInBackground() {
        return null;
    }

    @Override
    public void onPostExecute(String s) {

    }
}).execute();

Constructor

  • Runnable runnable : Compulsory Object, Runnable object to run
  • int poolSize : Optional Object, Pool size to execute multi-threading. Default value provided.
    • Basic Mode: Core Count + 1;
    • AsyncTask compatibility mode: Available Core Count + 1;

Changes

v 1.1.0 (2017. 01. 31)

  • adding AsyncTask compatibility mode in NaraeAsync
  • Language change: Korean -> English
  • Refactoring some code
  • Rewrite README.md

v 1.0.0 (2015. 06. 22)

  • Inital Commit

Contacts

"pyxis.moe#gmail.com".replace("#", "@");

License

Regards to my philosophy, All library disributed by MIT License, You can see License File in here

naraeasynchronous's People

Contributors

windsekirun avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

morristech

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.