|
@@ -31,32 +31,31 @@ import java.util.List;
|
|
|
|
|
|
|
|
public class RAUploadManager {
|
|
public class RAUploadManager {
|
|
|
|
|
|
|
|
- public int maxThread = 3;
|
|
|
|
|
|
|
+
|
|
|
|
|
+ private int retryWaiting = 300;
|
|
|
public int activeThread;
|
|
public int activeThread;
|
|
|
- public int maxRetry = 5;
|
|
|
|
|
- public int retryWaiting = 300;
|
|
|
|
|
|
|
+
|
|
|
|
|
+ public int maxThread = 3;
|
|
|
|
|
+ private int maxRetry = 5;
|
|
|
|
|
+ private Boolean wifiOnly = false;
|
|
|
|
|
+ private Boolean autoStart=true;
|
|
|
|
|
+ private Boolean removeFinish=true;
|
|
|
|
|
+ private Boolean removeError=false;
|
|
|
|
|
+ public TaskStatus newtaskStatus = TaskStatus.TaskStatusWait;
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
- public Boolean wifiOnly = false;
|
|
|
|
|
- // public Boolean autoStart=true;
|
|
|
|
|
-// public Boolean removeFinish=true;
|
|
|
|
|
-// public Boolean removeError=false;
|
|
|
|
|
- public QueueStatus queue_status;
|
|
|
|
|
|
|
+ private QueueStatus queue_status;
|
|
|
|
|
|
|
|
|
|
|
|
|
public static final int RESULT_BARCODE_ERROR = -50;
|
|
public static final int RESULT_BARCODE_ERROR = -50;
|
|
|
|
|
|
|
|
- public TaskStatus newtaskStatus = TaskStatus.TaskStatusWait;
|
|
|
|
|
private ArrayList<Bundle> arr_queue;
|
|
private ArrayList<Bundle> arr_queue;
|
|
|
|
|
|
|
|
public ArrayList<Bundle> get_arr_queue() {
|
|
public ArrayList<Bundle> get_arr_queue() {
|
|
|
return arr_queue;
|
|
return arr_queue;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // private List<Bundle> operation_queue;
|
|
|
|
|
-// private ExecutorService es = Executors.newFixedThreadPool(3);//
|
|
|
|
|
- // .newFixedThreadPool();
|
|
|
|
|
-// private CountDownLatch latch = new CountDownLatch(maxThread);
|
|
|
|
|
private RAOperationQueue operation_queue;
|
|
private RAOperationQueue operation_queue;
|
|
|
|
|
|
|
|
public enum QueueStatus {
|
|
public enum QueueStatus {
|
|
@@ -76,43 +75,93 @@ public class RAUploadManager {
|
|
|
//TaskStatusCancel,
|
|
//TaskStatusCancel,
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// public RAUploadManager(Context applicationContext)
|
|
|
|
|
-// {
|
|
|
|
|
-// if(applicationContext==null)
|
|
|
|
|
-// throw new IllegalArgumentException("applicationContext can't be null");
|
|
|
|
|
-// this.applicationContext = applicationContext;
|
|
|
|
|
-// }
|
|
|
|
|
- public UIUpdateListener uiUpdateListener;
|
|
|
|
|
|
|
+ public static class RAUploadManagerConfigure {
|
|
|
|
|
+
|
|
|
|
|
+ public Boolean autoStart=false;
|
|
|
|
|
+ public Boolean removeFinish=false;
|
|
|
|
|
+ public Boolean removeError=false;
|
|
|
|
|
+ public Boolean wifiOnly = false;
|
|
|
|
|
+
|
|
|
|
|
+ public int maxRetry = 5;
|
|
|
|
|
+ public int maxThread = 3;
|
|
|
|
|
+
|
|
|
|
|
+ public TaskStatus newtaskStatus = TaskStatus.TaskStatusWait;
|
|
|
|
|
+
|
|
|
|
|
+ private Context appContext;
|
|
|
|
|
+
|
|
|
|
|
+ RAUploadManagerConfigure(Context applicationContext) {
|
|
|
|
|
+ appContext = applicationContext;
|
|
|
|
|
+ if (applicationContext == null) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ SharedPreferences UMSetting = RAUtil.sharedPreferences(applicationContext,"UploadManager");
|
|
|
|
|
+
|
|
|
|
|
+ if (UMSetting != null) {
|
|
|
|
|
+ autoStart = UMSetting.getBoolean("auto_upload",false);
|
|
|
|
|
+ removeFinish = UMSetting.getBoolean("auto_rm_finish",false);
|
|
|
|
|
+ removeError = UMSetting.getBoolean("auto_rm_error",false);
|
|
|
|
|
+ wifiOnly = UMSetting.getBoolean("wifi_only", false);
|
|
|
|
|
+
|
|
|
|
|
+ maxRetry = UMSetting.getInt("retry_count", 5);
|
|
|
|
|
+ maxThread = UMSetting.getInt("max_thread", 3);
|
|
|
|
|
+
|
|
|
|
|
+ newtaskStatus = TaskStatus.values()[UMSetting.getInt("newtask_status", TaskStatus.TaskStatusWait.ordinal())];
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private void save() {
|
|
|
|
|
+
|
|
|
|
|
+ if (appContext != null) {
|
|
|
|
|
+
|
|
|
|
|
+ SharedPreferences UMSetting = RAUtil.sharedPreferences(appContext,"UploadManager");
|
|
|
|
|
+ if (UMSetting != null) {
|
|
|
|
|
+
|
|
|
|
|
+ SharedPreferences.Editor editor = UMSetting.edit();
|
|
|
|
|
+ editor.putBoolean("auto_upload",autoStart);
|
|
|
|
|
+ editor.putBoolean("auto_rm_finish",removeFinish);
|
|
|
|
|
+ editor.putBoolean("auto_rm_error",removeError);
|
|
|
|
|
+ editor.putBoolean("wifi_only",wifiOnly);
|
|
|
|
|
+ editor.putInt("retry_count",maxRetry);
|
|
|
|
|
+ editor.putInt("max_thread",maxThread);
|
|
|
|
|
+ editor.putInt("newtask_status",newtaskStatus.ordinal());
|
|
|
|
|
+
|
|
|
|
|
+ editor.apply();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public interface configureBlock {
|
|
|
|
|
+ void configure(RAUploadManagerConfigure configure);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public static void configureUploadManager(Context applicationContext, configureBlock blk) {
|
|
|
|
|
+
|
|
|
|
|
+ if (applicationContext != null) {
|
|
|
|
|
+
|
|
|
|
|
+ RAUploadManagerConfigure configure = new RAUploadManagerConfigure(applicationContext);
|
|
|
|
|
+ if (blk != null) {
|
|
|
|
|
+ blk.configure(configure);
|
|
|
|
|
+ }
|
|
|
|
|
+ configure.save();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
-// private Application mApp;
|
|
|
|
|
|
|
+
|
|
|
|
|
+ public UIUpdateListener uiUpdateListener;
|
|
|
private Context applicationContext;
|
|
private Context applicationContext;
|
|
|
-// public void setApplication(Application application) {
|
|
|
|
|
-// mApp = application;
|
|
|
|
|
-// }
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
public interface UIUpdateListener {
|
|
public interface UIUpdateListener {
|
|
|
- // void onProgress(long index, double percentage);
|
|
|
|
|
void updateCell(long index, Bundle taskinfo);
|
|
void updateCell(long index, Bundle taskinfo);
|
|
|
-// void updateList();
|
|
|
|
|
-
|
|
|
|
|
void updateList(ArrayList<Bundle> newlist);
|
|
void updateList(ArrayList<Bundle> newlist);
|
|
|
-// void addTasks(ArrayList<Bundle> tasks);
|
|
|
|
|
-// void RemoveTasks(ArrayList<Bundle> tasks);
|
|
|
|
|
-
|
|
|
|
|
-// void onFinish(int code, String res/*, HashMap<String, List<String>> headers*/);
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
-// class Poll implements Runnable {
|
|
|
|
|
-// public void run() {
|
|
|
|
|
-// // while (queue.size()>0) {
|
|
|
|
|
-// while (!operation_queue.isEmpty()) {
|
|
|
|
|
-// System.out.println(operation_queue.poll());
|
|
|
|
|
-// }
|
|
|
|
|
-// latch.countDown();
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-
|
|
|
|
|
public RAUploadManager(Context appCtx) {
|
|
public RAUploadManager(Context appCtx) {
|
|
|
|
|
|
|
|
if(appCtx==null)
|
|
if(appCtx==null)
|
|
@@ -125,9 +174,9 @@ public class RAUploadManager {
|
|
|
SharedPreferences UMSetting = RAUtil.sharedPreferences(applicationContext,"UploadManager");
|
|
SharedPreferences UMSetting = RAUtil.sharedPreferences(applicationContext,"UploadManager");
|
|
|
|
|
|
|
|
if (UMSetting != null) {
|
|
if (UMSetting != null) {
|
|
|
-// autoStart = UMSetting.getBoolean("auto_upload",false);
|
|
|
|
|
-// removeFinish = UMSetting.getBoolean("auto_rm_finish",false);
|
|
|
|
|
-// removeError = UMSetting.getBoolean("auto_rm_error",false);
|
|
|
|
|
|
|
+ autoStart = UMSetting.getBoolean("auto_upload",false);
|
|
|
|
|
+ removeFinish = UMSetting.getBoolean("auto_rm_finish",false);
|
|
|
|
|
+ removeError = UMSetting.getBoolean("auto_rm_error",false);
|
|
|
maxRetry = UMSetting.getInt("retry_count", 5);
|
|
maxRetry = UMSetting.getInt("retry_count", 5);
|
|
|
newtaskStatus = TaskStatus.values()[UMSetting.getInt("newtask_status", TaskStatus.TaskStatusWait.ordinal())];
|
|
newtaskStatus = TaskStatus.values()[UMSetting.getInt("newtask_status", TaskStatus.TaskStatusWait.ordinal())];
|
|
|
|
|
|
|
@@ -137,78 +186,11 @@ public class RAUploadManager {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
operation_queue = new RAOperationQueue(applicationContext);
|
|
operation_queue = new RAOperationQueue(applicationContext);
|
|
|
-// operation_queue.setApplication(mApp);
|
|
|
|
|
operation_queue.setCallback(new RAOperationQueue.OperationCallback() {
|
|
operation_queue.setCallback(new RAOperationQueue.OperationCallback() {
|
|
|
@Override
|
|
@Override
|
|
|
public Boolean operate(final Bundle taskinfo) {
|
|
public Boolean operate(final Bundle taskinfo) {
|
|
|
|
|
|
|
|
|
|
|
|
|
-//
|
|
|
|
|
-// ConnectivityManager connManager = (ConnectivityManager) context
|
|
|
|
|
-// .getSystemService(Context.CONNECTIVITY_SERVICE);
|
|
|
|
|
-//
|
|
|
|
|
-// NetworkInfo networkInfo = connManager
|
|
|
|
|
-// .getActiveNetworkInfo();
|
|
|
|
|
-// if (networkInfo == null)
|
|
|
|
|
-// {
|
|
|
|
|
-// dbgUtil.Logd(
|
|
|
|
|
-// "Current Network info",
|
|
|
|
|
-// "can not get Active NetworkInfo!");
|
|
|
|
|
-// false;
|
|
|
|
|
-// }
|
|
|
|
|
-// NetworkInfo.State netState = networkInfo
|
|
|
|
|
-// .getState();
|
|
|
|
|
-// if (netState != NetworkInfo.State.CONNECTED)
|
|
|
|
|
-// {
|
|
|
|
|
-// dbgUtil.Logd(
|
|
|
|
|
-// "Current Network info",
|
|
|
|
|
-// "not Connected!State="
|
|
|
|
|
-// + netState);
|
|
|
|
|
-// return;
|
|
|
|
|
-// }
|
|
|
|
|
-// int iconntype = -1;
|
|
|
|
|
-// iconntype = networkInfo
|
|
|
|
|
-// .getType();
|
|
|
|
|
-// SharedPreferences pref = RedAntApplication
|
|
|
|
|
-// .getInstance()
|
|
|
|
|
-// .getSharedPreferences(
|
|
|
|
|
-// "UploadManager",
|
|
|
|
|
-// 0);
|
|
|
|
|
-//
|
|
|
|
|
-//// String aa = pref
|
|
|
|
|
-//// .getString(
|
|
|
|
|
-//// "aa",
|
|
|
|
|
-//// null);
|
|
|
|
|
-//// String ea = pref
|
|
|
|
|
-//// .getString(
|
|
|
|
|
-//// "ea",
|
|
|
|
|
-//// null);
|
|
|
|
|
-//// if (iconntype == ConnectivityManager.TYPE_WIFI)
|
|
|
|
|
-//// {
|
|
|
|
|
-//// if (!TextUtils
|
|
|
|
|
-//// .isEmpty(aa))
|
|
|
|
|
-//// RedAntApplication.active_address = aa;
|
|
|
|
|
-//// }
|
|
|
|
|
-//// else
|
|
|
|
|
-//// {
|
|
|
|
|
-//// if (!TextUtils
|
|
|
|
|
-//// .isEmpty(ea))
|
|
|
|
|
-//// RedAntApplication.active_address = ea;
|
|
|
|
|
-//// }
|
|
|
|
|
-// boolean
|
|
|
|
|
-// wifi_only
|
|
|
|
|
-// =pref.getBoolean("wifi_only",
|
|
|
|
|
-// true);
|
|
|
|
|
-//
|
|
|
|
|
-// if
|
|
|
|
|
-// (wifi_only
|
|
|
|
|
-// == true
|
|
|
|
|
-// && iconntype !=
|
|
|
|
|
-// ConnectivityManager.TYPE_WIFI
|
|
|
|
|
-// && iconntype !=
|
|
|
|
|
-// 9/* earthnet */)
|
|
|
|
|
-//
|
|
|
|
|
-
|
|
|
|
|
boolean ret = false;
|
|
boolean ret = false;
|
|
|
String path = taskinfo.getString("path");
|
|
String path = taskinfo.getString("path");
|
|
|
taskinfo.putInt("status", TaskStatus.TaskStatusStart.ordinal());
|
|
taskinfo.putInt("status", TaskStatus.TaskStatusStart.ordinal());
|
|
@@ -230,9 +212,7 @@ public class RAUploadManager {
|
|
|
} catch (InterruptedException e) {
|
|
} catch (InterruptedException e) {
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
|
}
|
|
}
|
|
|
-// }catch(InterruptedException ie){
|
|
|
|
|
-// ie.printStackTrace();
|
|
|
|
|
-// }
|
|
|
|
|
|
|
+
|
|
|
JSONObject result = Network.uploadFileJSON(path, url, taskinfo.getBundle("params"), new Network.FileUploadListener() {
|
|
JSONObject result = Network.uploadFileJSON(path, url, taskinfo.getBundle("params"), new Network.FileUploadListener() {
|
|
|
@Override
|
|
@Override
|
|
|
public double percent_step() {
|
|
public double percent_step() {
|
|
@@ -242,8 +222,6 @@ public class RAUploadManager {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public boolean interupt() {
|
|
public boolean interupt() {
|
|
|
-// if(taskinfo.getBoolean("iscancel",false))
|
|
|
|
|
-// return false;
|
|
|
|
|
return taskinfo.getBoolean("iscancel", false);
|
|
return taskinfo.getBoolean("iscancel", false);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -257,7 +235,6 @@ public class RAUploadManager {
|
|
|
taskinfo.putDouble("progress", percentage);
|
|
taskinfo.putDouble("progress", percentage);
|
|
|
if (uiUpdateListener != null) {
|
|
if (uiUpdateListener != null) {
|
|
|
int index = arr_queue.indexOf(taskinfo);
|
|
int index = arr_queue.indexOf(taskinfo);
|
|
|
-// uiUpdateListener.onProgress(index,percentage);
|
|
|
|
|
|
|
|
|
|
uiUpdateListener.updateCell(index, taskinfo);
|
|
uiUpdateListener.updateCell(index, taskinfo);
|
|
|
}
|
|
}
|
|
@@ -305,7 +282,6 @@ public class RAUploadManager {
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (JSONException e) {
|
|
} catch (JSONException e) {
|
|
|
-// String rmsg=result.getString("msg");
|
|
|
|
|
taskinfo.putInt("status", TaskStatus.TaskStatusError.ordinal());
|
|
taskinfo.putInt("status", TaskStatus.TaskStatusError.ordinal());
|
|
|
taskinfo.putDouble("progress", 0.0);
|
|
taskinfo.putDouble("progress", 0.0);
|
|
|
taskinfo.putString("msg", "can not upload, please contact administrator.");
|
|
taskinfo.putString("msg", "can not upload, please contact administrator.");
|
|
@@ -326,18 +302,6 @@ public class RAUploadManager {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
return ret;
|
|
|
-// int a=0;
|
|
|
|
|
-// System.out.println(a+"running tid="+Thread.currentThread().getId());
|
|
|
|
|
-// int min=1000;
|
|
|
|
|
-// int max=5000;
|
|
|
|
|
-// int sleep=new Random().nextInt(max)%(max-min+1) + min;
|
|
|
|
|
-// try{
|
|
|
|
|
-// Thread.currentThread().sleep(sleep);
|
|
|
|
|
-// }catch(InterruptedException ie){
|
|
|
|
|
-// ie.printStackTrace();
|
|
|
|
|
-// }
|
|
|
|
|
-// System.out.println(a+" "+sleep+" finish tid="+Thread.currentThread().getId());
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -359,10 +323,10 @@ public class RAUploadManager {
|
|
|
///////////////////////////////////////////////
|
|
///////////////////////////////////////////////
|
|
|
|
|
|
|
|
boolean removefromlist = false;
|
|
boolean removefromlist = false;
|
|
|
-// if (status==TaskStatus.TaskStatusFinish&&removeFinish)
|
|
|
|
|
-// removefromlist=true;
|
|
|
|
|
-// else if (status==TaskStatus.TaskStatusError&&removeError)
|
|
|
|
|
-// removefromlist=true;
|
|
|
|
|
|
|
+ if (status==TaskStatus.TaskStatusFinish&&removeFinish)
|
|
|
|
|
+ removefromlist=true;
|
|
|
|
|
+ else if (status==TaskStatus.TaskStatusError&&removeError)
|
|
|
|
|
+ removefromlist=true;
|
|
|
|
|
|
|
|
synchronized (this) {
|
|
synchronized (this) {
|
|
|
|
|
|
|
@@ -371,9 +335,9 @@ public class RAUploadManager {
|
|
|
if (removefromlist) {
|
|
if (removefromlist) {
|
|
|
|
|
|
|
|
removeTask(taskinfo);
|
|
removeTask(taskinfo);
|
|
|
-// arr_queue.remove(taskinfo);
|
|
|
|
|
-// if(uiUpdateListener!=null)
|
|
|
|
|
-// uiUpdateListener.updateList();
|
|
|
|
|
|
|
+ arr_queue.remove(taskinfo);
|
|
|
|
|
+ if(uiUpdateListener!=null)
|
|
|
|
|
+ uiUpdateListener.updateList(arr_queue);
|
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
} else {
|
|
@@ -381,19 +345,12 @@ public class RAUploadManager {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Log.d("_synchronized", "OperationCallback operateFinish: end" + (System.currentTimeMillis() - timeStart));
|
|
Log.d("_synchronized", "OperationCallback operateFinish: end" + (System.currentTimeMillis() - timeStart));
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-// saveTasks();
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- // operation_queue = new List<Bundle>() {};
|
|
|
|
|
-
|
|
|
|
|
loadTask();
|
|
loadTask();
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -410,26 +367,6 @@ public class RAUploadManager {
|
|
|
String tasksBase64 = pref.getString("task_list", "");
|
|
String tasksBase64 = pref.getString("task_list", "");
|
|
|
|
|
|
|
|
|
|
|
|
|
-// ArrayList<String> wrap_arr = new ArrayList<String>();
|
|
|
|
|
-// for( Bundle b:arr_queue)
|
|
|
|
|
-// {
|
|
|
|
|
-// String sjson=RAUtil.Bundle2Json(b).toString();
|
|
|
|
|
-// Log.d("_RAIMAGE", "saveTasks: "+sjson);
|
|
|
|
|
-// wrap_arr.add(sjson);
|
|
|
|
|
-// }
|
|
|
|
|
-//
|
|
|
|
|
-// ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
|
|
|
|
-// ObjectOutputStream oos = new ObjectOutputStream(baos);
|
|
|
|
|
-// oos.writeObject(wrap_arr);
|
|
|
|
|
-//
|
|
|
|
|
-// String tasksBase64 = android.util.Base64.encodeToString(baos.toByteArray(), android.util.Base64.DEFAULT);//new String(Base64.encodeBase64(baos.toByteArray()));
|
|
|
|
|
-//
|
|
|
|
|
-//
|
|
|
|
|
-// editor.putString("task_list", tasksBase64);
|
|
|
|
|
-//
|
|
|
|
|
-//
|
|
|
|
|
-// editor.commit();
|
|
|
|
|
-
|
|
|
|
|
if (tasksBase64.length() > 0) {
|
|
if (tasksBase64.length() > 0) {
|
|
|
byte[] decode = Base64.decode(tasksBase64, Base64.DEFAULT);
|
|
byte[] decode = Base64.decode(tasksBase64, Base64.DEFAULT);
|
|
|
ByteArrayInputStream bais = new ByteArrayInputStream(decode);
|
|
ByteArrayInputStream bais = new ByteArrayInputStream(decode);
|
|
@@ -444,9 +381,6 @@ public class RAUploadManager {
|
|
|
JSONObject jsobj = new JSONObject((String)s);
|
|
JSONObject jsobj = new JSONObject((String)s);
|
|
|
Bundle b = RAUtil.Json2Bundle(jsobj);
|
|
Bundle b = RAUtil.Json2Bundle(jsobj);
|
|
|
arr_queue.add(b);
|
|
arr_queue.add(b);
|
|
|
-// String sjson=RAUtil.Bundle2Json(b).toString();
|
|
|
|
|
-
|
|
|
|
|
-// wrap_arr.add(sjson);
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -570,12 +504,10 @@ public class RAUploadManager {
|
|
|
public void clearTask() {
|
|
public void clearTask() {
|
|
|
ArrayList<Bundle> remove = new ArrayList<Bundle>();
|
|
ArrayList<Bundle> remove = new ArrayList<Bundle>();
|
|
|
for (Bundle b : arr_queue) {
|
|
for (Bundle b : arr_queue) {
|
|
|
-// if(TaskStatus.values()[b.getInt("status",0)]==TaskStatus.TaskStatusStart||TaskStatus.values()[b.getInt("status",0)]==TaskStatus.TaskStatusWait)
|
|
|
|
|
-// continue;
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
if (TaskStatus.values()[b.getInt("status", 0)] == TaskStatus.TaskStatusFinish || TaskStatus.values()[b.getInt("status", 0)] == TaskStatus.TaskStatusError)
|
|
if (TaskStatus.values()[b.getInt("status", 0)] == TaskStatus.TaskStatusFinish || TaskStatus.values()[b.getInt("status", 0)] == TaskStatus.TaskStatusError)
|
|
|
remove.add(b);
|
|
remove.add(b);
|
|
|
-// removeTask(b);
|
|
|
|
|
}
|
|
}
|
|
|
removeTasks(remove);
|
|
removeTasks(remove);
|
|
|
|
|
|
|
@@ -655,16 +587,6 @@ public class RAUploadManager {
|
|
|
return;
|
|
return;
|
|
|
|
|
|
|
|
task.putBoolean("iscancel", true);
|
|
task.putBoolean("iscancel", true);
|
|
|
-// long tid=task.getLong("tid",-1);
|
|
|
|
|
-// if(tid>0)
|
|
|
|
|
-// {
|
|
|
|
|
-//
|
|
|
|
|
-//
|
|
|
|
|
-// }
|
|
|
|
|
-// task.tet("tid",Thread.currentThread().getId());
|
|
|
|
|
-
|
|
|
|
|
-// RAUploadOperation
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -696,45 +618,17 @@ public class RAUploadManager {
|
|
|
|
|
|
|
|
editor.commit();
|
|
editor.commit();
|
|
|
|
|
|
|
|
-// byte[] decode=Base64.decode(personBase64,Base64.DEFAULT);
|
|
|
|
|
-// ByteArrayInputStream bais= new ByteArrayInputStream(decode);
|
|
|
|
|
-//
|
|
|
|
|
-// ObjectInputStream ois = new ObjectInputStream(bais);
|
|
|
|
|
-// ArrayList<String> arr_load=(ArrayList<String>)ois.readObject();
|
|
|
|
|
-// int a = 0;
|
|
|
|
|
-
|
|
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-// if (m_swSave.isChecked()&&!TextUtils.isEmpty(encryptPass)&&!TextUtils.isEmpty(encryptUser))
|
|
|
|
|
-// {
|
|
|
|
|
-// editor.putString("user", encryptUser);
|
|
|
|
|
-// editor.putString("password", encryptPass);
|
|
|
|
|
-// editor.putBoolean("kepppass", true);
|
|
|
|
|
-// }
|
|
|
|
|
-// else
|
|
|
|
|
-// {
|
|
|
|
|
-// editor.putString("user", null);
|
|
|
|
|
-// editor.putString("password", null);
|
|
|
|
|
-// editor.putBoolean("kepppass", false);
|
|
|
|
|
-// }
|
|
|
|
|
-//
|
|
|
|
|
-// editor.puts
|
|
|
|
|
-//
|
|
|
|
|
-// editor.commit();
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private String filePath(Bundle task) {
|
|
private String filePath(Bundle task) {
|
|
|
-// String path = Environment.getExternalStorageDirectory().getPath();
|
|
|
|
|
-// path+="/"+task.getString("path");
|
|
|
|
|
-// path+="/"+task.getString("file");
|
|
|
|
|
|
|
|
|
|
return task.getString("path", "");
|
|
return task.getString("path", "");
|
|
|
}
|
|
}
|