修复 双引号的bug
This commit is contained in:
@@ -22,8 +22,8 @@ dependencies {
|
|||||||
compile fileTree(include: ['*.jar'], dir: 'libs')
|
compile fileTree(include: ['*.jar'], dir: 'libs')
|
||||||
testCompile 'junit:junit:4.12'
|
testCompile 'junit:junit:4.12'
|
||||||
compile 'com.android.support:appcompat-v7:23.1.1'
|
compile 'com.android.support:appcompat-v7:23.1.1'
|
||||||
// compile project(':AriaAnnotations')
|
compile project(':AriaAnnotations')
|
||||||
compile 'com.arialyy.aria:aria-ftp-plug:1.0.3'
|
// compile 'com.arialyy.aria:aria-ftp-plug:1.0.3'
|
||||||
|
|
||||||
compile project(':AriaFtpPlug')
|
compile project(':AriaFtpPlug')
|
||||||
}
|
}
|
||||||
|
@@ -26,14 +26,8 @@ import android.app.Service;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.widget.PopupWindow;
|
import android.widget.PopupWindow;
|
||||||
import com.arialyy.annotations.Download;
|
|
||||||
import com.arialyy.annotations.Upload;
|
|
||||||
import com.arialyy.aria.core.download.DownloadReceiver;
|
import com.arialyy.aria.core.download.DownloadReceiver;
|
||||||
import com.arialyy.aria.core.scheduler.IDownloadSchedulerListener;
|
|
||||||
import com.arialyy.aria.core.scheduler.ISchedulerListener;
|
|
||||||
import com.arialyy.aria.core.download.DownloadTask;
|
|
||||||
import com.arialyy.aria.core.upload.UploadReceiver;
|
import com.arialyy.aria.core.upload.UploadReceiver;
|
||||||
import com.arialyy.aria.core.upload.UploadTask;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by lyy on 2016/12/1.
|
* Created by lyy on 2016/12/1.
|
||||||
|
@@ -23,20 +23,19 @@ import android.database.sqlite.SQLiteOpenHelper;
|
|||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.v4.util.LruCache;
|
import android.support.v4.util.LruCache;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
|
||||||
import com.arialyy.aria.core.AriaManager;
|
import com.arialyy.aria.core.AriaManager;
|
||||||
import com.arialyy.aria.util.ALog;
|
import com.arialyy.aria.util.ALog;
|
||||||
import com.arialyy.aria.util.CheckUtil;
|
import com.arialyy.aria.util.CheckUtil;
|
||||||
import com.arialyy.aria.util.CommonUtil;
|
import com.arialyy.aria.util.CommonUtil;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
|
import java.net.URLDecoder;
|
||||||
|
import java.net.URLEncoder;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by lyy on 2015/11/2.
|
* Created by lyy on 2015/11/2.
|
||||||
@@ -204,7 +203,7 @@ final class SqlHelper extends SQLiteOpenHelper {
|
|||||||
sql = sql.replace("?", "%s");
|
sql = sql.replace("?", "%s");
|
||||||
Object[] params = new String[expression.length - 1];
|
Object[] params = new String[expression.length - 1];
|
||||||
for (int i = 0, len = params.length; i < len; i++) {
|
for (int i = 0, len = params.length; i < len; i++) {
|
||||||
params[i] = "\"" + expression[i + 1] + "\"";
|
params[i] = "'" + expression[i + 1] + "'";
|
||||||
}
|
}
|
||||||
sql = String.format(sql, params);
|
sql = String.format(sql, params);
|
||||||
print(FIND_DATA, sql);
|
print(FIND_DATA, sql);
|
||||||
@@ -227,7 +226,7 @@ final class SqlHelper extends SQLiteOpenHelper {
|
|||||||
sql = sql.replace("?", "%s");
|
sql = sql.replace("?", "%s");
|
||||||
Object[] params = new String[expression.length - 1];
|
Object[] params = new String[expression.length - 1];
|
||||||
for (int i = 0, len = params.length; i < len; i++) {
|
for (int i = 0, len = params.length; i < len; i++) {
|
||||||
params[i] = "\"" + expression[i + 1] + "\"";
|
params[i] = "'" + checkValue(expression[i + 1]) + "'";
|
||||||
}
|
}
|
||||||
sql = String.format(sql, params);
|
sql = String.format(sql, params);
|
||||||
print(FIND_DATA, sql);
|
print(FIND_DATA, sql);
|
||||||
@@ -269,7 +268,7 @@ final class SqlHelper extends SQLiteOpenHelper {
|
|||||||
sb.append("SELECT rowid, * FROM ").append(CommonUtil.getClassName(clazz)).append(" where ");
|
sb.append("SELECT rowid, * FROM ").append(CommonUtil.getClassName(clazz)).append(" where ");
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (Object where : wheres) {
|
for (Object where : wheres) {
|
||||||
sb.append(where).append("=").append("\"").append(values[i]).append("\"");
|
sb.append(where).append("=").append("'").append(checkValue(values[i])).append("'");
|
||||||
sb.append(i >= wheres.length - 1 ? "" : " AND ");
|
sb.append(i >= wheres.length - 1 ? "" : " AND ");
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@@ -281,6 +280,13 @@ final class SqlHelper extends SQLiteOpenHelper {
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String checkValue(String value) {
|
||||||
|
if (value.contains("'")) {
|
||||||
|
return URLEncoder.encode(value);
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查找表的所有数据
|
* 查找表的所有数据
|
||||||
*/
|
*/
|
||||||
@@ -319,7 +325,7 @@ final class SqlHelper extends SQLiteOpenHelper {
|
|||||||
sql = sql.replace("?", "%s");
|
sql = sql.replace("?", "%s");
|
||||||
Object[] params = new String[expression.length - 1];
|
Object[] params = new String[expression.length - 1];
|
||||||
for (int i = 0, len = params.length; i < len; i++) {
|
for (int i = 0, len = params.length; i < len; i++) {
|
||||||
params[i] = "\"" + expression[i + 1] + "\"";
|
params[i] = "'" + expression[i + 1] + "'";
|
||||||
}
|
}
|
||||||
sql = String.format(sql, params);
|
sql = String.format(sql, params);
|
||||||
SqlHelper.print(DEL_DATA, sql);
|
SqlHelper.print(DEL_DATA, sql);
|
||||||
@@ -362,7 +368,7 @@ final class SqlHelper extends SQLiteOpenHelper {
|
|||||||
//sb.append(field.getName()).append("='");
|
//sb.append(field.getName()).append("='");
|
||||||
String value;
|
String value;
|
||||||
prams.append(i > 0 ? ", " : "");
|
prams.append(i > 0 ? ", " : "");
|
||||||
prams.append(field.getName()).append("=\"");
|
prams.append(field.getName()).append("='");
|
||||||
Type type = field.getType();
|
Type type = field.getType();
|
||||||
if (type == Map.class) {
|
if (type == Map.class) {
|
||||||
value = SqlUtil.map2Str((Map<String, String>) field.get(dbEntity));
|
value = SqlUtil.map2Str((Map<String, String>) field.get(dbEntity));
|
||||||
@@ -376,13 +382,13 @@ final class SqlHelper extends SQLiteOpenHelper {
|
|||||||
value = SqlUtil.getOneToOneParams(field);
|
value = SqlUtil.getOneToOneParams(field);
|
||||||
} else {
|
} else {
|
||||||
Object obj = field.get(dbEntity);
|
Object obj = field.get(dbEntity);
|
||||||
value = obj == null ? "" : obj.toString();
|
value = obj == null ? "" : checkValue(obj.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
//sb.append(value == null ? "" : value);
|
//sb.append(value == null ? "" : value);
|
||||||
//sb.append("'");
|
//sb.append("'");
|
||||||
prams.append(TextUtils.isEmpty(value) ? "" : value);
|
prams.append(TextUtils.isEmpty(value) ? "" : value);
|
||||||
prams.append("\"");
|
prams.append("'");
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -432,7 +438,7 @@ final class SqlHelper extends SQLiteOpenHelper {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
sb.append(i > 0 ? ", " : "");
|
sb.append(i > 0 ? ", " : "");
|
||||||
sb.append("\"");
|
sb.append("'");
|
||||||
Type type = field.getType();
|
Type type = field.getType();
|
||||||
if (type == Map.class) {
|
if (type == Map.class) {
|
||||||
sb.append(SqlUtil.map2Str((Map<String, String>) field.get(dbEntity)));
|
sb.append(SqlUtil.map2Str((Map<String, String>) field.get(dbEntity)));
|
||||||
@@ -445,9 +451,9 @@ final class SqlHelper extends SQLiteOpenHelper {
|
|||||||
} else if (SqlUtil.isOneToOne(field)) {
|
} else if (SqlUtil.isOneToOne(field)) {
|
||||||
sb.append(SqlUtil.getOneToOneParams(field));
|
sb.append(SqlUtil.getOneToOneParams(field));
|
||||||
} else {
|
} else {
|
||||||
sb.append(field.get(dbEntity));
|
sb.append(checkValue(field.get(dbEntity).toString()));
|
||||||
}
|
}
|
||||||
sb.append("\"");
|
sb.append("'");
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
@@ -639,7 +645,7 @@ final class SqlHelper extends SQLiteOpenHelper {
|
|||||||
int column = cursor.getColumnIndex(field.getName());
|
int column = cursor.getColumnIndex(field.getName());
|
||||||
if (column == -1) continue;
|
if (column == -1) continue;
|
||||||
if (type == String.class) {
|
if (type == String.class) {
|
||||||
field.set(entity, cursor.getString(column));
|
field.set(entity, URLDecoder.decode(cursor.getString(column)));
|
||||||
} else if (type == int.class || type == Integer.class) {
|
} else if (type == int.class || type == Integer.class) {
|
||||||
field.setInt(entity, cursor.getInt(column));
|
field.setInt(entity, cursor.getInt(column));
|
||||||
} else if (type == float.class || type == Float.class) {
|
} else if (type == float.class || type == Float.class) {
|
||||||
|
@@ -58,8 +58,8 @@ public class SingleTaskActivity extends BaseActivity<ActivitySingleBinding> {
|
|||||||
//"http://ox.konsung.net:5555/ksdc-web/download/downloadFile/?fileName=ksdc_1.0.2.apk&rRange=0-";
|
//"http://ox.konsung.net:5555/ksdc-web/download/downloadFile/?fileName=ksdc_1.0.2.apk&rRange=0-";
|
||||||
//"http://gdown.baidu.com/data/wisegame/0904344dee4a2d92/QQ_718.apk";
|
//"http://gdown.baidu.com/data/wisegame/0904344dee4a2d92/QQ_718.apk";
|
||||||
//"http://qudao.5535.cn/one/game.html?game=531&cpsuser=xiaoeryu2";
|
//"http://qudao.5535.cn/one/game.html?game=531&cpsuser=xiaoeryu2";
|
||||||
//"https://bogoe-res.mytbz.com/tbzengsong/If You're Happy.mp3";
|
"https://bogoe-res.mytbz.com/tbzengsong/If You're Happy.mp3";
|
||||||
"http://ozr0ucjs5.bkt.clouddn.com/51_box-104_20180131202610.apk";
|
//"http://ozr0ucjs5.bkt.clouddn.com/51_box-104_20180131202610.apk";
|
||||||
@Bind(R.id.start) Button mStart;
|
@Bind(R.id.start) Button mStart;
|
||||||
@Bind(R.id.stop) Button mStop;
|
@Bind(R.id.stop) Button mStop;
|
||||||
@Bind(R.id.cancel) Button mCancel;
|
@Bind(R.id.cancel) Button mCancel;
|
||||||
|
@@ -17,7 +17,6 @@
|
|||||||
package com.arialyy.simple.upload;
|
package com.arialyy.simple.upload;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
|
||||||
import butterknife.Bind;
|
import butterknife.Bind;
|
||||||
import butterknife.OnClick;
|
import butterknife.OnClick;
|
||||||
import com.arialyy.annotations.Upload;
|
import com.arialyy.annotations.Upload;
|
||||||
@@ -36,7 +35,7 @@ public class HttpUploadActivity extends BaseActivity<ActivityUploadBinding> {
|
|||||||
private static final String TAG = "HttpUploadActivity";
|
private static final String TAG = "HttpUploadActivity";
|
||||||
@Bind(R.id.pb) HorizontalProgressBarWithNumber mPb;
|
@Bind(R.id.pb) HorizontalProgressBarWithNumber mPb;
|
||||||
|
|
||||||
private static final String FILE_PATH = "/mnt/sdcard/gg.zip";
|
private static final String FILE_PATH = "/mnt/sdcard/360sicheck.txt";
|
||||||
|
|
||||||
@Override protected int setLayoutId() {
|
@Override protected int setLayoutId() {
|
||||||
return R.layout.activity_upload;
|
return R.layout.activity_upload;
|
||||||
@@ -51,8 +50,10 @@ public class HttpUploadActivity extends BaseActivity<ActivityUploadBinding> {
|
|||||||
@OnClick(R.id.upload) void upload() {
|
@OnClick(R.id.upload) void upload() {
|
||||||
Aria.upload(HttpUploadActivity.this)
|
Aria.upload(HttpUploadActivity.this)
|
||||||
.load(FILE_PATH)
|
.load(FILE_PATH)
|
||||||
.setUploadUrl("http://192.168.1.9:8080/upload/")
|
.setUploadUrl(
|
||||||
.setAttachment("serveFile")
|
"http://lib-test.xzxyun.com:8042/Api/upload?data={\"type\":\"1\",\"fileType\":\".txt\"}")
|
||||||
|
.setAttachment("file")
|
||||||
|
.addHeader("iplanetdirectorypro", "")
|
||||||
.start();
|
.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,7 +65,6 @@ public class HttpUploadActivity extends BaseActivity<ActivityUploadBinding> {
|
|||||||
Aria.upload(this).load(FILE_PATH).cancel();
|
Aria.upload(this).load(FILE_PATH).cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Upload.onPre public void onPre(UploadTask task) {
|
@Upload.onPre public void onPre(UploadTask task) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,6 +88,7 @@ public class HttpUploadActivity extends BaseActivity<ActivityUploadBinding> {
|
|||||||
@Upload.onTaskRunning public void taskRunning(UploadTask task) {
|
@Upload.onTaskRunning public void taskRunning(UploadTask task) {
|
||||||
getBinding().setSpeed(task.getConvertSpeed());
|
getBinding().setSpeed(task.getConvertSpeed());
|
||||||
getBinding().setProgress(task.getPercent());
|
getBinding().setProgress(task.getPercent());
|
||||||
|
L.d(TAG, "P => " + task.getPercent());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Upload.onTaskComplete public void taskComplete(UploadTask task) {
|
@Upload.onTaskComplete public void taskComplete(UploadTask task) {
|
||||||
|
Reference in New Issue
Block a user