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