Android Open Source - mazer Job Runner






From Project

Back to project page mazer.

License

The source code is released under:

GNU General Public License

If you think the Android project mazer listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package org.spatialia.santa.util;
//from   w  ww  . j  a va  2 s  . c  om
import android.os.AsyncTask;

public class JobRunner {

  public static abstract class Job {
    public void doWork() {
    }

    public void doUIBefore() {
    }

    public void doUIAfter() {
    }
  }

  public JobRunner() {
  }

  public static void run(Job job) {
    new AsyncServiceTask(job).execute();
  }

  /**
   * Task used in services.
   */
  private static class AsyncServiceTask extends
      AsyncTask<Object, Integer, Long> {

    private Job job;

    public AsyncServiceTask(Job job) {
      super();
      this.job = job;
    }

    @Override
    protected void onPreExecute() {
      job.doUIBefore();
    }

    @Override
    protected Long doInBackground(Object... params) {
      job.doWork();
      return 0L;
    }

    @Override
    protected void onPostExecute(Long result) {
      job.doUIAfter();
    }
  }
}




Java Source Code List

org.spatialia.santa.AlertDialog.java
org.spatialia.santa.GameEngine.java
org.spatialia.santa.GameInput.java
org.spatialia.santa.GameView.java
org.spatialia.santa.MainActivity.java
org.spatialia.santa.Sprite.java
org.spatialia.santa.Tile.java
org.spatialia.santa.logic.LevelManager.java
org.spatialia.santa.logic.Level.java
org.spatialia.santa.logic.Settings.java
org.spatialia.santa.util.JobRunner.java
org.spatialia.santa.util.Perf.java
org.spatialia.santa.util.Post.java