update:2020.05.23
fix:toast显示问题 add:
This commit is contained in:
@@ -15,8 +15,8 @@ android {
|
|||||||
minSdkVersion 20
|
minSdkVersion 20
|
||||||
targetSdkVersion 29
|
targetSdkVersion 29
|
||||||
|
|
||||||
versionCode 134
|
versionCode 135
|
||||||
versionName "2.9.1"//测试jiaoguanyi.cn
|
versionName "2.9.2"//测试jiaoguanyi.cn
|
||||||
// versionCode 127
|
// versionCode 127
|
||||||
// versionName "2.0.0.7"// 正式jiaoguanyi.com 双数正式 单数测试
|
// versionName "2.0.0.7"// 正式jiaoguanyi.com 双数正式 单数测试
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
|
|||||||
@@ -88,18 +88,16 @@ public class GuardService extends Service implements NetStateChangeObserver {
|
|||||||
return START_STICKY;
|
return START_STICKY;
|
||||||
}
|
}
|
||||||
|
|
||||||
long time1 = 0L;
|
|
||||||
long time2 = 0L;
|
|
||||||
|
|
||||||
//在这里处理任务执行中的状态,如进度进度条的刷新
|
//在这里处理任务执行中的状态,如进度进度条的刷新
|
||||||
@Download.onTaskRunning
|
@Download.onTaskRunning
|
||||||
protected void running(DownloadTask task) {
|
protected void running(DownloadTask task) {
|
||||||
Log.e("aria", "正在下载=--------------::" + task.getState() + "-------" + task.getPercent() + "-------" + task.getExtendField());
|
Log.e("aria", "正在下载=--------------::" + task.getState() + "-------" + task.getPercent() + "-------" + task.getExtendField());
|
||||||
time2 = System.currentTimeMillis();
|
|
||||||
if ((time2 - time1) > 3499) {
|
|
||||||
ToastUtil.show("正在下载:" + task.getExtendField() + "--" + task.getPercent() + "%" + "\t" + Formatter.formatFileSize(GuardService.this, task.getSpeed()) + "/s");
|
ToastUtil.show("正在下载:" + task.getExtendField() + "--" + task.getPercent() + "%" + "\t" + Formatter.formatFileSize(GuardService.this, task.getSpeed()) + "/s");
|
||||||
time1 = time2;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Download.onTaskComplete
|
@Download.onTaskComplete
|
||||||
|
|||||||
@@ -28,14 +28,20 @@ public class ToastUtil {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static long time1 = 0L;
|
||||||
|
private static long time2 = 0L;
|
||||||
|
|
||||||
public static void show(final String msg) {
|
public static void show(final String msg) {
|
||||||
mainHandler.post(new Runnable() {
|
mainHandler.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
|
time2 = System.currentTimeMillis();
|
||||||
|
if ((time2 - time1) > 3499) {
|
||||||
showToast(mContext, msg, Toast.LENGTH_LONG);
|
showToast(mContext, msg, Toast.LENGTH_LONG);
|
||||||
Log.e("fht", "LENGTH_LONG");
|
Log.e("fht", "LENGTH_LONG");
|
||||||
|
time1 = time2;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (toast != null) {
|
if (toast != null) {
|
||||||
toast.setText(msg);
|
toast.setText(msg);
|
||||||
|
|||||||
Reference in New Issue
Block a user