mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-11-13 09:27:16 +01:00
42 lines
1.5 KiB
Java
42 lines
1.5 KiB
Java
package androidx.work.impl;
|
|
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.RestrictTo;
|
|
import androidx.lifecycle.LiveData;
|
|
import androidx.lifecycle.MutableLiveData;
|
|
import androidx.work.Operation;
|
|
import androidx.work.impl.utils.futures.SettableFuture;
|
|
import com.google.common.util.concurrent.ListenableFuture;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
|
|
/* loaded from: classes14.dex */
|
|
public class OperationImpl implements Operation {
|
|
private final MutableLiveData<Operation.State> mOperationState = new MutableLiveData<>();
|
|
private final SettableFuture<Operation.State.SUCCESS> mOperationFuture = SettableFuture.create();
|
|
|
|
public OperationImpl() {
|
|
markState(Operation.IN_PROGRESS);
|
|
}
|
|
|
|
@Override // androidx.work.Operation
|
|
@NonNull
|
|
public ListenableFuture<Operation.State.SUCCESS> getResult() {
|
|
return this.mOperationFuture;
|
|
}
|
|
|
|
@Override // androidx.work.Operation
|
|
@NonNull
|
|
public LiveData<Operation.State> getState() {
|
|
return this.mOperationState;
|
|
}
|
|
|
|
public void markState(@NonNull Operation.State state) {
|
|
this.mOperationState.postValue(state);
|
|
if (state instanceof Operation.State.SUCCESS) {
|
|
this.mOperationFuture.set((Operation.State.SUCCESS) state);
|
|
} else if (state instanceof Operation.State.FAILURE) {
|
|
this.mOperationFuture.setException(((Operation.State.FAILURE) state).getThrowable());
|
|
}
|
|
}
|
|
}
|