package com.bumptech.glide.manager; import android.content.Context; import androidx.fragment.app.Fragment; import com.airbnb.deeplinkdispatch.UrlTreeKt; import com.bumptech.glide.Glide; import java.util.HashSet; import java.util.Set; import o.InterfaceC17301vdx; import o.YSJ; import o.sXW; import o.yRS; /* loaded from: classes.dex */ public class SupportRequestManagerFragment extends Fragment { public final InterfaceC17301vdx a; public final sXW b; public YSJ c; public Fragment d; private final Set e; private SupportRequestManagerFragment f; public SupportRequestManagerFragment() { this(new sXW()); } private SupportRequestManagerFragment(sXW sxw) { this.a = new RVV(this); this.e = new HashSet(); this.b = sxw; } public static yRS b(Fragment fragment) { while (fragment.getParentFragment() != null) { fragment = fragment.getParentFragment(); } return fragment.getFragmentManager(); } public final void d(Context context, yRS yrs) { SupportRequestManagerFragment supportRequestManagerFragment = this.f; if (supportRequestManagerFragment != null) { supportRequestManagerFragment.e.remove(this); this.f = null; } SupportRequestManagerFragment c = Glide.a(context).i.c(yrs, null); this.f = c; if (equals(c)) { return; } this.f.e.add(this); } @Override // androidx.fragment.app.Fragment public void onAttach(Context context) { super.onAttach(context); Fragment fragment = this; while (fragment.getParentFragment() != null) { fragment = fragment.getParentFragment(); } yRS fragmentManager = fragment.getFragmentManager(); if (fragmentManager == null) { return; } try { d(getContext(), fragmentManager); } catch (IllegalStateException unused) { } } @Override // androidx.fragment.app.Fragment public void onDetach() { super.onDetach(); this.d = null; SupportRequestManagerFragment supportRequestManagerFragment = this.f; if (supportRequestManagerFragment != null) { supportRequestManagerFragment.e.remove(this); this.f = null; } } @Override // androidx.fragment.app.Fragment public void onStart() { super.onStart(); this.b.e(); } @Override // androidx.fragment.app.Fragment public void onStop() { super.onStop(); this.b.a(); } @Override // androidx.fragment.app.Fragment public void onDestroy() { super.onDestroy(); this.b.d(); SupportRequestManagerFragment supportRequestManagerFragment = this.f; if (supportRequestManagerFragment != null) { supportRequestManagerFragment.e.remove(this); this.f = null; } } @Override // androidx.fragment.app.Fragment public String toString() { StringBuilder sb = new StringBuilder(); sb.append(super.toString()); sb.append("{parent="); Fragment parentFragment = getParentFragment(); if (parentFragment == null) { parentFragment = this.d; } sb.append(parentFragment); sb.append(UrlTreeKt.componentParamSuffix); return sb.toString(); } /* loaded from: classes.dex */ class RVV implements InterfaceC17301vdx { private SupportRequestManagerFragment e; RVV(SupportRequestManagerFragment supportRequestManagerFragment) { this.e = supportRequestManagerFragment; } public final String toString() { StringBuilder sb = new StringBuilder(); sb.append(super.toString()); sb.append("{fragment="); sb.append(this.e); sb.append(UrlTreeKt.componentParamSuffix); return sb.toString(); } } }