CheckUpdateTaskWithUI.java
4.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
package net.hockeyapp.android.tasks;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.widget.Toast;
import java.lang.ref.WeakReference;
import net.hockeyapp.android.R.string;
import net.hockeyapp.android.UpdateActivity;
import net.hockeyapp.android.UpdateManagerListener;
import net.hockeyapp.android.utils.HockeyLog;
import net.hockeyapp.android.utils.Util;
import net.hockeyapp.android.utils.VersionCache;
import org.json.JSONArray;
public class CheckUpdateTaskWithUI
extends CheckUpdateTask
{
private Activity a = null;
private AlertDialog b = null;
protected boolean mIsDialogRequired = false;
public CheckUpdateTaskWithUI(WeakReference<Activity> paramWeakReference, String paramString1, String paramString2, UpdateManagerListener paramUpdateManagerListener, boolean paramBoolean)
{
super(paramWeakReference, paramString1, paramString2, paramUpdateManagerListener);
if (paramWeakReference != null) {
this.a = ((Activity)paramWeakReference.get());
}
this.mIsDialogRequired = paramBoolean;
}
private void a(JSONArray paramJSONArray, Boolean paramBoolean)
{
Object localObject1 = null;
if (this.listener != null) {
localObject1 = this.listener.getUpdateActivityClass();
}
Object localObject2 = localObject1;
if (localObject1 == null) {
localObject2 = UpdateActivity.class;
}
if (this.a != null)
{
localObject1 = new Intent();
((Intent)localObject1).setClass(this.a, (Class)localObject2);
((Intent)localObject1).putExtra("json", paramJSONArray.toString());
((Intent)localObject1).putExtra("url", getURLString("apk"));
this.a.startActivity((Intent)localObject1);
if (paramBoolean.booleanValue()) {
this.a.finish();
}
}
cleanUp();
}
protected void cleanUp()
{
super.cleanUp();
this.a = null;
this.b = null;
}
public void detach()
{
super.detach();
this.a = null;
if (this.b != null)
{
this.b.dismiss();
this.b = null;
}
}
protected void onPostExecute(final JSONArray paramJSONArray)
{
super.onPostExecute(paramJSONArray);
if ((paramJSONArray != null) && (this.mIsDialogRequired))
{
if (getCachingEnabled())
{
HockeyLog.verbose("HockeyUpdate", "Caching is enabled. Setting version to cached one.");
VersionCache.setVersionInfo(this.a, paramJSONArray.toString());
}
if ((this.a != null) && (!this.a.isFinishing())) {}
}
else
{
return;
}
Object localObject = new AlertDialog.Builder(this.a);
((AlertDialog.Builder)localObject).setTitle(R.string.hockeyapp_update_dialog_title);
if (!this.mandatory.booleanValue())
{
((AlertDialog.Builder)localObject).setMessage(R.string.hockeyapp_update_dialog_message);
((AlertDialog.Builder)localObject).setNegativeButton(R.string.hockeyapp_update_dialog_negative_button, new DialogInterface.OnClickListener()
{
public final void onClick(DialogInterface paramAnonymousDialogInterface, int paramAnonymousInt)
{
CheckUpdateTaskWithUI.this.cleanUp();
if (CheckUpdateTaskWithUI.this.listener != null) {
CheckUpdateTaskWithUI.this.listener.onCancel();
}
}
});
((AlertDialog.Builder)localObject).setPositiveButton(R.string.hockeyapp_update_dialog_positive_button, new DialogInterface.OnClickListener()
{
public final void onClick(DialogInterface paramAnonymousDialogInterface, int paramAnonymousInt)
{
if (CheckUpdateTaskWithUI.this.getCachingEnabled()) {
VersionCache.setVersionInfo(CheckUpdateTaskWithUI.a(CheckUpdateTaskWithUI.this), "[]");
}
paramAnonymousDialogInterface = new WeakReference(CheckUpdateTaskWithUI.a(CheckUpdateTaskWithUI.this));
if ((Util.fragmentsSupported().booleanValue()) && (Util.runsOnTablet(paramAnonymousDialogInterface).booleanValue()))
{
CheckUpdateTaskWithUI.a(CheckUpdateTaskWithUI.this, paramJSONArray);
return;
}
CheckUpdateTaskWithUI.a(CheckUpdateTaskWithUI.this, paramJSONArray, Boolean.valueOf(false));
}
});
this.b = ((AlertDialog.Builder)localObject).create();
this.b.show();
return;
}
localObject = Util.getAppName(this.a);
localObject = String.format(this.a.getString(R.string.hockeyapp_update_mandatory_toast), new Object[] { localObject });
Toast.makeText(this.a, (CharSequence)localObject, 1).show();
a(paramJSONArray, Boolean.valueOf(true));
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/net/hockeyapp/android/tasks/CheckUpdateTaskWithUI.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/