AvatarBuilderActivityV3.java 23 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
package com.bitstrips.imoji.abv3;

import android.app.AlertDialog.Builder;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.os.PersistableBundle;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.util.Log;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.Toast;
import com.bitstrips.imoji.InjectorApplication;
import com.bitstrips.imoji.abv3.api.AvatarBuilderApi;
import com.bitstrips.imoji.abv3.api.AvatarBuilderApiV3;
import com.bitstrips.imoji.abv3.api.AvatarBuilderGetAssetsCallback;
import com.bitstrips.imoji.abv3.api.AvatarBuilderGetAvatarCallback;
import com.bitstrips.imoji.abv3.api.AvatarBuilderGetMappedOptionIdsCallback;
import com.bitstrips.imoji.abv3.api.AvatarBuilderSaveAvatarCallback;
import com.bitstrips.imoji.abv3.camera.AvatarBuilderCameraFragment;
import com.bitstrips.imoji.abv3.camera.AvatarBuilderCameraFragmentListener;
import com.bitstrips.imoji.abv3.camera.AvatarBuilderImageHelper;
import com.bitstrips.imoji.abv3.category.AvatarCategoryDetails;
import com.bitstrips.imoji.abv3.gender.AvatarGenderFragment;
import com.bitstrips.imoji.abv3.gender.AvatarGenderFragmentListener;
import com.bitstrips.imoji.abv3.model.AvatarAssets;
import com.bitstrips.imoji.abv3.model.AvatarGetMappedOptionIdsResponse;
import com.bitstrips.imoji.abv3.model.AvatarGetV3;
import com.bitstrips.imoji.abv3.model.AvatarSaveResponseV3;
import com.bitstrips.imoji.abv3.model.AvatarStylePreviouslySaved;
import com.bitstrips.imoji.abv3.style.AvatarStyleFragment;
import com.bitstrips.imoji.abv3.upgrade.AvatarUpgradeFragment;
import com.bitstrips.imoji.abv3.upgrade.AvatarUpgradeFragmentListener;
import com.bitstrips.imoji.api.BitmojiApi;
import com.bitstrips.imoji.behaviour.BehaviourHelper;
import com.bitstrips.imoji.browser.ImojiBrowserActivity;
import com.bitstrips.imoji.experiments.Experiments;
import com.bitstrips.imoji.experiments.FullCharacterDataWithOrigins;
import com.bitstrips.imoji.experiments.MirrorUploadHelper;
import com.bitstrips.imoji.hardware.CameraUtils;
import com.bitstrips.imoji.ui.BitmojiBaseActivity;
import com.bitstrips.imoji.ui.IntentCreatorService;
import com.bitstrips.imoji.util.PreferenceUtils;
import hg;
import hh;
import java.io.IOException;
import java.util.Map;
import javax.inject.Inject;
import retrofit.Callback;
import retrofit.RetrofitError;

public class AvatarBuilderActivityV3
  extends BitmojiBaseActivity
  implements AvatarBuilderCameraFragmentListener, AvatarGenderFragmentListener, AvatarUpgradeFragmentListener, hg, hh
{
  public static final String EXTRA_AVATAR_BUILDER_MODE = "EXTRA_AVATAR_BUILDER_MODE";
  public static final String EXTRA_EDIT_START_CATEGORY = "EXTRA_EDIT_START_CATEGORY";
  public static final String EXTRA_IS_EDIT_FROM_SNAPCHAT = "com.bitstrips.imoji.avatar.isEditFromSnapchat";
  public static final String EXTRA_IS_SNAPCHAT = "com.bitstrips.imoji.avatar.issnapchat";
  public static final String EXTRA_RESET_UPGRADE_TO_CM = "EXTRA_RESET_UPGRADE_TO_CM";
  public static final String EXTRA_TEST_MODE = "EXTRA_TEST_MODE";
  public static final String USER_IMAGE_FILENAME = "avatar_builder_bitmoji_user_image";
  private static final String x = AvatarBuilderActivityV3.class.getSimpleName();
  private AvatarBuilderFragment A;
  private AvatarGenderFragment B;
  private AvatarAssets C;
  private Fragment D;
  private AvatarBuilderGender E;
  private AvatarBuilderStyle F;
  private Map<String, Integer> G;
  private AvatarBuilderConfig H;
  private AvatarFlowBuilder I;
  private ImageView J;
  private String S;
  private boolean T;
  AvatarBuilderActivityMode n;
  @Inject
  IntentCreatorService o;
  @Inject
  PreferenceUtils p;
  @Inject
  CameraUtils q;
  @Inject
  BehaviourHelper r;
  @Inject
  Experiments s;
  @Inject
  AvatarBuilderMetricsHelper t;
  @Inject
  MirrorUploadHelper u;
  @Inject
  BitmojiApi v;
  AvatarBuilderApi w;
  private AvatarUpgradeFragment y;
  private AvatarBuilderCameraFragment z;
  
  private void b(Fragment paramFragment)
  {
    if (!isActivityValid()) {
      return;
    }
    FragmentManager localFragmentManager = getSupportFragmentManager();
    if (this.D != null) {
      localFragmentManager.beginTransaction().setCustomAnimations(2130968588, 2130968590).remove(this.D).commitAllowingStateLoss();
    }
    String str = paramFragment.getClass().getName();
    localFragmentManager.beginTransaction().setCustomAnimations(2130968589, 2130968591).add(2131689621, paramFragment, str).commitAllowingStateLoss();
    this.D = paramFragment;
  }
  
  private void d()
  {
    this.w.getAvatar(new AvatarBuilderGetAvatarCallback()
    {
      public final void failure(RetrofitError paramAnonymousRetrofitError)
      {
        Log.e(AvatarBuilderActivityV3.c(), "Failed to load user data");
        AvatarBuilderActivityV3.this.a();
      }
      
      public final void success(AvatarGetV3 paramAnonymousAvatarGetV3)
      {
        Object localObject = AvatarBuilderGender.fromValue(paramAnonymousAvatarGetV3.getGender());
        if (localObject == null)
        {
          Log.e(AvatarBuilderActivityV3.c(), "Current gender is invalid: " + paramAnonymousAvatarGetV3.getGender());
          AvatarBuilderActivityV3.this.a();
          return;
        }
        if (AvatarBuilderActivityV3.d(AvatarBuilderActivityV3.this) == AvatarBuilderActivityMode.EDIT) {
          AvatarBuilderActivityV3.a(AvatarBuilderActivityV3.this, (AvatarBuilderGender)localObject);
        }
        localObject = AvatarBuilderStyle.fromValue(paramAnonymousAvatarGetV3.getStyle());
        if (localObject == null)
        {
          Log.e(AvatarBuilderActivityV3.c(), "Current style is invalid: " + paramAnonymousAvatarGetV3.getStyle());
          AvatarBuilderActivityV3.this.a();
          return;
        }
        AvatarBuilderActivityV3.a(AvatarBuilderActivityV3.this, (AvatarBuilderStyle)localObject);
        AvatarBuilderActivityV3.c();
        new StringBuilder("loadUserData gender: ").append(AvatarBuilderActivityV3.a(AvatarBuilderActivityV3.this));
        AvatarBuilderActivityV3.c();
        new StringBuilder("loadUserData style: ").append(AvatarBuilderActivityV3.b(AvatarBuilderActivityV3.this));
        if (AvatarBuilderActivityV3.d(AvatarBuilderActivityV3.this) == AvatarBuilderActivityMode.EDIT) {
          AvatarBuilderActivityV3.a(AvatarBuilderActivityV3.this, paramAnonymousAvatarGetV3.getOptionIds());
        }
        AvatarBuilderActivityV3.c(AvatarBuilderActivityV3.this);
      }
    });
  }
  
  private void e()
  {
    this.w.getAssets(new AvatarBuilderGetAssetsCallback()
    {
      public final void failure(RetrofitError paramAnonymousRetrofitError)
      {
        Log.e(AvatarBuilderActivityV3.c(), "Failed to load user assets");
        AvatarBuilderActivityV3.this.a();
      }
      
      public final void success(AvatarAssets paramAnonymousAvatarAssets)
      {
        AvatarBuilderActivityV3.a(AvatarBuilderActivityV3.this, paramAnonymousAvatarAssets);
        AvatarBuilderActivityV3.e(AvatarBuilderActivityV3.this);
      }
    });
  }
  
  private void f()
  {
    String str = AvatarBuilderImageHelper.getImagePath(this, "avatar_builder_bitmoji_user_image");
    if ((AvatarBuilderActivityMode.CREATE == this.n) || (AvatarBuilderActivityMode.RESET == this.n))
    {
      localObject = this.I.getFlow(this.F, this.E, "create");
      if (this.G == null) {
        this.G = this.C.getDefaults(this.E, this.F);
      }
      this.H = new AvatarBuilderConfig(this.E, this.F, true, true, null, (AvatarBuilderFlow)localObject, null, null, this.C, this.G);
      this.A = AvatarBuilderFragment.createFragment(str);
      b(this.A);
      return;
    }
    if (this.S != null) {}
    for (Object localObject = this.S;; localObject = "hair")
    {
      AvatarBuilderFlow localAvatarBuilderFlow = this.I.getFlow(this.F, this.E, "edit");
      this.H = new AvatarBuilderConfig(this.E, this.F, true, false, (String)localObject, localAvatarBuilderFlow, null, null, this.C, this.G);
      this.A = AvatarBuilderFragment.createFragment(str);
      b(this.A);
      this.v.getAvatarStyles(new Callback()
      {
        public final void failure(RetrofitError paramAnonymousRetrofitError)
        {
          AvatarBuilderActivityV3.c();
        }
      });
      return;
    }
  }
  
  private void g()
  {
    new AlertDialog.Builder(this).setTitle(2131230852).setMessage(getString(2131230849)).setPositiveButton(2131230850, new DialogInterface.OnClickListener()
    {
      public final void onClick(DialogInterface paramAnonymousDialogInterface, int paramAnonymousInt)
      {
        AvatarBuilderActivityV3.g(AvatarBuilderActivityV3.this);
      }
    }).setNegativeButton(2131230851, new DialogInterface.OnClickListener()
    {
      public final void onClick(DialogInterface paramAnonymousDialogInterface, int paramAnonymousInt)
      {
        AvatarBuilderActivityV3.this.t.selfieCancel(AvatarBuilderActivityV3.a(AvatarBuilderActivityV3.this), AvatarBuilderActivityV3.b(AvatarBuilderActivityV3.this));
        AvatarBuilderActivityV3.f(AvatarBuilderActivityV3.this);
      }
    }).show();
  }
  
  private void h()
  {
    AlertDialog.Builder localBuilder = new AlertDialog.Builder(this);
    if ((o()) && (!this.A.hasNewChanges()) && (AvatarBuilderActivityMode.EDIT == this.n))
    {
      this.t.avatarExit(this.E, this.F, this.n, this.A.getCurrentAvatarDetails().getCategoryKey());
      exitBack();
      return;
    }
    if (AvatarBuilderActivityMode.EDIT == this.n) {}
    for (int i = 2131230788;; i = 2131230802)
    {
      localBuilder.setTitle(2131230805).setMessage(getString(i)).setPositiveButton(2131230803, new DialogInterface.OnClickListener()
      {
        public final void onClick(DialogInterface paramAnonymousDialogInterface, int paramAnonymousInt)
        {
          if (AvatarBuilderActivityV3.h(AvatarBuilderActivityV3.this)) {
            AvatarBuilderActivityV3.this.t.avatarExit(null, AvatarBuilderActivityV3.b(AvatarBuilderActivityV3.this), AvatarBuilderActivityV3.d(AvatarBuilderActivityV3.this), "gender");
          }
          for (;;)
          {
            AvatarBuilderActivityV3.this.exitBack();
            return;
            if (AvatarBuilderActivityV3.i(AvatarBuilderActivityV3.this))
            {
              paramAnonymousDialogInterface = AvatarBuilderActivityV3.j(AvatarBuilderActivityV3.this).getCurrentAvatarDetails().getCategoryKey();
              AvatarBuilderActivityV3.this.t.avatarExit(AvatarBuilderActivityV3.a(AvatarBuilderActivityV3.this), AvatarBuilderActivityV3.b(AvatarBuilderActivityV3.this), AvatarBuilderActivityV3.d(AvatarBuilderActivityV3.this), paramAnonymousDialogInterface);
            }
          }
        }
      }).setNegativeButton(2131230804, new DialogInterface.OnClickListener()
      {
        public final void onClick(DialogInterface paramAnonymousDialogInterface, int paramAnonymousInt) {}
      }).show();
      return;
    }
  }
  
  private void i()
  {
    this.B = AvatarGenderFragment.createFragment();
    b(this.B);
  }
  
  private void j()
  {
    if (n()) {
      return;
    }
    FragmentManager localFragmentManager = getSupportFragmentManager();
    String str = this.z.getClass().getName();
    localFragmentManager.beginTransaction().setCustomAnimations(2130968586, 2130968587).add(2131689621, this.z, str).commitAllowingStateLoss();
  }
  
  private void k()
  {
    getSupportFragmentManager().beginTransaction().setCustomAnimations(2130968586, 2130968587).remove(this.z).commitAllowingStateLoss();
  }
  
  private void l()
  {
    this.t.genderSelected(this.E);
    g();
  }
  
  private boolean m()
  {
    boolean bool2 = false;
    boolean bool1 = bool2;
    if (getIntent() != null)
    {
      bool1 = bool2;
      if (getIntent().getBooleanExtra("EXTRA_TEST_MODE", false)) {
        bool1 = true;
      }
    }
    return bool1;
  }
  
  private boolean n()
  {
    if (this.z == null) {}
    while (getSupportFragmentManager().findFragmentByTag(this.z.getClass().getName()) == null) {
      return false;
    }
    return true;
  }
  
  private boolean o()
  {
    if (this.A == null) {}
    while (getSupportFragmentManager().findFragmentByTag(this.A.getClass().getName()) == null) {
      return false;
    }
    return true;
  }
  
  private boolean p()
  {
    boolean bool2 = false;
    boolean bool1 = bool2;
    if (getIntent() != null)
    {
      bool1 = bool2;
      if (getIntent().getBooleanExtra("com.bitstrips.imoji.avatar.isEditFromSnapchat", false)) {
        bool1 = true;
      }
    }
    return bool1;
  }
  
  private String q()
  {
    if (p()) {
      return "snapchat";
    }
    return "bitmoji";
  }
  
  final void a()
  {
    Toast.makeText(getApplicationContext(), 2131230831, 0).show();
    exitBack();
  }
  
  final void b()
  {
    Intent localIntent = new Intent(this, ImojiBrowserActivity.class);
    localIntent.addFlags(131072);
    if (p()) {
      localIntent.putExtra("com.bitstrips.imoji.isEditFromSnapchat", true);
    }
    startActivity(localIntent);
    finish();
  }
  
  public void exitBack()
  {
    if ((AvatarBuilderActivityMode.CREATE == this.n) && (!m()))
    {
      logout();
      return;
    }
    b();
  }
  
  public AvatarBuilderConfig getConfig()
  {
    return this.H;
  }
  
  public void onBackPressed()
  {
    if (n())
    {
      this.t.selfieCancel(this.E, this.F);
      k();
      if (!o()) {
        f();
      }
      return;
    }
    if ((this.D instanceof AvatarStyleFragment))
    {
      i();
      return;
    }
    h();
  }
  
  public void onCameraCancel()
  {
    this.t.selfieCancel(this.E, this.F);
    k();
    if (!o()) {
      f();
    }
  }
  
  public void onCameraFailed()
  {
    k();
    Toast.makeText(this, 2131230795, 0).show();
    if (!o()) {
      f();
    }
  }
  
  public void onCameraPermissionDenied()
  {
    k();
    Toast.makeText(this, 2131230796, 0).show();
    if (!o()) {
      f();
    }
  }
  
  public void onCameraStarted()
  {
    this.t.selfieStart(this.E, this.F);
  }
  
  public void onCameraSuccess(@NonNull Bitmap paramBitmap)
  {
    this.t.selfieSnap(this.E, this.F);
    if (!AvatarBuilderImageHelper.saveImage(this, paramBitmap, "avatar_builder_bitmoji_user_image")) {
      Toast.makeText(this, 2131230795, 0).show();
    }
    k();
    if (!o())
    {
      f();
      return;
    }
    this.A.refreshUserImage();
  }
  
  public void onCreate(Bundle paramBundle)
  {
    super.onCreate(null);
    ((InjectorApplication)getApplication()).inject(this);
    setContentView(2130903067);
    this.w = new AvatarBuilderApiV3(this.v);
    this.J = ((ImageView)findViewById(2131689620));
    this.J.setAnimation(AnimationUtils.loadAnimation(this, 2130968614));
    this.z = AvatarBuilderCameraFragment.createFragment(1600, this.r.isBiggerSelfieEnabled(this.s));
    this.T = false;
    paramBundle = getIntent().getExtras();
    if (paramBundle != null)
    {
      this.n = ((AvatarBuilderActivityMode)paramBundle.getSerializable("EXTRA_AVATAR_BUILDER_MODE"));
      this.S = paramBundle.getString("EXTRA_EDIT_START_CATEGORY");
      this.T = paramBundle.getBoolean("EXTRA_RESET_UPGRADE_TO_CM", false);
    }
    try
    {
      this.I = new AvatarFlowBuilder("avatar-builder/avatar_category_details.json", getResources(), getPackageName());
      AvatarBuilderImageHelper.deleteImage(this, "avatar_builder_bitmoji_user_image");
      new StringBuilder("onCreate mode: ").append(this.n);
      if (AvatarBuilderActivityMode.EDIT == this.n)
      {
        d();
        return;
      }
    }
    catch (IOException paramBundle)
    {
      throw new IllegalStateException("Could not load the avatar flow builder.");
    }
    if (AvatarBuilderActivityMode.CREATE == this.n)
    {
      this.F = this.r.getDefaultStyle();
      e();
      return;
    }
    if (AvatarBuilderActivityMode.RESET == this.n)
    {
      if (this.T)
      {
        paramBundle = AvatarBuilderStyle.STYLE_CM;
        this.w.getMappedOptionIds(paramBundle.getValue(), new AvatarBuilderGetMappedOptionIdsCallback()
        {
          public final void failure(RetrofitError paramAnonymousRetrofitError)
          {
            Log.e(AvatarBuilderActivityV3.c(), "Failed to load option ids");
            AvatarBuilderActivityV3.this.a();
          }
          
          public final void success(AvatarGetMappedOptionIdsResponse paramAnonymousAvatarGetMappedOptionIdsResponse)
          {
            Object localObject = AvatarBuilderGender.fromValue(paramAnonymousAvatarGetMappedOptionIdsResponse.getGender());
            if (localObject == null)
            {
              Log.e(AvatarBuilderActivityV3.c(), "Gender is invalid: " + paramAnonymousAvatarGetMappedOptionIdsResponse.getGender());
              AvatarBuilderActivityV3.this.a();
              return;
            }
            AvatarBuilderActivityV3.a(AvatarBuilderActivityV3.this, (AvatarBuilderGender)localObject);
            localObject = AvatarBuilderStyle.fromValue(paramAnonymousAvatarGetMappedOptionIdsResponse.getStyle());
            if (localObject == null)
            {
              Log.e(AvatarBuilderActivityV3.c(), "Style is invalid: " + paramAnonymousAvatarGetMappedOptionIdsResponse.getStyle());
              AvatarBuilderActivityV3.this.a();
              return;
            }
            AvatarBuilderActivityV3.a(AvatarBuilderActivityV3.this, (AvatarBuilderStyle)localObject);
            AvatarBuilderActivityV3.c();
            new StringBuilder("loadMappedDataForUpgrade gender: ").append(AvatarBuilderActivityV3.a(AvatarBuilderActivityV3.this));
            AvatarBuilderActivityV3.c();
            new StringBuilder("loadMappedDataForUpgrade style: ").append(AvatarBuilderActivityV3.b(AvatarBuilderActivityV3.this));
            AvatarBuilderActivityV3.a(AvatarBuilderActivityV3.this, paramAnonymousAvatarGetMappedOptionIdsResponse.getOptionIds());
            AvatarBuilderActivityV3.c(AvatarBuilderActivityV3.this);
          }
        });
        return;
      }
      d();
      return;
    }
    throw new IllegalStateException("Incorrect mode");
  }
  
  public void onDestroy()
  {
    AvatarBuilderImageHelper.deleteImage(this, "avatar_builder_bitmoji_user_image");
    super.onDestroy();
  }
  
  public void onExit()
  {
    h();
  }
  
  public void onFemaleSelected()
  {
    this.E = AvatarBuilderGender.GENDER_FEMALE;
    l();
  }
  
  public void onGenderExit()
  {
    h();
  }
  
  public void onMaleSelected()
  {
    this.E = AvatarBuilderGender.GENDER_MALE;
    l();
  }
  
  public void onRequestPermissionsResult(int paramInt, @NonNull String[] paramArrayOfString, @NonNull int[] paramArrayOfInt)
  {
    this.z.onRequestPermissionsResult(paramInt, paramArrayOfString, paramArrayOfInt);
  }
  
  public void onSave(final AvatarBuilderConfig paramAvatarBuilderConfig, final AvatarBuilderSelection paramAvatarBuilderSelection)
  {
    if (m()) {
      finish();
    }
    FullCharacterDataWithOrigins localFullCharacterDataWithOrigins;
    do
    {
      do
      {
        return;
        if ((o()) && (!this.A.hasNewChanges()) && (AvatarBuilderActivityMode.EDIT == this.n))
        {
          exitBack();
          return;
        }
        localFullCharacterDataWithOrigins = FullCharacterDataWithOrigins.Create(paramAvatarBuilderSelection, paramAvatarBuilderConfig);
      } while ((paramAvatarBuilderConfig.getStyle().getValue() == AvatarBuilderStyle.STYLE_CM.getValue()) && (!this.r.isCMSaveEnabled()));
      this.w.saveAvatar(paramAvatarBuilderConfig.getGender(), paramAvatarBuilderConfig.getStyle(), localFullCharacterDataWithOrigins.getOptions(), this.n.getModeName(), new AvatarBuilderSaveAvatarCallback()
      {
        public final void failure(RetrofitError paramAnonymousRetrofitError)
        {
          Toast.makeText(AvatarBuilderActivityV3.this, 2131230847, 0).show();
        }
        
        public final void success(AvatarSaveResponseV3 paramAnonymousAvatarSaveResponseV3)
        {
          if (AvatarBuilderActivityMode.CREATE == AvatarBuilderActivityV3.d(AvatarBuilderActivityV3.this))
          {
            AvatarBuilderActivityV3.this.p.putString(2131231270, paramAnonymousAvatarSaveResponseV3.getId());
            AvatarBuilderActivityV3.this.p.putString(2131231175, paramAnonymousAvatarSaveResponseV3.getAvatarUUID());
          }
          AvatarBuilderActivityV3.this.t.save(paramAvatarBuilderConfig.getGender(), paramAvatarBuilderConfig.getStyle(), AvatarBuilderActivityV3.d(AvatarBuilderActivityV3.this), paramAvatarBuilderSelection.getSelectedOption("outfit"), AvatarBuilderActivityV3.j(AvatarBuilderActivityV3.this).getCurrentAvatarDetails().getCategoryKey());
          AvatarBuilderActivityV3.this.setResult(-1);
          paramAnonymousAvatarSaveResponseV3 = AvatarBuilderActivityV3.this;
          if (AvatarBuilderActivityMode.CREATE == paramAnonymousAvatarSaveResponseV3.n)
          {
            if ((paramAnonymousAvatarSaveResponseV3.getIntent() != null) && (paramAnonymousAvatarSaveResponseV3.getIntent().getBooleanExtra("com.bitstrips.imoji.avatar.issnapchat", false))) {}
            for (int i = 1; i != 0; i = 0)
            {
              paramAnonymousAvatarSaveResponseV3.o.goToImojiBrowserThenSnapchatActivity(paramAnonymousAvatarSaveResponseV3, null);
              paramAnonymousAvatarSaveResponseV3.finish();
              return;
            }
          }
          paramAnonymousAvatarSaveResponseV3.b();
        }
      });
    } while (!this.u.shouldSaveMirrorImage());
    paramAvatarBuilderConfig = getString(2131231165);
    paramAvatarBuilderSelection = AvatarBuilderImageHelper.loadImage(AvatarBuilderImageHelper.getImagePath(this, "avatar_builder_bitmoji_user_image"));
    this.u.uploadMirrorImage(localFullCharacterDataWithOrigins, paramAvatarBuilderSelection, this.n, paramAvatarBuilderConfig, getApplicationContext(), null, true);
  }
  
  public void onSaveInstanceState(Bundle paramBundle, PersistableBundle paramPersistableBundle)
  {
    super.onSaveInstanceState(paramBundle, paramPersistableBundle);
  }
  
  public void onShowCamera()
  {
    j();
  }
  
  public void onUpgradeAvatarSelected()
  {
    this.t.upgradeTeaserShowMe(q(), "half");
    if (this.n != AvatarBuilderActivityMode.EDIT)
    {
      Toast.makeText(this, 2131230797, 0).show();
      return;
    }
    Bundle localBundle2 = getIntent().getExtras();
    Bundle localBundle1 = localBundle2;
    if (localBundle2 == null) {
      localBundle1 = new Bundle();
    }
    localBundle1.putBoolean("EXTRA_RESET_UPGRADE_TO_CM", true);
    localBundle1.putString("EXTRA_EDIT_START_CATEGORY", null);
    localBundle1.putSerializable("EXTRA_AVATAR_BUILDER_MODE", AvatarBuilderActivityMode.RESET);
    getIntent().putExtras(localBundle1);
    recreate();
  }
  
  public void onUpgradeDismiss()
  {
    this.t.upgradeTeaserSkip(q(), "half");
    if (this.y != null) {
      getSupportFragmentManager().beginTransaction().remove(this.y).commitAllowingStateLoss();
    }
  }
  
  public boolean preloadAdjacentCategories()
  {
    return this.r.avatarBuilderPreloadAdjacent(this.s);
  }
}


/* Location:              /home/merong/decompile/hackery-dex2jar.jar!/com/bitstrips/imoji/abv3/AvatarBuilderActivityV3.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */