package com.liulishuo.filedownloader.download; import com.liulishuo.filedownloader.database.FileDownloadDatabase; import com.liulishuo.filedownloader.download.ConnectTask; import com.liulishuo.filedownloader.model.ConnectionModel; import com.liulishuo.filedownloader.model.FileDownloadHeader; import com.liulishuo.filedownloader.util.FileDownloadUtils; /* loaded from: classes.dex */ public class DownloadRunnable implements Runnable { private final ConnectTask a; private final ProcessCallback b; private final String c; private final boolean d; private FetchDataTask e; private volatile boolean f; private final int g; final int h; public static class Builder { private final ConnectTask.Builder a = new ConnectTask.Builder(); private ProcessCallback b; private String c; private Boolean d; private Integer e; public Builder a(ProcessCallback processCallback) { this.b = processCallback; return this; } public Builder b(String str) { this.c = str; return this; } public Builder c(String str) { this.a.b(str); return this; } public Builder a(int i) { this.a.a(i); return this; } public Builder a(String str) { this.a.a(str); return this; } public Builder a(FileDownloadHeader fileDownloadHeader) { this.a.a(fileDownloadHeader); return this; } public Builder a(ConnectionProfile connectionProfile) { this.a.a(connectionProfile); return this; } public Builder a(boolean z) { this.d = Boolean.valueOf(z); return this; } public Builder a(Integer num) { this.e = num; return this; } public DownloadRunnable a() { if (this.b != null && this.c != null && this.d != null && this.e != null) { ConnectTask a = this.a.a(); return new DownloadRunnable(a.a, this.e.intValue(), a, this.b, this.d.booleanValue(), this.c); } throw new IllegalArgumentException(FileDownloadUtils.a("%s %s %B", this.b, this.c, this.d)); } } private long b() { FileDownloadDatabase a = CustomComponentHolder.i().a(); if (this.h < 0) { return a.e(this.g).getSoFar(); } for (ConnectionModel connectionModel : a.d(this.g)) { if (connectionModel.d() == this.h) { return connectionModel.a(); } } return 0L; } public void a() { pause(); } public void pause() { this.f = true; FetchDataTask fetchDataTask = this.e; if (fetchDataTask != null) { fetchDataTask.a(); } } /* JADX WARN: Removed duplicated region for block: B:71:0x014f */ @Override // java.lang.Runnable /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct code enable 'Show inconsistent code' option in preferences */ public void run() { /* Method dump skipped, instructions count: 339 To view this dump change 'Code comments level' option to 'DEBUG' */ throw new UnsupportedOperationException("Method not decompiled: com.liulishuo.filedownloader.download.DownloadRunnable.run():void"); } private DownloadRunnable(int i, int i2, ConnectTask connectTask, ProcessCallback processCallback, boolean z, String str) { this.g = i; this.h = i2; this.f = false; this.b = processCallback; this.c = str; this.a = connectTask; this.d = z; } }