ADD week 5
This commit is contained in:
202
02-Easy5/E5/sources/androidx/loader/R.java
Normal file
202
02-Easy5/E5/sources/androidx/loader/R.java
Normal file
@ -0,0 +1,202 @@
|
||||
package androidx.loader;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class R {
|
||||
|
||||
public static final class attr {
|
||||
public static final int alpha = 0x7f03002e;
|
||||
public static final int font = 0x7f0301fb;
|
||||
public static final int fontProviderAuthority = 0x7f0301fd;
|
||||
public static final int fontProviderCerts = 0x7f0301fe;
|
||||
public static final int fontProviderFetchStrategy = 0x7f0301ff;
|
||||
public static final int fontProviderFetchTimeout = 0x7f030200;
|
||||
public static final int fontProviderPackage = 0x7f030201;
|
||||
public static final int fontProviderQuery = 0x7f030202;
|
||||
public static final int fontStyle = 0x7f030204;
|
||||
public static final int fontVariationSettings = 0x7f030205;
|
||||
public static final int fontWeight = 0x7f030206;
|
||||
public static final int ttcIndex = 0x7f0304b6;
|
||||
|
||||
private attr() {
|
||||
}
|
||||
}
|
||||
|
||||
public static final class color {
|
||||
public static final int notification_action_color_filter = 0x7f0502e9;
|
||||
public static final int notification_icon_bg_color = 0x7f0502ea;
|
||||
public static final int ripple_material_light = 0x7f0502f7;
|
||||
public static final int secondary_text_default_material_light = 0x7f0502f9;
|
||||
|
||||
private color() {
|
||||
}
|
||||
}
|
||||
|
||||
public static final class dimen {
|
||||
public static final int compat_button_inset_horizontal_material = 0x7f060058;
|
||||
public static final int compat_button_inset_vertical_material = 0x7f060059;
|
||||
public static final int compat_button_padding_horizontal_material = 0x7f06005a;
|
||||
public static final int compat_button_padding_vertical_material = 0x7f06005b;
|
||||
public static final int compat_control_corner_material = 0x7f06005c;
|
||||
public static final int compat_notification_large_icon_max_height = 0x7f06005d;
|
||||
public static final int compat_notification_large_icon_max_width = 0x7f06005e;
|
||||
public static final int notification_action_icon_size = 0x7f060307;
|
||||
public static final int notification_action_text_size = 0x7f060308;
|
||||
public static final int notification_big_circle_margin = 0x7f060309;
|
||||
public static final int notification_content_margin_start = 0x7f06030a;
|
||||
public static final int notification_large_icon_height = 0x7f06030b;
|
||||
public static final int notification_large_icon_width = 0x7f06030c;
|
||||
public static final int notification_main_column_padding_top = 0x7f06030d;
|
||||
public static final int notification_media_narrow_margin = 0x7f06030e;
|
||||
public static final int notification_right_icon_size = 0x7f06030f;
|
||||
public static final int notification_right_side_padding_top = 0x7f060310;
|
||||
public static final int notification_small_icon_background_padding = 0x7f060311;
|
||||
public static final int notification_small_icon_size_as_large = 0x7f060312;
|
||||
public static final int notification_subtext_size = 0x7f060313;
|
||||
public static final int notification_top_pad = 0x7f060314;
|
||||
public static final int notification_top_pad_large_text = 0x7f060315;
|
||||
|
||||
private dimen() {
|
||||
}
|
||||
}
|
||||
|
||||
public static final class drawable {
|
||||
public static final int notification_action_background = 0x7f0700d0;
|
||||
public static final int notification_bg = 0x7f0700d1;
|
||||
public static final int notification_bg_low = 0x7f0700d2;
|
||||
public static final int notification_bg_low_normal = 0x7f0700d3;
|
||||
public static final int notification_bg_low_pressed = 0x7f0700d4;
|
||||
public static final int notification_bg_normal = 0x7f0700d5;
|
||||
public static final int notification_bg_normal_pressed = 0x7f0700d6;
|
||||
public static final int notification_icon_background = 0x7f0700d7;
|
||||
public static final int notification_template_icon_bg = 0x7f0700d8;
|
||||
public static final int notification_template_icon_low_bg = 0x7f0700d9;
|
||||
public static final int notification_tile_bg = 0x7f0700da;
|
||||
public static final int notify_panel_notification_icon_bg = 0x7f0700db;
|
||||
|
||||
private drawable() {
|
||||
}
|
||||
}
|
||||
|
||||
public static final class id {
|
||||
public static final int action_container = 0x7f08003a;
|
||||
public static final int action_divider = 0x7f08003c;
|
||||
public static final int action_image = 0x7f08003d;
|
||||
public static final int action_text = 0x7f080043;
|
||||
public static final int actions = 0x7f080044;
|
||||
public static final int async = 0x7f080052;
|
||||
public static final int blocking = 0x7f08005c;
|
||||
public static final int chronometer = 0x7f080071;
|
||||
public static final int forever = 0x7f0800c2;
|
||||
public static final int icon = 0x7f0800d4;
|
||||
public static final int icon_group = 0x7f0800d5;
|
||||
public static final int info = 0x7f0800dd;
|
||||
public static final int italic = 0x7f0800e0;
|
||||
public static final int line1 = 0x7f0800e9;
|
||||
public static final int line3 = 0x7f0800ea;
|
||||
public static final int normal = 0x7f080139;
|
||||
public static final int notification_background = 0x7f08013b;
|
||||
public static final int notification_main_column = 0x7f08013c;
|
||||
public static final int notification_main_column_container = 0x7f08013d;
|
||||
public static final int right_icon = 0x7f08016b;
|
||||
public static final int right_side = 0x7f08016c;
|
||||
public static final int tag_transition_group = 0x7f0801b6;
|
||||
public static final int tag_unhandled_key_event_manager = 0x7f0801b7;
|
||||
public static final int tag_unhandled_key_listeners = 0x7f0801b8;
|
||||
public static final int text = 0x7f0801ba;
|
||||
public static final int text2 = 0x7f0801bb;
|
||||
public static final int time = 0x7f0801ca;
|
||||
public static final int title = 0x7f0801cb;
|
||||
|
||||
private id() {
|
||||
}
|
||||
}
|
||||
|
||||
public static final class integer {
|
||||
public static final int status_bar_notification_info_maxnum = 0x7f090043;
|
||||
|
||||
private integer() {
|
||||
}
|
||||
}
|
||||
|
||||
public static final class layout {
|
||||
public static final int notification_action = 0x7f0b0060;
|
||||
public static final int notification_action_tombstone = 0x7f0b0061;
|
||||
public static final int notification_template_custom_big = 0x7f0b0062;
|
||||
public static final int notification_template_icon_group = 0x7f0b0063;
|
||||
public static final int notification_template_part_chronometer = 0x7f0b0064;
|
||||
public static final int notification_template_part_time = 0x7f0b0065;
|
||||
|
||||
private layout() {
|
||||
}
|
||||
}
|
||||
|
||||
public static final class string {
|
||||
public static final int status_bar_notification_info_overflow = 0x7f0f00a8;
|
||||
|
||||
private string() {
|
||||
}
|
||||
}
|
||||
|
||||
public static final class style {
|
||||
public static final int TextAppearance_Compat_Notification = 0x7f1001c3;
|
||||
public static final int TextAppearance_Compat_Notification_Info = 0x7f1001c4;
|
||||
public static final int TextAppearance_Compat_Notification_Line2 = 0x7f1001c5;
|
||||
public static final int TextAppearance_Compat_Notification_Time = 0x7f1001c6;
|
||||
public static final int TextAppearance_Compat_Notification_Title = 0x7f1001c7;
|
||||
public static final int Widget_Compat_NotificationActionContainer = 0x7f10032d;
|
||||
public static final int Widget_Compat_NotificationActionText = 0x7f10032e;
|
||||
|
||||
private style() {
|
||||
}
|
||||
}
|
||||
|
||||
public static final class styleable {
|
||||
public static final int ColorStateListItem_alpha = 0x00000003;
|
||||
public static final int ColorStateListItem_android_alpha = 0x00000001;
|
||||
public static final int ColorStateListItem_android_color = 0x00000000;
|
||||
public static final int ColorStateListItem_android_lStar = 0x00000002;
|
||||
public static final int ColorStateListItem_lStar = 0x00000004;
|
||||
public static final int FontFamilyFont_android_font = 0x00000000;
|
||||
public static final int FontFamilyFont_android_fontStyle = 0x00000002;
|
||||
public static final int FontFamilyFont_android_fontVariationSettings = 0x00000004;
|
||||
public static final int FontFamilyFont_android_fontWeight = 0x00000001;
|
||||
public static final int FontFamilyFont_android_ttcIndex = 0x00000003;
|
||||
public static final int FontFamilyFont_font = 0x00000005;
|
||||
public static final int FontFamilyFont_fontStyle = 0x00000006;
|
||||
public static final int FontFamilyFont_fontVariationSettings = 0x00000007;
|
||||
public static final int FontFamilyFont_fontWeight = 0x00000008;
|
||||
public static final int FontFamilyFont_ttcIndex = 0x00000009;
|
||||
public static final int FontFamily_fontProviderAuthority = 0x00000000;
|
||||
public static final int FontFamily_fontProviderCerts = 0x00000001;
|
||||
public static final int FontFamily_fontProviderFetchStrategy = 0x00000002;
|
||||
public static final int FontFamily_fontProviderFetchTimeout = 0x00000003;
|
||||
public static final int FontFamily_fontProviderPackage = 0x00000004;
|
||||
public static final int FontFamily_fontProviderQuery = 0x00000005;
|
||||
public static final int FontFamily_fontProviderSystemFontFamily = 0x00000006;
|
||||
public static final int GradientColorItem_android_color = 0x00000000;
|
||||
public static final int GradientColorItem_android_offset = 0x00000001;
|
||||
public static final int GradientColor_android_centerColor = 0x00000007;
|
||||
public static final int GradientColor_android_centerX = 0x00000003;
|
||||
public static final int GradientColor_android_centerY = 0x00000004;
|
||||
public static final int GradientColor_android_endColor = 0x00000001;
|
||||
public static final int GradientColor_android_endX = 0x0000000a;
|
||||
public static final int GradientColor_android_endY = 0x0000000b;
|
||||
public static final int GradientColor_android_gradientRadius = 0x00000005;
|
||||
public static final int GradientColor_android_startColor = 0x00000000;
|
||||
public static final int GradientColor_android_startX = 0x00000008;
|
||||
public static final int GradientColor_android_startY = 0x00000009;
|
||||
public static final int GradientColor_android_tileMode = 0x00000006;
|
||||
public static final int GradientColor_android_type = 0x00000002;
|
||||
public static final int[] ColorStateListItem = {android.R.attr.color, android.R.attr.alpha, android.R.attr.lStar, ch.mod_p.sre24.e5.R.attr.alpha, ch.mod_p.sre24.e5.R.attr.lStar};
|
||||
public static final int[] FontFamily = {ch.mod_p.sre24.e5.R.attr.fontProviderAuthority, ch.mod_p.sre24.e5.R.attr.fontProviderCerts, ch.mod_p.sre24.e5.R.attr.fontProviderFetchStrategy, ch.mod_p.sre24.e5.R.attr.fontProviderFetchTimeout, ch.mod_p.sre24.e5.R.attr.fontProviderPackage, ch.mod_p.sre24.e5.R.attr.fontProviderQuery, ch.mod_p.sre24.e5.R.attr.fontProviderSystemFontFamily};
|
||||
public static final int[] FontFamilyFont = {android.R.attr.font, android.R.attr.fontWeight, android.R.attr.fontStyle, android.R.attr.ttcIndex, android.R.attr.fontVariationSettings, ch.mod_p.sre24.e5.R.attr.font, ch.mod_p.sre24.e5.R.attr.fontStyle, ch.mod_p.sre24.e5.R.attr.fontVariationSettings, ch.mod_p.sre24.e5.R.attr.fontWeight, ch.mod_p.sre24.e5.R.attr.ttcIndex};
|
||||
public static final int[] GradientColor = {android.R.attr.startColor, android.R.attr.endColor, android.R.attr.type, android.R.attr.centerX, android.R.attr.centerY, android.R.attr.gradientRadius, android.R.attr.tileMode, android.R.attr.centerColor, android.R.attr.startX, android.R.attr.startY, android.R.attr.endX, android.R.attr.endY};
|
||||
public static final int[] GradientColorItem = {android.R.attr.color, android.R.attr.offset};
|
||||
|
||||
private styleable() {
|
||||
}
|
||||
}
|
||||
|
||||
private R() {
|
||||
}
|
||||
}
|
45
02-Easy5/E5/sources/androidx/loader/app/LoaderManager.java
Normal file
45
02-Easy5/E5/sources/androidx/loader/app/LoaderManager.java
Normal file
@ -0,0 +1,45 @@
|
||||
package androidx.loader.app;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
import androidx.lifecycle.ViewModelStoreOwner;
|
||||
import androidx.loader.content.Loader;
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class LoaderManager {
|
||||
|
||||
public interface LoaderCallbacks<D> {
|
||||
Loader<D> onCreateLoader(int i, Bundle bundle);
|
||||
|
||||
void onLoadFinished(Loader<D> loader, D d);
|
||||
|
||||
void onLoaderReset(Loader<D> loader);
|
||||
}
|
||||
|
||||
public abstract void destroyLoader(int i);
|
||||
|
||||
@Deprecated
|
||||
public abstract void dump(String str, FileDescriptor fileDescriptor, PrintWriter printWriter, String[] strArr);
|
||||
|
||||
public abstract <D> Loader<D> getLoader(int i);
|
||||
|
||||
public boolean hasRunningLoaders() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public abstract <D> Loader<D> initLoader(int i, Bundle bundle, LoaderCallbacks<D> loaderCallbacks);
|
||||
|
||||
public abstract void markForRedelivery();
|
||||
|
||||
public abstract <D> Loader<D> restartLoader(int i, Bundle bundle, LoaderCallbacks<D> loaderCallbacks);
|
||||
|
||||
public static <T extends LifecycleOwner & ViewModelStoreOwner> LoaderManager getInstance(T t) {
|
||||
return new LoaderManagerImpl(t, t.getViewModelStore());
|
||||
}
|
||||
|
||||
public static void enableDebugLogging(boolean z) {
|
||||
LoaderManagerImpl.DEBUG = z;
|
||||
}
|
||||
}
|
435
02-Easy5/E5/sources/androidx/loader/app/LoaderManagerImpl.java
Normal file
435
02-Easy5/E5/sources/androidx/loader/app/LoaderManagerImpl.java
Normal file
@ -0,0 +1,435 @@
|
||||
package androidx.loader.app;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.os.Looper;
|
||||
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.lifecycle.viewmodel.CreationExtras;
|
||||
import androidx.loader.app.LoaderManager;
|
||||
import androidx.loader.content.Loader;
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.PrintWriter;
|
||||
import java.lang.reflect.Modifier;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class LoaderManagerImpl extends LoaderManager {
|
||||
static boolean DEBUG = false;
|
||||
static final String TAG = "LoaderManager";
|
||||
private final LifecycleOwner mLifecycleOwner;
|
||||
private final LoaderViewModel mLoaderViewModel;
|
||||
|
||||
public static class LoaderInfo<D> extends MutableLiveData<D> implements Loader.OnLoadCompleteListener<D> {
|
||||
private final Bundle mArgs;
|
||||
private final int mId;
|
||||
private LifecycleOwner mLifecycleOwner;
|
||||
private final Loader<D> mLoader;
|
||||
private LoaderObserver<D> mObserver;
|
||||
private Loader<D> mPriorLoader;
|
||||
|
||||
Loader<D> getLoader() {
|
||||
return this.mLoader;
|
||||
}
|
||||
|
||||
LoaderInfo(int i, Bundle bundle, Loader<D> loader, Loader<D> loader2) {
|
||||
this.mId = i;
|
||||
this.mArgs = bundle;
|
||||
this.mLoader = loader;
|
||||
this.mPriorLoader = loader2;
|
||||
loader.registerListener(i, this);
|
||||
}
|
||||
|
||||
@Override // androidx.lifecycle.LiveData
|
||||
protected void onActive() {
|
||||
if (LoaderManagerImpl.DEBUG) {
|
||||
Log.v(LoaderManagerImpl.TAG, " Starting: " + this);
|
||||
}
|
||||
this.mLoader.startLoading();
|
||||
}
|
||||
|
||||
@Override // androidx.lifecycle.LiveData
|
||||
protected void onInactive() {
|
||||
if (LoaderManagerImpl.DEBUG) {
|
||||
Log.v(LoaderManagerImpl.TAG, " Stopping: " + this);
|
||||
}
|
||||
this.mLoader.stopLoading();
|
||||
}
|
||||
|
||||
Loader<D> setCallback(LifecycleOwner lifecycleOwner, LoaderManager.LoaderCallbacks<D> loaderCallbacks) {
|
||||
LoaderObserver<D> loaderObserver = new LoaderObserver<>(this.mLoader, loaderCallbacks);
|
||||
observe(lifecycleOwner, loaderObserver);
|
||||
LoaderObserver<D> loaderObserver2 = this.mObserver;
|
||||
if (loaderObserver2 != null) {
|
||||
removeObserver(loaderObserver2);
|
||||
}
|
||||
this.mLifecycleOwner = lifecycleOwner;
|
||||
this.mObserver = loaderObserver;
|
||||
return this.mLoader;
|
||||
}
|
||||
|
||||
void markForRedelivery() {
|
||||
LifecycleOwner lifecycleOwner = this.mLifecycleOwner;
|
||||
LoaderObserver<D> loaderObserver = this.mObserver;
|
||||
if (lifecycleOwner == null || loaderObserver == null) {
|
||||
return;
|
||||
}
|
||||
super.removeObserver(loaderObserver);
|
||||
observe(lifecycleOwner, loaderObserver);
|
||||
}
|
||||
|
||||
boolean isCallbackWaitingForData() {
|
||||
LoaderObserver<D> loaderObserver;
|
||||
return (!hasActiveObservers() || (loaderObserver = this.mObserver) == null || loaderObserver.hasDeliveredData()) ? false : true;
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
@Override // androidx.lifecycle.LiveData
|
||||
public void removeObserver(Observer<? super D> observer) {
|
||||
super.removeObserver(observer);
|
||||
this.mLifecycleOwner = null;
|
||||
this.mObserver = null;
|
||||
}
|
||||
|
||||
Loader<D> destroy(boolean z) {
|
||||
if (LoaderManagerImpl.DEBUG) {
|
||||
Log.v(LoaderManagerImpl.TAG, " Destroying: " + this);
|
||||
}
|
||||
this.mLoader.cancelLoad();
|
||||
this.mLoader.abandon();
|
||||
LoaderObserver<D> loaderObserver = this.mObserver;
|
||||
if (loaderObserver != null) {
|
||||
removeObserver(loaderObserver);
|
||||
if (z) {
|
||||
loaderObserver.reset();
|
||||
}
|
||||
}
|
||||
this.mLoader.unregisterListener(this);
|
||||
if ((loaderObserver == null || loaderObserver.hasDeliveredData()) && !z) {
|
||||
return this.mLoader;
|
||||
}
|
||||
this.mLoader.reset();
|
||||
return this.mPriorLoader;
|
||||
}
|
||||
|
||||
@Override // androidx.loader.content.Loader.OnLoadCompleteListener
|
||||
public void onLoadComplete(Loader<D> loader, D d) {
|
||||
if (LoaderManagerImpl.DEBUG) {
|
||||
Log.v(LoaderManagerImpl.TAG, "onLoadComplete: " + this);
|
||||
}
|
||||
if (Looper.myLooper() == Looper.getMainLooper()) {
|
||||
setValue(d);
|
||||
return;
|
||||
}
|
||||
if (LoaderManagerImpl.DEBUG) {
|
||||
Log.w(LoaderManagerImpl.TAG, "onLoadComplete was incorrectly called on a background thread");
|
||||
}
|
||||
postValue(d);
|
||||
}
|
||||
|
||||
@Override // androidx.lifecycle.MutableLiveData, androidx.lifecycle.LiveData
|
||||
public void setValue(D d) {
|
||||
super.setValue(d);
|
||||
Loader<D> loader = this.mPriorLoader;
|
||||
if (loader != null) {
|
||||
loader.reset();
|
||||
this.mPriorLoader = null;
|
||||
}
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder(64);
|
||||
sb.append("LoaderInfo{");
|
||||
sb.append(Integer.toHexString(System.identityHashCode(this)));
|
||||
sb.append(" #");
|
||||
sb.append(this.mId);
|
||||
sb.append(" : ");
|
||||
DebugUtils.buildShortClassTag(this.mLoader, sb);
|
||||
sb.append("}}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public void dump(String str, FileDescriptor fileDescriptor, PrintWriter printWriter, String[] strArr) {
|
||||
printWriter.print(str);
|
||||
printWriter.print("mId=");
|
||||
printWriter.print(this.mId);
|
||||
printWriter.print(" mArgs=");
|
||||
printWriter.println(this.mArgs);
|
||||
printWriter.print(str);
|
||||
printWriter.print("mLoader=");
|
||||
printWriter.println(this.mLoader);
|
||||
this.mLoader.dump(str + " ", fileDescriptor, printWriter, strArr);
|
||||
if (this.mObserver != null) {
|
||||
printWriter.print(str);
|
||||
printWriter.print("mCallbacks=");
|
||||
printWriter.println(this.mObserver);
|
||||
this.mObserver.dump(str + " ", printWriter);
|
||||
}
|
||||
printWriter.print(str);
|
||||
printWriter.print("mData=");
|
||||
printWriter.println(getLoader().dataToString(getValue()));
|
||||
printWriter.print(str);
|
||||
printWriter.print("mStarted=");
|
||||
printWriter.println(hasActiveObservers());
|
||||
}
|
||||
}
|
||||
|
||||
static class LoaderObserver<D> implements Observer<D> {
|
||||
private final LoaderManager.LoaderCallbacks<D> mCallback;
|
||||
private boolean mDeliveredData = false;
|
||||
private final Loader<D> mLoader;
|
||||
|
||||
boolean hasDeliveredData() {
|
||||
return this.mDeliveredData;
|
||||
}
|
||||
|
||||
LoaderObserver(Loader<D> loader, LoaderManager.LoaderCallbacks<D> loaderCallbacks) {
|
||||
this.mLoader = loader;
|
||||
this.mCallback = loaderCallbacks;
|
||||
}
|
||||
|
||||
@Override // androidx.lifecycle.Observer
|
||||
public void onChanged(D d) {
|
||||
if (LoaderManagerImpl.DEBUG) {
|
||||
Log.v(LoaderManagerImpl.TAG, " onLoadFinished in " + this.mLoader + ": " + this.mLoader.dataToString(d));
|
||||
}
|
||||
this.mCallback.onLoadFinished(this.mLoader, d);
|
||||
this.mDeliveredData = true;
|
||||
}
|
||||
|
||||
void reset() {
|
||||
if (this.mDeliveredData) {
|
||||
if (LoaderManagerImpl.DEBUG) {
|
||||
Log.v(LoaderManagerImpl.TAG, " Resetting: " + this.mLoader);
|
||||
}
|
||||
this.mCallback.onLoaderReset(this.mLoader);
|
||||
}
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return this.mCallback.toString();
|
||||
}
|
||||
|
||||
public void dump(String str, PrintWriter printWriter) {
|
||||
printWriter.print(str);
|
||||
printWriter.print("mDeliveredData=");
|
||||
printWriter.println(this.mDeliveredData);
|
||||
}
|
||||
}
|
||||
|
||||
static class LoaderViewModel extends ViewModel {
|
||||
private static final ViewModelProvider.Factory FACTORY = new ViewModelProvider.Factory() { // from class: androidx.loader.app.LoaderManagerImpl.LoaderViewModel.1
|
||||
@Override // androidx.lifecycle.ViewModelProvider.Factory
|
||||
public /* synthetic */ ViewModel create(Class cls, CreationExtras creationExtras) {
|
||||
return ViewModelProvider.Factory.CC.$default$create(this, cls, creationExtras);
|
||||
}
|
||||
|
||||
@Override // androidx.lifecycle.ViewModelProvider.Factory
|
||||
public <T extends ViewModel> T create(Class<T> cls) {
|
||||
return new LoaderViewModel();
|
||||
}
|
||||
};
|
||||
private SparseArrayCompat<LoaderInfo> mLoaders = new SparseArrayCompat<>();
|
||||
private boolean mCreatingLoader = false;
|
||||
|
||||
void finishCreatingLoader() {
|
||||
this.mCreatingLoader = false;
|
||||
}
|
||||
|
||||
boolean isCreatingLoader() {
|
||||
return this.mCreatingLoader;
|
||||
}
|
||||
|
||||
void startCreatingLoader() {
|
||||
this.mCreatingLoader = true;
|
||||
}
|
||||
|
||||
LoaderViewModel() {
|
||||
}
|
||||
|
||||
static LoaderViewModel getInstance(ViewModelStore viewModelStore) {
|
||||
return (LoaderViewModel) new ViewModelProvider(viewModelStore, FACTORY).get(LoaderViewModel.class);
|
||||
}
|
||||
|
||||
void putLoader(int i, LoaderInfo loaderInfo) {
|
||||
this.mLoaders.put(i, loaderInfo);
|
||||
}
|
||||
|
||||
<D> LoaderInfo<D> getLoader(int i) {
|
||||
return this.mLoaders.get(i);
|
||||
}
|
||||
|
||||
void removeLoader(int i) {
|
||||
this.mLoaders.remove(i);
|
||||
}
|
||||
|
||||
boolean hasRunningLoaders() {
|
||||
int size = this.mLoaders.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
if (this.mLoaders.valueAt(i).isCallbackWaitingForData()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void markForRedelivery() {
|
||||
int size = this.mLoaders.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
this.mLoaders.valueAt(i).markForRedelivery();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.lifecycle.ViewModel
|
||||
protected void onCleared() {
|
||||
super.onCleared();
|
||||
int size = this.mLoaders.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
this.mLoaders.valueAt(i).destroy(true);
|
||||
}
|
||||
this.mLoaders.clear();
|
||||
}
|
||||
|
||||
public void dump(String str, FileDescriptor fileDescriptor, PrintWriter printWriter, String[] strArr) {
|
||||
if (this.mLoaders.size() > 0) {
|
||||
printWriter.print(str);
|
||||
printWriter.println("Loaders:");
|
||||
String str2 = str + " ";
|
||||
for (int i = 0; i < this.mLoaders.size(); i++) {
|
||||
LoaderInfo valueAt = this.mLoaders.valueAt(i);
|
||||
printWriter.print(str);
|
||||
printWriter.print(" #");
|
||||
printWriter.print(this.mLoaders.keyAt(i));
|
||||
printWriter.print(": ");
|
||||
printWriter.println(valueAt.toString());
|
||||
valueAt.dump(str2, fileDescriptor, printWriter, strArr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LoaderManagerImpl(LifecycleOwner lifecycleOwner, ViewModelStore viewModelStore) {
|
||||
this.mLifecycleOwner = lifecycleOwner;
|
||||
this.mLoaderViewModel = LoaderViewModel.getInstance(viewModelStore);
|
||||
}
|
||||
|
||||
private <D> Loader<D> createAndInstallLoader(int i, Bundle bundle, LoaderManager.LoaderCallbacks<D> loaderCallbacks, Loader<D> loader) {
|
||||
try {
|
||||
this.mLoaderViewModel.startCreatingLoader();
|
||||
Loader<D> onCreateLoader = loaderCallbacks.onCreateLoader(i, bundle);
|
||||
if (onCreateLoader == null) {
|
||||
throw new IllegalArgumentException("Object returned from onCreateLoader must not be null");
|
||||
}
|
||||
if (onCreateLoader.getClass().isMemberClass() && !Modifier.isStatic(onCreateLoader.getClass().getModifiers())) {
|
||||
throw new IllegalArgumentException("Object returned from onCreateLoader must not be a non-static inner member class: " + onCreateLoader);
|
||||
}
|
||||
LoaderInfo loaderInfo = new LoaderInfo(i, bundle, onCreateLoader, loader);
|
||||
if (DEBUG) {
|
||||
Log.v(TAG, " Created new loader " + loaderInfo);
|
||||
}
|
||||
this.mLoaderViewModel.putLoader(i, loaderInfo);
|
||||
this.mLoaderViewModel.finishCreatingLoader();
|
||||
return loaderInfo.setCallback(this.mLifecycleOwner, loaderCallbacks);
|
||||
} catch (Throwable th) {
|
||||
this.mLoaderViewModel.finishCreatingLoader();
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.loader.app.LoaderManager
|
||||
public <D> Loader<D> initLoader(int i, Bundle bundle, LoaderManager.LoaderCallbacks<D> loaderCallbacks) {
|
||||
if (this.mLoaderViewModel.isCreatingLoader()) {
|
||||
throw new IllegalStateException("Called while creating a loader");
|
||||
}
|
||||
if (Looper.getMainLooper() != Looper.myLooper()) {
|
||||
throw new IllegalStateException("initLoader must be called on the main thread");
|
||||
}
|
||||
LoaderInfo<D> loader = this.mLoaderViewModel.getLoader(i);
|
||||
if (DEBUG) {
|
||||
Log.v(TAG, "initLoader in " + this + ": args=" + bundle);
|
||||
}
|
||||
if (loader == null) {
|
||||
return createAndInstallLoader(i, bundle, loaderCallbacks, null);
|
||||
}
|
||||
if (DEBUG) {
|
||||
Log.v(TAG, " Re-using existing loader " + loader);
|
||||
}
|
||||
return loader.setCallback(this.mLifecycleOwner, loaderCallbacks);
|
||||
}
|
||||
|
||||
@Override // androidx.loader.app.LoaderManager
|
||||
public <D> Loader<D> restartLoader(int i, Bundle bundle, LoaderManager.LoaderCallbacks<D> loaderCallbacks) {
|
||||
if (this.mLoaderViewModel.isCreatingLoader()) {
|
||||
throw new IllegalStateException("Called while creating a loader");
|
||||
}
|
||||
if (Looper.getMainLooper() != Looper.myLooper()) {
|
||||
throw new IllegalStateException("restartLoader must be called on the main thread");
|
||||
}
|
||||
if (DEBUG) {
|
||||
Log.v(TAG, "restartLoader in " + this + ": args=" + bundle);
|
||||
}
|
||||
LoaderInfo<D> loader = this.mLoaderViewModel.getLoader(i);
|
||||
return createAndInstallLoader(i, bundle, loaderCallbacks, loader != null ? loader.destroy(false) : null);
|
||||
}
|
||||
|
||||
@Override // androidx.loader.app.LoaderManager
|
||||
public void destroyLoader(int i) {
|
||||
if (this.mLoaderViewModel.isCreatingLoader()) {
|
||||
throw new IllegalStateException("Called while creating a loader");
|
||||
}
|
||||
if (Looper.getMainLooper() != Looper.myLooper()) {
|
||||
throw new IllegalStateException("destroyLoader must be called on the main thread");
|
||||
}
|
||||
if (DEBUG) {
|
||||
Log.v(TAG, "destroyLoader in " + this + " of " + i);
|
||||
}
|
||||
LoaderInfo loader = this.mLoaderViewModel.getLoader(i);
|
||||
if (loader != null) {
|
||||
loader.destroy(true);
|
||||
this.mLoaderViewModel.removeLoader(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.loader.app.LoaderManager
|
||||
public <D> Loader<D> getLoader(int i) {
|
||||
if (this.mLoaderViewModel.isCreatingLoader()) {
|
||||
throw new IllegalStateException("Called while creating a loader");
|
||||
}
|
||||
LoaderInfo<D> loader = this.mLoaderViewModel.getLoader(i);
|
||||
if (loader != null) {
|
||||
return loader.getLoader();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.loader.app.LoaderManager
|
||||
public void markForRedelivery() {
|
||||
this.mLoaderViewModel.markForRedelivery();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder(128);
|
||||
sb.append("LoaderManager{");
|
||||
sb.append(Integer.toHexString(System.identityHashCode(this)));
|
||||
sb.append(" in ");
|
||||
DebugUtils.buildShortClassTag(this.mLifecycleOwner, sb);
|
||||
sb.append("}}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override // androidx.loader.app.LoaderManager
|
||||
@Deprecated
|
||||
public void dump(String str, FileDescriptor fileDescriptor, PrintWriter printWriter, String[] strArr) {
|
||||
this.mLoaderViewModel.dump(str, fileDescriptor, printWriter, strArr);
|
||||
}
|
||||
|
||||
@Override // androidx.loader.app.LoaderManager
|
||||
public boolean hasRunningLoaders() {
|
||||
return this.mLoaderViewModel.hasRunningLoaders();
|
||||
}
|
||||
}
|
224
02-Easy5/E5/sources/androidx/loader/content/AsyncTaskLoader.java
Normal file
224
02-Easy5/E5/sources/androidx/loader/content/AsyncTaskLoader.java
Normal file
@ -0,0 +1,224 @@
|
||||
package androidx.loader.content;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.SystemClock;
|
||||
import androidx.core.os.OperationCanceledException;
|
||||
import androidx.core.util.TimeUtils;
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class AsyncTaskLoader<D> extends Loader<D> {
|
||||
static final boolean DEBUG = false;
|
||||
static final String TAG = "AsyncTaskLoader";
|
||||
volatile AsyncTaskLoader<D>.LoadTask mCancellingTask;
|
||||
private final Executor mExecutor;
|
||||
Handler mHandler;
|
||||
long mLastLoadCompleteTime;
|
||||
volatile AsyncTaskLoader<D>.LoadTask mTask;
|
||||
long mUpdateThrottle;
|
||||
|
||||
public void cancelLoadInBackground() {
|
||||
}
|
||||
|
||||
public boolean isLoadInBackgroundCanceled() {
|
||||
return this.mCancellingTask != null;
|
||||
}
|
||||
|
||||
public abstract D loadInBackground();
|
||||
|
||||
public void onCanceled(D d) {
|
||||
}
|
||||
|
||||
final class LoadTask extends ModernAsyncTask<Void, Void, D> implements Runnable {
|
||||
private final CountDownLatch mDone = new CountDownLatch(1);
|
||||
boolean waiting;
|
||||
|
||||
LoadTask() {
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: protected */
|
||||
@Override // androidx.loader.content.ModernAsyncTask
|
||||
public D doInBackground(Void... voidArr) {
|
||||
try {
|
||||
return (D) AsyncTaskLoader.this.onLoadInBackground();
|
||||
} catch (OperationCanceledException e) {
|
||||
if (isCancelled()) {
|
||||
return null;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.loader.content.ModernAsyncTask
|
||||
protected void onPostExecute(D d) {
|
||||
try {
|
||||
AsyncTaskLoader.this.dispatchOnLoadComplete(this, d);
|
||||
} finally {
|
||||
this.mDone.countDown();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.loader.content.ModernAsyncTask
|
||||
protected void onCancelled(D d) {
|
||||
try {
|
||||
AsyncTaskLoader.this.dispatchOnCancelled(this, d);
|
||||
} finally {
|
||||
this.mDone.countDown();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
this.waiting = false;
|
||||
AsyncTaskLoader.this.executePendingTask();
|
||||
}
|
||||
|
||||
public void waitForLoader() {
|
||||
try {
|
||||
this.mDone.await();
|
||||
} catch (InterruptedException unused) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public AsyncTaskLoader(Context context) {
|
||||
this(context, ModernAsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
|
||||
private AsyncTaskLoader(Context context, Executor executor) {
|
||||
super(context);
|
||||
this.mLastLoadCompleteTime = -10000L;
|
||||
this.mExecutor = executor;
|
||||
}
|
||||
|
||||
public void setUpdateThrottle(long j) {
|
||||
this.mUpdateThrottle = j;
|
||||
if (j != 0) {
|
||||
this.mHandler = new Handler();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.loader.content.Loader
|
||||
protected void onForceLoad() {
|
||||
super.onForceLoad();
|
||||
cancelLoad();
|
||||
this.mTask = new LoadTask();
|
||||
executePendingTask();
|
||||
}
|
||||
|
||||
@Override // androidx.loader.content.Loader
|
||||
protected boolean onCancelLoad() {
|
||||
if (this.mTask == null) {
|
||||
return false;
|
||||
}
|
||||
if (!this.mStarted) {
|
||||
this.mContentChanged = true;
|
||||
}
|
||||
if (this.mCancellingTask != null) {
|
||||
if (this.mTask.waiting) {
|
||||
this.mTask.waiting = false;
|
||||
this.mHandler.removeCallbacks(this.mTask);
|
||||
}
|
||||
this.mTask = null;
|
||||
return false;
|
||||
}
|
||||
if (this.mTask.waiting) {
|
||||
this.mTask.waiting = false;
|
||||
this.mHandler.removeCallbacks(this.mTask);
|
||||
this.mTask = null;
|
||||
return false;
|
||||
}
|
||||
boolean cancel = this.mTask.cancel(false);
|
||||
if (cancel) {
|
||||
this.mCancellingTask = this.mTask;
|
||||
cancelLoadInBackground();
|
||||
}
|
||||
this.mTask = null;
|
||||
return cancel;
|
||||
}
|
||||
|
||||
void executePendingTask() {
|
||||
if (this.mCancellingTask != null || this.mTask == null) {
|
||||
return;
|
||||
}
|
||||
if (this.mTask.waiting) {
|
||||
this.mTask.waiting = false;
|
||||
this.mHandler.removeCallbacks(this.mTask);
|
||||
}
|
||||
if (this.mUpdateThrottle > 0 && SystemClock.uptimeMillis() < this.mLastLoadCompleteTime + this.mUpdateThrottle) {
|
||||
this.mTask.waiting = true;
|
||||
this.mHandler.postAtTime(this.mTask, this.mLastLoadCompleteTime + this.mUpdateThrottle);
|
||||
} else {
|
||||
this.mTask.executeOnExecutor(this.mExecutor, null);
|
||||
}
|
||||
}
|
||||
|
||||
void dispatchOnCancelled(AsyncTaskLoader<D>.LoadTask loadTask, D d) {
|
||||
onCanceled(d);
|
||||
if (this.mCancellingTask == loadTask) {
|
||||
rollbackContentChanged();
|
||||
this.mLastLoadCompleteTime = SystemClock.uptimeMillis();
|
||||
this.mCancellingTask = null;
|
||||
deliverCancellation();
|
||||
executePendingTask();
|
||||
}
|
||||
}
|
||||
|
||||
void dispatchOnLoadComplete(AsyncTaskLoader<D>.LoadTask loadTask, D d) {
|
||||
if (this.mTask != loadTask) {
|
||||
dispatchOnCancelled(loadTask, d);
|
||||
return;
|
||||
}
|
||||
if (isAbandoned()) {
|
||||
onCanceled(d);
|
||||
return;
|
||||
}
|
||||
commitContentChanged();
|
||||
this.mLastLoadCompleteTime = SystemClock.uptimeMillis();
|
||||
this.mTask = null;
|
||||
deliverResult(d);
|
||||
}
|
||||
|
||||
protected D onLoadInBackground() {
|
||||
return loadInBackground();
|
||||
}
|
||||
|
||||
public void waitForLoader() {
|
||||
AsyncTaskLoader<D>.LoadTask loadTask = this.mTask;
|
||||
if (loadTask != null) {
|
||||
loadTask.waitForLoader();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.loader.content.Loader
|
||||
@Deprecated
|
||||
public void dump(String str, FileDescriptor fileDescriptor, PrintWriter printWriter, String[] strArr) {
|
||||
super.dump(str, fileDescriptor, printWriter, strArr);
|
||||
if (this.mTask != null) {
|
||||
printWriter.print(str);
|
||||
printWriter.print("mTask=");
|
||||
printWriter.print(this.mTask);
|
||||
printWriter.print(" waiting=");
|
||||
printWriter.println(this.mTask.waiting);
|
||||
}
|
||||
if (this.mCancellingTask != null) {
|
||||
printWriter.print(str);
|
||||
printWriter.print("mCancellingTask=");
|
||||
printWriter.print(this.mCancellingTask);
|
||||
printWriter.print(" waiting=");
|
||||
printWriter.println(this.mCancellingTask.waiting);
|
||||
}
|
||||
if (this.mUpdateThrottle != 0) {
|
||||
printWriter.print(str);
|
||||
printWriter.print("mUpdateThrottle=");
|
||||
TimeUtils.formatDuration(this.mUpdateThrottle, printWriter);
|
||||
printWriter.print(" mLastLoadCompleteTime=");
|
||||
TimeUtils.formatDuration(this.mLastLoadCompleteTime, SystemClock.uptimeMillis(), printWriter);
|
||||
printWriter.println();
|
||||
}
|
||||
}
|
||||
}
|
204
02-Easy5/E5/sources/androidx/loader/content/CursorLoader.java
Normal file
204
02-Easy5/E5/sources/androidx/loader/content/CursorLoader.java
Normal file
@ -0,0 +1,204 @@
|
||||
package androidx.loader.content;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import androidx.core.content.ContentResolverCompat;
|
||||
import androidx.core.os.CancellationSignal;
|
||||
import androidx.core.os.OperationCanceledException;
|
||||
import androidx.loader.content.Loader;
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.Arrays;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class CursorLoader extends AsyncTaskLoader<Cursor> {
|
||||
CancellationSignal mCancellationSignal;
|
||||
Cursor mCursor;
|
||||
final Loader<Cursor>.ForceLoadContentObserver mObserver;
|
||||
String[] mProjection;
|
||||
String mSelection;
|
||||
String[] mSelectionArgs;
|
||||
String mSortOrder;
|
||||
Uri mUri;
|
||||
|
||||
public String[] getProjection() {
|
||||
return this.mProjection;
|
||||
}
|
||||
|
||||
public String getSelection() {
|
||||
return this.mSelection;
|
||||
}
|
||||
|
||||
public String[] getSelectionArgs() {
|
||||
return this.mSelectionArgs;
|
||||
}
|
||||
|
||||
public String getSortOrder() {
|
||||
return this.mSortOrder;
|
||||
}
|
||||
|
||||
public Uri getUri() {
|
||||
return this.mUri;
|
||||
}
|
||||
|
||||
public void setProjection(String[] strArr) {
|
||||
this.mProjection = strArr;
|
||||
}
|
||||
|
||||
public void setSelection(String str) {
|
||||
this.mSelection = str;
|
||||
}
|
||||
|
||||
public void setSelectionArgs(String[] strArr) {
|
||||
this.mSelectionArgs = strArr;
|
||||
}
|
||||
|
||||
public void setSortOrder(String str) {
|
||||
this.mSortOrder = str;
|
||||
}
|
||||
|
||||
public void setUri(Uri uri) {
|
||||
this.mUri = uri;
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // androidx.loader.content.AsyncTaskLoader
|
||||
public Cursor loadInBackground() {
|
||||
synchronized (this) {
|
||||
if (isLoadInBackgroundCanceled()) {
|
||||
throw new OperationCanceledException();
|
||||
}
|
||||
this.mCancellationSignal = new CancellationSignal();
|
||||
}
|
||||
try {
|
||||
Cursor query = ContentResolverCompat.query(getContext().getContentResolver(), this.mUri, this.mProjection, this.mSelection, this.mSelectionArgs, this.mSortOrder, this.mCancellationSignal);
|
||||
if (query != null) {
|
||||
try {
|
||||
query.getCount();
|
||||
query.registerContentObserver(this.mObserver);
|
||||
} catch (RuntimeException e) {
|
||||
query.close();
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
synchronized (this) {
|
||||
this.mCancellationSignal = null;
|
||||
}
|
||||
return query;
|
||||
} catch (Throwable th) {
|
||||
synchronized (this) {
|
||||
this.mCancellationSignal = null;
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.loader.content.AsyncTaskLoader
|
||||
public void cancelLoadInBackground() {
|
||||
super.cancelLoadInBackground();
|
||||
synchronized (this) {
|
||||
CancellationSignal cancellationSignal = this.mCancellationSignal;
|
||||
if (cancellationSignal != null) {
|
||||
cancellationSignal.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.loader.content.Loader
|
||||
public void deliverResult(Cursor cursor) {
|
||||
if (isReset()) {
|
||||
if (cursor != null) {
|
||||
cursor.close();
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
Cursor cursor2 = this.mCursor;
|
||||
this.mCursor = cursor;
|
||||
if (isStarted()) {
|
||||
super.deliverResult((CursorLoader) cursor);
|
||||
}
|
||||
if (cursor2 == null || cursor2 == cursor || cursor2.isClosed()) {
|
||||
return;
|
||||
}
|
||||
cursor2.close();
|
||||
}
|
||||
|
||||
public CursorLoader(Context context) {
|
||||
super(context);
|
||||
this.mObserver = new Loader.ForceLoadContentObserver();
|
||||
}
|
||||
|
||||
public CursorLoader(Context context, Uri uri, String[] strArr, String str, String[] strArr2, String str2) {
|
||||
super(context);
|
||||
this.mObserver = new Loader.ForceLoadContentObserver();
|
||||
this.mUri = uri;
|
||||
this.mProjection = strArr;
|
||||
this.mSelection = str;
|
||||
this.mSelectionArgs = strArr2;
|
||||
this.mSortOrder = str2;
|
||||
}
|
||||
|
||||
@Override // androidx.loader.content.Loader
|
||||
protected void onStartLoading() {
|
||||
Cursor cursor = this.mCursor;
|
||||
if (cursor != null) {
|
||||
deliverResult(cursor);
|
||||
}
|
||||
if (takeContentChanged() || this.mCursor == null) {
|
||||
forceLoad();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.loader.content.Loader
|
||||
protected void onStopLoading() {
|
||||
cancelLoad();
|
||||
}
|
||||
|
||||
@Override // androidx.loader.content.AsyncTaskLoader
|
||||
public void onCanceled(Cursor cursor) {
|
||||
if (cursor == null || cursor.isClosed()) {
|
||||
return;
|
||||
}
|
||||
cursor.close();
|
||||
}
|
||||
|
||||
@Override // androidx.loader.content.Loader
|
||||
protected void onReset() {
|
||||
super.onReset();
|
||||
onStopLoading();
|
||||
Cursor cursor = this.mCursor;
|
||||
if (cursor != null && !cursor.isClosed()) {
|
||||
this.mCursor.close();
|
||||
}
|
||||
this.mCursor = null;
|
||||
}
|
||||
|
||||
@Override // androidx.loader.content.AsyncTaskLoader, androidx.loader.content.Loader
|
||||
@Deprecated
|
||||
public void dump(String str, FileDescriptor fileDescriptor, PrintWriter printWriter, String[] strArr) {
|
||||
super.dump(str, fileDescriptor, printWriter, strArr);
|
||||
printWriter.print(str);
|
||||
printWriter.print("mUri=");
|
||||
printWriter.println(this.mUri);
|
||||
printWriter.print(str);
|
||||
printWriter.print("mProjection=");
|
||||
printWriter.println(Arrays.toString(this.mProjection));
|
||||
printWriter.print(str);
|
||||
printWriter.print("mSelection=");
|
||||
printWriter.println(this.mSelection);
|
||||
printWriter.print(str);
|
||||
printWriter.print("mSelectionArgs=");
|
||||
printWriter.println(Arrays.toString(this.mSelectionArgs));
|
||||
printWriter.print(str);
|
||||
printWriter.print("mSortOrder=");
|
||||
printWriter.println(this.mSortOrder);
|
||||
printWriter.print(str);
|
||||
printWriter.print("mCursor=");
|
||||
printWriter.println(this.mCursor);
|
||||
printWriter.print(str);
|
||||
printWriter.print("mContentChanged=");
|
||||
printWriter.println(this.mContentChanged);
|
||||
}
|
||||
}
|
239
02-Easy5/E5/sources/androidx/loader/content/Loader.java
Normal file
239
02-Easy5/E5/sources/androidx/loader/content/Loader.java
Normal file
@ -0,0 +1,239 @@
|
||||
package androidx.loader.content;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.ContentObserver;
|
||||
import android.os.Handler;
|
||||
import androidx.core.util.DebugUtils;
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class Loader<D> {
|
||||
Context mContext;
|
||||
int mId;
|
||||
OnLoadCompleteListener<D> mListener;
|
||||
OnLoadCanceledListener<D> mOnLoadCanceledListener;
|
||||
boolean mStarted = false;
|
||||
boolean mAbandoned = false;
|
||||
boolean mReset = true;
|
||||
boolean mContentChanged = false;
|
||||
boolean mProcessingChange = false;
|
||||
|
||||
public interface OnLoadCanceledListener<D> {
|
||||
void onLoadCanceled(Loader<D> loader);
|
||||
}
|
||||
|
||||
public interface OnLoadCompleteListener<D> {
|
||||
void onLoadComplete(Loader<D> loader, D d);
|
||||
}
|
||||
|
||||
public void commitContentChanged() {
|
||||
this.mProcessingChange = false;
|
||||
}
|
||||
|
||||
public Context getContext() {
|
||||
return this.mContext;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return this.mId;
|
||||
}
|
||||
|
||||
public boolean isAbandoned() {
|
||||
return this.mAbandoned;
|
||||
}
|
||||
|
||||
public boolean isReset() {
|
||||
return this.mReset;
|
||||
}
|
||||
|
||||
public boolean isStarted() {
|
||||
return this.mStarted;
|
||||
}
|
||||
|
||||
protected void onAbandon() {
|
||||
}
|
||||
|
||||
protected boolean onCancelLoad() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void onForceLoad() {
|
||||
}
|
||||
|
||||
protected void onReset() {
|
||||
}
|
||||
|
||||
protected void onStartLoading() {
|
||||
}
|
||||
|
||||
protected void onStopLoading() {
|
||||
}
|
||||
|
||||
public boolean takeContentChanged() {
|
||||
boolean z = this.mContentChanged;
|
||||
this.mContentChanged = false;
|
||||
this.mProcessingChange |= z;
|
||||
return z;
|
||||
}
|
||||
|
||||
public final class ForceLoadContentObserver extends ContentObserver {
|
||||
@Override // android.database.ContentObserver
|
||||
public boolean deliverSelfNotifications() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public ForceLoadContentObserver() {
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
@Override // android.database.ContentObserver
|
||||
public void onChange(boolean z) {
|
||||
Loader.this.onContentChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public Loader(Context context) {
|
||||
this.mContext = context.getApplicationContext();
|
||||
}
|
||||
|
||||
public void deliverResult(D d) {
|
||||
OnLoadCompleteListener<D> onLoadCompleteListener = this.mListener;
|
||||
if (onLoadCompleteListener != null) {
|
||||
onLoadCompleteListener.onLoadComplete(this, d);
|
||||
}
|
||||
}
|
||||
|
||||
public void deliverCancellation() {
|
||||
OnLoadCanceledListener<D> onLoadCanceledListener = this.mOnLoadCanceledListener;
|
||||
if (onLoadCanceledListener != null) {
|
||||
onLoadCanceledListener.onLoadCanceled(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void registerListener(int i, OnLoadCompleteListener<D> onLoadCompleteListener) {
|
||||
if (this.mListener != null) {
|
||||
throw new IllegalStateException("There is already a listener registered");
|
||||
}
|
||||
this.mListener = onLoadCompleteListener;
|
||||
this.mId = i;
|
||||
}
|
||||
|
||||
public void unregisterListener(OnLoadCompleteListener<D> onLoadCompleteListener) {
|
||||
OnLoadCompleteListener<D> onLoadCompleteListener2 = this.mListener;
|
||||
if (onLoadCompleteListener2 == null) {
|
||||
throw new IllegalStateException("No listener register");
|
||||
}
|
||||
if (onLoadCompleteListener2 != onLoadCompleteListener) {
|
||||
throw new IllegalArgumentException("Attempting to unregister the wrong listener");
|
||||
}
|
||||
this.mListener = null;
|
||||
}
|
||||
|
||||
public void registerOnLoadCanceledListener(OnLoadCanceledListener<D> onLoadCanceledListener) {
|
||||
if (this.mOnLoadCanceledListener != null) {
|
||||
throw new IllegalStateException("There is already a listener registered");
|
||||
}
|
||||
this.mOnLoadCanceledListener = onLoadCanceledListener;
|
||||
}
|
||||
|
||||
public void unregisterOnLoadCanceledListener(OnLoadCanceledListener<D> onLoadCanceledListener) {
|
||||
OnLoadCanceledListener<D> onLoadCanceledListener2 = this.mOnLoadCanceledListener;
|
||||
if (onLoadCanceledListener2 == null) {
|
||||
throw new IllegalStateException("No listener register");
|
||||
}
|
||||
if (onLoadCanceledListener2 != onLoadCanceledListener) {
|
||||
throw new IllegalArgumentException("Attempting to unregister the wrong listener");
|
||||
}
|
||||
this.mOnLoadCanceledListener = null;
|
||||
}
|
||||
|
||||
public final void startLoading() {
|
||||
this.mStarted = true;
|
||||
this.mReset = false;
|
||||
this.mAbandoned = false;
|
||||
onStartLoading();
|
||||
}
|
||||
|
||||
public boolean cancelLoad() {
|
||||
return onCancelLoad();
|
||||
}
|
||||
|
||||
public void forceLoad() {
|
||||
onForceLoad();
|
||||
}
|
||||
|
||||
public void stopLoading() {
|
||||
this.mStarted = false;
|
||||
onStopLoading();
|
||||
}
|
||||
|
||||
public void abandon() {
|
||||
this.mAbandoned = true;
|
||||
onAbandon();
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
onReset();
|
||||
this.mReset = true;
|
||||
this.mStarted = false;
|
||||
this.mAbandoned = false;
|
||||
this.mContentChanged = false;
|
||||
this.mProcessingChange = false;
|
||||
}
|
||||
|
||||
public void rollbackContentChanged() {
|
||||
if (this.mProcessingChange) {
|
||||
onContentChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public void onContentChanged() {
|
||||
if (this.mStarted) {
|
||||
forceLoad();
|
||||
} else {
|
||||
this.mContentChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
public String dataToString(D d) {
|
||||
StringBuilder sb = new StringBuilder(64);
|
||||
DebugUtils.buildShortClassTag(d, sb);
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder(64);
|
||||
DebugUtils.buildShortClassTag(this, sb);
|
||||
sb.append(" id=");
|
||||
sb.append(this.mId);
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void dump(String str, FileDescriptor fileDescriptor, PrintWriter printWriter, String[] strArr) {
|
||||
printWriter.print(str);
|
||||
printWriter.print("mId=");
|
||||
printWriter.print(this.mId);
|
||||
printWriter.print(" mListener=");
|
||||
printWriter.println(this.mListener);
|
||||
if (this.mStarted || this.mContentChanged || this.mProcessingChange) {
|
||||
printWriter.print(str);
|
||||
printWriter.print("mStarted=");
|
||||
printWriter.print(this.mStarted);
|
||||
printWriter.print(" mContentChanged=");
|
||||
printWriter.print(this.mContentChanged);
|
||||
printWriter.print(" mProcessingChange=");
|
||||
printWriter.println(this.mProcessingChange);
|
||||
}
|
||||
if (this.mAbandoned || this.mReset) {
|
||||
printWriter.print(str);
|
||||
printWriter.print("mAbandoned=");
|
||||
printWriter.print(this.mAbandoned);
|
||||
printWriter.print(" mReset=");
|
||||
printWriter.println(this.mReset);
|
||||
}
|
||||
}
|
||||
}
|
262
02-Easy5/E5/sources/androidx/loader/content/ModernAsyncTask.java
Normal file
262
02-Easy5/E5/sources/androidx/loader/content/ModernAsyncTask.java
Normal file
@ -0,0 +1,262 @@
|
||||
package androidx.loader.content;
|
||||
|
||||
import android.os.Binder;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.os.Process;
|
||||
import android.util.Log;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.FutureTask;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
abstract class ModernAsyncTask<Params, Progress, Result> {
|
||||
private static final int CORE_POOL_SIZE = 5;
|
||||
private static final int KEEP_ALIVE = 1;
|
||||
private static final String LOG_TAG = "AsyncTask";
|
||||
private static final int MAXIMUM_POOL_SIZE = 128;
|
||||
private static final int MESSAGE_POST_PROGRESS = 2;
|
||||
private static final int MESSAGE_POST_RESULT = 1;
|
||||
public static final Executor THREAD_POOL_EXECUTOR;
|
||||
private static volatile Executor sDefaultExecutor;
|
||||
private static InternalHandler sHandler;
|
||||
private static final BlockingQueue<Runnable> sPoolWorkQueue;
|
||||
private static final ThreadFactory sThreadFactory;
|
||||
private final FutureTask<Result> mFuture;
|
||||
private final WorkerRunnable<Params, Result> mWorker;
|
||||
private volatile Status mStatus = Status.PENDING;
|
||||
final AtomicBoolean mCancelled = new AtomicBoolean();
|
||||
final AtomicBoolean mTaskInvoked = new AtomicBoolean();
|
||||
|
||||
public enum Status {
|
||||
PENDING,
|
||||
RUNNING,
|
||||
FINISHED
|
||||
}
|
||||
|
||||
public static void setDefaultExecutor(Executor executor) {
|
||||
sDefaultExecutor = executor;
|
||||
}
|
||||
|
||||
protected abstract Result doInBackground(Params... paramsArr);
|
||||
|
||||
public final Status getStatus() {
|
||||
return this.mStatus;
|
||||
}
|
||||
|
||||
protected void onCancelled() {
|
||||
}
|
||||
|
||||
protected void onPostExecute(Result result) {
|
||||
}
|
||||
|
||||
protected void onPreExecute() {
|
||||
}
|
||||
|
||||
protected void onProgressUpdate(Progress... progressArr) {
|
||||
}
|
||||
|
||||
static {
|
||||
ThreadFactory threadFactory = new ThreadFactory() { // from class: androidx.loader.content.ModernAsyncTask.1
|
||||
private final AtomicInteger mCount = new AtomicInteger(1);
|
||||
|
||||
@Override // java.util.concurrent.ThreadFactory
|
||||
public Thread newThread(Runnable runnable) {
|
||||
return new Thread(runnable, "ModernAsyncTask #" + this.mCount.getAndIncrement());
|
||||
}
|
||||
};
|
||||
sThreadFactory = threadFactory;
|
||||
LinkedBlockingQueue linkedBlockingQueue = new LinkedBlockingQueue(10);
|
||||
sPoolWorkQueue = linkedBlockingQueue;
|
||||
ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(5, 128, 1L, TimeUnit.SECONDS, linkedBlockingQueue, threadFactory);
|
||||
THREAD_POOL_EXECUTOR = threadPoolExecutor;
|
||||
sDefaultExecutor = threadPoolExecutor;
|
||||
}
|
||||
|
||||
private static Handler getHandler() {
|
||||
InternalHandler internalHandler;
|
||||
synchronized (ModernAsyncTask.class) {
|
||||
if (sHandler == null) {
|
||||
sHandler = new InternalHandler();
|
||||
}
|
||||
internalHandler = sHandler;
|
||||
}
|
||||
return internalHandler;
|
||||
}
|
||||
|
||||
ModernAsyncTask() {
|
||||
WorkerRunnable<Params, Result> workerRunnable = new WorkerRunnable<Params, Result>() { // from class: androidx.loader.content.ModernAsyncTask.2
|
||||
@Override // java.util.concurrent.Callable
|
||||
public Result call() throws Exception {
|
||||
ModernAsyncTask.this.mTaskInvoked.set(true);
|
||||
Result result = null;
|
||||
try {
|
||||
Process.setThreadPriority(10);
|
||||
result = (Result) ModernAsyncTask.this.doInBackground(this.mParams);
|
||||
Binder.flushPendingCommands();
|
||||
return result;
|
||||
} finally {
|
||||
}
|
||||
}
|
||||
};
|
||||
this.mWorker = workerRunnable;
|
||||
this.mFuture = new FutureTask<Result>(workerRunnable) { // from class: androidx.loader.content.ModernAsyncTask.3
|
||||
@Override // java.util.concurrent.FutureTask
|
||||
protected void done() {
|
||||
try {
|
||||
ModernAsyncTask.this.postResultIfNotInvoked(get());
|
||||
} catch (InterruptedException e) {
|
||||
Log.w(ModernAsyncTask.LOG_TAG, e);
|
||||
} catch (CancellationException unused) {
|
||||
ModernAsyncTask.this.postResultIfNotInvoked(null);
|
||||
} catch (ExecutionException e2) {
|
||||
throw new RuntimeException("An error occurred while executing doInBackground()", e2.getCause());
|
||||
} catch (Throwable th) {
|
||||
throw new RuntimeException("An error occurred while executing doInBackground()", th);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
void postResultIfNotInvoked(Result result) {
|
||||
if (this.mTaskInvoked.get()) {
|
||||
return;
|
||||
}
|
||||
postResult(result);
|
||||
}
|
||||
|
||||
Result postResult(Result result) {
|
||||
getHandler().obtainMessage(1, new AsyncTaskResult(this, result)).sendToTarget();
|
||||
return result;
|
||||
}
|
||||
|
||||
protected void onCancelled(Result result) {
|
||||
onCancelled();
|
||||
}
|
||||
|
||||
public final boolean isCancelled() {
|
||||
return this.mCancelled.get();
|
||||
}
|
||||
|
||||
public final boolean cancel(boolean z) {
|
||||
this.mCancelled.set(true);
|
||||
return this.mFuture.cancel(z);
|
||||
}
|
||||
|
||||
public final Result get() throws InterruptedException, ExecutionException {
|
||||
return this.mFuture.get();
|
||||
}
|
||||
|
||||
public final Result get(long j, TimeUnit timeUnit) throws InterruptedException, ExecutionException, TimeoutException {
|
||||
return this.mFuture.get(j, timeUnit);
|
||||
}
|
||||
|
||||
public final ModernAsyncTask<Params, Progress, Result> execute(Params... paramsArr) {
|
||||
return executeOnExecutor(sDefaultExecutor, paramsArr);
|
||||
}
|
||||
|
||||
/* renamed from: androidx.loader.content.ModernAsyncTask$4, reason: invalid class name */
|
||||
static /* synthetic */ class AnonymousClass4 {
|
||||
static final /* synthetic */ int[] $SwitchMap$androidx$loader$content$ModernAsyncTask$Status;
|
||||
|
||||
static {
|
||||
int[] iArr = new int[Status.values().length];
|
||||
$SwitchMap$androidx$loader$content$ModernAsyncTask$Status = iArr;
|
||||
try {
|
||||
iArr[Status.RUNNING.ordinal()] = 1;
|
||||
} catch (NoSuchFieldError unused) {
|
||||
}
|
||||
try {
|
||||
$SwitchMap$androidx$loader$content$ModernAsyncTask$Status[Status.FINISHED.ordinal()] = 2;
|
||||
} catch (NoSuchFieldError unused2) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public final ModernAsyncTask<Params, Progress, Result> executeOnExecutor(Executor executor, Params... paramsArr) {
|
||||
if (this.mStatus != Status.PENDING) {
|
||||
int i = AnonymousClass4.$SwitchMap$androidx$loader$content$ModernAsyncTask$Status[this.mStatus.ordinal()];
|
||||
if (i == 1) {
|
||||
throw new IllegalStateException("Cannot execute task: the task is already running.");
|
||||
}
|
||||
if (i == 2) {
|
||||
throw new IllegalStateException("Cannot execute task: the task has already been executed (a task can be executed only once)");
|
||||
}
|
||||
throw new IllegalStateException("We should never reach this state");
|
||||
}
|
||||
this.mStatus = Status.RUNNING;
|
||||
onPreExecute();
|
||||
this.mWorker.mParams = paramsArr;
|
||||
executor.execute(this.mFuture);
|
||||
return this;
|
||||
}
|
||||
|
||||
public static void execute(Runnable runnable) {
|
||||
sDefaultExecutor.execute(runnable);
|
||||
}
|
||||
|
||||
protected final void publishProgress(Progress... progressArr) {
|
||||
if (isCancelled()) {
|
||||
return;
|
||||
}
|
||||
getHandler().obtainMessage(2, new AsyncTaskResult(this, progressArr)).sendToTarget();
|
||||
}
|
||||
|
||||
void finish(Result result) {
|
||||
if (isCancelled()) {
|
||||
onCancelled(result);
|
||||
} else {
|
||||
onPostExecute(result);
|
||||
}
|
||||
this.mStatus = Status.FINISHED;
|
||||
}
|
||||
|
||||
private static class InternalHandler extends Handler {
|
||||
InternalHandler() {
|
||||
super(Looper.getMainLooper());
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
@Override // android.os.Handler
|
||||
public void handleMessage(Message message) {
|
||||
AsyncTaskResult asyncTaskResult = (AsyncTaskResult) message.obj;
|
||||
int i = message.what;
|
||||
if (i == 1) {
|
||||
asyncTaskResult.mTask.finish(asyncTaskResult.mData[0]);
|
||||
} else {
|
||||
if (i != 2) {
|
||||
return;
|
||||
}
|
||||
asyncTaskResult.mTask.onProgressUpdate(asyncTaskResult.mData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static abstract class WorkerRunnable<Params, Result> implements Callable<Result> {
|
||||
Params[] mParams;
|
||||
|
||||
WorkerRunnable() {
|
||||
}
|
||||
}
|
||||
|
||||
private static class AsyncTaskResult<Data> {
|
||||
final Data[] mData;
|
||||
final ModernAsyncTask mTask;
|
||||
|
||||
AsyncTaskResult(ModernAsyncTask modernAsyncTask, Data... dataArr) {
|
||||
this.mTask = modernAsyncTask;
|
||||
this.mData = dataArr;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user