正在查看: 自健身 v3.3.4 应用的 CoachDetailActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 自健身 v3.3.4 应用的 CoachDetailActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.mu.gymtrain.Activity.MainPackage;
import android.app.Dialog;
import android.content.Intent;
import android.text.SpannableString;
import android.text.TextUtils;
import android.text.style.ForegroundColorSpan;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.widget.NestedScrollView;
import androidx.fragment.app.FragmentActivity;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.OnClick;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.mu.gymtrain.Activity.AllCommentActivity;
import com.mu.gymtrain.Activity.CoachDetailHtmlActivity;
import com.mu.gymtrain.Activity.PersonPackage.PersonalInfoActivity;
import com.mu.gymtrain.Activity.WebViewActivity;
import com.mu.gymtrain.Adapter.ClassTimeAdapter;
import com.mu.gymtrain.Adapter.CoachClassAdaptger;
import com.mu.gymtrain.Adapter.PublicClazzListAdapter;
import com.mu.gymtrain.Adapter.WeekAdapter;
import com.mu.gymtrain.Base.BaseActivity;
import com.mu.gymtrain.Bean.AllCommentBean;
import com.mu.gymtrain.Bean.CoachImgBean;
import com.mu.gymtrain.Bean.PriveClassisBean;
import com.mu.gymtrain.Bean.PublicCourseBeanBox1;
import com.mu.gymtrain.Bean.PublicCourseListBean;
import com.mu.gymtrain.Bean.WeekBean;
import com.mu.gymtrain.Dialog.DialogUtils;
import com.mu.gymtrain.Http.CreatMap;
import com.mu.gymtrain.Http.HttpHelper;
import com.mu.gymtrain.Http.ResponseFunc;
import com.mu.gymtrain.Utils.DateUtils;
import com.mu.gymtrain.Utils.PreferenceUtils;
import com.mu.gymtrain.Utils.ViewUtils;
import com.mu.gymtrain.Widget.CircleImageView;
import com.mu.gymtrain.Widget.RatingBar;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import rx.Observable;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;
public class CoachDetailActivity extends BaseActivity implements BaseQuickAdapter.OnItemClickListener {
private PublicClazzListAdapter adapter;
private CoachClassAdaptger adaptger;
private int age;
@BindView(2131296364)
ImageView avatar;
@BindView(2131296365)
ImageView avatar2;
@BindView(2131296416)
CircleImageView civHead;
@BindView(2131296417)
ConstraintLayout clLayout;
@BindView(2131296418)
ConstraintLayout clLayout2;
private boolean hasInfo;
private double height;
private String html;
@BindView(2131296683)
ImageView iv_bg;
@BindView(2131296800)
LinearLayout llMid;
WeekAdapter mAdapter;
ClassTimeAdapter mClazzAdapter;
private Dialog mNoInfoDialog;
Observable ob;
Observable obClazz;
@BindView(2131296994)
RatingBar rbContent;
@BindView(2131296995)
RatingBar rbContent2;
@BindView(2131297009)
RecyclerView recyClazz;
@BindView(2131297022)
RecyclerView recyclerView;
@BindView(2131297075)
RatingBar rtvCoach;
@BindView(2131297223)
NestedScrollView thsvMain;
@BindView(2131297253)
ImageView titleLeft;
@BindView(2131297255)
TextView titleMiddle;
@BindView(2131297290)
TextView tvAllComment;
@BindView(2131297502)
TextView tvCoachName;
@BindView(2131297503)
TextView tvCoachbirth;
@BindView(2131297504)
TextView tvCoachlevel;
@BindView(2131297316)
TextView tvComment;
@BindView(2131297317)
TextView tvComment2;
@BindView(2131297329)
TextView tvDetail;
private TextView tvMain;
@BindView(2131297364)
TextView tvName;
@BindView(2131297366)
TextView tvName2;
private TextView tvOther;
@BindView(2131297430)
TextView tvTime;
@BindView(2131297431)
TextView tvTime2;
private String userName;
String cochId = "";
String gymid = "";
private int coachType = 0;
List<WeekBean> mList = new ArrayList();
private String currentDay = "";
List<PriveClassisBean.ClassesBean> mClazzList = new ArrayList();
List<PublicCourseBeanBox1> mListCK_box = new ArrayList();
List<PublicCourseListBean.DataBean> mListCK = new ArrayList();
@Override
public int getContentLayout() {
return 2131492911;
}
@Override
public void initData() {
ViewUtils.showLoading(this, "加载中...");
if (this.coachType == 0) {
this.ob = HttpHelper.getInstance().getRetrofitService(this).getCKCoachPage(new CreatMap.Builder().addParams("coach_id", this.cochId).build().getParam());
} else {
this.ob = HttpHelper.getInstance().getRetrofitService(this).getSKCoachPage(new CreatMap.Builder().addParams("coach_id", this.cochId).build().getParam());
}
this.rbContent2.setmClickable(false);
this.rbContent.setmClickable(false);
this.rtvCoach.setmClickable(false);
getData();
requestComment();
requestCount();
}
private void requestCount() {
HttpHelper.getInstance().getRetrofitService(this).requestCoachCommentCount(getToken(), this.cochId, 1).enqueue(new 1(this));
}
private void requestComment() {
HttpHelper.getInstance().getRetrofitService(this).coachAllCommentList(getToken(), this.cochId, 1, 1, 2).enqueue(new 2(this));
}
public void setComments(List<AllCommentBean.DataBean> list) {
this.clLayout.setVisibility(0);
Glide.with((FragmentActivity) this).load("https://www.zijianshen.com/" + list.get(0).getUser_avatar()).apply(new RequestOptions().circleCrop()).into(this.avatar);
this.tvName.setText(list.get(0).getUser_name());
String str = "#" + list.get(0).getInfo_name() + "# ";
SpannableString spannableString = new SpannableString(str + list.get(0).getComment());
spannableString.setSpan(new ForegroundColorSpan(getResources().getColor(2131099865)), 0, str.length(), 33);
this.tvComment.setText(spannableString);
this.rbContent.setStar((float) list.get(0).getScore());
this.rbContent.setmClickable(false);
double currentTimeMillis = System.currentTimeMillis() - DateUtils.date2Stamp(list.get(0).getComment_time(), "yyyy-MM-dd hh:mm:ss");
Double.isNaN(currentTimeMillis);
double d = (currentTimeMillis / 1000.0d) / 3600.0d;
if (d < 1.0d) {
this.tvTime2.setText("刚刚");
} else if (d > 1.0d && d <= 24.0d) {
this.tvTime.setText(Math.round(d) + "小时前");
} else {
this.tvTime.setText(list.get(0).getComment_time().substring(0, 10));
}
if (list.size() >= 2) {
this.clLayout2.setVisibility(0);
Glide.with((FragmentActivity) this).load("https://www.zijianshen.com/" + list.get(1).getUser_avatar()).apply(new RequestOptions().circleCrop()).into(this.avatar2);
this.tvName2.setText(list.get(1).getUser_name());
String str2 = "#" + list.get(1).getInfo_name() + "# ";
SpannableString spannableString2 = new SpannableString(str2 + list.get(1).getComment());
spannableString2.setSpan(new ForegroundColorSpan(getResources().getColor(2131099865)), 0, str2.length(), 33);
this.tvComment2.setText(spannableString2);
this.rbContent2.setStar((float) list.get(1).getScore());
this.rbContent2.setmClickable(false);
double currentTimeMillis2 = System.currentTimeMillis() - DateUtils.date2Stamp(list.get(1).getComment_time(), "yyyy-MM-dd hh:mm:ss");
Double.isNaN(currentTimeMillis2);
double d2 = (currentTimeMillis2 / 1000.0d) / 3600.0d;
if (d2 < 1.0d) {
this.tvTime2.setText("刚刚");
return;
}
if (d2 > 1.0d && d2 <= 24.0d) {
this.tvTime2.setText(Math.round(d2) + "小时前");
return;
}
this.tvTime2.setText(list.get(1).getComment_time().substring(0, 10));
}
}
@Override
public void initView() {
this.titleMiddle.setText(getString(2131820632));
if (!EventBus.getDefault().isRegistered(this)) {
EventBus.getDefault().register(this);
}
this.cochId = getIntent().getStringExtra("intent_common");
this.coachType = getIntent().getIntExtra("intent_common2", 0);
String stringExtra = getIntent().getStringExtra("gymid");
this.gymid = stringExtra;
if (TextUtils.isEmpty(stringExtra)) {
this.gymid = PreferenceUtils.getInstance().getString("currentgymid", "");
}
this.rtvCoach.setmClickable(false);
WeekAdapter weekAdapter = new WeekAdapter(this.mList, this);
this.mAdapter = weekAdapter;
weekAdapter.setOnItemClickListener(new 3(this));
this.recyClazz.setLayoutManager(new LinearLayoutManager(this));
RecyclerView.Adapter publicClazzListAdapter = new PublicClazzListAdapter(new 4(this));
this.adapter = publicClazzListAdapter;
this.recyClazz.setAdapter(publicClazzListAdapter);
this.tvMain = (TextView) findViewById(2131297351);
this.tvOther = (TextView) findViewById(2131297379);
this.recyclerView.setLayoutManager(new GridLayoutManager(this, 2));
RecyclerView.Adapter coachClassAdaptger = new CoachClassAdaptger();
this.adaptger = coachClassAdaptger;
this.recyclerView.setAdapter(coachClassAdaptger);
this.adaptger.setOnItemClickListener(this);
reqestClassImg();
}
public void noInfoDialog() {
View inflate = View.inflate(this, 2131493026, null);
((TextView) inflate.findViewById(2131297190)).setText("请您完善个人资料再预约课程。");
this.mNoInfoDialog = DialogUtils.createDialog(this, inflate);
inflate.findViewById(2131297339).setOnClickListener(this);
this.mNoInfoDialog.setCanceledOnTouchOutside(true);
this.mNoInfoDialog.show();
}
private void reqestClassImg() {
HttpHelper.getInstance().getRetrofitService(this).requestClassImg(new CreatMap.Builder().addParams("coach_id", this.cochId).build().getParam()).enqueue(new 5(this));
}
public void getUserInfo(final String id) {
ViewUtils.showLoading(this, "加载中...");
HttpHelper.getInstance().getRetrofitService(this).getUserInfo(new CreatMap.Builder().build().getParam()).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).map(new ResponseFunc()).subscribe(new 6(this, id));
}
@OnClick({2131297253, 2131297329, 2131297290})
public void onViewClicked(View view) {
int id = view.getId();
if (id == 2131297253) {
finish();
return;
}
if (id == 2131297290) {
Intent intent = new Intent(this, (Class<?>) AllCommentActivity.class);
intent.putExtra("id", this.cochId);
intent.putExtra("from", "coach");
startActivity(intent);
return;
}
if (id != 2131297329) {
return;
}
Intent intent2 = new Intent(this, (Class<?>) CoachDetailHtmlActivity.class);
intent2.putExtra("html", this.html);
startActivity(intent2);
}
@Override
public void onClick(View v) {
super.onClick(v);
if (v.getId() != 2131297339) {
return;
}
this.mNoInfoDialog.dismiss();
startActivity(new Intent(this, (Class<?>) PersonalInfoActivity.class));
}
private void getData() {
this.ob.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).map(new ResponseFunc()).subscribe(new 7(this));
}
public void creatWeek() {
ArrayList fetureDays = DateUtils.getFetureDays(7);
ArrayList fetureDaysofWeek = DateUtils.getFetureDaysofWeek(7);
int i = 0;
while (i < fetureDays.size()) {
this.mList.add(new WeekBean((String) fetureDaysofWeek.get(i), (String) fetureDays.get(i), i == 0));
i++;
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEvent(String event) {
if (event.equals("5")) {
getClazz();
}
}
public void getClazz() {
HttpHelper.getInstance().getRetrofitService(this).getCKByCoach(new CreatMap.Builder().addParams("coach_id", this.cochId).addParams("gym_id", this.gymid).addParams("class_date", this.currentDay).build().getParam()).enqueue(new 8(this));
}
public void changData(List<PublicCourseListBean.DataBean> data) {
this.mListCK.clear();
this.mListCK.addAll(data);
boxCK();
this.adapter.setNewData(this.mListCK_box);
}
private void boxCK() {
this.mListCK_box.clear();
LinkedHashMap linkedHashMap = new LinkedHashMap();
for (PublicCourseListBean.DataBean dataBean : this.mListCK) {
if (linkedHashMap.containsKey(dataBean.getClass_date())) {
((List) linkedHashMap.get(dataBean.getClass_date())).add(0, dataBean);
} else {
ArrayList arrayList = new ArrayList();
arrayList.add(dataBean);
linkedHashMap.put(dataBean.getClass_date(), arrayList);
}
}
for (Map.Entry entry : linkedHashMap.entrySet()) {
PublicCourseBeanBox1 publicCourseBeanBox1 = new PublicCourseBeanBox1();
publicCourseBeanBox1.setTime((String) entry.getKey());
publicCourseBeanBox1.setPublicCourseBean((List) entry.getValue());
this.mListCK_box.add(0, publicCourseBeanBox1);
}
}
@Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
CoachImgBean.Bean bean = (CoachImgBean.Bean) adapter.getData().get(position);
Intent intent = new Intent(this, (Class<?>) WebViewActivity.class);
intent.putExtra("url", "https://www.zijianshen.com/index.php/app/classes/get_class_info_detail/" + bean.getInfo_id());
intent.putExtra("title", bean.getClass_name());
startActivity(intent);
}
@Override
protected void onDestroy() {
super.onDestroy();
EventBus.getDefault().unregister(this);
}
}