正在查看: 自健身 v3.3.4 应用的 OnlineCoachActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 自健身 v3.3.4 应用的 OnlineCoachActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.mu.gymtrain.Activity;
import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.TextView;
import androidx.lifecycle.ViewModel;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelStoreOwner;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.mu.gymtrain.Adapter.OnlineListAdapter;
import com.mu.gymtrain.Adapter.OnlineTabsAdapter;
import com.mu.gymtrain.Adapter.TabChildAdapter;
import com.mu.gymtrain.Base.BaseActivityKT;
import com.mu.gymtrain.Bean.ArticleListBean;
import com.mu.gymtrain.Bean.OnlineTabsBean;
import com.mu.gymtrain.R;
import com.mu.gymtrain.Utils.UrlConfig;
import com.mu.gymtrain.viewmodel.OnlineViewModel;
import com.tencent.open.SocialConstants;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.Typography;
@Metadata(d1 = {"\u0000Z\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\u0018\u00002\u00020\u00012\u00020\u0002B\u0005¢\u0006\u0002\u0010\u0003J\b\u0010\u0018\u001a\u00020\u000eH\u0016J\b\u0010\u0019\u001a\u00020\u001aH\u0016J(\u0010\u001b\u001a\u00020\u001a2\u000e\u0010\u001c\u001a\n\u0012\u0002\b\u0003\u0012\u0002\b\u00030\u001d2\u0006\u0010\u001e\u001a\u00020\u001f2\u0006\u0010 \u001a\u00020\u000eH\u0016J\b\u0010!\u001a\u00020\u001aH\u0002R\u000e\u0010\u0004\u001a\u00020\u0005X\u0082.¢\u0006\u0002\n\u0000R\u000e\u0010\u0006\u001a\u00020\u0007X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\b\u001a\u00020\tX\u0082.¢\u0006\u0002\n\u0000R\u000e\u0010\n\u001a\u00020\u000bX\u0082.¢\u0006\u0002\n\u0000R\u000e\u0010\f\u001a\u00020\u0007X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\r\u001a\u00020\u000eX\u0082\u000e¢\u0006\u0002\n\u0000R-\u0010\u000f\u001a\u001e\u0012\u0004\u0012\u00020\u0007\u0012\u0004\u0012\u00020\u00070\u0010j\u000e\u0012\u0004\u0012\u00020\u0007\u0012\u0004\u0012\u00020\u0007`\u0011¢\u0006\b\n\u0000\u001a\u0004\b\u0012\u0010\u0013R\u000e\u0010\u0014\u001a\u00020\u0015X\u0082.¢\u0006\u0002\n\u0000R\u000e\u0010\u0016\u001a\u00020\u000eX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0017\u001a\u00020\u0007X\u0082\u000e¢\u0006\u0002\n\u0000¨\u0006\""}, d2 = {"Lcom/mu/gymtrain/Activity/OnlineCoachActivity;", "Lcom/mu/gymtrain/Base/BaseActivityKT;", "Lcom/chad/library/adapter/base/BaseQuickAdapter$OnItemClickListener;", "()V", "adapterList", "Lcom/mu/gymtrain/Adapter/OnlineListAdapter;", "attrValue", "", "childAdapter", "Lcom/mu/gymtrain/Adapter/TabChildAdapter;", "model", "Lcom/mu/gymtrain/viewmodel/OnlineViewModel;", "newUrl", UrlConfig.Params.PAGE, "", "paramsMap", "Ljava/util/HashMap;", "Lkotlin/collections/HashMap;", "getParamsMap", "()Ljava/util/HashMap;", "tabAdapter", "Lcom/mu/gymtrain/Adapter/OnlineTabsAdapter;", "tabPosition", SocialConstants.PARAM_URL, "getLayoutRes", "init", "", "onItemClick", "adapter", "Lcom/chad/library/adapter/base/BaseQuickAdapter;", "view", "Landroid/view/View;", "position", "requestList", "app_release"}, k = 1, mv = {1, 5, 1}, xi = 48)
public final class OnlineCoachActivity extends BaseActivityKT implements BaseQuickAdapter.OnItemClickListener {
private OnlineListAdapter adapterList;
private TabChildAdapter childAdapter;
private OnlineViewModel model;
private OnlineTabsAdapter tabAdapter;
private final HashMap<String, String> paramsMap = new HashMap<>();
private int tabPosition = -1;
private int page = 1;
private String url = "http://36.112.61.98:8888/article-api/list";
private String newUrl = "";
private String attrValue = "";
@Override
public void _$_clearFindViewByIdCache() {
}
@Override
public int getLayoutRes() {
return R.layout.activity_online_layout;
}
public final HashMap<String, String> getParamsMap() {
return this.paramsMap;
}
@Override
public void init() {
((TextView) findViewById(R.id.tvTitle)).setText("线上教练");
((FrameLayout) findViewById(R.id.imgBack)).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
OnlineCoachActivity.m49init$lambda0(OnlineCoachActivity.this, view);
}
});
ViewModel viewModel = new ViewModelProvider((ViewModelStoreOwner) this).get(OnlineViewModel.class);
Intrinsics.checkNotNullExpressionValue(viewModel, "ViewModelProvider(this)[OnlineViewModel::class.java]");
this.model = (OnlineViewModel) viewModel;
RecyclerView findViewById = findViewById(R.id.tabRecyclerView);
Context context = (Context) this;
RecyclerView.LayoutManager linearLayoutManager = new LinearLayoutManager(context);
linearLayoutManager.setOrientation(0);
Unit unit = Unit.INSTANCE;
findViewById.setLayoutManager(linearLayoutManager);
this.tabAdapter = new OnlineTabsAdapter();
RecyclerView findViewById2 = findViewById(R.id.tabRecyclerView);
RecyclerView.Adapter adapter = this.tabAdapter;
if (adapter == null) {
Intrinsics.throwUninitializedPropertyAccessException("tabAdapter");
throw null;
}
findViewById2.setAdapter(adapter);
OnlineTabsAdapter onlineTabsAdapter = this.tabAdapter;
if (onlineTabsAdapter == null) {
Intrinsics.throwUninitializedPropertyAccessException("tabAdapter");
throw null;
}
OnlineCoachActivity onlineCoachActivity = this;
onlineTabsAdapter.setOnItemClickListener(onlineCoachActivity);
findViewById(R.id.listRecyclerView).setLayoutManager(new LinearLayoutManager(context));
this.adapterList = new OnlineListAdapter();
RecyclerView findViewById3 = findViewById(R.id.listRecyclerView);
RecyclerView.Adapter adapter2 = this.adapterList;
if (adapter2 == null) {
Intrinsics.throwUninitializedPropertyAccessException("adapterList");
throw null;
}
findViewById3.setAdapter(adapter2);
OnlineListAdapter onlineListAdapter = this.adapterList;
if (onlineListAdapter == null) {
Intrinsics.throwUninitializedPropertyAccessException("adapterList");
throw null;
}
onlineListAdapter.setOnItemClickListener(onlineCoachActivity);
findViewById(R.id.tabChildRecyclerView).setLayoutManager(new LinearLayoutManager(context));
this.childAdapter = new TabChildAdapter();
RecyclerView findViewById4 = findViewById(R.id.tabChildRecyclerView);
RecyclerView.Adapter adapter3 = this.childAdapter;
if (adapter3 == null) {
Intrinsics.throwUninitializedPropertyAccessException("childAdapter");
throw null;
}
findViewById4.setAdapter(adapter3);
TabChildAdapter tabChildAdapter = this.childAdapter;
if (tabChildAdapter == null) {
Intrinsics.throwUninitializedPropertyAccessException("childAdapter");
throw null;
}
tabChildAdapter.setOnItemClickListener(onlineCoachActivity);
requestList();
OnlineViewModel onlineViewModel = this.model;
if (onlineViewModel != null) {
onlineViewModel.requestTabs(new Function1<List<OnlineTabsBean.DataBean>, Unit>() {
{
super(1);
}
public Object invoke(Object obj) {
invoke((List<OnlineTabsBean.DataBean>) obj);
return Unit.INSTANCE;
}
public final void invoke(List<OnlineTabsBean.DataBean> it) {
OnlineTabsAdapter onlineTabsAdapter2;
Intrinsics.checkNotNullParameter(it, "it");
onlineTabsAdapter2 = OnlineCoachActivity.this.tabAdapter;
if (onlineTabsAdapter2 != null) {
onlineTabsAdapter2.setNewData(it);
} else {
Intrinsics.throwUninitializedPropertyAccessException("tabAdapter");
throw null;
}
}
});
} else {
Intrinsics.throwUninitializedPropertyAccessException("model");
throw null;
}
}
public static final void m49init$lambda0(OnlineCoachActivity this$0, View view) {
Intrinsics.checkNotNullParameter(this$0, "this$0");
this$0.finish();
}
private final void requestList() {
this.newUrl = this.url + "?page=" + this.page;
for (Map.Entry<String, String> entry : this.paramsMap.entrySet()) {
this.newUrl += Typography.amp + entry.getKey() + '=' + entry.getValue();
}
OnlineViewModel onlineViewModel = this.model;
if (onlineViewModel == null) {
Intrinsics.throwUninitializedPropertyAccessException("model");
throw null;
}
onlineViewModel.requestList(this.newUrl, new Function1<List<ArticleListBean.ListBean>, Unit>() {
{
super(1);
}
public Object invoke(Object obj) {
invoke((List<ArticleListBean.ListBean>) obj);
return Unit.INSTANCE;
}
public final void invoke(List<ArticleListBean.ListBean> it) {
OnlineListAdapter onlineListAdapter;
Intrinsics.checkNotNullParameter(it, "it");
onlineListAdapter = OnlineCoachActivity.this.adapterList;
if (onlineListAdapter != null) {
onlineListAdapter.setNewData(it);
} else {
Intrinsics.throwUninitializedPropertyAccessException("adapterList");
throw null;
}
}
});
}
public void onItemClick(BaseQuickAdapter<?, ?> adapter, View view, int position) {
String attrValue;
Intrinsics.checkNotNullParameter(adapter, "adapter");
Intrinsics.checkNotNullParameter(view, "view");
if (adapter instanceof OnlineTabsAdapter) {
this.tabPosition = position;
OnlineTabsBean.DataBean dataBean = (OnlineTabsBean.DataBean) ((OnlineTabsAdapter) adapter).getItem(position);
Intrinsics.checkNotNull(dataBean);
String attrValue2 = dataBean.getAttrValue();
Intrinsics.checkNotNullExpressionValue(attrValue2, "item!!.attrValue");
this.attrValue = attrValue2;
findViewById(R.id.viewBg).setVisibility(0);
findViewById(R.id.tabChildRecyclerView).setVisibility(0);
findViewById(R.id.listRecyclerView).setVisibility(8);
TabChildAdapter tabChildAdapter = this.childAdapter;
if (tabChildAdapter != null) {
tabChildAdapter.setNewData(dataBean.getChildren());
return;
} else {
Intrinsics.throwUninitializedPropertyAccessException("childAdapter");
throw null;
}
}
if (adapter instanceof TabChildAdapter) {
OnlineTabsBean.DataBean.ChildrenBean childrenBean = (OnlineTabsBean.DataBean.ChildrenBean) ((TabChildAdapter) adapter).getItem(position);
OnlineTabsAdapter onlineTabsAdapter = this.tabAdapter;
if (onlineTabsAdapter == null) {
Intrinsics.throwUninitializedPropertyAccessException("tabAdapter");
throw null;
}
OnlineTabsBean.DataBean dataBean2 = (OnlineTabsBean.DataBean) onlineTabsAdapter.getItem(this.tabPosition);
if (dataBean2 != null) {
dataBean2.setCheck(true);
}
if (dataBean2 != null) {
dataBean2.setAttrName(childrenBean == null ? null : childrenBean.getAttrName());
}
OnlineTabsAdapter onlineTabsAdapter2 = this.tabAdapter;
if (onlineTabsAdapter2 == null) {
Intrinsics.throwUninitializedPropertyAccessException("tabAdapter");
throw null;
}
onlineTabsAdapter2.notifyItemChanged(this.tabPosition);
findViewById(R.id.viewBg).setVisibility(8);
findViewById(R.id.tabChildRecyclerView).setVisibility(8);
HashMap<String, String> hashMap = this.paramsMap;
String str = this.attrValue;
String str2 = "";
if (childrenBean != null && (attrValue = childrenBean.getAttrValue()) != null) {
str2 = attrValue;
}
hashMap.put(str, str2);
findViewById(R.id.listRecyclerView).setVisibility(0);
requestList();
return;
}
if (adapter instanceof OnlineListAdapter) {
ArticleListBean.ListBean listBean = (ArticleListBean.ListBean) ((OnlineListAdapter) adapter).getItem(position);
Integer valueOf = listBean == null ? null : Integer.valueOf(listBean.getId());
Intent intent = new Intent((Context) this, (Class<?>) ArticleDetailActivity.class);
intent.putExtra("html", listBean != null ? listBean.getContent() : null);
intent.putExtra("id", valueOf);
startActivity(intent);
}
}
}