GithubHelp home page GithubHelp logo

android-tiny-task's Introduction

android-tiny-task

Download
A tiny asynchronized task library for android.

在这里插入图片描述

Solution

  1. we should avoid to use thread, runnable, handler, and AsyncTask;
  2. we should use thread pool executors to handle threads;
  3. we will handle background thread and UI thread, and their interactions, even frequently;
  4. simple and easy to use, focus lifecycle and avoid OOM.

Function

  1. handle asynchronized task in background;
  2. handle asynchronized task first in background and then to front;
  3. handle asynchronized task with delay;
  4. cancel handle asynchronized task.
  5. set task priority.

Technology

  1. Desing Pattern
    1. Singleton Pattern
    2. static
  2. Skill Point
    1. ExecutorService
    2. synchronized
    3. Callable
    4. FutureTask
    5. Handler
    6. Runnable

Usage

  1. only run in background TinyTaskExecutor.execute(new SimpleTask() { ... });
  2. run in background and then go back to main ui; TinyTaskExecutor.execute(new AdvancedTask() { ... });
  3. run with delay TinyTaskExecutor.execute(task, 5000);
  4. remove delay task TinyTaskExecutor.removeTask(task);
  5. check a task(not recommend) TinyTaskExecutor.check();
  6. post to main thread TinyTaskExecutor.postToMainThread(runnable, 2000);
  7. remove post to main thread TinyTaskExecutor.removeMainThreadRunnable(delayRunnable);
  8. set task priority new TestTask(TinyTaskExecutor.PRIORITY_LOWEST); TinyTaskExecutor.execute(s1);

TODO

  1. to cancel when overtime has come;
  2. schedule task;
  3. (done in 20190105) task priority;
  4. (done in 20190119) BlockQueue;
  5. (done in 20190119) customized thread pool and queue;

android-tiny-task's People

Contributors

ddnosh avatar

Watchers

 avatar

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.