first commit
[bylock.git] / sources / net / client / by / lock / task / FileTask.java
blob3992a1f1156d74afc6633692181ec2f6a1d707bb
1 package net.client.by.lock.task;
3 import android.app.NotificationManager;
4 import android.app.PendingIntent;
5 import android.content.Context;
6 import android.content.Intent;
7 import android.os.Process;
8 import android.support.v4.app.ap;
9 import java.io.IOException;
10 import net.client.by.lock.b.d;
11 import net.client.by.lock.b.e;
12 import net.client.by.lock.b.i;
13 import net.client.by.lock.b.j;
14 import net.client.by.lock.gui.a.a;
15 import net.client.by.lock.service.BackgroundService;
17 /* compiled from: MyApp */
18 public abstract class FileTask extends a implements j {
19 private static final String TAG = "FileTask";
20 private a ftBubble;
21 e ftis;
22 private ap mBuilder;
23 private NotificationManager mNM;
24 private int mNotificationId;
26 public FileTask(Context context, Object obj) {
27 super(context, obj);
28 this.ftBubble = ((d) obj).A();
31 public i getProgressController() {
32 if (this.ftis == null) {
33 return null;
35 return this.ftis.a();
38 @Override // net.client.by.lock.task.a
39 public boolean cancelTask(boolean z) {
40 boolean cancelTask = super.cancelTask(z);
41 if (z && this.ftis != null) {
42 try {
43 this.ftis.close();
44 } catch (IOException e) {
45 net.client.by.lock.f.j.a(TAG, e);
48 return cancelTask;
51 /* access modifiers changed from: protected */
52 @Override // net.client.by.lock.task.a
53 public void onCancel() {
54 this.mNM.cancel(this.mNotificationId);
57 /* access modifiers changed from: protected */
58 @Override // net.client.by.lock.task.a, net.client.by.lock.task.a, android.os.AsyncTask
59 public Object[] doInBackground(Object... objArr) {
60 this.mNotificationId = (int) System.currentTimeMillis();
61 this.mNM = (NotificationManager) BackgroundService.a().getSystemService("notification");
62 lock();
63 if (!(this instanceof FileTask)) {
64 Process.setThreadPriority(-8);
66 try {
67 return genericOnSuccess(call());
68 } catch (Exception e) {
69 if (isCancelled()) {
70 return null;
72 return genericOnException(e);
76 /* access modifiers changed from: protected */
77 public void onProgressUpdate(Integer... numArr) {
78 this.ftBubble.b(numArr[0].intValue());
81 @Override // net.client.by.lock.b.j
82 public void updateProgress(int i) {
83 publishProgress(new Integer[]{Integer.valueOf(i)});
86 public void initProgress() {
89 public void finalizeProgress() {
90 this.ftis.a().b();
93 /* access modifiers changed from: protected */
94 @Override // net.client.by.lock.task.a
95 public Object[] genericOnException(Throwable th) {
96 this.state = 2;
97 ((d) this.startupParameter).a(th);
98 this.mBuilder = new ap(this.ctx).a(false).c(true).a(17301504).a(((d) this.startupParameter).e()).a(PendingIntent.getBroadcast(BackgroundService.a(), 0, new Intent(), 134217728)).b("Some kind of error occured").c("Error");
99 this.mNM.notify(this.mNotificationId, this.mBuilder.a());
100 this.mNM.cancel(this.mNotificationId);
101 return onException(th);
104 /* access modifiers changed from: protected */
105 @Override // net.client.by.lock.task.a
106 public void onPostExecute(Object[] objArr) {
107 int i;
108 super.onPostExecute(objArr);
109 ap c = new ap(this.ctx).c(true).a(((d) this.startupParameter).e()).a(false).c(String.valueOf(((d) this.startupParameter).e()) + " is " + (this instanceof SendFileTask ? "uploaded" : "downloaded"));
110 if (this instanceof SendFileTask) {
111 i = 17301641;
112 } else {
113 i = 17301634;
115 this.mBuilder = c.a(i).b(this instanceof SendFileTask ? "Uploaded" : "Downloaded").a(PendingIntent.getBroadcast(BackgroundService.a(), 0, new Intent(), 134217728));
116 this.mNM.notify(this.mNotificationId, this.mBuilder.a());
117 this.mNM.cancel(this.mNotificationId);
118 if (this.ftBubble != null) {
119 this.ftBubble.a(8);