乐健体育 v3.9.1版本的 MD5 值为:87ae8a64955cdd0e43f3559ee8984d75
以下内容为反编译后的 SelfSelectedDetailActivity.java 源代码,内容仅作参考
package com.ledreamer.train.activity;
import android.app.Dialog;
import android.content.Intent;
import android.os.Bundle;
import android.text.SpannableString;
import android.text.TextUtils;
import android.text.style.ForegroundColorSpan;
import android.view.KeyEvent;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.LinearLayoutManager;
import com.alibaba.android.arouter.facade.Postcard;
import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.google.android.material.shadow.ShadowDrawableWrapper;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.ledreamer.privacyModule.db.PersonInfo;
import com.ledreamer.train.R;
import com.ledreamer.train.activity.SelfSelectedDetailActivity;
import com.ledreamer.train.view.ProjectItemPopWindow;
import com.legym.base.utils.XUtil;
import com.legym.sport.param.ExerciseProject;
import com.legym.sport.param.MediaResParam;
import com.legym.sport.param.ResourceCollection;
import com.legym.sport.param.SimpleResCallback;
import com.legym.sport.param.StartParams;
import com.legym.sport.sdk.ExerciseMediaResManager;
import com.legym.sport.sdk.SportSdk;
import com.legym.sport.utils.ExerciseDetailUtil;
import com.taobao.weex.el.parse.Operators;
import f.l.a.d.e;
import f.l.d.g.d;
import f.l.d.i.i;
import f.m.b.h.f;
import f.m.b.h.h;
import f.m.b.h.k;
import f.p.b.a;
import io.reactivex.rxjava3.core.Observable;
import io.reactivex.rxjava3.functions.Consumer;
import io.reactivex.rxjava3.functions.Function;
import io.reactivex.rxjava3.schedulers.Schedulers;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Route(path = "/train/selfSelectedDetail")
public class SelfSelectedDetailActivity extends BaseTrainTitleBarActivity<f.l.d.m.a> {
@Autowired(name = "componentsList")
public String c;
@Autowired(name = "ruleId")
public String f1602d;
public List<ExerciseProject> f1606h;
public f.l.d.g.d f1607i;
public ExerciseMediaResManager f1608j;
public i f1610l;
public int f1603e = 0;
public int f1604f = 0;
public int f1605g = 0;
public boolean f1609k = false;
public class a extends TypeToken<List<ExerciseProject>> {
public a() {
}
}
public class b extends SimpleResCallback {
public final List a;
public b(List list) {
this.a = list;
}
@Override
public void onError(Throwable th) {
SelfSelectedDetailActivity.this.R();
XUtil.k(R.string.train_plan_loading_error);
}
@Override
public void onFinish(ResourceCollection resourceCollection) {
SelfSelectedDetailActivity.this.R();
SelfSelectedDetailActivity.this.E(this.a);
}
@Override
public void onProcess(long j2, long j3) {
SelfSelectedDetailActivity.this.U(j2, j3);
}
@Override
public void onWarning(long j2) {
super.onWarning(j2);
SelfSelectedDetailActivity.this.S(j2);
}
}
public class c implements e.a {
public final e a;
public c(e eVar) {
this.a = eVar;
}
@Override
public void a(@NonNull Dialog dialog) {
this.a.dismiss();
SelfSelectedDetailActivity.this.R();
}
}
public class d implements e.b {
public final e a;
public d(e eVar) {
this.a = eVar;
}
@Override
public void a(@NonNull Dialog dialog) {
this.a.dismiss();
SelfSelectedDetailActivity.this.D(true);
}
}
public StartParams G(List list, Map map, Boolean bool) throws Throwable {
f.l.b.a.d dVar = new f.l.b.a.d();
dVar.c(Long.valueOf(System.currentTimeMillis()));
dVar.d(PersonInfo.PERSON_STORAGE_INFO.getType());
f.l.b.a.d dVar2 = new f.l.b.a.d();
dVar2.c(Long.valueOf(dVar.a().longValue() + 100));
dVar2.d(PersonInfo.PERSON_DEVICE_INFO.getType());
f.l.b.a.c.c().d().a(dVar);
f.l.b.a.c.c().d().a(dVar2);
StartParams.Builder builder = new StartParams.Builder();
builder.setEnableBackup(true).setSportMode("AIMODE").setExerciserId("234").setForceLandScope(list.size() != 1).setProjects(list).setCustom(map).setAction("com.legym.result").setBackupSignKey(C("")).setEnableWsProjects(this.f1610l.r.getSelect());
return builder.build();
}
public void I(StartParams startParams) throws Throwable {
SportSdk.getInstance().startSport(this, startParams);
}
public void K(ExerciseProject exerciseProject) {
if (B()) {
Q(exerciseProject);
}
}
public void L(View view) {
if (this.f1609k) {
XUtil.k(R.string.train_plan_loading_cancel);
}
setResult(306);
finish();
}
public void M(View view) {
if (B()) {
f.c.a.a.b.a.d().a("/train/sportDescription").navigation();
}
}
public void N(View view) {
if (B()) {
Postcard withString = f.c.a.a.b.a.d().a("/login/webActivity").withString("webTitle", "运动风险自查清单");
withString.withString("webUrl", "https://university.legym.cn/app/v1/risklist.html?token=" + f.l.d.c.b.a()).navigation();
}
}
public void O(View view) {
this.f1610l.a.setClickable(false);
T();
}
public final int A(List<ExerciseProject> list) {
int i2 = 0;
for (ExerciseProject exerciseProject : list) {
if (exerciseProject != null) {
double actionKeepTime = exerciseProject.getActionKeepTime();
if (actionKeepTime != ShadowDrawableWrapper.COS_45) {
i2 = (int) (i2 + (((int) (exerciseProject.getKeepTime() / actionKeepTime)) * exerciseProject.getMet() * 5));
}
}
}
return i2;
}
public final boolean B() {
if (this.f1609k) {
XUtil.l("正在加载运动资源");
return false;
}
return true;
}
public final String C(String str) {
String b2 = f.m.b.h.b.b(System.currentTimeMillis());
return str + Operators.SUB + b2;
}
public final void D(boolean z) {
this.f1609k = true;
this.f1610l.r.setDisable(true);
this.f1608j = SportSdk.getInstance().getExerciseMediaManager(this);
MediaResParam mediaResParam = new MediaResParam();
ArrayList arrayList = new ArrayList(this.f1606h);
mediaResParam.setExerciseProjects(arrayList);
mediaResParam.setIgnoreWarn(z);
mediaResParam.setMediaType(511);
this.f1608j.checkMediaRes(mediaResParam, new b(arrayList));
}
public final void E(final List<ExerciseProject> list) {
final HashMap hashMap = new HashMap();
hashMap.put("ruleId", this.f1602d);
Observable.just(Boolean.TRUE).subscribeOn(Schedulers.io()).map(new Function() {
@Override
public final Object apply(Object obj) {
return SelfSelectedDetailActivity.this.G(list, hashMap, (Boolean) obj);
}
}).subscribe(new Consumer() {
@Override
public final void accept(Object obj) {
SelfSelectedDetailActivity.this.I((StartParams) obj);
}
});
}
@Override
@Nullable
public f.l.d.m.a u() {
return new f.l.d.m.a();
}
public final void Q(ExerciseProject exerciseProject) {
if (h.a(this)) {
f.p.b.a.f(650);
new a.C0141a(this).a(new ProjectItemPopWindow(this, exerciseProject)).show();
}
}
public final void R() {
this.f1610l.f3774h.a();
this.f1610l.f3777k.setText(getString(R.string.string_start_sport, new Object[]{Integer.valueOf(this.f1606h.size())}));
this.f1610l.a.setClickable(true);
this.f1609k = false;
this.f1610l.r.setDisable(false);
}
public final void S(long j2) {
e eVar = new e(this, R.style.common_dialog);
eVar.m(8).a("非Wi-Fi环境加载运动资源将消耗" + k.a(j2) + "流量");
eVar.d("取消下载", new c(eVar));
eVar.h("流量加载", new d(eVar));
eVar.show();
}
public final void T() {
this.f1610l.f3774h.b();
this.f1610l.f3777k.setText(R.string.string_source_loading);
D(f.b(this));
}
public final void U(long j2, long j3) {
this.f1610l.f3774h.setMax((float) j3);
this.f1610l.f3774h.setProgress((float) j2);
TextView textView = this.f1610l.f3777k;
StringBuilder sb = new StringBuilder();
sb.append(getString(R.string.string_source_loading));
sb.append(k.b(j2, "#"));
sb.append(Operators.DIV);
sb.append(k.b(j3, "#"));
textView.setText(sb);
}
public final void initData() {
f.c.a.a.b.a.d().f(this);
if (!TextUtils.isEmpty(this.c)) {
this.f1606h = (List) new Gson().fromJson(this.c, new a().getType());
}
this.f1604f = ExerciseDetailUtil.getTotalTime(this.f1606h);
this.f1605g = ExerciseDetailUtil.getTotalCalories(this.f1606h);
this.f1603e = A(this.f1606h);
}
public final void initView() {
TextView textView = this.f1610l.f3780n;
StringBuilder sb = new StringBuilder();
sb.append(this.f1603e);
sb.append(getString(R.string.string_unit_score));
textView.setText(sb);
TextView textView2 = this.f1610l.f3779m;
StringBuilder sb2 = new StringBuilder();
sb2.append(this.f1604f);
sb2.append(getString(R.string.string_unit_minute));
textView2.setText(sb2);
TextView textView3 = this.f1610l.f3776j;
StringBuilder sb3 = new StringBuilder();
sb3.append(this.f1605g);
sb3.append(getString(R.string.string_unit_calories));
textView3.setText(sb3);
this.f1610l.f3775i.setLayoutManager(new LinearLayoutManager(this, 1, false));
f.l.d.g.d dVar = new f.l.d.g.d();
this.f1607i = dVar;
dVar.f(new d.c() {
@Override
public final void a(ExerciseProject exerciseProject) {
SelfSelectedDetailActivity.this.K(exerciseProject);
}
});
this.f1610l.f3775i.setAdapter(this.f1607i);
this.f1610l.b.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
SelfSelectedDetailActivity.this.L(view);
}
});
this.f1610l.f3772f.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
SelfSelectedDetailActivity.this.M(view);
}
});
SpannableString spannableString = new SpannableString(getString(R.string.string_i_have_read));
spannableString.setSpan(new ForegroundColorSpan(getResources().getColor(R.color.color_text_blue)), 5, 13, 33);
this.f1610l.f3781o.setText(spannableString);
this.f1610l.f3781o.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
SelfSelectedDetailActivity.this.N(view);
}
});
this.f1610l.f3774h.a();
this.f1610l.a.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
SelfSelectedDetailActivity.this.O(view);
}
});
this.f1610l.r.setVisibility(this.f1603e <= 1 ? 8 : 0);
R();
}
@Override
public void onActivityResult(int i2, int i3, Intent intent) {
super.onActivityResult(i2, i3, intent);
}
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
initData();
this.f1610l = (i) DataBindingUtil.setContentView(this, R.layout.activity_self_selected_detail);
initView();
this.f1607i.e(this.f1606h);
}
@Override
public void onDestroy() {
super.onDestroy();
i iVar = this.f1610l;
if (iVar != null) {
iVar.unbind();
}
ExerciseMediaResManager exerciseMediaResManager = this.f1608j;
if (exerciseMediaResManager != null) {
exerciseMediaResManager.cancelDownload();
}
}
@Override
public boolean onKeyDown(int i2, KeyEvent keyEvent) {
if (i2 == 4) {
if (this.f1609k) {
XUtil.k(R.string.train_plan_loading_cancel);
}
setResult(306);
finish();
}
return super.onKeyDown(i2, keyEvent);
}
}