package androidx.recyclerview.widget;

import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityEvent;
import c.f.l.t;
import java.util.Map;
import java.util.WeakHashMap;

/* JADX INFO: compiled from: RecyclerViewAccessibilityDelegate.java */
/* JADX INFO: loaded from: classes.dex */
public class i extends c.f.l.a {

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    final RecyclerView f1164d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    private final a f1165e;

    /* JADX INFO: compiled from: RecyclerViewAccessibilityDelegate.java */
    public static class a extends c.f.l.a {

        /* JADX INFO: renamed from: d, reason: collision with root package name */
        final i f1166d;

        /* JADX INFO: renamed from: e, reason: collision with root package name */
        private Map<View, c.f.l.a> f1167e = new WeakHashMap();

        public a(i iVar) {
            this.f1166d = iVar;
        }

        @Override // c.f.l.a
        public boolean a(View view, AccessibilityEvent accessibilityEvent) {
            c.f.l.a aVar = this.f1167e.get(view);
            return aVar != null ? aVar.a(view, accessibilityEvent) : super.a(view, accessibilityEvent);
        }

        @Override // c.f.l.a
        public c.f.l.c0.e b(View view) {
            c.f.l.a aVar = this.f1167e.get(view);
            return aVar != null ? aVar.b(view) : super.b(view);
        }

        @Override // c.f.l.a
        public void f(View view, AccessibilityEvent accessibilityEvent) {
            c.f.l.a aVar = this.f1167e.get(view);
            if (aVar != null) {
                aVar.f(view, accessibilityEvent);
            } else {
                super.f(view, accessibilityEvent);
            }
        }

        @Override // c.f.l.a
        public void g(View view, c.f.l.c0.d dVar) {
            if (this.f1166d.o() || this.f1166d.f1164d.getLayoutManager() == null) {
                super.g(view, dVar);
                return;
            }
            this.f1166d.f1164d.getLayoutManager().M0(view, dVar);
            c.f.l.a aVar = this.f1167e.get(view);
            if (aVar != null) {
                aVar.g(view, dVar);
            } else {
                super.g(view, dVar);
            }
        }

        @Override // c.f.l.a
        public void h(View view, AccessibilityEvent accessibilityEvent) {
            c.f.l.a aVar = this.f1167e.get(view);
            if (aVar != null) {
                aVar.h(view, accessibilityEvent);
            } else {
                super.h(view, accessibilityEvent);
            }
        }

        @Override // c.f.l.a
        public boolean i(ViewGroup viewGroup, View view, AccessibilityEvent accessibilityEvent) {
            c.f.l.a aVar = this.f1167e.get(viewGroup);
            return aVar != null ? aVar.i(viewGroup, view, accessibilityEvent) : super.i(viewGroup, view, accessibilityEvent);
        }

        @Override // c.f.l.a
        public boolean j(View view, int i2, Bundle bundle) {
            if (this.f1166d.o() || this.f1166d.f1164d.getLayoutManager() == null) {
                return super.j(view, i2, bundle);
            }
            c.f.l.a aVar = this.f1167e.get(view);
            if (aVar != null) {
                if (aVar.j(view, i2, bundle)) {
                    return true;
                }
            } else if (super.j(view, i2, bundle)) {
                return true;
            }
            return this.f1166d.f1164d.getLayoutManager().f1(view, i2, bundle);
        }

        @Override // c.f.l.a
        public void l(View view, int i2) {
            c.f.l.a aVar = this.f1167e.get(view);
            if (aVar != null) {
                aVar.l(view, i2);
            } else {
                super.l(view, i2);
            }
        }

        @Override // c.f.l.a
        public void m(View view, AccessibilityEvent accessibilityEvent) {
            c.f.l.a aVar = this.f1167e.get(view);
            if (aVar != null) {
                aVar.m(view, accessibilityEvent);
            } else {
                super.m(view, accessibilityEvent);
            }
        }

        c.f.l.a n(View view) {
            return this.f1167e.remove(view);
        }

        void o(View view) {
            c.f.l.a aVarG = t.g(view);
            if (aVarG == null || aVarG == this) {
                return;
            }
            this.f1167e.put(view, aVarG);
        }
    }

    public i(RecyclerView recyclerView) {
        this.f1164d = recyclerView;
        c.f.l.a aVarN = n();
        if (aVarN == null || !(aVarN instanceof a)) {
            this.f1165e = new a(this);
        } else {
            this.f1165e = (a) aVarN;
        }
    }

    @Override // c.f.l.a
    public void f(View view, AccessibilityEvent accessibilityEvent) {
        super.f(view, accessibilityEvent);
        if (!(view instanceof RecyclerView) || o()) {
            return;
        }
        RecyclerView recyclerView = (RecyclerView) view;
        if (recyclerView.getLayoutManager() != null) {
            recyclerView.getLayoutManager().I0(accessibilityEvent);
        }
    }

    @Override // c.f.l.a
    public void g(View view, c.f.l.c0.d dVar) {
        super.g(view, dVar);
        if (o() || this.f1164d.getLayoutManager() == null) {
            return;
        }
        this.f1164d.getLayoutManager().K0(dVar);
    }

    @Override // c.f.l.a
    public boolean j(View view, int i2, Bundle bundle) {
        if (super.j(view, i2, bundle)) {
            return true;
        }
        if (o() || this.f1164d.getLayoutManager() == null) {
            return false;
        }
        return this.f1164d.getLayoutManager().d1(i2, bundle);
    }

    public c.f.l.a n() {
        return this.f1165e;
    }

    boolean o() {
        return this.f1164d.l0();
    }
}
