家家有田 v1.2.8版本的 MD5 值为:62f44aac901441b9b72af508fbe86bf2
以下内容为反编译后的 BaseViewModel.java 源代码,内容仅作参考
package com.ssm.comm.ui.base;
import android.os.Build;
import androidx.lifecycle.ViewModel;
import com.alipay.sdk.m.l.c;
import com.comm.net_work.base.BaseRepository;
import com.ssm.comm.ui.base.BaseModel;
import io.reactivex.Flowable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Function;
import java.util.concurrent.TimeUnit;
import kotlin.Lazy;
import kotlin.LazyKt;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
import org.reactivestreams.Subscriber;
import org.reactivestreams.Subscription;
@Metadata(d1 = {"\u0000F\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\t\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\b&\u0018\u0000*\b\b\u0000\u0010\u0001*\u00020\u0002*\b\b\u0001\u0010\u0003*\u00020\u00042\u00020\u0005B\r\u0012\u0006\u0010\u0006\u001a\u00028\u0001¢\u0006\u0002\u0010\u0007JC\u0010\u0013\u001a\u00020\u00142\b\b\u0002\u0010\u0015\u001a\u00020\u00162#\u0010\u0017\u001a\u001f\u0012\u0015\u0012\u0013\u0018\u00010\u0016¢\u0006\f\b\u0019\u0012\b\b\u001a\u0012\u0004\b\b(\u001b\u0012\u0004\u0012\u00020\u00140\u00182\f\u0010\u001c\u001a\b\u0012\u0004\u0012\u00020\u00140\u001dR\u0014\u0010\b\u001a\u00020\tX\u0086D¢\u0006\b\n\u0000\u001a\u0004\b\n\u0010\u000bR\u0010\u0010\f\u001a\u0004\u0018\u00010\rX\u0082\u000e¢\u0006\u0002\n\u0000R\u001b\u0010\u000e\u001a\u00028\u00018VX\u0096\u0084\u0002¢\u0006\f\n\u0004\b\u0011\u0010\u0012\u001a\u0004\b\u000f\u0010\u0010¨\u0006\u001e"}, d2 = {"Lcom/ssm/comm/ui/base/BaseViewModel;", "M", "Lcom/ssm/comm/ui/base/BaseModel;", "R", "Lcom/comm/net_work/base/BaseRepository;", "Landroidx/lifecycle/ViewModel;", "mRepository", "(Lcom/comm/net_work/base/BaseRepository;)V", "img", "", "getImg", "()Ljava/lang/String;", "mSubscription", "Lorg/reactivestreams/Subscription;", "repository", "getRepository", "()Lcom/comm/net_work/base/BaseRepository;", "repository$delegate", "Lkotlin/Lazy;", "onStartCountDownTime", "", "count", "", "onNext", "Lkotlin/Function1;", "Lkotlin/ParameterName;", c.e, "aLong", "onComplete", "Lkotlin/Function0;", "comm_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
public abstract class BaseViewModel<M extends BaseModel, R extends BaseRepository> extends ViewModel {
private final String img;
private Subscription mSubscription;
private final Lazy repository$delegate;
public BaseViewModel(final R mRepository) {
Intrinsics.checkNotNullParameter(mRepository, "mRepository");
this.repository$delegate = LazyKt.lazy(new Function0<R>() {
{
super(0);
}
@Override
public final BaseRepository invoke() {
return BaseRepository.this;
}
});
this.img = "https://img2.baidu.com/it/u=1814268193,3619863984&fm=253&fmt=auto&app=138&f=JPEG?w=632&h=500";
}
public R getRepository() {
return (R) this.repository$delegate.getValue();
}
public final String getImg() {
return this.img;
}
public static void onStartCountDownTime$default(BaseViewModel baseViewModel, long j, Function1 function1, Function0 function0, int i, Object obj) {
if (obj != null) {
throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: onStartCountDownTime");
}
if ((i & 1) != 0) {
j = 2;
}
baseViewModel.onStartCountDownTime(j, function1, function0);
}
public final void onStartCountDownTime(final long j, final Function1<? super Long, Unit> onNext, final Function0<Unit> onComplete) {
Intrinsics.checkNotNullParameter(onNext, "onNext");
Intrinsics.checkNotNullParameter(onComplete, "onComplete");
Flowable<Long> take = Flowable.interval(0L, 1L, TimeUnit.SECONDS).onBackpressureBuffer().take(j);
final Function1<Long, Long> function1 = new Function1<Long, Long>() {
{
super(1);
}
@Override
public final Long invoke(Long aLong) {
Intrinsics.checkNotNullParameter(aLong, "aLong");
return Long.valueOf(j - aLong.longValue());
}
};
take.map(new Function() {
@Override
public final Object apply(Object obj) {
Long onStartCountDownTime$lambda$0;
onStartCountDownTime$lambda$0 = BaseViewModel.onStartCountDownTime$lambda$0(Function1.this, obj);
return onStartCountDownTime$lambda$0;
}
}).observeOn(AndroidSchedulers.mainThread()).subscribe(new Subscriber<Long>(this) {
final BaseViewModel<M, R> this$0;
{
this.this$0 = this;
}
@Override
public void onSubscribe(Subscription subscription) {
((BaseViewModel) this.this$0).mSubscription = subscription;
if (subscription != null) {
subscription.request(Long.MAX_VALUE);
}
}
@Override
public void onNext(Long l) {
onNext.invoke(l);
}
@Override
public void onComplete() {
Subscription subscription;
if (Build.VERSION.SDK_INT >= 30 && subscription != null) {
subscription.cancel();
}
onComplete.invoke();
}
@Override
public void onError(Throwable th) {
Subscription subscription;
if (Build.VERSION.SDK_INT >= 30 && subscription != null) {
subscription.cancel();
}
onComplete.invoke();
if (th != null) {
th.printStackTrace();
}
}
});
}
public static final Long onStartCountDownTime$lambda$0(Function1 tmp0, Object obj) {
Intrinsics.checkNotNullParameter(tmp0, "$tmp0");
return (Long) tmp0.invoke(obj);
}
}