コード例 #1
0
  private void setLanguageOptions() {
    final ICartApplication localICartApplication = getApplication();
    final Locale localLocale1 =
        localICartApplication.getLocaleByCountryCode(localICartApplication.getCountryCode());
    this.mRbLocalLanguage.setText(localLocale1.getDisplayLanguage());
    final Locale localLocale2 = localICartApplication.getSharedPreferencesManager().getLocale();
    if (localLocale2.equals(Locale.ENGLISH)) {
      this.mRgLanguage.check(2131558788);
    }
    for (; ; ) {
      this.mRgLanguage.setOnCheckedChangeListener(
          new RadioGroup.OnCheckedChangeListener() {
            public void onCheckedChanged(
                RadioGroup paramAnonymousRadioGroup, final int paramAnonymousInt) {
              paramAnonymousRadioGroup = localLocale1;
              if (paramAnonymousInt == 2131558788) {
                paramAnonymousRadioGroup = Locale.ENGLISH;
              }
              if (paramAnonymousRadioGroup.equals(localLocale2)) {}
              while (localICartApplication
                  .getSharedPreferencesManager()
                  .getLocale()
                  .equals(paramAnonymousRadioGroup)) {
                return;
              }
              DialogUtils.showDialog(
                  MyAccountFragment.this.getActivity(),
                  MyAccountFragment.this.getString(2131165319),
                  MyAccountFragment.this.getString(2131165285),
                  MyAccountFragment.this.getString(17039379),
                  MyAccountFragment.this.getString(17039369),
                  null,
                  new ICartDialogCallback() {
                    public void onCancel() {}

                    public void onNegative(MaterialDialog paramAnonymous2MaterialDialog) {}

                    public void onNeutral(MaterialDialog paramAnonymous2MaterialDialog) {}

                    public void onPositive(MaterialDialog paramAnonymous2MaterialDialog) {
                      MyAccountFragment.this.sendPreferredLanguage(paramAnonymousInt);
                    }
                  });
            }
          });
      return;
      if (localLocale2.getDisplayLanguage().equalsIgnoreCase(localLocale1.getDisplayLanguage())) {
        this.mRgLanguage.check(2131558789);
      }
    }
  }
コード例 #2
0
  private void sendPreferredLanguage(final int paramInt) {
    ICartApplication localICartApplication = getApplication();
    Object localObject4 =
        localICartApplication.getLocaleByCountryCode(localICartApplication.getCountryCode());
    Object localObject1 = "en";
    final Object localObject2 = Locale.ENGLISH;
    final Object localObject3 = this.mRbEnglish;
    if (paramInt == 2131558789) {
      RadioButton localRadioButton = this.mRbLocalLanguage;
      String str = ((Locale) localObject4).getLanguage();
      localObject1 = str;
      localObject2 = localObject4;
      localObject3 = localRadioButton;
      if ("in".equalsIgnoreCase(str)) {
        localObject1 = "id";
        localObject3 = localRadioButton;
        localObject2 = localObject4;
      }
    }
    localObject4 = new CircularProgressDrawable(2131493005, 4.0F);
    ((RadioButton) localObject3)
        .setCompoundDrawablesWithIntrinsicBounds(null, null, (Drawable) localObject4, null);
    ((CircularProgressDrawable) localObject4).setBounds(-30, -30, 30, 30);
    ((CircularProgressDrawable) localObject4)
        .setColorFilter(getResources().getColor(2131493005), PorterDuff.Mode.LIGHTEN);
    ((CircularProgressDrawable) localObject4).start();
    try {
      localICartApplication
          .getUserManager()
          .sendPreferredLanguage(
              (String) localObject1,
              new ICartCallback(TAG) {
                public void onFailure(Throwable paramAnonymousThrowable) {
                  localObject3.setCompoundDrawables(null, null, null, null);
                  if (paramInt == 2131558788) {
                    MyAccountFragment.this.mRbEnglish.setChecked(false);
                    MyAccountFragment.this.mRbLocalLanguage.setChecked(true);
                    return;
                  }
                  MyAccountFragment.this.mRbEnglish.setChecked(true);
                  MyAccountFragment.this.mRbLocalLanguage.setChecked(false);
                }

                public void onSuccess(User paramAnonymousUser) {
                  MyAccountFragment.this
                      .getApplication()
                      .getSharedPreferencesManager()
                      .saveLocale(localObject2);
                  if (MyAccountFragment.this.getActivity() != null) {
                    localObject3.setCompoundDrawables(null, null, null, null);
                    MyAccountFragment.this.restartApp();
                  }
                }
              });
      return;
    } catch (Exception localException) {
      ((RadioButton) localObject3).setCompoundDrawables(null, null, null, null);
      if (paramInt == 2131558788) {
        this.mRbEnglish.setChecked(false);
        this.mRbLocalLanguage.setChecked(true);
        return;
      }
      this.mRbEnglish.setChecked(true);
      this.mRbLocalLanguage.setChecked(false);
    }
  }