导航菜单

页面标题

页面副标题

BetterTogether v3.0.0 - EditAccountActivity.java 源代码

正在查看: BetterTogether v3.0.0 应用的 EditAccountActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.bettertogether.screens.account.edit;

import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.view.View;
import android.widget.CompoundButton;
import android.widget.ImageView;
import androidx.appcompat.widget.AppCompatCheckBox;
import androidx.constraintlayout.widget.ConstraintLayout;
import be.d;
import be.i;
import be.p;
import be.q;
import com.adapty.ui.internal.mapping.viewconfig.ViewConfigurationMapper;
import com.bettertogether.cache.preferences.PreferenceData;
import com.bettertogether.remote.model.common.UserData;
import com.bettertogether.remote.model.request.UpdateUserProfileRequest;
import com.bettertogether.remote.model.request.WaterReminderResponse;
import com.bettertogether.screens.account.edit.EditAccountActivity;
import com.bettertogether.screens.login.LoginActivity;
import com.bettertogether.screens.main.MainActivity;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.fitness.FitnessLocal;
import com.google.android.gms.fitness.LocalRecordingClient;
import com.google.android.gms.fitness.data.LocalDataType;
import com.google.android.material.textfield.TextInputEditText;
import com.google.firebase.messaging.e;
import h.k;
import hr.m0;
import java.io.File;
import java.util.List;
import k7.j;
import kotlin.Metadata;
import kotlin.Pair;
import kotlin.Unit;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.g0;
import kotlin.text.y;
import lq.m;
import lq.n;
import lq.o;
import lq.x;
import md.l;
import o9.l0;
import s6.s;
import s8.h;
import xs.c;
import ys.a;
import z8.f;
import zd.b;

@Metadata
public final class EditAccountActivity extends b implements q, j {
    public static final int U = 0;
    public boolean M;
    public final x N;
    public boolean O;
    public PreferenceData P;
    public boolean Q;
    public boolean R;
    public boolean S;
    public int T;

    public final m f4966i;

    public final m f4967v;

    public UserData f4968w;

    public UpdateUserProfileRequest f4969x;

    public boolean f4970y;

    static {
        new s(22, 0);
    }

    public EditAccountActivity() {
        h s10 = e.s(this);
        String o10 = e.o();
        c cVar = new c(g0.a(EditAccountActivity.class));
        i iVar = new i(this, 2);
        o oVar = o.f13215d;
        this.f4966i = n.a(oVar, new l(((a) s10.a).a(o10, cVar), iVar, 2));
        this.f4967v = n.a(oVar, new dd.s(this, 5));
        this.f4969x = new UpdateUserProfileRequest(null, null, null, null, null, null, null, null, null, null, null, null, null, false, 16383, null);
        this.N = n.b(new i(this, 0));
        this.Q = true;
        this.T = -1;
    }

    public final void A(final boolean z4) {
        if (!this.f4969x.hasAnyChanges() && !this.f4969x.hasReminderDailyChanges(this.f4970y, this.M)) {
            if (z4) {
                finish();
                return;
            } else {
                D().d();
                return;
            }
        }
        k kVar = new k((Context) this);
        kVar.u(2131951687);
        kVar.o(2131951894);
        kVar.s(2131951893, new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i10) {
                int i11 = EditAccountActivity.U;
                ?? r22 = this;
                Intrinsics.checkNotNullParameter((Object) r22, "this$0");
                if (z4) {
                    r22.finish();
                } else {
                    r22.D().d();
                }
            }
        });
        kVar.q(2131951723, new d(this, 0));
        kVar.r(new f(this, 1));
        kVar.f().show();
    }

    public final void B() {
        D().f3442f.p(false);
        if (((Boolean) D().f3442f.j().f12190d).booleanValue()) {
            nl.f.O(lh.d.b(m0.b), (kotlin.coroutines.a) null, 0, new be.k(this, null), 3);
        }
    }

    public final cd.a C() {
        return (cd.a) this.N.getValue();
    }

    public final p D() {
        return (p) this.f4966i.getValue();
    }

    public final void E() {
        if (GooglePlayServicesUtil.isGooglePlayServicesAvailable(this, 241500000) != 0) {
            showErrorMessageDialog("Please update your Google Play services, as this feature requires it to monitor health data");
            return;
        }
        if (jh.o.w(this)) {
            LocalRecordingClient localRecordingClient = FitnessLocal.getLocalRecordingClient(this);
            Intrinsics.checkNotNullExpressionValue(localRecordingClient, "getLocalRecordingClient(this)");
            localRecordingClient.subscribe(LocalDataType.TYPE_CALORIES_EXPENDED).addOnSuccessListener(new a9.h(12, sd.f.O)).addOnFailureListener(new l0(10));
            localRecordingClient.subscribe(LocalDataType.TYPE_STEP_COUNT_DELTA).addOnSuccessListener(new a9.h(13, new be.j(this, 2))).addOnFailureListener(new l0(11));
        }
    }

    public final void F() {
        if (this.f4969x.hasAnyChanges() || this.f4969x.hasReminderDailyChanges(this.f4970y, this.M)) {
            C().f4087c.setBackground(z2.h.getDrawable(this, 2131230928));
        } else {
            C().f4087c.setBackground(z2.h.getDrawable(this, 2131231010));
        }
    }

    @Override
    public final void a() {
        if (this.S) {
            finish();
        } else {
            MainActivity.Companion.getClass();
            startActivity(ye.a.a(this, null));
        }
    }

    @Override
    public final void b() {
        final cd.a C = C();
        final int i10 = 1;
        C.f4098n.setOnClickListener(new be.a(this, i10));
        int i11 = 3;
        C.f4088d.setOnClickListener(new be.a(this, i11));
        C.f4089e.setOnClickListener(new be.a(this, 4));
        TextInputEditText textInputEditText = C.f4093i;
        Intrinsics.checkNotNullExpressionValue(textInputEditText, "etFirstName");
        fs.d.y(textInputEditText, new be.j(this, 0));
        TextInputEditText textInputEditText2 = C.f4096l;
        Intrinsics.checkNotNullExpressionValue(textInputEditText2, "etLastName");
        fs.d.y(textInputEditText2, new be.j(this, 1));
        C.f4092h.setOnClickListener(new be.e(this, C, 0));
        C.f4094j.setOnClickListener(new be.e(this, C, 1));
        final Object[] objArr = 0 == true ? 1 : 0;
        C.f4103s.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener(this) {

            public final EditAccountActivity f3416b;

            {
                this.f3416b = this;
            }

            @Override
            public final void onCheckedChanged(CompoundButton compoundButton, boolean z4) {
                UserData userData;
                UserData userData2;
                int i12 = objArr;
                ?? r11 = this.f3416b;
                Object obj = C;
                switch (i12) {
                    case 0:
                        cd.a aVar = (cd.a) obj;
                        int i13 = EditAccountActivity.U;
                        Intrinsics.checkNotNullParameter((Object) r11, "this$0");
                        Intrinsics.checkNotNullParameter(aVar, "$this_apply");
                        if (z4 && (userData = r11.f4968w) != null) {
                            if (Intrinsics.c(userData.getMetrics(), "kg")) {
                                TextInputEditText textInputEditText3 = aVar.f4095k;
                                Float height = userData.getHeight();
                                Intrinsics.e(height);
                                textInputEditText3.setText(String.valueOf(height.floatValue()));
                                r11.F();
                            } else {
                                Intrinsics.e(userData.getHeight());
                                double floatValue = r2.floatValue() * 2.54d;
                                aVar.f4095k.setText(String.valueOf(Math.rint(floatValue)));
                                rd.a aVar2 = rd.a.METRIC;
                                Intrinsics.checkNotNullParameter(aVar2, "<set-?>");
                                r11.f23176e = aVar2;
                                r11.f4969x.setMetrics("kg");
                                r11.f4969x.setHeight(Float.valueOf((float) floatValue));
                                Float weight = userData.getWeight();
                                if (weight != null && !Intrinsics.a(weight, 0.0f)) {
                                    r11.f4969x.setWeight(Float.valueOf((float) Math.rint(weight.floatValue() / 2.2046d)));
                                }
                                r11.F();
                                Unit unit = Unit.f12192a;
                            }
                            Unit unit2 = Unit.f12192a;
                            break;
                        }
                        break;
                    case 1:
                        cd.a aVar3 = (cd.a) obj;
                        int i14 = EditAccountActivity.U;
                        Intrinsics.checkNotNullParameter((Object) r11, "this$0");
                        Intrinsics.checkNotNullParameter(aVar3, "$this_apply");
                        if (z4 && (userData2 = r11.f4968w) != null) {
                            if (Intrinsics.c(userData2.getMetrics(), "lbs")) {
                                TextInputEditText textInputEditText4 = aVar3.f4095k;
                                Float height2 = userData2.getHeight();
                                Intrinsics.e(height2);
                                textInputEditText4.setText(zd.b.w(height2.floatValue()));
                                r11.F();
                            } else {
                                Float height3 = userData2.getHeight();
                                List O = y.O(String.valueOf(height3 != null ? Double.valueOf(height3.floatValue() / 30.48d) : null), new String[]{"."}, 0, 6);
                                aVar3.f4095k.setText(O.get(0) + "' " + ((String) O.get(1)).charAt(0) + "\"");
                                rd.a aVar4 = rd.a.IMPERIAL;
                                Intrinsics.checkNotNullParameter(aVar4, "<set-?>");
                                r11.f23176e = aVar4;
                                r11.f4969x.setMetrics("lbs");
                                UpdateUserProfileRequest updateUserProfileRequest = r11.f4969x;
                                Intrinsics.e(height3);
                                updateUserProfileRequest.setHeight(Float.valueOf((float) (height3.floatValue() / 2.54d)));
                                Float weight2 = userData2.getWeight();
                                UpdateUserProfileRequest updateUserProfileRequest2 = r11.f4969x;
                                Intrinsics.e(weight2);
                                updateUserProfileRequest2.setWeight(Float.valueOf((float) Math.rint(weight2.floatValue() * 2.2046d)));
                                r11.F();
                                Unit unit3 = Unit.f12192a;
                            }
                            Unit unit4 = Unit.f12192a;
                            break;
                        }
                        break;
                    default:
                        AppCompatCheckBox appCompatCheckBox = (AppCompatCheckBox) obj;
                        int i15 = EditAccountActivity.U;
                        Intrinsics.checkNotNullParameter((Object) r11, "this$0");
                        Intrinsics.checkNotNullParameter(appCompatCheckBox, "$this_with");
                        if (compoundButton.isPressed()) {
                            r11.O = z4;
                            if (!z4) {
                                r11.Q = false;
                                PreferenceData preferenceData = r11.P;
                                if (preferenceData != null) {
                                    preferenceData.y(false);
                                }
                                r11.f4969x.setGoogleFitSync(false);
                                r11.F();
                                break;
                            } else if (!ag.f.e(r11)) {
                                appCompatCheckBox.setChecked(false);
                                break;
                            } else {
                                PreferenceData preferenceData2 = r11.P;
                                if (!(preferenceData2 != null && preferenceData2.b("HAS_USER_SUBSCRIBED_THE_RECORDING_API", false))) {
                                    r11.E();
                                    break;
                                } else {
                                    PreferenceData preferenceData3 = r11.P;
                                    if (preferenceData3 != null) {
                                        preferenceData3.y(true);
                                    }
                                    r11.C().A.setChecked(true);
                                    r11.C().f4110z.setChecked(false);
                                    fs.d.o((Activity) r11, new i(r11, 1));
                                    break;
                                }
                            }
                        }
                        break;
                }
            }
        });
        C.f4104t.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener(this) {

            public final EditAccountActivity f3416b;

            {
                this.f3416b = this;
            }

            @Override
            public final void onCheckedChanged(CompoundButton compoundButton, boolean z4) {
                UserData userData;
                UserData userData2;
                int i12 = i10;
                ?? r11 = this.f3416b;
                Object obj = C;
                switch (i12) {
                    case 0:
                        cd.a aVar = (cd.a) obj;
                        int i13 = EditAccountActivity.U;
                        Intrinsics.checkNotNullParameter((Object) r11, "this$0");
                        Intrinsics.checkNotNullParameter(aVar, "$this_apply");
                        if (z4 && (userData = r11.f4968w) != null) {
                            if (Intrinsics.c(userData.getMetrics(), "kg")) {
                                TextInputEditText textInputEditText3 = aVar.f4095k;
                                Float height = userData.getHeight();
                                Intrinsics.e(height);
                                textInputEditText3.setText(String.valueOf(height.floatValue()));
                                r11.F();
                            } else {
                                Intrinsics.e(userData.getHeight());
                                double floatValue = r2.floatValue() * 2.54d;
                                aVar.f4095k.setText(String.valueOf(Math.rint(floatValue)));
                                rd.a aVar2 = rd.a.METRIC;
                                Intrinsics.checkNotNullParameter(aVar2, "<set-?>");
                                r11.f23176e = aVar2;
                                r11.f4969x.setMetrics("kg");
                                r11.f4969x.setHeight(Float.valueOf((float) floatValue));
                                Float weight = userData.getWeight();
                                if (weight != null && !Intrinsics.a(weight, 0.0f)) {
                                    r11.f4969x.setWeight(Float.valueOf((float) Math.rint(weight.floatValue() / 2.2046d)));
                                }
                                r11.F();
                                Unit unit = Unit.f12192a;
                            }
                            Unit unit2 = Unit.f12192a;
                            break;
                        }
                        break;
                    case 1:
                        cd.a aVar3 = (cd.a) obj;
                        int i14 = EditAccountActivity.U;
                        Intrinsics.checkNotNullParameter((Object) r11, "this$0");
                        Intrinsics.checkNotNullParameter(aVar3, "$this_apply");
                        if (z4 && (userData2 = r11.f4968w) != null) {
                            if (Intrinsics.c(userData2.getMetrics(), "lbs")) {
                                TextInputEditText textInputEditText4 = aVar3.f4095k;
                                Float height2 = userData2.getHeight();
                                Intrinsics.e(height2);
                                textInputEditText4.setText(zd.b.w(height2.floatValue()));
                                r11.F();
                            } else {
                                Float height3 = userData2.getHeight();
                                List O = y.O(String.valueOf(height3 != null ? Double.valueOf(height3.floatValue() / 30.48d) : null), new String[]{"."}, 0, 6);
                                aVar3.f4095k.setText(O.get(0) + "' " + ((String) O.get(1)).charAt(0) + "\"");
                                rd.a aVar4 = rd.a.IMPERIAL;
                                Intrinsics.checkNotNullParameter(aVar4, "<set-?>");
                                r11.f23176e = aVar4;
                                r11.f4969x.setMetrics("lbs");
                                UpdateUserProfileRequest updateUserProfileRequest = r11.f4969x;
                                Intrinsics.e(height3);
                                updateUserProfileRequest.setHeight(Float.valueOf((float) (height3.floatValue() / 2.54d)));
                                Float weight2 = userData2.getWeight();
                                UpdateUserProfileRequest updateUserProfileRequest2 = r11.f4969x;
                                Intrinsics.e(weight2);
                                updateUserProfileRequest2.setWeight(Float.valueOf((float) Math.rint(weight2.floatValue() * 2.2046d)));
                                r11.F();
                                Unit unit3 = Unit.f12192a;
                            }
                            Unit unit4 = Unit.f12192a;
                            break;
                        }
                        break;
                    default:
                        AppCompatCheckBox appCompatCheckBox = (AppCompatCheckBox) obj;
                        int i15 = EditAccountActivity.U;
                        Intrinsics.checkNotNullParameter((Object) r11, "this$0");
                        Intrinsics.checkNotNullParameter(appCompatCheckBox, "$this_with");
                        if (compoundButton.isPressed()) {
                            r11.O = z4;
                            if (!z4) {
                                r11.Q = false;
                                PreferenceData preferenceData = r11.P;
                                if (preferenceData != null) {
                                    preferenceData.y(false);
                                }
                                r11.f4969x.setGoogleFitSync(false);
                                r11.F();
                                break;
                            } else if (!ag.f.e(r11)) {
                                appCompatCheckBox.setChecked(false);
                                break;
                            } else {
                                PreferenceData preferenceData2 = r11.P;
                                if (!(preferenceData2 != null && preferenceData2.b("HAS_USER_SUBSCRIBED_THE_RECORDING_API", false))) {
                                    r11.E();
                                    break;
                                } else {
                                    PreferenceData preferenceData3 = r11.P;
                                    if (preferenceData3 != null) {
                                        preferenceData3.y(true);
                                    }
                                    r11.C().A.setChecked(true);
                                    r11.C().f4110z.setChecked(false);
                                    fs.d.o((Activity) r11, new i(r11, 1));
                                    break;
                                }
                            }
                        }
                        break;
                }
            }
        });
        C.f4091g.setOnCheckedChangeListener(new be.b(this, i11));
        C.f4095k.setOnClickListener(new be.a(this, 5));
        PreferenceData preferenceData = this.P;
        boolean e10 = preferenceData != null ? preferenceData.e() : false;
        final AppCompatCheckBox appCompatCheckBox = C.A;
        appCompatCheckBox.setChecked(e10);
        final int i12 = 2;
        appCompatCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener(this) {

            public final EditAccountActivity f3416b;

            {
                this.f3416b = this;
            }

            @Override
            public final void onCheckedChanged(CompoundButton compoundButton, boolean z4) {
                UserData userData;
                UserData userData2;
                int i122 = i12;
                ?? r11 = this.f3416b;
                Object obj = appCompatCheckBox;
                switch (i122) {
                    case 0:
                        cd.a aVar = (cd.a) obj;
                        int i13 = EditAccountActivity.U;
                        Intrinsics.checkNotNullParameter((Object) r11, "this$0");
                        Intrinsics.checkNotNullParameter(aVar, "$this_apply");
                        if (z4 && (userData = r11.f4968w) != null) {
                            if (Intrinsics.c(userData.getMetrics(), "kg")) {
                                TextInputEditText textInputEditText3 = aVar.f4095k;
                                Float height = userData.getHeight();
                                Intrinsics.e(height);
                                textInputEditText3.setText(String.valueOf(height.floatValue()));
                                r11.F();
                            } else {
                                Intrinsics.e(userData.getHeight());
                                double floatValue = r2.floatValue() * 2.54d;
                                aVar.f4095k.setText(String.valueOf(Math.rint(floatValue)));
                                rd.a aVar2 = rd.a.METRIC;
                                Intrinsics.checkNotNullParameter(aVar2, "<set-?>");
                                r11.f23176e = aVar2;
                                r11.f4969x.setMetrics("kg");
                                r11.f4969x.setHeight(Float.valueOf((float) floatValue));
                                Float weight = userData.getWeight();
                                if (weight != null && !Intrinsics.a(weight, 0.0f)) {
                                    r11.f4969x.setWeight(Float.valueOf((float) Math.rint(weight.floatValue() / 2.2046d)));
                                }
                                r11.F();
                                Unit unit = Unit.f12192a;
                            }
                            Unit unit2 = Unit.f12192a;
                            break;
                        }
                        break;
                    case 1:
                        cd.a aVar3 = (cd.a) obj;
                        int i14 = EditAccountActivity.U;
                        Intrinsics.checkNotNullParameter((Object) r11, "this$0");
                        Intrinsics.checkNotNullParameter(aVar3, "$this_apply");
                        if (z4 && (userData2 = r11.f4968w) != null) {
                            if (Intrinsics.c(userData2.getMetrics(), "lbs")) {
                                TextInputEditText textInputEditText4 = aVar3.f4095k;
                                Float height2 = userData2.getHeight();
                                Intrinsics.e(height2);
                                textInputEditText4.setText(zd.b.w(height2.floatValue()));
                                r11.F();
                            } else {
                                Float height3 = userData2.getHeight();
                                List O = y.O(String.valueOf(height3 != null ? Double.valueOf(height3.floatValue() / 30.48d) : null), new String[]{"."}, 0, 6);
                                aVar3.f4095k.setText(O.get(0) + "' " + ((String) O.get(1)).charAt(0) + "\"");
                                rd.a aVar4 = rd.a.IMPERIAL;
                                Intrinsics.checkNotNullParameter(aVar4, "<set-?>");
                                r11.f23176e = aVar4;
                                r11.f4969x.setMetrics("lbs");
                                UpdateUserProfileRequest updateUserProfileRequest = r11.f4969x;
                                Intrinsics.e(height3);
                                updateUserProfileRequest.setHeight(Float.valueOf((float) (height3.floatValue() / 2.54d)));
                                Float weight2 = userData2.getWeight();
                                UpdateUserProfileRequest updateUserProfileRequest2 = r11.f4969x;
                                Intrinsics.e(weight2);
                                updateUserProfileRequest2.setWeight(Float.valueOf((float) Math.rint(weight2.floatValue() * 2.2046d)));
                                r11.F();
                                Unit unit3 = Unit.f12192a;
                            }
                            Unit unit4 = Unit.f12192a;
                            break;
                        }
                        break;
                    default:
                        AppCompatCheckBox appCompatCheckBox2 = (AppCompatCheckBox) obj;
                        int i15 = EditAccountActivity.U;
                        Intrinsics.checkNotNullParameter((Object) r11, "this$0");
                        Intrinsics.checkNotNullParameter(appCompatCheckBox2, "$this_with");
                        if (compoundButton.isPressed()) {
                            r11.O = z4;
                            if (!z4) {
                                r11.Q = false;
                                PreferenceData preferenceData2 = r11.P;
                                if (preferenceData2 != null) {
                                    preferenceData2.y(false);
                                }
                                r11.f4969x.setGoogleFitSync(false);
                                r11.F();
                                break;
                            } else if (!ag.f.e(r11)) {
                                appCompatCheckBox2.setChecked(false);
                                break;
                            } else {
                                PreferenceData preferenceData22 = r11.P;
                                if (!(preferenceData22 != null && preferenceData22.b("HAS_USER_SUBSCRIBED_THE_RECORDING_API", false))) {
                                    r11.E();
                                    break;
                                } else {
                                    PreferenceData preferenceData3 = r11.P;
                                    if (preferenceData3 != null) {
                                        preferenceData3.y(true);
                                    }
                                    r11.C().A.setChecked(true);
                                    r11.C().f4110z.setChecked(false);
                                    fs.d.o((Activity) r11, new i(r11, 1));
                                    break;
                                }
                            }
                        }
                        break;
                }
            }
        });
        boolean hasFitbitConnected = hasFitbitConnected();
        AppCompatCheckBox appCompatCheckBox2 = C.f4110z;
        appCompatCheckBox2.setChecked(hasFitbitConnected);
        appCompatCheckBox2.setOnCheckedChangeListener(new be.b(this, i12));
        C.f4087c.setOnClickListener(new be.a(this, i12));
    }

    public final View getView() {
        ConstraintLayout constraintLayout = C().f4085a;
        Intrinsics.checkNotNullExpressionValue(constraintLayout, "binding.root");
        return constraintLayout;
    }

    @Override
    public final void h(WaterReminderResponse waterReminderResponse) {
        Intrinsics.checkNotNullParameter(waterReminderResponse, ViewConfigurationMapper.DATA);
        C().B.setChecked(waterReminderResponse.getReminder());
    }

    @Override
    public final void hideLoadingDialog() {
        C().f4108x.setRefreshing(false);
        C().f4102r.a();
        enableViews();
    }

    @Override
    public final void i(com.bettertogether.remote.model.common.UserData r24) {
        throw new UnsupportedOperationException("Method not decompiled: com.bettertogether.screens.account.edit.EditAccountActivity.i(com.bettertogether.remote.model.common.UserData):void");
    }

    @Override
    public final void initViews() {
        throw new UnsupportedOperationException("Method not decompiled: com.bettertogether.screens.account.edit.EditAccountActivity.initViews():void");
    }

    @Override
    public final void navigateToLoginScreen() {
        rh.k.b(this);
        startActivity(LoginActivity.f5000y.p(this, false));
    }

    public final void onActivityResult(int i10, int i11, Intent intent) {
        super/*zc.u*/.onActivityResult(i10, i11, intent);
        if (i10 == 3) {
            if (i11 != -1) {
                et.d.d("GoogleFit").a("Connection error", new Object[0]);
                C().A.setChecked(false);
                this.f4969x.setGoogleFitSync(false);
                F();
                return;
            }
            et.d.d("GoogleFit").a("Connected", new Object[0]);
            signOutFromFitbit();
            C().f4110z.setChecked(false);
            B();
            rh.k.n(this);
            this.f4969x.setGoogleFitSync(true);
            F();
        }
    }

    public final void onBackPressed() {
        if (this.Q) {
            A(true);
        }
    }

    public final void onDestroy() {
        super/*androidx.fragment.app.e0*/.onDestroy();
        this.O = false;
    }

    public final void onFitbitConnectError() {
        C().f4110z.setChecked(false);
        F();
    }

    public final void onFitbitConnectSuccess() {
        B();
        PreferenceData preferenceData = this.P;
        if (preferenceData != null) {
            preferenceData.y(false);
        }
        C().A.setChecked(false);
        rh.k.n(this);
        C().f4110z.setChecked(true);
        F();
    }

    public final void onImageFileReady(Pair pair) {
        Intrinsics.checkNotNullParameter(pair, "result");
        File file = (File) pair.f12191e;
        if (file != null) {
            bg.b bVar = (bg.b) this.f4967v.getValue();
            ImageView imageView = C().f4088d;
            Intrinsics.checkNotNullExpressionValue(imageView, "binding.btnAvatar");
            bVar.getClass();
            bg.b.e(this, file, imageView, true);
            this.f4969x.setUserAvatar(file);
            F();
        }
    }

    @Override
    public final void onRefresh() {
        disableViews();
        A(false);
    }

    public final void onResume() {
        super/*com.bettertogether.base.BaseActivity*/.onResume();
        boolean z4 = this.O && ag.f.d(this);
        boolean a10 = D().f3442f.a();
        et.d.a("EditAccountActivity onResume " + this.O + " " + ag.f.d(this) + "  " + a10, new Object[0]);
        if (z4 && !a10) {
            this.O = false;
            C().A.setChecked(true);
            PreferenceData preferenceData = this.P;
            if (preferenceData != null) {
                preferenceData.y(true);
            }
            PreferenceData preferenceData2 = this.P;
            if ((preferenceData2 == null || preferenceData2.b("HAS_USER_SUBSCRIBED_THE_RECORDING_API", false)) ? false : true) {
                E();
            }
        }
        cd.a C = C();
        AppCompatCheckBox appCompatCheckBox = C.A;
        PreferenceData preferenceData3 = this.P;
        appCompatCheckBox.setChecked(preferenceData3 != null ? preferenceData3.e() : false);
        C.f4110z.setChecked(hasFitbitConnected());
        this.O = false;
    }

    public final ad.a providePresenter() {
        return D();
    }

    @Override
    public final void showLoadingDialog() {
        disableViews();
        C().f4102r.b();
    }

    @Override
    public final void x(String str, String str2) {
        Intrinsics.checkNotNullParameter(str, "displayDate");
        Intrinsics.checkNotNullParameter(str2, "requestDate");
        this.f4969x.setBirthDate(str2);
        C().f4092h.setText(str);
        F();
    }

    @Override
    public final void y(rd.a aVar, float f10, String str) {
        Intrinsics.checkNotNullParameter(aVar, "heightSystem");
        Intrinsics.checkNotNullParameter(str, "displayValue");
        C().f4095k.setText(str);
        this.f4969x.setHeight(Float.valueOf(f10));
        F();
    }
}