ImojiBrowserActivity.java
29.3 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
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
package com.bitstrips.imoji.browser;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Build.VERSION;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.VisibleForTesting;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentManager.BackStackEntry;
import android.support.v4.app.FragmentManager.OnBackStackChangedListener;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.view.ViewPager;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.Button;
import com.bitstrips.imoji.abv3.AvatarBuilderMetricsHelper;
import com.bitstrips.imoji.abv3.AvatarBuilderStyle;
import com.bitstrips.imoji.abv3.model.AvatarStylePreviouslySaved;
import com.bitstrips.imoji.abv3.style.AvatarStyleFragmentListener;
import com.bitstrips.imoji.analytics.Action;
import com.bitstrips.imoji.analytics.AnalyticsWrapper;
import com.bitstrips.imoji.analytics.Category;
import com.bitstrips.imoji.analytics.LegacyAnalyticsService;
import com.bitstrips.imoji.analytics.performance.AnalyticsLabelKey;
import com.bitstrips.imoji.analytics.performance.PerformanceTimer;
import com.bitstrips.imoji.analytics.performance.TimedMetric;
import com.bitstrips.imoji.api.BitmojiApi;
import com.bitstrips.imoji.behaviour.BehaviourHelper;
import com.bitstrips.imoji.browser.adapters.ImojiPagerAdapter;
import com.bitstrips.imoji.browser.fragments.ShareImageDialogFragment;
import com.bitstrips.imoji.browser.fragments.ShareImageDialogFragment.OnShareListener;
import com.bitstrips.imoji.browser.views.ImojiBrowserTabLayout;
import com.bitstrips.imoji.experiments.Experiments;
import com.bitstrips.imoji.firebase.FirebaseUtils;
import com.bitstrips.imoji.identity.AvatarManager;
import com.bitstrips.imoji.identity.AvatarManager.UpdateAvatarInfoCallback;
import com.bitstrips.imoji.manager.AppIndexingManager;
import com.bitstrips.imoji.manager.AppIndexingManager.OnFirebaseIndexCompleteListener;
import com.bitstrips.imoji.manager.RecentStickersManager;
import com.bitstrips.imoji.manager.SnapchatManager;
import com.bitstrips.imoji.manager.StickerPacksManager;
import com.bitstrips.imoji.manager.StickerPacksManager.OnStickerPacksLoadFailedCallback;
import com.bitstrips.imoji.manager.TOUManager;
import com.bitstrips.imoji.models.Sticker;
import com.bitstrips.imoji.models.StickerPacks;
import com.bitstrips.imoji.monouser.models.SnapchatUserData;
import com.bitstrips.imoji.onboarding.gboard.GboardOnboardingIntroFragment;
import com.bitstrips.imoji.onboarding.gboard.GboardOnboardingLowStorageFragment;
import com.bitstrips.imoji.onboarding.gboard.GboardOnboardingSource;
import com.bitstrips.imoji.onboarding.gboard.GboardOnboardingUtils;
import com.bitstrips.imoji.onboarding.upgrade.FullAvatarUpgradeFragmentListener;
import com.bitstrips.imoji.onboarding.upgrade.FullAvatarUpgradeUtils;
import com.bitstrips.imoji.persistence.MediaCache;
import com.bitstrips.imoji.search.SearchIndex;
import com.bitstrips.imoji.search.SearchIndex.OnIndexCompleteListener;
import com.bitstrips.imoji.ui.BitmojiBaseActivity;
import com.bitstrips.imoji.ui.BmTypefaceLoader;
import com.bitstrips.imoji.ui.BmTypefaceLoader.OnTypefaceLoadedCallback;
import com.bitstrips.imoji.ui.IntentCreatorService;
import com.bitstrips.imoji.ui.SettingsFragment;
import com.bitstrips.imoji.ui.StickerPreloader;
import com.bitstrips.imoji.util.FileUtil;
import com.bitstrips.imoji.util.PreferenceUtils;
import com.bitstrips.imoji.util.ShareUtils;
import com.crashlytics.android.Crashlytics;
import java.io.File;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Locale;
import java.util.concurrent.TimeUnit;
import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Provider;
import retrofit.Callback;
import retrofit.RetrofitError;
public class ImojiBrowserActivity
extends BitmojiBaseActivity
implements FragmentManager.OnBackStackChangedListener, AvatarStyleFragmentListener, BitmojiClickListener, ShareImageDialogFragment.OnShareListener, AppIndexingManager.OnFirebaseIndexCompleteListener, FullAvatarUpgradeFragmentListener, SearchIndex.OnIndexCompleteListener
{
public static final int ADDITIONAL_SHARES_UNTIL_RATING_REPROMPT = 2;
public static final int DAYS_TO_REMINDER = 2;
public static final String EXTRA_BUNDLE = "com.bitstrips.imoji.browser.extra.bundle";
public static final String EXTRA_IS_EDIT_AVATAR_FROM_SNAPCHAT = "com.bitstrips.imoji.isEditFromSnapchat";
public static final String EXTRA_OPEN_GBOARD_ONBOARDING_FROM_KEYBOARD = "open_gboard_onboarding_from_keyboard";
public static final String EXTRA_SCHEME_HOST = "schemeHost";
public static final int INITIAL_SHARES_BEFORE_RATING = 3;
protected static final int OUTFIT_BUILDER_REQUEST_CODE = 8;
private static final String[] S = { "android.permission.READ_EXTERNAL_STORAGE", "android.permission.WRITE_EXTERNAL_STORAGE" };
public static final long SHOULD_UPDATE_APP_INDEX_INTERVAL = TimeUnit.HOURS.toMillis(1L);
public static final String TAG_SHARE_DIALOG = "shareDialog";
@Inject
StickerPacksManager A;
@Inject
LegacyAnalyticsService B;
@Inject
AppIndexingManager C;
@Inject
BehaviourHelper D;
@Inject
AvatarBuilderMetricsHelper E;
@Inject
@Named("sdkVersion")
Provider<Integer> F;
ViewPager G;
ImojiBrowserTabLayout H;
Toolbar I;
View J;
private boolean T = false;
private AlertDialog U;
private int V = 3;
private ImojiPagerAdapter W;
private boolean X = false;
private boolean Y = false;
private boolean Z = false;
private boolean aa = false;
private boolean ab = false;
private AsyncTask<Void, Void, Void> ac;
ShareImageDialogFragment n;
@Inject
Experiments o;
@Inject
AvatarManager p;
@Inject
BitmojiApi q;
@Inject
MediaCache r;
@Inject
StickerPreloader s;
@Inject
IntentCreatorService t;
@Inject
RecentStickersManager u;
@Inject
SnapchatManager v;
@Inject
FileUtil w;
@Inject
TOUManager x;
@Inject
SearchIndex y;
@Inject
PreferenceUtils z;
private void a()
{
StickerPacksManager.OnStickerPacksLoadFailedCallback local7 = null;
if (this.A.getStickerPacks() == null) {
local7 = new StickerPacksManager.OnStickerPacksLoadFailedCallback()
{
public final void onStickerPacksLoadFailed(RetrofitError paramAnonymousRetrofitError)
{
ImojiBrowserActivity.c(ImojiBrowserActivity.this);
}
};
}
this.A.updateStickerPacksAsync(getResources().getInteger(2131558411), local7);
}
private void a(View paramView)
{
if (paramView == null) {}
for (;;)
{
return;
if (paramView.getBackground() != null) {
paramView.getBackground().setCallback(null);
}
if (((paramView instanceof ViewGroup)) && (!(paramView instanceof AdapterView)))
{
int i = 0;
while (i < ((ViewGroup)paramView).getChildCount())
{
a(((ViewGroup)paramView).getChildAt(i));
i += 1;
}
}
}
}
private void a(GboardOnboardingSource paramGboardOnboardingSource)
{
HashMap localHashMap = new HashMap();
localHashMap.put(AnalyticsLabelKey.GBOARD_ONBOARDING_SOURCE, paramGboardOnboardingSource.toString());
this.B.sendEvent(Category.GBOARD_ONBOARDING, Action.GBOARD_ONBOARDING_OPEN, localHashMap);
b(GboardOnboardingIntroFragment.newInstance(paramGboardOnboardingSource));
}
private static boolean a(Intent paramIntent)
{
paramIntent = paramIntent.getBundleExtra("com.bitstrips.imoji.browser.extra.bundle");
if (paramIntent == null) {}
do
{
return false;
paramIntent = paramIntent.getString("com.bitstrips.imoji.browser.extra.action");
} while (TextUtils.isEmpty(paramIntent));
return paramIntent.equals("com.bitstrips.imoji.browser.extra.action.connect.sc");
}
private void b(Intent paramIntent)
{
paramIntent = paramIntent.getDataString();
if ((paramIntent != null) && (paramIntent.equals(getString(2131231276)))) {
logout();
}
}
private void b(Fragment paramFragment)
{
this.aa = true;
getSupportFragmentManager().beginTransaction().setCustomAnimations(2130968610, 0, 0, 2130968611).replace(2131689651, paramFragment, "OnboardingFragment").addToBackStack("OnboardingFragment").commit();
if (Build.VERSION.SDK_INT >= 21) {
getWindow().setStatusBarColor(getResources().getColor(2131624093));
}
}
private boolean b()
{
if (this.ab) {
this.ab = false;
}
while ((this.aa) || (getSupportFragmentManager().findFragmentByTag("OnboardingFragment") != null)) {
return false;
}
return true;
}
private void c()
{
getSupportFragmentManager().popBackStack(null, 1);
}
private boolean c(Intent paramIntent)
{
boolean bool2 = false;
boolean bool1 = bool2;
if (paramIntent != null)
{
bool1 = bool2;
if (paramIntent.getBooleanExtra("com.bitstrips.imoji.isEditFromSnapchat", false))
{
this.v.goBackToSnapchatWithAvatarChange(this);
bool1 = true;
}
}
return bool1;
}
private void d()
{
if (!b()) {}
long l;
do
{
do
{
do
{
return;
} while (!GboardOnboardingUtils.hasSupportedGboardVersion(this));
this.B.sendEvent(Category.GBOARD_ONBOARDING, Action.GBOARD_ONBOARDING_GBOARD_INSTALLED);
Bundle localBundle = getIntent().getBundleExtra("com.bitstrips.imoji.browser.extra.bundle");
if ((localBundle != null) && (localBundle.getBoolean("open_gboard_onboarding_from_keyboard", false)))
{
a(GboardOnboardingSource.KEYBOARD);
return;
}
if (this.z.getBoolean(2131231242, false)) {
break;
}
} while (this.z.getBoolean(2131231240, false));
a(GboardOnboardingSource.APP_OPEN);
return;
l = FirebaseUtils.additionalRequiredStorageToIndex(this) + this.D.getForcedGboardRequiredStorage();
} while (l <= 0L);
this.B.sendEvent(Category.GBOARD_ONBOARDING, Action.GBOARD_ONBOARDING_LOW_STORAGE);
b(GboardOnboardingLowStorageFragment.newInstance(l, GboardOnboardingSource.APP_OPEN));
}
private Date e()
{
Object localObject2 = null;
String str = this.z.getString(2131231314, null);
Object localObject1 = localObject2;
if (str != null) {
localObject1 = new SimpleDateFormat("yyyy-MM-dd", Locale.US);
}
try
{
localObject1 = ((DateFormat)localObject1).parse(str);
return (Date)localObject1;
}
catch (ParseException localParseException)
{
do
{
localObject1 = localObject2;
} while (!"release".equals("debug"));
Log.e("ImojiBrowser", "Rating: Error parsing reminder date: " + str, localParseException);
}
return null;
}
private void f()
{
if ((this.X) || (isFinishing())) {
return;
}
final Dialog localDialog = new Dialog(this);
localDialog.requestWindowFeature(1);
localDialog.setContentView(2130903098);
((Button)localDialog.findViewById(2131689681)).setOnClickListener(new View.OnClickListener()
{
public final void onClick(View paramAnonymousView)
{
ImojiBrowserActivity.this.B.sendEvent(Category.RATING, Action.RATE_NOW);
ImojiBrowserActivity.f(ImojiBrowserActivity.this);
ImojiBrowserActivity.this.t.goToGooglePlayStore("com.bitstrips.imoji", ImojiBrowserActivity.this);
localDialog.dismiss();
}
});
((Button)localDialog.findViewById(2131689682)).setOnClickListener(new View.OnClickListener()
{
public final void onClick(View paramAnonymousView)
{
ImojiBrowserActivity.this.B.sendEvent(Category.RATING, Action.NO_THANKS);
ImojiBrowserActivity.f(ImojiBrowserActivity.this);
localDialog.dismiss();
}
});
((Button)localDialog.findViewById(2131689683)).setOnClickListener(new View.OnClickListener()
{
public final void onClick(View paramAnonymousView)
{
ImojiBrowserActivity.this.B.sendEvent(Category.RATING, Action.REMIND_ME);
ImojiBrowserActivity.g(ImojiBrowserActivity.this);
ImojiBrowserActivity.h(ImojiBrowserActivity.this);
localDialog.dismiss();
}
});
localDialog.setCancelable(false);
localDialog.show();
}
private void g()
{
if (this.W == null) {
return;
}
if ((isFinishing()) || (isDestroyed()) || (this.X))
{
this.Z = true;
return;
}
try
{
this.W.notifyDataSetChanged();
return;
}
catch (Exception localException)
{
Crashlytics.logException(localException);
}
}
private void h()
{
int i = this.z.getInt(2131231320, this.V).intValue();
this.z.putInt(2131231320, Integer.valueOf(i - 1).intValue());
}
@VisibleForTesting
private void i()
{
String str1 = this.z.getString(2131231186, "");
String str2 = this.z.getString(2131231318, "");
String str3 = this.z.getString(2131231283, "");
if ((TextUtils.isEmpty(str1)) && (TextUtils.isEmpty(str2)) && (TextUtils.isEmpty(str3)))
{
logout();
return;
}
this.p.updateAvatarInfo(new AvatarManager.UpdateAvatarInfoCallback()
{
public final void onFailure()
{
ImojiBrowserActivity.this.s.load();
}
public final void onSuccess(String paramAnonymousString1, String paramAnonymousString2)
{
if (TextUtils.isEmpty(paramAnonymousString2)) {
ImojiBrowserActivity.this.t.goToLoginActivity(jdField_this);
}
do
{
return;
if ((paramAnonymousString1 == null) || (!paramAnonymousString1.equals(ImojiBrowserActivity.this.s.getLastPreloadedAvatarId()))) {
ImojiBrowserActivity.this.s.load();
}
} while ((paramAnonymousString1 != null) && (paramAnonymousString1.equals(paramAnonymousString2)));
ImojiBrowserActivity.d(ImojiBrowserActivity.this);
}
});
}
private void j()
{
if (!isActivityValid()) {
return;
}
this.t.goToOutfitBuilder(this, 8);
}
protected void createTabs()
{
if ((isFinishing()) || (this.A.getStickerPacks() == null)) {
return;
}
this.W = new ImojiPagerAdapter(getSupportFragmentManager(), StickerPacks.SUPERPACK_TAGS);
}
@VisibleForTesting
protected void initImojiAdapter()
{
if (this.G.getAdapter() == null)
{
if (this.W == null) {
createTabs();
}
this.G.setAdapter(this.W);
this.H.setupWithViewPager(this.G);
this.G.setCurrentItem(1);
}
}
@VisibleForTesting
protected boolean isSharingDialogShowing()
{
return (this.n != null) && (this.n.isAdded());
}
public void onActivityResult(int paramInt1, int paramInt2, Intent paramIntent)
{
int i = 0;
super.onActivityResult(paramInt1, paramInt2, paramIntent);
if (paramInt1 == 8) {
if (paramInt2 == -1) {
i();
}
}
do
{
do
{
do
{
return;
} while (paramInt1 != 55);
paramInt1 = i;
if (paramIntent != null)
{
paramInt1 = i;
if (paramIntent.getBooleanExtra("is_linked", false)) {
paramInt1 = 1;
}
}
if (paramInt1 != 0) {
this.v.goToSnapchatWithSuccess(this);
}
paramIntent = getIntent();
} while (paramIntent == null);
paramIntent = paramIntent.getBundleExtra("com.bitstrips.imoji.browser.extra.bundle");
} while ((paramIntent == null) || (!paramIntent.containsKey("com.bitstrips.imoji.browser.extra.action")));
paramIntent.remove("com.bitstrips.imoji.browser.extra.action");
}
public void onBackStackChanged()
{
int k = 0;
int m;
int i;
if (Build.VERSION.SDK_INT >= 21)
{
m = getSupportFragmentManager().getBackStackEntryCount();
i = 0;
}
for (;;)
{
int j = k;
if (i < m)
{
if ("OnboardingFragment".equals(getSupportFragmentManager().getBackStackEntryAt(i).getName())) {
j = 1;
}
}
else
{
if (j == 0) {
getWindow().setStatusBarColor(getResources().getColor(2131624040));
}
return;
}
i += 1;
}
}
public void onClick(Sticker paramSticker, @NonNull AnalyticsWrapper paramAnalyticsWrapper)
{
Object localObject = this.r.getCachedImage(paramSticker.getImageUrl());
Intent localIntent;
if (localObject != null)
{
if (!this.T) {
break label106;
}
if (((File)localObject).exists())
{
File localFile = this.w.copy((File)localObject);
localIntent = new Intent();
if (localFile == null) {
break label103;
}
localObject = localFile;
}
}
label103:
for (;;)
{
ShareUtils.intentForAttach(localIntent, (File)localObject);
setResult(-1, localIntent);
finish();
onShare(paramSticker);
this.B.sendEvent(Category.CLICK, Action.SHARE, paramAnalyticsWrapper.setIsAttach());
h();
return;
}
label106:
shareFile((File)localObject, paramSticker, paramAnalyticsWrapper);
}
public void onCreate(@Nullable Bundle paramBundle)
{
super.onCreate(paramBundle);
PerformanceTimer.startTimer(TimedMetric.APP_START);
setActivityLayout();
this.G = ((ViewPager)findViewById(2131689654));
this.H = ((ImojiBrowserTabLayout)findViewById(2131689653));
this.I = ((Toolbar)findViewById(2131689623));
this.J = findViewById(2131689655);
if (paramBundle != null) {
this.aa = paramBundle.getBoolean("did_show_onboarding", false);
}
setSupportActionBar(this.I);
setTitle("");
this.I.setLogo(2130837886);
b(getIntent());
paramBundle = getIntent().getStringExtra("schemeHost");
int i;
if (!TextUtils.isEmpty(paramBundle)) {
i = -1;
}
switch (paramBundle.hashCode())
{
default:
switch (i)
{
default:
label192:
this.o.updateABConfig();
this.o.updateGlobalVars();
if ((a(getIntent())) && (!this.z.getBoolean(2131231250, false)))
{
paramBundle = getIntent().getBundleExtra("com.bitstrips.imoji.browser.extra.bundle").getString("request_token");
this.t.goToConnectSnapchatActivity(this, paramBundle);
this.ab = true;
}
break;
}
break;
}
while (!c(getIntent()))
{
return;
if (!paramBundle.equals("catalog")) {
break;
}
i = 0;
break;
if (!paramBundle.equals("avatar")) {
break;
}
i = 1;
break;
j();
break label192;
this.t.goToAvatarBuilderEdit(this);
break label192;
}
}
public boolean onCreateOptionsMenu(final Menu paramMenu)
{
getMenuInflater().inflate(2131755010, paramMenu);
if ((!GboardOnboardingUtils.hasSupportedGboardVersion(this)) || (!this.C.hasCompletedIndex())) {
paramMenu.findItem(2131689975).setVisible(false);
}
BmTypefaceLoader.getInstance().loadTypefaceStyle(this, 0, new BmTypefaceLoader.OnTypefaceLoadedCallback()
{
public final void onTypefaceLoaded(Typeface paramAnonymousTypeface)
{
int j = paramMenu.size();
int i = 0;
while (i < j)
{
ImojiBrowserActivity.a(paramMenu.getItem(i), paramAnonymousTypeface);
i += 1;
}
}
});
return super.onCreateOptionsMenu(paramMenu);
}
protected void onDestroy()
{
super.onDestroy();
if (this.U != null)
{
this.U.dismiss();
this.U = null;
}
a(findViewById(2131689653));
a(findViewById(2131689654));
if ((this.ac != null) && (!this.ac.isCancelled()))
{
this.ac.cancel(true);
this.ac = null;
}
this.ac = new AsyncTask() {}.execute(new Void[0]);
}
public void onFirebaseIndexComplete(AppIndexingManager paramAppIndexingManager)
{
runOnUiThread(new Runnable()
{
public final void run()
{
if ((ImojiBrowserActivity.a(ImojiBrowserActivity.this)) || (ImojiBrowserActivity.this.isFinishing()) || (ImojiBrowserActivity.this.isDestroyed())) {
return;
}
ImojiBrowserActivity.b(ImojiBrowserActivity.this);
}
});
this.C.removeOnFirebaseIndexCompleteListener(this);
}
public void onIndexComplete(SearchIndex paramSearchIndex)
{
this.J.setVisibility(8);
g();
initImojiAdapter();
}
protected void onNewIntent(Intent paramIntent)
{
super.onNewIntent(paramIntent);
b(paramIntent);
c(paramIntent);
}
public boolean onOptionsItemSelected(MenuItem paramMenuItem)
{
boolean bool = true;
switch (paramMenuItem.getItemId())
{
default:
bool = super.onOptionsItemSelected(paramMenuItem);
case 16908332:
return bool;
case 2131689973:
this.t.goToAvatarBuilderEdit(this);
return true;
case 2131689974:
j();
return true;
case 2131689975:
a(GboardOnboardingSource.MENU);
return true;
case 2131689977:
getSupportFragmentManager().beginTransaction().replace(2131689651, new SettingsFragment()).addToBackStack(null).commit();
return true;
case 2131689978:
this.t.goToSupportPage(this);
return true;
}
f();
return true;
}
protected void onPause()
{
super.onPause();
this.X = true;
}
@TargetApi(23)
public void onRequestPermissionsResult(int paramInt, @NonNull String[] paramArrayOfString, @NonNull int[] paramArrayOfInt)
{
switch (paramInt)
{
}
do
{
return;
if ((paramArrayOfInt.length <= 0) || (paramArrayOfInt[0] != 0)) {
break;
}
} while (!isSharingDialogShowing());
this.n.onWritePermission(true);
return;
if ((((Integer)this.F.get()).intValue() >= 23) && (!shouldShowRequestPermissionRationale("android.permission.WRITE_EXTERNAL_STORAGE"))) {
this.z.putBoolean("pref_write_dontaskagain", true);
}
if (isSharingDialogShowing()) {
this.n.onWritePermission(false);
}
showAlertDialog(null, getString(2131230762), new Runnable()
{
public final void run() {}
}, null);
}
public void onRequestStoragePermissions()
{
if ((Build.VERSION.SDK_INT >= 23) && (ActivityCompat.checkSelfPermission(this, "android.permission.WRITE_EXTERNAL_STORAGE") != 0))
{
ActivityCompat.requestPermissions(this, S, 24);
if (this.z.getBoolean("pref_write_dontaskagain", false)) {
showAlertDialog(null, getString(2131230885), new Runnable()
{
public final void run() {}
}, null);
}
}
do
{
return;
this.z.putBoolean("pref_write_dontaskagain", false);
} while ((this.n == null) || (!this.n.isAdded()));
this.n.onWritePermission(true);
}
protected void onResume()
{
int j = 1;
super.onResume();
this.X = false;
Object localObject = getIntent().getAction();
int i;
boolean bool;
if (localObject != null) {
if ((((String)localObject).equals("android.intent.action.GET_CONTENT")) || (((String)localObject).equals("android.intent.action.PICK")))
{
i = 1;
if (i == 0) {
break label260;
}
bool = true;
label55:
this.T = bool;
i();
if (this.z.getString(2131231233, null) == null)
{
localObject = new Date();
localObject = new SimpleDateFormat("yyyy-MM-dd", Locale.US).format((Date)localObject);
this.z.putString(2131231233, (String)localObject);
}
if ((this.Z) && (!isFinishing()))
{
this.Z = false;
this.W.notifyDataSetChanged();
}
if (!a(getIntent()))
{
if (TextUtils.isEmpty(this.z.getString(2131231318, null))) {
break label265;
}
i = 1;
label174:
if (i == 0)
{
if (TextUtils.isEmpty(this.z.getString(2131231283, null))) {
break label270;
}
i = j;
label197:
if (i == 0) {}
}
else if (!this.z.getBoolean(2131231251, false))
{
if (this.z.containsKey(2131231250)) {
break label275;
}
this.q.getSnapchatUserData(new Callback()
{
public final void failure(RetrofitError paramAnonymousRetrofitError) {}
});
}
}
}
}
label260:
label265:
label270:
label275:
while (this.z.getBoolean(2131231250, false))
{
this.x.checkTermsChanged(this);
return;
i = 0;
break;
bool = false;
break label55;
i = 0;
break label174;
i = 0;
break label197;
}
this.t.goToForcedConnectSnapchatActivity(this);
}
protected void onSaveInstanceState(Bundle paramBundle)
{
paramBundle.putBoolean("did_show_onboarding", this.aa);
super.onSaveInstanceState(paramBundle);
}
public void onShare(Sticker paramSticker)
{
this.u.addRecentSticker(paramSticker);
g();
}
protected void onStart()
{
int i = 1;
super.onStart();
if (this.z.getBoolean(2131231312, false))
{
i = 0;
if (i != 0) {
f();
}
if ((b()) && (this.D.isUpgradeTeaserExperimentEnabled(this.o).booleanValue()) && (FullAvatarUpgradeUtils.isOverDateLimitSinceShown(this.z)) && (FullAvatarUpgradeUtils.isUnderTimesShownLimit(this.z))) {
this.q.getAvatarStyles(new Callback()
{
public final void failure(RetrofitError paramAnonymousRetrofitError) {}
});
}
if (!this.C.hasCompletedIndex()) {
break label226;
}
d();
label105:
this.y.addOnIndexCompleteListener(this);
if (!this.y.hasResults()) {
break label237;
}
initImojiAdapter();
this.J.setVisibility(8);
}
for (;;)
{
a();
this.Y = false;
getSupportFragmentManager().addOnBackStackChangedListener(this);
return;
this.V = this.z.getInt(2131231320, this.V).intValue();
if (this.V <= 0) {}
for (int j = 1;; j = 0)
{
Date localDate = e();
if (localDate == null) {
break label221;
}
if ((new Date().after(localDate)) && (j != 0)) {
break;
}
i = 0;
break;
}
label221:
i = j;
break;
label226:
this.C.addOnFirebaseIndexCompleteListener(this);
break label105;
label237:
this.J.setVisibility(0);
}
}
protected void onStop()
{
super.onStop();
this.ab = false;
this.C.removeOnFirebaseIndexCompleteListener(this);
this.y.removeOnIndexCompleteListener(this);
this.Y = true;
getSupportFragmentManager().removeOnBackStackChangedListener(this);
}
public void onStyleExit()
{
onBackPressed();
}
public void onStyleSelected(boolean paramBoolean, AvatarBuilderStyle paramAvatarBuilderStyle)
{
getSupportFragmentManager().popBackStack(null, 1);
if (paramBoolean)
{
this.t.goToAvatarBuilderEdit(this);
return;
}
i();
}
public void onUpgradeAvatarSelected()
{
this.E.upgradeTeaserShowMe("bitmoji", "full");
c();
this.t.goToAvatarBuilderResetFromUpgradeTeaser(this);
}
public void onUpgradeDismiss()
{
this.E.upgradeTeaserSkip("bitmoji", "full");
c();
}
protected void setActivityLayout()
{
setContentView(2130903078);
}
protected void shareFile(File paramFile, Sticker paramSticker, @NonNull AnalyticsWrapper paramAnalyticsWrapper)
{
Intent localIntent = new Intent();
ShareUtils.intentForShare(localIntent, this.w.copy(paramFile));
this.B.sendEvent(Category.CLICK, Action.PREVIEW, paramAnalyticsWrapper);
if ((this.X) || (isFinishing())) {}
for (;;)
{
h();
return;
if (getSupportFragmentManager().findFragmentByTag("shareDialog") == null)
{
FragmentTransaction localFragmentTransaction = getSupportFragmentManager().beginTransaction();
this.n = new ShareImageDialogFragment();
Bundle localBundle = new Bundle();
localBundle.putParcelable("intent", localIntent);
localBundle.putString("filePath", paramFile.getAbsolutePath());
localBundle.putSerializable("sticker", paramSticker);
localBundle.putSerializable("ShareImageDialogFragment.analytics.wrapper", paramAnalyticsWrapper);
this.n.setArguments(localBundle);
this.n.show(localFragmentTransaction, "shareDialog");
}
}
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/com/bitstrips/imoji/browser/ImojiBrowserActivity.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/