package ca.canadapost.module.epostprofile.account.whatisnew;

import android.content.res.Resources;
import android.content.res.TypedArray;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.fragment.app.f;
import androidx.fragment.app.p0;
import androidx.lifecycle.c1;
import androidx.lifecycle.d1;
import androidx.lifecycle.e1;
import androidx.lifecycle.u;
import androidx.lifecycle.z0;
import androidx.viewpager2.widget.ViewPager2;
import androidx.viewpager2.widget.e;
import ca.canadapost.module.epostprofile.account.whatisnew.WhatIsNewFragment;
import com.google.android.material.tabs.TabLayout;
import com.google.android.material.tabs.d;
import java.util.List;
import kotlin.Metadata;
import kotlin.jvm.internal.t;
import kotlin.jvm.internal.v;
import ob.j;
import rm.o;
import sm.p;
import u7.x;
import zb.y3;

@Metadata(d1 = {"\u0000J\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0018\u0002\n\u0002\u0010\b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\n\b\u0007\u0018\u00002\u00020\u00012\b\u0012\u0004\u0012\u00020\u00030\u0002B\u0007¢\u0006\u0004\b\u001f\u0010 J\u0010\u0010\u0007\u001a\u00020\u00062\u0006\u0010\u0005\u001a\u00020\u0004H\u0002J5\u0010\u0013\u001a\u00020\u00122\u0006\u0010\t\u001a\u00020\b2\b\u0010\u000b\u001a\u0004\u0018\u00010\n2\b\u0010\r\u001a\u0004\u0018\u00010\f2\u0006\u0010\u000f\u001a\u00020\u000e2\u0006\u0010\u0011\u001a\u00020\u0010H\u0096\u0001J$\u0010\u0014\u001a\u00020\u00122\u0006\u0010\t\u001a\u00020\b2\b\u0010\u000b\u001a\u0004\u0018\u00010\n2\b\u0010\r\u001a\u0004\u0018\u00010\fH\u0016J\u001a\u0010\u0016\u001a\u00020\u00062\u0006\u0010\u0015\u001a\u00020\u00122\b\u0010\r\u001a\u0004\u0018\u00010\fH\u0016R\u001b\u0010\u0011\u001a\u00020\u00178BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\u0018\u0010\u0019\u001a\u0004\b\u001a\u0010\u001bR\u0014\u0010\u001e\u001a\u00020\u00038\u0016X\u0096\u0005¢\u0006\u0006\u001a\u0004\b\u001c\u0010\u001d¨\u0006!"}, d2 = {"Lca/canadapost/module/epostprofile/account/whatisnew/WhatIsNewFragment;", "Lu8/b;", "", "Lzb/y3;", "", "position", "Lrm/n0;", "Q", "Landroid/view/LayoutInflater;", "inflater", "Landroid/view/ViewGroup;", "container", "Landroid/os/Bundle;", "savedInstanceState", "Landroidx/lifecycle/u;", "viewLifecycleOwner", "Landroidx/lifecycle/z0;", "viewModel", "Landroid/view/View;", "N", "onCreateView", "view", "onViewCreated", "Lyb/d;", "t", "Lrm/o;", "M", "()Lyb/d;", "L", "()Lzb/y3;", "binding", "<init>", "()V", "epostprofile_productionRelease"}, k = 1, mv = {1, 9, 0})
/* loaded from: classes4.dex */
public final class WhatIsNewFragment extends u8.b {

    /* renamed from: s, reason: collision with root package name */
    private final /* synthetic */ x f8782s = new x(j.f31227n0);

    /* renamed from: t, reason: collision with root package name and from kotlin metadata */
    private final o viewModel = p0.a(this, kotlin.jvm.internal.p0.b(yb.d.class), new c(new b(this)), new d());

    /* loaded from: classes4.dex */
    public static final class a extends ViewPager2.i {
        a() {
        }

        @Override // androidx.viewpager2.widget.ViewPager2.i
        public void c(int i10) {
            super.c(i10);
            WhatIsNewFragment.this.M().Q(i10);
            WhatIsNewFragment.this.Q(i10);
        }
    }

    /* loaded from: classes4.dex */
    public static final class b extends v implements dn.a {

        /* renamed from: p, reason: collision with root package name */
        final /* synthetic */ f f8785p;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public b(f fVar) {
            super(0);
            this.f8785p = fVar;
        }

        @Override // dn.a
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final f invoke() {
            return this.f8785p;
        }
    }

    /* loaded from: classes4.dex */
    public static final class c extends v implements dn.a {

        /* renamed from: p, reason: collision with root package name */
        final /* synthetic */ dn.a f8786p;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public c(dn.a aVar) {
            super(0);
            this.f8786p = aVar;
        }

        @Override // dn.a
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final d1 invoke() {
            d1 viewModelStore = ((e1) this.f8786p.invoke()).getViewModelStore();
            t.f(viewModelStore, "ownerProducer().viewModelStore");
            return viewModelStore;
        }
    }

    /* loaded from: classes4.dex */
    static final class d extends v implements dn.a {
        d() {
            super(0);
        }

        @Override // dn.a
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final c1.c invoke() {
            return WhatIsNewFragment.this.y();
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    public final yb.d M() {
        return (yb.d) this.viewModel.getValue();
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void O(TabLayout.g gVar, int i10) {
        t.g(gVar, "<anonymous parameter 0>");
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void P(View page, float f10) {
        t.g(page, "page");
        page.setScaleY(((1 - Math.abs(f10)) * 0.2f) + 0.8f);
    }

    /* JADX INFO: Access modifiers changed from: private */
    public final void Q(int i10) {
        String[] stringArray = getResources().getStringArray(ob.f.f31111d);
        t.f(stringArray, "getStringArray(...)");
        String[] stringArray2 = getResources().getStringArray(ob.f.f31109b);
        t.f(stringArray2, "getStringArray(...)");
        L().D.setText(stringArray[i10]);
        L().C.setText(stringArray2[i10]);
    }

    public y3 L() {
        return (y3) this.f8782s.b();
    }

    public View N(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState, u viewLifecycleOwner, z0 viewModel) {
        t.g(inflater, "inflater");
        t.g(viewLifecycleOwner, "viewLifecycleOwner");
        t.g(viewModel, "viewModel");
        return this.f8782s.c(inflater, container, savedInstanceState, viewLifecycleOwner, viewModel);
    }

    @Override // androidx.fragment.app.f
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        t.g(inflater, "inflater");
        u viewLifecycleOwner = getViewLifecycleOwner();
        t.f(viewLifecycleOwner, "getViewLifecycleOwner(...)");
        return N(inflater, container, savedInstanceState, viewLifecycleOwner, M());
    }

    @Override // u8.b, androidx.fragment.app.f
    public void onViewCreated(View view, Bundle bundle) {
        List H0;
        t.g(view, "view");
        super.onViewCreated(view, bundle);
        ViewPager2 viewPager2 = L().B;
        viewPager2.setClipChildren(false);
        viewPager2.setClipToPadding(false);
        viewPager2.setOffscreenPageLimit(3);
        TypedArray obtainTypedArray = getResources().obtainTypedArray(ob.f.f31110c);
        t.f(obtainTypedArray, "obtainTypedArray(...)");
        int length = obtainTypedArray.length();
        int[] iArr = new int[length];
        for (int i10 = 0; i10 < length; i10++) {
            iArr[i10] = obtainTypedArray.getResourceId(i10, 0);
        }
        obtainTypedArray.recycle();
        ViewPager2 viewPager22 = L().B;
        H0 = p.H0(iArr);
        viewPager22.setAdapter(new yb.a(H0));
        new com.google.android.material.tabs.d(L().A, L().B, new d.b() { // from class: yb.b
            @Override // com.google.android.material.tabs.d.b
            public final void a(TabLayout.g gVar, int i11) {
                WhatIsNewFragment.O(gVar, i11);
            }
        }).a();
        androidx.viewpager2.widget.c cVar = new androidx.viewpager2.widget.c();
        cVar.b(new e((int) (40 * Resources.getSystem().getDisplayMetrics().density)));
        cVar.b(new ViewPager2.k() { // from class: yb.c
            @Override // androidx.viewpager2.widget.ViewPager2.k
            public final void a(View view2, float f10) {
                WhatIsNewFragment.P(view2, f10);
            }
        });
        L().B.setPageTransformer(cVar);
        L().B.g(new a());
        Q(0);
    }
}
