Back to project page android-mvc-framework.
The source code is released under:
Apache License
If you think the Android project android-mvc-framework listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.android_mvc.framework.task; /*www. j a v a 2 s.c om*/ import java.util.HashMap; import com.android_mvc.framework.annotations.SuppressDebugLog; import com.android_mvc.framework.common.FWUtil; import android.os.AsyncTask; /** * ????????????????????????????? * @author id:language_and_engineering * */ @SuppressDebugLog(false) abstract public class SequentialAsyncTask extends AsyncTask<Void, Void, Void> // TODO:?????? { // TODO: API???13??????????????3.2?????????? // AsyncTask#execute??????????????????????????????????????????? // ???????????????????????????????????? // @see http://www.swingingblue.net/mt/archives/003629.html // @see http://developer.android.com/intl/ja/guide/appendix/api-levels.html // NOTE: AsyncTask?????java.util.concurrent??????????????? // UI??????????????????????????? // https://github.com/android/platform_frameworks_base/blob/master/core/java/android/os/AsyncTask.java // ???????????????? protected AsyncTasksRunner parent = null; // ??????????? private boolean task_execution_result = true; // ?????????????? private HashMap<String, Object> hash = new HashMap<String, Object>(); // ????????????????????????????????????? protected boolean CONTINUE_TASKS = true; protected boolean BREAK_TASKS = false; /** * ???????????????? */ protected void onPreExecuteHook() { // Override me } /** * ??????????????????????????????????????? */ protected abstract boolean main(); /** * ?????????????????????? */ public void kickByRunner( AsyncTasksRunner parent ) { // ???????????????????? this.parent = parent; // ?????? execute(); FWUtil.d("????????????????????????????????"); } /** * ??????????????????????????????? */ public boolean tasksContinuable() { return task_execution_result; } // ------------- ?????????????? ------------ // NOTE: AsyncTask??????????????????? /** * ??????? */ @Override protected void onPreExecute() { onPreExecuteHook(); } /** * ??????? */ protected Void doInBackground(Void... unused) { // ?????????????????????????????????? task_execution_result = main(); FWUtil.d("????????????????????????????????????????" + task_execution_result); return null; } /** * ?????? */ protected void onPostExecute(Void unused) { // ?????????????? parent.onCurrentTaskFinished(); } // ------------- ???????????????????????????????? ------------ /** * ????????????????? */ protected void storeData( String key, Object val ) { hash.put( key, val ); FWUtil.d("????????" + key + "???????????????????????????????????????"); } /** * ????????? */ public HashMap<String, Object> getStoredObjects() { return hash; } // ------------- ?????????????????????????? ------------ /** * ????????????????????????????? */ protected Object getDataFromRunner( String key ) { return parent.getDataByKey( key ); } }