225 lines
5.6 KiB
Java
225 lines
5.6 KiB
Java
|
package o;
|
||
|
|
||
|
import android.content.Context;
|
||
|
import com.airbnb.deeplinkdispatch.UrlTreeKt;
|
||
|
import java.io.FileDescriptor;
|
||
|
import java.io.PrintWriter;
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public class iBO<D> {
|
||
|
Context mContext;
|
||
|
int mId;
|
||
|
LWm<D> mListener;
|
||
|
RVV<D> mOnLoadCanceledListener;
|
||
|
boolean mStarted = false;
|
||
|
boolean mAbandoned = false;
|
||
|
boolean mReset = true;
|
||
|
boolean mContentChanged = false;
|
||
|
boolean mProcessingChange = false;
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public interface LWm<D> {
|
||
|
void e(iBO<D> ibo, D d);
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public interface RVV<D> {
|
||
|
void d(iBO<D> ibo);
|
||
|
}
|
||
|
|
||
|
protected void onAbandon() {
|
||
|
}
|
||
|
|
||
|
protected boolean onCancelLoad() {
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: protected */
|
||
|
public void onForceLoad() {
|
||
|
}
|
||
|
|
||
|
protected void onReset() {
|
||
|
}
|
||
|
|
||
|
protected void onStartLoading() {
|
||
|
}
|
||
|
|
||
|
protected void onStopLoading() {
|
||
|
}
|
||
|
|
||
|
public iBO(Context context) {
|
||
|
this.mContext = context.getApplicationContext();
|
||
|
}
|
||
|
|
||
|
public void deliverResult(D d) {
|
||
|
LWm<D> lWm = this.mListener;
|
||
|
if (lWm != null) {
|
||
|
lWm.e(this, d);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void deliverCancellation() {
|
||
|
RVV<D> rvv = this.mOnLoadCanceledListener;
|
||
|
if (rvv != null) {
|
||
|
rvv.d(this);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void registerListener(int i, LWm<D> lWm) {
|
||
|
if (this.mListener != null) {
|
||
|
throw new IllegalStateException("There is already a listener registered");
|
||
|
}
|
||
|
this.mListener = lWm;
|
||
|
this.mId = i;
|
||
|
}
|
||
|
|
||
|
public void unregisterListener(LWm<D> lWm) {
|
||
|
LWm<D> lWm2 = this.mListener;
|
||
|
if (lWm2 == null) {
|
||
|
throw new IllegalStateException("No listener register");
|
||
|
}
|
||
|
if (lWm2 != lWm) {
|
||
|
throw new IllegalArgumentException("Attempting to unregister the wrong listener");
|
||
|
}
|
||
|
this.mListener = null;
|
||
|
}
|
||
|
|
||
|
public void registerOnLoadCanceledListener(RVV<D> rvv) {
|
||
|
if (this.mOnLoadCanceledListener != null) {
|
||
|
throw new IllegalStateException("There is already a listener registered");
|
||
|
}
|
||
|
this.mOnLoadCanceledListener = rvv;
|
||
|
}
|
||
|
|
||
|
public void unregisterOnLoadCanceledListener(RVV<D> rvv) {
|
||
|
RVV<D> rvv2 = this.mOnLoadCanceledListener;
|
||
|
if (rvv2 == null) {
|
||
|
throw new IllegalStateException("No listener register");
|
||
|
}
|
||
|
if (rvv2 != rvv) {
|
||
|
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);
|
||
|
OcZ.e(d, sb);
|
||
|
sb.append(UrlTreeKt.componentParamSuffix);
|
||
|
return sb.toString();
|
||
|
}
|
||
|
|
||
|
public String toString() {
|
||
|
StringBuilder sb = new StringBuilder(64);
|
||
|
OcZ.e(this, sb);
|
||
|
sb.append(" id=");
|
||
|
sb.append(this.mId);
|
||
|
sb.append(UrlTreeKt.componentParamSuffix);
|
||
|
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);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public boolean takeContentChanged() {
|
||
|
boolean z = this.mContentChanged;
|
||
|
this.mContentChanged = false;
|
||
|
this.mProcessingChange |= z;
|
||
|
return z;
|
||
|
}
|
||
|
|
||
|
public boolean isStarted() {
|
||
|
return this.mStarted;
|
||
|
}
|
||
|
|
||
|
public boolean isReset() {
|
||
|
return this.mReset;
|
||
|
}
|
||
|
|
||
|
public boolean isAbandoned() {
|
||
|
return this.mAbandoned;
|
||
|
}
|
||
|
|
||
|
public int getId() {
|
||
|
return this.mId;
|
||
|
}
|
||
|
|
||
|
public Context getContext() {
|
||
|
return this.mContext;
|
||
|
}
|
||
|
|
||
|
public void commitContentChanged() {
|
||
|
this.mProcessingChange = false;
|
||
|
}
|
||
|
}
|