TaskStackBuilder.java
6.5 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
package android.support.v4.app;
import android.app.Activity;
import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Build.VERSION;
import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.util.Log;
import java.util.ArrayList;
import java.util.Iterator;
public final class TaskStackBuilder
implements Iterable<Intent>
{
private static final a a = new b();
private final ArrayList<Intent> b = new ArrayList();
private final Context c;
static
{
if (Build.VERSION.SDK_INT >= 11)
{
a = new c();
return;
}
}
private TaskStackBuilder(Context paramContext)
{
this.c = paramContext;
}
public static TaskStackBuilder create(Context paramContext)
{
return new TaskStackBuilder(paramContext);
}
@Deprecated
public static TaskStackBuilder from(Context paramContext)
{
return create(paramContext);
}
public final TaskStackBuilder addNextIntent(Intent paramIntent)
{
this.b.add(paramIntent);
return this;
}
public final TaskStackBuilder addNextIntentWithParentStack(Intent paramIntent)
{
ComponentName localComponentName2 = paramIntent.getComponent();
ComponentName localComponentName1 = localComponentName2;
if (localComponentName2 == null) {
localComponentName1 = paramIntent.resolveActivity(this.c.getPackageManager());
}
if (localComponentName1 != null) {
addParentStack(localComponentName1);
}
addNextIntent(paramIntent);
return this;
}
public final TaskStackBuilder addParentStack(Activity paramActivity)
{
Object localObject = null;
if ((paramActivity instanceof SupportParentable)) {
localObject = ((SupportParentable)paramActivity).getSupportParentActivityIntent();
}
if (localObject == null) {}
for (paramActivity = NavUtils.getParentActivityIntent(paramActivity);; paramActivity = (Activity)localObject)
{
if (paramActivity != null)
{
ComponentName localComponentName = paramActivity.getComponent();
localObject = localComponentName;
if (localComponentName == null) {
localObject = paramActivity.resolveActivity(this.c.getPackageManager());
}
addParentStack((ComponentName)localObject);
addNextIntent(paramActivity);
}
return this;
}
}
public final TaskStackBuilder addParentStack(ComponentName paramComponentName)
{
int i = this.b.size();
try
{
for (paramComponentName = NavUtils.getParentActivityIntent(this.c, paramComponentName); paramComponentName != null; paramComponentName = NavUtils.getParentActivityIntent(this.c, paramComponentName.getComponent())) {
this.b.add(i, paramComponentName);
}
return this;
}
catch (PackageManager.NameNotFoundException paramComponentName)
{
Log.e("TaskStackBuilder", "Bad ComponentName while traversing activity parent metadata");
throw new IllegalArgumentException(paramComponentName);
}
}
public final TaskStackBuilder addParentStack(Class<?> paramClass)
{
return addParentStack(new ComponentName(this.c, paramClass));
}
public final Intent editIntentAt(int paramInt)
{
return (Intent)this.b.get(paramInt);
}
@Deprecated
public final Intent getIntent(int paramInt)
{
return editIntentAt(paramInt);
}
public final int getIntentCount()
{
return this.b.size();
}
public final Intent[] getIntents()
{
Intent[] arrayOfIntent = new Intent[this.b.size()];
if (arrayOfIntent.length == 0) {
return arrayOfIntent;
}
arrayOfIntent[0] = new Intent((Intent)this.b.get(0)).addFlags(268484608);
int i = 1;
while (i < arrayOfIntent.length)
{
arrayOfIntent[i] = new Intent((Intent)this.b.get(i));
i += 1;
}
return arrayOfIntent;
}
public final PendingIntent getPendingIntent(int paramInt1, int paramInt2)
{
return getPendingIntent(paramInt1, paramInt2, null);
}
public final PendingIntent getPendingIntent(int paramInt1, int paramInt2, Bundle paramBundle)
{
if (this.b.isEmpty()) {
throw new IllegalStateException("No intents added to TaskStackBuilder; cannot getPendingIntent");
}
paramBundle = (Intent[])this.b.toArray(new Intent[this.b.size()]);
paramBundle[0] = new Intent(paramBundle[0]).addFlags(268484608);
return a.a(this.c, paramBundle, paramInt1, paramInt2);
}
@Deprecated
public final Iterator<Intent> iterator()
{
return this.b.iterator();
}
public final void startActivities()
{
startActivities(null);
}
public final void startActivities(Bundle paramBundle)
{
if (this.b.isEmpty()) {
throw new IllegalStateException("No intents added to TaskStackBuilder; cannot startActivities");
}
Intent[] arrayOfIntent = (Intent[])this.b.toArray(new Intent[this.b.size()]);
arrayOfIntent[0] = new Intent(arrayOfIntent[0]).addFlags(268484608);
if (!ContextCompat.startActivities(this.c, arrayOfIntent, paramBundle))
{
paramBundle = new Intent(arrayOfIntent[(arrayOfIntent.length - 1)]);
paramBundle.addFlags(268435456);
this.c.startActivity(paramBundle);
}
}
public static abstract interface SupportParentable
{
public abstract Intent getSupportParentActivityIntent();
}
static abstract interface a
{
public abstract PendingIntent a(Context paramContext, Intent[] paramArrayOfIntent, int paramInt1, int paramInt2);
}
static final class b
implements TaskStackBuilder.a
{
public final PendingIntent a(Context paramContext, Intent[] paramArrayOfIntent, int paramInt1, int paramInt2)
{
paramArrayOfIntent = new Intent(paramArrayOfIntent[(paramArrayOfIntent.length - 1)]);
paramArrayOfIntent.addFlags(268435456);
return PendingIntent.getActivity(paramContext, paramInt1, paramArrayOfIntent, paramInt2);
}
}
static final class c
implements TaskStackBuilder.a
{
public final PendingIntent a(Context paramContext, Intent[] paramArrayOfIntent, int paramInt1, int paramInt2)
{
paramArrayOfIntent[0] = new Intent(paramArrayOfIntent[0]).addFlags(268484608);
return PendingIntent.getActivities(paramContext, paramInt1, paramArrayOfIntent, paramInt2);
}
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/android/support/v4/app/TaskStackBuilder.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/