141 lines
3.6 KiB
Java
141 lines
3.6 KiB
Java
package com.bumptech.glide.manager;
|
|
|
|
import android.annotation.SuppressLint;
|
|
import android.annotation.TargetApi;
|
|
import android.app.Activity;
|
|
import android.app.Fragment;
|
|
import android.os.Build;
|
|
import android.util.Log;
|
|
import com.bumptech.glide.Glide;
|
|
import com.bumptech.glide.RequestManager;
|
|
import java.util.HashSet;
|
|
import java.util.Set;
|
|
|
|
@Deprecated
|
|
/* loaded from: classes.dex */
|
|
public class RequestManagerFragment extends Fragment {
|
|
private final ActivityFragmentLifecycle a;
|
|
private final RequestManagerTreeNode b;
|
|
private final Set<RequestManagerFragment> c;
|
|
private RequestManager d;
|
|
private RequestManagerFragment e;
|
|
private Fragment f;
|
|
|
|
private class FragmentRequestManagerTreeNode implements RequestManagerTreeNode {
|
|
FragmentRequestManagerTreeNode() {
|
|
}
|
|
|
|
public String toString() {
|
|
return super.toString() + "{fragment=" + RequestManagerFragment.this + "}";
|
|
}
|
|
}
|
|
|
|
public RequestManagerFragment() {
|
|
this(new ActivityFragmentLifecycle());
|
|
}
|
|
|
|
@TargetApi(17)
|
|
private Fragment d() {
|
|
Fragment parentFragment = Build.VERSION.SDK_INT >= 17 ? getParentFragment() : null;
|
|
return parentFragment != null ? parentFragment : this.f;
|
|
}
|
|
|
|
private void e() {
|
|
RequestManagerFragment requestManagerFragment = this.e;
|
|
if (requestManagerFragment != null) {
|
|
requestManagerFragment.b(this);
|
|
this.e = null;
|
|
}
|
|
}
|
|
|
|
public void a(RequestManager requestManager) {
|
|
this.d = requestManager;
|
|
}
|
|
|
|
public RequestManager b() {
|
|
return this.d;
|
|
}
|
|
|
|
public RequestManagerTreeNode c() {
|
|
return this.b;
|
|
}
|
|
|
|
@Override // android.app.Fragment
|
|
public void onAttach(Activity activity) {
|
|
super.onAttach(activity);
|
|
try {
|
|
a(activity);
|
|
} catch (IllegalStateException e) {
|
|
if (Log.isLoggable("RMFragment", 5)) {
|
|
Log.w("RMFragment", "Unable to register fragment with root", e);
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // android.app.Fragment
|
|
public void onDestroy() {
|
|
super.onDestroy();
|
|
this.a.a();
|
|
e();
|
|
}
|
|
|
|
@Override // android.app.Fragment
|
|
public void onDetach() {
|
|
super.onDetach();
|
|
e();
|
|
}
|
|
|
|
@Override // android.app.Fragment
|
|
public void onStart() {
|
|
super.onStart();
|
|
this.a.b();
|
|
}
|
|
|
|
@Override // android.app.Fragment
|
|
public void onStop() {
|
|
super.onStop();
|
|
this.a.c();
|
|
}
|
|
|
|
@Override // android.app.Fragment
|
|
public String toString() {
|
|
return super.toString() + "{parent=" + d() + "}";
|
|
}
|
|
|
|
@SuppressLint({"ValidFragment"})
|
|
RequestManagerFragment(ActivityFragmentLifecycle activityFragmentLifecycle) {
|
|
this.b = new FragmentRequestManagerTreeNode();
|
|
this.c = new HashSet();
|
|
this.a = activityFragmentLifecycle;
|
|
}
|
|
|
|
private void b(RequestManagerFragment requestManagerFragment) {
|
|
this.c.remove(requestManagerFragment);
|
|
}
|
|
|
|
ActivityFragmentLifecycle a() {
|
|
return this.a;
|
|
}
|
|
|
|
private void a(RequestManagerFragment requestManagerFragment) {
|
|
this.c.add(requestManagerFragment);
|
|
}
|
|
|
|
void a(Fragment fragment) {
|
|
this.f = fragment;
|
|
if (fragment == null || fragment.getActivity() == null) {
|
|
return;
|
|
}
|
|
a(fragment.getActivity());
|
|
}
|
|
|
|
private void a(Activity activity) {
|
|
e();
|
|
this.e = Glide.b(activity).i().b(activity);
|
|
if (equals(this.e)) {
|
|
return;
|
|
}
|
|
this.e.a(this);
|
|
}
|
|
}
|