正在查看: 自健身 v3.3.4 应用的 OnlineViewModel.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 自健身 v3.3.4 应用的 OnlineViewModel.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.mu.gymtrain.viewmodel;
import com.blankj.utilcode.util.ToastUtils;
import com.hjq.http.EasyHttp;
import com.hjq.http.config.RequestUrl;
import com.hjq.http.listener.OnHttpListener;
import com.hjq.http.request.GetRequest;
import com.mu.gymtrain.Bean.ArticleListBean;
import com.mu.gymtrain.Bean.OnlineTabsBean;
import com.tencent.open.SocialConstants;
import java.util.List;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
import okhttp3.Call;
@Metadata(d1 = {"\u0000,\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010!\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J(\u0010\u0003\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u00062\u0018\u0010\u0007\u001a\u0014\u0012\n\u0012\b\u0012\u0004\u0012\u00020\n0\t\u0012\u0004\u0012\u00020\u00040\bJ \u0010\u000b\u001a\u00020\u00042\u0018\u0010\u0007\u001a\u0014\u0012\n\u0012\b\u0012\u0004\u0012\u00020\f0\t\u0012\u0004\u0012\u00020\u00040\b¨\u0006\r"}, d2 = {"Lcom/mu/gymtrain/viewmodel/OnlineViewModel;", "Lcom/mu/gymtrain/viewmodel/BaseViewModel;", "()V", "requestList", "", SocialConstants.PARAM_URL, "", "onCallBack", "Lkotlin/Function1;", "", "Lcom/mu/gymtrain/Bean/ArticleListBean$ListBean;", "requestTabs", "Lcom/mu/gymtrain/Bean/OnlineTabsBean$DataBean;", "app_release"}, k = 1, mv = {1, 5, 1}, xi = 48)
public final class OnlineViewModel extends BaseViewModel {
public final void requestTabs(final Function1<? super List<OnlineTabsBean.DataBean>, Unit> onCallBack) {
Intrinsics.checkNotNullParameter(onCallBack, "onCallBack");
((GetRequest) EasyHttp.get(this).api(new RequestUrl("http://36.112.61.98:8888/article-api/attribute/list"))).request(new OnHttpListener<OnlineTabsBean>() {
@Override
public void onEnd(Call call) {
OnHttpListener.CC.$default$onEnd(this, call);
}
@Override
public void onStart(Call call) {
OnHttpListener.CC.$default$onStart(this, call);
}
@Override
public void onSucceed(OnlineTabsBean onlineTabsBean, boolean z) {
onSucceed((OnlineViewModel$requestTabs$1) onlineTabsBean);
}
@Override
public void onSucceed(OnlineTabsBean result) {
Intrinsics.checkNotNullParameter(result, "result");
Function1<List<OnlineTabsBean.DataBean>, Unit> function1 = onCallBack;
List<OnlineTabsBean.DataBean> data = result.getData();
Intrinsics.checkNotNullExpressionValue(data, "result.data");
function1.invoke(data);
}
@Override
public void onFail(Exception e) {
Intrinsics.checkNotNullParameter(e, "e");
ToastUtils.showShort(e.getMessage(), new Object[0]);
}
});
}
public final void requestList(String url, final Function1<? super List<ArticleListBean.ListBean>, Unit> onCallBack) {
Intrinsics.checkNotNullParameter(url, "url");
Intrinsics.checkNotNullParameter(onCallBack, "onCallBack");
((GetRequest) EasyHttp.get(this).api(new RequestUrl(url))).request(new OnHttpListener<ArticleListBean>() {
@Override
public void onEnd(Call call) {
OnHttpListener.CC.$default$onEnd(this, call);
}
@Override
public void onStart(Call call) {
OnHttpListener.CC.$default$onStart(this, call);
}
@Override
public void onSucceed(ArticleListBean articleListBean, boolean z) {
onSucceed((OnlineViewModel$requestList$1) articleListBean);
}
@Override
public void onSucceed(ArticleListBean result) {
Intrinsics.checkNotNullParameter(result, "result");
Function1<List<ArticleListBean.ListBean>, Unit> function1 = onCallBack;
List<ArticleListBean.ListBean> list = result.getList();
Intrinsics.checkNotNullExpressionValue(list, "result.list");
function1.invoke(list);
}
@Override
public void onFail(Exception e) {
Intrinsics.checkNotNullParameter(e, "e");
ToastUtils.showShort(e.getMessage(), new Object[0]);
}
});
}
}