导航菜单

页面标题

页面副标题

OLX India v19.42.007 - CommunicationPreferencesActivity.java 源代码

正在查看: OLX India v19.42.007 应用的 CommunicationPreferencesActivity.java JAVA 源代码文件

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


package com.olxgroup.panamera.app.users.myAccount.activities;

import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.graphics.PorterDuff;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider;
import com.olx.southasia.databinding.g2;
import com.olxgroup.panamera.app.common.utils.h1;
import com.olxgroup.panamera.app.users.myAccount.viewmodel.a;
import com.olxgroup.panamera.domain.users.settings.entities.ConsentPreferenceType;
import kotlin.Function;
import kotlin.Metadata;
import kotlin.NoWhenBranchMatchedException;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.FunctionAdapter;
import kotlin.jvm.internal.Intrinsics;
import olx.com.delorean.view.base.a;

@Metadata
public final class CommunicationPreferencesActivity extends w {
    public static final a c0 = new a(null);
    public static final int d0 = 8;
    public com.olxgroup.panamera.app.users.myAccount.viewmodel.a b0;

    public static final class a {
        public a(DefaultConstructorMarker defaultConstructorMarker) {
            this();
        }

        public final Intent a(Context context) {
            return new Intent(context, (Class<?>) CommunicationPreferencesActivity.class);
        }

        private a() {
        }
    }

    static final class b implements Observer, FunctionAdapter {
        private final Function1 a;

        b(Function1 function1) {
            this.a = function1;
        }

        public final boolean equals(Object obj) {
            if ((obj instanceof Observer) && (obj instanceof FunctionAdapter)) {
                return Intrinsics.d(getFunctionDelegate(), ((FunctionAdapter) obj).getFunctionDelegate());
            }
            return false;
        }

        @Override
        public final Function getFunctionDelegate() {
            return this.a;
        }

        public final int hashCode() {
            return getFunctionDelegate().hashCode();
        }

        public final void onChanged(Object obj) {
            this.a.invoke(obj);
        }
    }

    private final void Q2(final boolean z, final ConsentPreferenceType consentPreferenceType, String str, String str2) {
        final Dialog dialog = new Dialog(this);
        g2 Q = g2.Q(getLayoutInflater());
        Window window = dialog.getWindow();
        if (window != null) {
            window.setBackgroundDrawable(new ColorDrawable(0));
        }
        Q.D.setText(str);
        Q.B.setText(str2);
        dialog.setContentView(Q.getRoot());
        Window window2 = dialog.getWindow();
        if (window2 != null) {
            window2.setLayout((int) getResources().getDimension(com.olx.southasia.f.module_240), -2);
        }
        Q.A.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                CommunicationPreferencesActivity.R2(CommunicationPreferencesActivity.this, consentPreferenceType, dialog, view);
            }
        });
        Q.C.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                CommunicationPreferencesActivity.S2(dialog, this, consentPreferenceType, z, view);
            }
        });
        dialog.show();
    }

    public static final void R2(CommunicationPreferencesActivity communicationPreferencesActivity, ConsentPreferenceType consentPreferenceType, Dialog dialog, View view) {
        communicationPreferencesActivity.V2().K0(consentPreferenceType);
        dialog.dismiss();
    }

    public static final void S2(Dialog dialog, CommunicationPreferencesActivity communicationPreferencesActivity, ConsentPreferenceType consentPreferenceType, boolean z, View view) {
        dialog.dismiss();
        communicationPreferencesActivity.V2().L0(consentPreferenceType);
        communicationPreferencesActivity.l3(z, consentPreferenceType);
    }

    public static final Intent T2(Context context) {
        return c0.a(context);
    }

    private final void W2(a.b bVar) {
        hideLoading();
        Boolean a2 = bVar.a();
        X2(a2 != null ? a2.booleanValue() : false);
        Boolean c = bVar.c();
        Z2(c != null ? c.booleanValue() : false);
        Boolean d = bVar.d();
        b3(d != null ? d.booleanValue() : false);
        Boolean b2 = bVar.b();
        Y2(b2 != null ? b2.booleanValue() : false);
    }

    private final void X2(boolean z) {
        G2().B.d(getString(com.olx.southasia.p.my_account_settings_communication_email), getString(com.olx.southasia.p.my_account_settings_communication_email_sub), z, true, com.olx.southasia.q.CustomTextViewStyle_MenuItem_TextWithSameFontSize);
    }

    private final void Y2(boolean z) {
        G2().D.d(getString(com.olx.southasia.p.my_account_settings_communication_phone_call), getString(com.olx.southasia.p.my_account_settings_communication_phone_call_sub), z, true, com.olx.southasia.q.CustomTextViewStyle_MenuItem_TextWithSameFontSize);
    }

    private final void Z2(boolean z) {
        G2().E.d(getString(com.olx.southasia.p.my_account_settings_communication_sms), getString(com.olx.southasia.p.my_account_settings_communication_sms_sub), z, true, com.olx.southasia.q.CustomTextViewStyle_MenuItem_TextWithSameFontSize);
    }

    private final void b3(boolean z) {
        G2().G.d(getString(com.olx.southasia.p.my_account_settings_communication_whatsapp), getString(com.olx.southasia.p.my_account_settings_communication_whatsapp_sub), z, true, com.olx.southasia.q.CustomTextViewStyle_MenuItem_TextWithSameFontSize);
    }

    private final void c3() {
        G2().B.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                CommunicationPreferencesActivity.d3(CommunicationPreferencesActivity.this, view);
            }
        });
        G2().E.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                CommunicationPreferencesActivity.e3(CommunicationPreferencesActivity.this, view);
            }
        });
        G2().G.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                CommunicationPreferencesActivity.f3(CommunicationPreferencesActivity.this, view);
            }
        });
        G2().D.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                CommunicationPreferencesActivity.g3(CommunicationPreferencesActivity.this, view);
            }
        });
    }

    public static final void d3(CommunicationPreferencesActivity communicationPreferencesActivity, View view) {
        communicationPreferencesActivity.m3(communicationPreferencesActivity.G2().B.b(), ConsentPreferenceType.EMAIL, communicationPreferencesActivity.getString(com.olx.southasia.p.consent_confirmation_title, communicationPreferencesActivity.getString(com.olx.southasia.p.my_account_settings_communication_email)), communicationPreferencesActivity.getString(com.olx.southasia.p.consent_confirmation_desc_for_email));
    }

    public static final void e3(CommunicationPreferencesActivity communicationPreferencesActivity, View view) {
        communicationPreferencesActivity.m3(communicationPreferencesActivity.G2().E.b(), ConsentPreferenceType.SMS, communicationPreferencesActivity.getString(com.olx.southasia.p.consent_confirmation_title, communicationPreferencesActivity.getString(com.olx.southasia.p.my_account_settings_communication_sms)), communicationPreferencesActivity.getString(com.olx.southasia.p.consent_confirmation_desc, communicationPreferencesActivity.getString(com.olx.southasia.p.my_account_settings_communication_sms)));
    }

    public static final void f3(CommunicationPreferencesActivity communicationPreferencesActivity, View view) {
        communicationPreferencesActivity.m3(communicationPreferencesActivity.G2().G.b(), ConsentPreferenceType.WHATAPP, communicationPreferencesActivity.getString(com.olx.southasia.p.consent_confirmation_title, communicationPreferencesActivity.getString(com.olx.southasia.p.my_account_settings_communication_whatsapp)), communicationPreferencesActivity.getString(com.olx.southasia.p.consent_confirmation_desc, communicationPreferencesActivity.getString(com.olx.southasia.p.my_account_settings_communication_whatsapp)));
    }

    public static final void g3(CommunicationPreferencesActivity communicationPreferencesActivity, View view) {
        communicationPreferencesActivity.m3(communicationPreferencesActivity.G2().D.b(), ConsentPreferenceType.PHONE, communicationPreferencesActivity.getString(com.olx.southasia.p.consent_confirmation_title, communicationPreferencesActivity.getString(com.olx.southasia.p.my_account_settings_communication_phone_call)), communicationPreferencesActivity.getString(com.olx.southasia.p.consent_confirmation_desc_for_phone));
    }

    public static final Unit i3(CommunicationPreferencesActivity communicationPreferencesActivity, olx.com.delorean.view.base.a aVar) {
        if (aVar instanceof a.d) {
            communicationPreferencesActivity.W2((a.b) ((a.d) aVar).c());
        } else if (aVar instanceof a.c) {
            communicationPreferencesActivity.showLoading();
        } else {
            if (!(aVar instanceof a.b)) {
                throw new NoWhenBranchMatchedException();
            }
            communicationPreferencesActivity.j3(((a.b) aVar).c());
        }
        return Unit.a;
    }

    private final void k3(String str) {
        h1.b(G2().A, str, -1).show();
    }

    private final void l3(boolean z, ConsentPreferenceType consentPreferenceType) {
        showLoading();
        V2().J0(z, consentPreferenceType);
    }

    private final void m3(boolean z, ConsentPreferenceType consentPreferenceType, String str, String str2) {
        if (z) {
            Q2(!z, consentPreferenceType, str, str2);
        } else {
            l3(!z, consentPreferenceType);
        }
    }

    public com.olx.southasia.databinding.m H2() {
        return com.olx.southasia.databinding.m.Q(getLayoutInflater());
    }

    public final com.olxgroup.panamera.app.users.myAccount.viewmodel.a V2() {
        com.olxgroup.panamera.app.users.myAccount.viewmodel.a aVar = this.b0;
        if (aVar != null) {
            return aVar;
        }
        return null;
    }

    public final void a3(com.olxgroup.panamera.app.users.myAccount.viewmodel.a aVar) {
        this.b0 = aVar;
    }

    public final void h3() {
        V2().w0().observe(this, new b(new Function1() {
            @Override
            public final Object invoke(Object obj) {
                Unit i3;
                i3 = CommunicationPreferencesActivity.i3(CommunicationPreferencesActivity.this, (olx.com.delorean.view.base.a) obj);
                return i3;
            }
        }));
    }

    public final void hideLoading() {
        G2().C.setVisibility(8);
    }

    public final void j3(olx.com.delorean.exception.b bVar) {
        hideLoading();
        k3(bVar.getMessage());
    }

    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setActionBarTitle();
        a3((com.olxgroup.panamera.app.users.myAccount.viewmodel.a) new ViewModelProvider(this).get(com.olxgroup.panamera.app.users.myAccount.viewmodel.a.class));
        h3();
        c3();
        V2().I0();
        X2(false);
        Z2(false);
        b3(false);
        Y2(false);
    }

    public boolean onSupportNavigateUp() {
        onBackPressed();
        return true;
    }

    public final void setActionBarTitle() {
        setSupportActionBar(G2().F);
        androidx.appcompat.app.a supportActionBar = getSupportActionBar();
        if (supportActionBar != null) {
            supportActionBar.w(true);
            supportActionBar.D(com.olx.southasia.p.communication_preferences);
            G2().F.getNavigationIcon().setColorFilter(androidx.core.content.b.getColor(this, com.olx.southasia.e.toolbar_text), PorterDuff.Mode.SRC_ATOP);
        }
    }

    public final void showLoading() {
        G2().C.setVisibility(0);
    }
}