导航菜单

页面标题

页面副标题

Uptodown App Store v6.80 - UserAvatarActivity.java 源代码

正在查看: Uptodown App Store v6.80 应用的 UserAvatarActivity.java JAVA 源代码文件

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


package com.uptodown.activities;

import N1.k;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import androidx.activity.ComponentActivity;
import androidx.core.content.ContextCompat;
import androidx.lifecycle.LifecycleOwnerKt;
import androidx.lifecycle.ViewModelLazy;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelStore;
import androidx.lifecycle.viewmodel.CreationExtras;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import c2.O0;
import com.uptodown.activities.UserAvatarActivity;
import com.uptodown.activities.X;
import f2.InterfaceC0923f;
import g2.C0956g;
import java.util.ArrayList;
import java.util.concurrent.atomic.AtomicBoolean;
import u2.H;

public final class UserAvatarActivity extends AbstractC0740a {
    private M1.K L;
    private M1.K M;
    private int N;
    private final R2.g J = R2.h.a(new d3.a() {
        @Override
        public final Object invoke() {
            c2.O0 n32;
            n32 = UserAvatarActivity.n3(UserAvatarActivity.this);
            return n32;
        }
    });
    private final R2.g K = new ViewModelLazy(kotlin.jvm.internal.D.b(X.class), new g(this), new f(this), new h(null, this));
    private final AtomicBoolean O = new AtomicBoolean(false);
    private final c P = new c();

    static final class a extends kotlin.coroutines.jvm.internal.l implements d3.p {
        int a;

        a(V2.d dVar) {
            super(2, dVar);
        }

        @Override
        public final V2.d create(Object obj, V2.d dVar) {
            return UserAvatarActivity.this.new a(dVar);
        }

        @Override
        public final Object invokeSuspend(Object obj) {
            Object c = W2.b.c();
            int i = this.a;
            if (i == 0) {
                R2.n.b(obj);
                if (UserAvatarActivity.this.O.compareAndSet(false, true)) {
                    UserAvatarActivity userAvatarActivity = UserAvatarActivity.this;
                    this.a = 1;
                    if (userAvatarActivity.x3(this) == c) {
                        return c;
                    }
                }
                return R2.s.a;
            }
            if (i != 1) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            R2.n.b(obj);
            UserAvatarActivity.this.O.set(false);
            return R2.s.a;
        }

        @Override
        public final Object invoke(o3.J j, V2.d dVar) {
            return ((a) create(j, dVar)).invokeSuspend(R2.s.a);
        }
    }

    static final class b extends kotlin.coroutines.jvm.internal.l implements d3.p {
        int a;

        b(V2.d dVar) {
            super(2, dVar);
        }

        @Override
        public final V2.d create(Object obj, V2.d dVar) {
            return UserAvatarActivity.this.new b(dVar);
        }

        @Override
        public final Object invokeSuspend(Object obj) {
            W2.b.c();
            if (this.a != 0) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            R2.n.b(obj);
            UserAvatarActivity.this.r3();
            return R2.s.a;
        }

        @Override
        public final Object invoke(o3.J j, V2.d dVar) {
            return ((b) create(j, dVar)).invokeSuspend(R2.s.a);
        }
    }

    public static final class c implements InterfaceC0923f {
        c() {
        }

        @Override
        public void a(C0956g avatar, int i) {
            kotlin.jvm.internal.m.e(avatar, "avatar");
            if (UserAvatarActivity.this.M != null) {
                M1.K k = UserAvatarActivity.this.M;
                kotlin.jvm.internal.m.b(k);
                if (k.c() != -1) {
                    M1.K k4 = UserAvatarActivity.this.M;
                    kotlin.jvm.internal.m.b(k4);
                    M1.K k5 = UserAvatarActivity.this.M;
                    kotlin.jvm.internal.m.b(k5);
                    k4.notifyItemChanged(k5.c());
                    M1.K k6 = UserAvatarActivity.this.M;
                    kotlin.jvm.internal.m.b(k6);
                    k6.d(-1);
                    M1.K k7 = UserAvatarActivity.this.M;
                    kotlin.jvm.internal.m.b(k7);
                    k7.notifyItemChanged(i);
                }
            }
            M1.K k8 = UserAvatarActivity.this.L;
            kotlin.jvm.internal.m.b(k8);
            k8.d(i);
            M1.K k9 = UserAvatarActivity.this.L;
            kotlin.jvm.internal.m.b(k9);
            k9.notifyDataSetChanged();
        }

        @Override
        public void b(C0956g avatar, int i) {
            kotlin.jvm.internal.m.e(avatar, "avatar");
            if (UserAvatarActivity.this.s3().f().getValue() != null) {
                Object value = UserAvatarActivity.this.s3().f().getValue();
                kotlin.jvm.internal.m.b(value);
                if (((g2.S) value).m(UserAvatarActivity.this)) {
                    Object value2 = UserAvatarActivity.this.s3().f().getValue();
                    kotlin.jvm.internal.m.b(value2);
                    if (((g2.S) value2).n()) {
                        M1.K k = UserAvatarActivity.this.L;
                        if (k == null || k.c() != -1) {
                            M1.K k4 = UserAvatarActivity.this.L;
                            kotlin.jvm.internal.m.b(k4);
                            k4.d(-1);
                            M1.K k5 = UserAvatarActivity.this.L;
                            kotlin.jvm.internal.m.b(k5);
                            k5.notifyDataSetChanged();
                        }
                        M1.K k6 = UserAvatarActivity.this.M;
                        if (k6 != null) {
                            M1.K k7 = UserAvatarActivity.this.M;
                            kotlin.jvm.internal.m.b(k7);
                            k6.notifyItemChanged(k7.c());
                        }
                        M1.K k8 = UserAvatarActivity.this.M;
                        if (k8 != null) {
                            k8.d(i);
                        }
                        M1.K k9 = UserAvatarActivity.this.M;
                        if (k9 != null) {
                            k9.notifyItemChanged(i);
                            return;
                        }
                        return;
                    }
                }
            }
            u2.p.q(new u2.p(), UserAvatarActivity.this, u2.O.b.c(UserAvatarActivity.this), null, 4, null);
        }
    }

    static final class d extends kotlin.coroutines.jvm.internal.l implements d3.p {
        int a;

        static final class a implements r3.f {
            final UserAvatarActivity a;

            a(UserAvatarActivity userAvatarActivity) {
                this.a = userAvatarActivity;
            }

            public final Object emit(u2.H h, V2.d dVar) {
                if (h instanceof H.a) {
                    this.a.p3().d.setVisibility(0);
                } else if (h instanceof H.c) {
                    this.a.p3().d.setVisibility(8);
                    this.a.p3().j.setVisibility(0);
                    H.c cVar = (H.c) h;
                    this.a.o3(((X.a) cVar.a()).a(), ((X.a) cVar.a()).b());
                } else if (!(h instanceof H.b)) {
                    throw new R2.k();
                }
                return R2.s.a;
            }
        }

        d(V2.d dVar) {
            super(2, dVar);
        }

        @Override
        public final V2.d create(Object obj, V2.d dVar) {
            return UserAvatarActivity.this.new d(dVar);
        }

        @Override
        public final Object invokeSuspend(Object obj) {
            Object c = W2.b.c();
            int i = this.a;
            if (i == 0) {
                R2.n.b(obj);
                r3.I d = UserAvatarActivity.this.s3().d();
                a aVar = new a(UserAvatarActivity.this);
                this.a = 1;
                if (d.collect(aVar, this) == c) {
                    return c;
                }
            } else {
                if (i != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                R2.n.b(obj);
            }
            throw new R2.d();
        }

        @Override
        public final Object invoke(o3.J j, V2.d dVar) {
            return ((d) create(j, dVar)).invokeSuspend(R2.s.a);
        }
    }

    static final class e extends kotlin.coroutines.jvm.internal.l implements d3.p {
        int a;

        static final class a implements r3.f {
            final UserAvatarActivity a;

            a(UserAvatarActivity userAvatarActivity) {
                this.a = userAvatarActivity;
            }

            public final Object b(boolean z, V2.d dVar) {
                if (z) {
                    ?? r22 = this.a;
                    String string = r22.getString(2131951716);
                    kotlin.jvm.internal.m.d(string, "getString(...)");
                    r22.r0(string);
                    this.a.setResult(10);
                    this.a.finish();
                }
                return R2.s.a;
            }

            public Object emit(Object obj, V2.d dVar) {
                return b(((Boolean) obj).booleanValue(), dVar);
            }
        }

        e(V2.d dVar) {
            super(2, dVar);
        }

        @Override
        public final V2.d create(Object obj, V2.d dVar) {
            return UserAvatarActivity.this.new e(dVar);
        }

        @Override
        public final Object invokeSuspend(Object obj) {
            Object c = W2.b.c();
            int i = this.a;
            if (i == 0) {
                R2.n.b(obj);
                r3.I e = UserAvatarActivity.this.s3().e();
                a aVar = new a(UserAvatarActivity.this);
                this.a = 1;
                if (e.collect(aVar, this) == c) {
                    return c;
                }
            } else {
                if (i != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                R2.n.b(obj);
            }
            throw new R2.d();
        }

        @Override
        public final Object invoke(o3.J j, V2.d dVar) {
            return ((e) create(j, dVar)).invokeSuspend(R2.s.a);
        }
    }

    public static final class f extends kotlin.jvm.internal.n implements d3.a {
        final ComponentActivity a;

        public f(ComponentActivity componentActivity) {
            super(0);
            this.a = componentActivity;
        }

        @Override
        public final ViewModelProvider.Factory invoke() {
            return this.a.getDefaultViewModelProviderFactory();
        }
    }

    public static final class g extends kotlin.jvm.internal.n implements d3.a {
        final ComponentActivity a;

        public g(ComponentActivity componentActivity) {
            super(0);
            this.a = componentActivity;
        }

        @Override
        public final ViewModelStore invoke() {
            return this.a.getViewModelStore();
        }
    }

    public static final class h extends kotlin.jvm.internal.n implements d3.a {
        final d3.a a;
        final ComponentActivity b;

        public h(d3.a aVar, ComponentActivity componentActivity) {
            super(0);
            this.a = aVar;
            this.b = componentActivity;
        }

        @Override
        public final CreationExtras invoke() {
            CreationExtras creationExtras;
            d3.a aVar = this.a;
            return (aVar == null || (creationExtras = (CreationExtras) aVar.invoke()) == null) ? this.b.getDefaultViewModelCreationExtras() : creationExtras;
        }
    }

    public static final O0 n3(UserAvatarActivity userAvatarActivity) {
        return O0.c(userAvatarActivity.getLayoutInflater());
    }

    public final void o3(ArrayList arrayList, ArrayList arrayList2) {
        ArrayList arrayList3;
        ArrayList arrayList4;
        int i = 0;
        if (this.L == null) {
            arrayList3 = arrayList;
            this.L = new M1.K(arrayList3, this.P, 0, this.N, false, 16, null);
            p3().e.setAdapter(this.L);
            p3().h.setVisibility(0);
        } else {
            arrayList3 = arrayList;
        }
        p3().c.setVisibility(8);
        if (arrayList2.isEmpty()) {
            arrayList4 = arrayList2;
            p3().c.setVisibility(8);
            p3().f.setVisibility(8);
        } else {
            p3().c.setVisibility(0);
            g2.S e4 = g2.S.m.e(this);
            boolean n = e4 != null ? e4.n() : false;
            if (this.M == null) {
                arrayList4 = arrayList2;
                this.M = new M1.K(arrayList4, this.P, 1, 0, n, 8, null);
                p3().f.setAdapter(this.M);
                p3().f.setVisibility(0);
            } else {
                arrayList4 = arrayList2;
            }
        }
        int size = arrayList3.size();
        int i4 = 0;
        int i5 = 0;
        while (true) {
            if (i5 >= size) {
                i4 = -1;
                break;
            }
            Object obj = arrayList3.get(i5);
            i5++;
            if (((C0956g) obj).b() == 1) {
                break;
            } else {
                i4++;
            }
        }
        int size2 = arrayList4.size();
        int i6 = 0;
        while (true) {
            if (i6 >= size2) {
                i = -1;
                break;
            }
            Object obj2 = arrayList4.get(i6);
            i6++;
            if (((C0956g) obj2).b() == 1) {
                break;
            } else {
                i++;
            }
        }
        if (i4 > -1) {
            M1.K k = this.L;
            if (k != null) {
                k.d(i4);
            }
            M1.K k4 = this.L;
            if (k4 != null) {
                k4.notifyItemChanged(i4);
                return;
            }
            return;
        }
        if (i > -1) {
            M1.K k5 = this.M;
            if (k5 != null) {
                k5.d(i);
            }
            M1.K k6 = this.M;
            if (k6 != null) {
                k6.notifyItemChanged(i);
            }
        }
    }

    public final O0 p3() {
        return (O0) this.J.getValue();
    }

    private final int q3() {
        int i = getResources().getDisplayMetrics().widthPixels;
        int dimensionPixelSize = getResources().getDimensionPixelSize(2131166020);
        int i4 = 6;
        while (true) {
            if ((i - ((i4 + 1) * dimensionPixelSize)) / i4 > getResources().getDimensionPixelSize(2131165361)) {
                break;
            }
            i4--;
            if (i4 <= 0) {
                i4 = 1;
                break;
            }
        }
        this.N = (i - (dimensionPixelSize * (i4 + 1))) / i4;
        return i4;
    }

    public final void r3() {
        s3().c(this);
    }

    public final X s3() {
        return (X) this.K.getValue();
    }

    private final void t3() {
        Drawable drawable = ContextCompat.getDrawable(this, N1.e.c);
        O0 p3 = p3();
        if (drawable != null) {
            p3.g.setNavigationIcon(drawable);
            p3.g.setNavigationContentDescription(getString(2131951721));
        }
        p3.g.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                UserAvatarActivity.u3(UserAvatarActivity.this, view);
            }
        });
        TextView textView = p3.k;
        k.a aVar = N1.k.g;
        textView.setTypeface(aVar.w());
        p3.j.setTypeface(aVar.w());
        p3.i.setTypeface(aVar.w());
        p3.h.setTypeface(aVar.w());
        p3.l.setTypeface(aVar.w());
        p3.i.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                UserAvatarActivity.v3(UserAvatarActivity.this, view);
            }
        });
        if (s3().f().getValue() != null) {
            Object value = s3().f().getValue();
            kotlin.jvm.internal.m.b(value);
            if (((g2.S) value).n()) {
                p3.b.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public final void onClick(View view) {
                        UserAvatarActivity.w3(UserAvatarActivity.this, view);
                    }
                });
            }
        }
        p3.e.setLayoutManager(new GridLayoutManager(this, q3()));
        DefaultItemAnimator defaultItemAnimator = new DefaultItemAnimator();
        defaultItemAnimator.setSupportsChangeAnimations(false);
        p3.e.setItemAnimator(defaultItemAnimator);
        p3.f.setLayoutManager(new LinearLayoutManager(this, 0, false));
        p3.f.addItemDecoration(new w2.r(this));
        p3.f.setItemAnimator(defaultItemAnimator);
        o3.g.d(LifecycleOwnerKt.getLifecycleScope(this), (V2.g) null, (o3.L) null, new b(null), 3, (Object) null);
    }

    public static final void u3(UserAvatarActivity userAvatarActivity, View view) {
        userAvatarActivity.finish();
    }

    public static final void v3(UserAvatarActivity userAvatarActivity, View view) {
        o3.g.d(LifecycleOwnerKt.getLifecycleScope(userAvatarActivity), (V2.g) null, (o3.L) null, userAvatarActivity.new a(null), 3, (Object) null);
    }

    public static final void w3(UserAvatarActivity userAvatarActivity, View view) {
        u2.p.q(new u2.p(), userAvatarActivity, u2.O.b.c(userAvatarActivity), null, 4, null);
    }

    public final java.lang.Object x3(V2.d r7) {
        throw new UnsupportedOperationException("Method not decompiled: com.uptodown.activities.UserAvatarActivity.x3(V2.d):java.lang.Object");
    }

    @Override
    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(p3().getRoot());
        s3().f().setValue(g2.S.m.e(this));
        t3();
        o3.g.d(LifecycleOwnerKt.getLifecycleScope(this), o3.Y.c(), (o3.L) null, new d(null), 2, (Object) null);
    }
}