fg.java
7.17 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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.location.LocationManager;
import android.os.Build.VERSION;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.RequiresApi;
import android.support.annotation.VisibleForTesting;
import android.support.v7.app.AppCompatCallback;
import android.support.v7.view.SupportActionModeWrapper.CallbackWrapper;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.ActionMode.Callback;
import android.view.Window;
import android.view.Window.Callback;
@TargetApi(14)
@RequiresApi(14)
public class fg
extends ff
{
private int v = -100;
private boolean w;
private boolean x = true;
private fg.b y;
public fg(Context paramContext, Window paramWindow, AppCompatCallback paramAppCompatCallback)
{
super(paramContext, paramWindow, paramAppCompatCallback);
}
private void g()
{
if (this.y == null)
{
Context localContext = this.a;
if (fo.a == null)
{
localContext = localContext.getApplicationContext();
fo.a = new fo(localContext, (LocationManager)localContext.getSystemService("location"));
}
this.y = new fg.b(fo.a);
}
}
private boolean h()
{
PackageManager localPackageManager;
if ((this.w) && ((this.a instanceof Activity))) {
localPackageManager = this.a.getPackageManager();
}
try
{
int i = localPackageManager.getActivityInfo(new ComponentName(this.a, this.a.getClass()), 0).configChanges;
return (i & 0x200) == 0;
}
catch (PackageManager.NameNotFoundException localNameNotFoundException) {}
return false;
return true;
}
Window.Callback a(Window.Callback paramCallback)
{
return new fg.a(paramCallback);
}
public boolean applyDayNight()
{
int i;
int j;
Object localObject;
Configuration localConfiguration;
label55:
label80:
boolean bool;
if (this.v != -100)
{
i = this.v;
j = c(i);
if (j == -1) {
break label314;
}
localObject = this.a.getResources();
localConfiguration = ((Resources)localObject).getConfiguration();
int k = localConfiguration.uiMode;
if (j != 2) {
break label211;
}
j = 32;
if ((k & 0x30) == j) {
break label308;
}
if (!h()) {
break label217;
}
((Activity)this.a).recreate();
bool = true;
}
for (;;)
{
if (i == 0)
{
g();
localObject = this.y;
((fg.b)localObject).a();
if (((fg.b)localObject).c == null) {
((fg.b)localObject).c = new fg.b.1((fg.b)localObject);
}
if (((fg.b)localObject).d == null)
{
((fg.b)localObject).d = new IntentFilter();
((fg.b)localObject).d.addAction("android.intent.action.TIME_SET");
((fg.b)localObject).d.addAction("android.intent.action.TIMEZONE_CHANGED");
((fg.b)localObject).d.addAction("android.intent.action.TIME_TICK");
}
((fg.b)localObject).e.a.registerReceiver(((fg.b)localObject).c, ((fg.b)localObject).d);
}
this.w = true;
return bool;
i = getDefaultNightMode();
break;
label211:
j = 16;
break label55;
label217:
localConfiguration = new Configuration(localConfiguration);
DisplayMetrics localDisplayMetrics = ((Resources)localObject).getDisplayMetrics();
localConfiguration.uiMode = (j | localConfiguration.uiMode & 0xFFFFFFCF);
((Resources)localObject).updateConfiguration(localConfiguration, localDisplayMetrics);
j = Build.VERSION.SDK_INT;
if (j >= 24)
{
fl.c((Resources)localObject);
break label80;
}
if (j >= 23)
{
fl.b((Resources)localObject);
break label80;
}
if (j < 21) {
break label80;
}
fl.a((Resources)localObject);
break label80;
label308:
bool = false;
continue;
label314:
bool = false;
}
}
int c(int paramInt)
{
switch (paramInt)
{
default:
return paramInt;
case 0:
g();
fg.b localb = this.y;
localb.b = localb.a.a();
if (localb.b) {
return 2;
}
return 1;
}
return -1;
}
public boolean isHandleNativeActionModesEnabled()
{
return this.x;
}
public void onCreate(Bundle paramBundle)
{
super.onCreate(paramBundle);
if ((paramBundle != null) && (this.v == -100)) {
this.v = paramBundle.getInt("appcompat:local_night_mode", -100);
}
}
public void onDestroy()
{
super.onDestroy();
if (this.y != null) {
this.y.a();
}
}
public void onSaveInstanceState(Bundle paramBundle)
{
super.onSaveInstanceState(paramBundle);
if (this.v != -100) {
paramBundle.putInt("appcompat:local_night_mode", this.v);
}
}
public void onStart()
{
super.onStart();
applyDayNight();
}
public void onStop()
{
super.onStop();
if (this.y != null) {
this.y.a();
}
}
public void setHandleNativeActionModesEnabled(boolean paramBoolean)
{
this.x = paramBoolean;
}
public void setLocalNightMode(int paramInt)
{
switch (paramInt)
{
}
do
{
Log.i("AppCompatDelegate", "setLocalNightMode() called with an unknown mode");
do
{
return;
} while (this.v == paramInt);
this.v = paramInt;
} while (!this.w);
applyDayNight();
}
class a
extends fd.b
{
a(Window.Callback paramCallback)
{
super(paramCallback);
}
final android.view.ActionMode a(ActionMode.Callback paramCallback)
{
paramCallback = new SupportActionModeWrapper.CallbackWrapper(fg.this.a, paramCallback);
android.support.v7.view.ActionMode localActionMode = fg.this.startSupportActionMode(paramCallback);
if (localActionMode != null) {
return paramCallback.getActionModeWrapper(localActionMode);
}
return null;
}
public android.view.ActionMode onWindowStartingActionMode(ActionMode.Callback paramCallback)
{
if (fg.this.isHandleNativeActionModesEnabled()) {
return a(paramCallback);
}
return super.onWindowStartingActionMode(paramCallback);
}
}
@VisibleForTesting
final class b
{
fo a;
boolean b;
BroadcastReceiver c;
IntentFilter d;
b(@NonNull fo paramfo)
{
this.a = paramfo;
this.b = paramfo.a();
}
final void a()
{
if (this.c != null)
{
fg.this.a.unregisterReceiver(this.c);
this.c = null;
}
}
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/fg.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/