jimu-decompiled/sources/androidx/loader/app/LoaderManagerImpl.java
2025-05-13 19:24:51 +02:00

196 lines
6.3 KiB
Java

package androidx.loader.app;
import android.os.Bundle;
import android.util.Log;
import androidx.collection.SparseArrayCompat;
import androidx.core.util.DebugUtils;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModel;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelStore;
import androidx.loader.content.Loader;
import com.ubtrobot.jimu.robotapi.PeripheralType;
import java.io.FileDescriptor;
import java.io.PrintWriter;
/* loaded from: classes.dex */
class LoaderManagerImpl extends LoaderManager {
static boolean c = false;
private final LifecycleOwner a;
private final LoaderViewModel b;
static class LoaderObserver<D> implements Observer<D> {
}
static class LoaderViewModel extends ViewModel {
private static final ViewModelProvider.Factory b = new ViewModelProvider.Factory() { // from class: androidx.loader.app.LoaderManagerImpl.LoaderViewModel.1
@Override // androidx.lifecycle.ViewModelProvider.Factory
public <T extends ViewModel> T a(Class<T> cls) {
return new LoaderViewModel();
}
};
private SparseArrayCompat<LoaderInfo> a = new SparseArrayCompat<>();
LoaderViewModel() {
}
static LoaderViewModel a(ViewModelStore viewModelStore) {
return (LoaderViewModel) new ViewModelProvider(viewModelStore, b).a(LoaderViewModel.class);
}
void b() {
int b2 = this.a.b();
for (int i = 0; i < b2; i++) {
this.a.f(i).c();
}
}
@Override // androidx.lifecycle.ViewModel
protected void a() {
super.a();
if (this.a.b() <= 0) {
this.a.a();
} else {
this.a.f(0).a(true);
throw null;
}
}
public void a(String str, FileDescriptor fileDescriptor, PrintWriter printWriter, String[] strArr) {
if (this.a.b() > 0) {
printWriter.print(str);
printWriter.println("Loaders:");
String str2 = str + " ";
if (this.a.b() <= 0) {
return;
}
LoaderInfo f = this.a.f(0);
printWriter.print(str);
printWriter.print(" #");
printWriter.print(this.a.d(0));
printWriter.print(": ");
printWriter.println(f.toString());
f.a(str2, fileDescriptor, printWriter, strArr);
throw null;
}
}
}
LoaderManagerImpl(LifecycleOwner lifecycleOwner, ViewModelStore viewModelStore) {
this.a = lifecycleOwner;
this.b = LoaderViewModel.a(viewModelStore);
}
@Override // androidx.loader.app.LoaderManager
public void a() {
this.b.b();
}
public String toString() {
StringBuilder sb = new StringBuilder(PeripheralType.SERVO);
sb.append("LoaderManager{");
sb.append(Integer.toHexString(System.identityHashCode(this)));
sb.append(" in ");
DebugUtils.a(this.a, sb);
sb.append("}}");
return sb.toString();
}
public static class LoaderInfo<D> extends MutableLiveData<D> implements Loader.OnLoadCompleteListener<D> {
private final int j;
private final Bundle k;
private final Loader<D> l;
private LifecycleOwner m;
private LoaderObserver<D> n;
private Loader<D> o;
@Override // androidx.lifecycle.LiveData
protected void a() {
if (LoaderManagerImpl.c) {
Log.v("LoaderManager", " Starting: " + this);
}
this.l.c();
throw null;
}
@Override // androidx.lifecycle.LiveData
protected void b() {
if (LoaderManagerImpl.c) {
Log.v("LoaderManager", " Stopping: " + this);
}
this.l.d();
throw null;
}
void c() {
LifecycleOwner lifecycleOwner = this.m;
LoaderObserver<D> loaderObserver = this.n;
if (lifecycleOwner == null || loaderObserver == null) {
return;
}
super.a((Observer) loaderObserver);
a(lifecycleOwner, loaderObserver);
}
public String toString() {
StringBuilder sb = new StringBuilder(64);
sb.append("LoaderInfo{");
sb.append(Integer.toHexString(System.identityHashCode(this)));
sb.append(" #");
sb.append(this.j);
sb.append(" : ");
DebugUtils.a(this.l, sb);
sb.append("}}");
return sb.toString();
}
/* JADX WARN: Multi-variable type inference failed */
@Override // androidx.lifecycle.LiveData
public void a(Observer<? super D> observer) {
super.a((Observer) observer);
this.m = null;
this.n = null;
}
Loader<D> a(boolean z) {
if (LoaderManagerImpl.c) {
Log.v("LoaderManager", " Destroying: " + this);
}
this.l.a();
throw null;
}
@Override // androidx.lifecycle.MutableLiveData, androidx.lifecycle.LiveData
public void a(D d) {
super.a((LoaderInfo<D>) d);
Loader<D> loader = this.o;
if (loader == null) {
return;
}
loader.b();
throw null;
}
public void a(String str, FileDescriptor fileDescriptor, PrintWriter printWriter, String[] strArr) {
printWriter.print(str);
printWriter.print("mId=");
printWriter.print(this.j);
printWriter.print(" mArgs=");
printWriter.println(this.k);
printWriter.print(str);
printWriter.print("mLoader=");
printWriter.println(this.l);
this.l.a(str + " ", fileDescriptor, printWriter, strArr);
throw null;
}
}
@Override // androidx.loader.app.LoaderManager
@Deprecated
public void a(String str, FileDescriptor fileDescriptor, PrintWriter printWriter, String[] strArr) {
this.b.a(str, fileDescriptor, printWriter, strArr);
}
}