导航菜单

页面标题

页面副标题

自健身 v3.3.4 - FriendCourseDetailActivity.java 源代码

正在查看: 自健身 v3.3.4 应用的 FriendCourseDetailActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.mu.gymtrain.Activity;

import android.widget.ImageView;
import android.widget.TextView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.OnClick;
import com.mu.gymtrain.Adapter.FriendCourseAdapter;
import com.mu.gymtrain.Base.BaseActivity;
import com.mu.gymtrain.Bean.FriendsCourseEntity;
import com.mu.gymtrain.Http.HttpHelper;
import com.mu.gymtrain.R;
import com.mu.gymtrain.Utils.FinalTools;
import com.mu.gymtrain.Utils.ViewUtils;
import rx.Subscriber;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

public class FriendCourseDetailActivity extends BaseActivity {
    private FriendCourseAdapter adapter;

    @BindView(2131297022)
    RecyclerView mRecyclerView;

    @BindView(R.id.title_left)
    ImageView mTitleLeft;

    @BindView(R.id.title_middle)
    TextView mTitleMiddle;
    private String url;
    private String userId;

    public int getContentLayout() {
        return R.layout.activity_friend_course_layout;
    }

    public void initView() {
        String stringExtra = getIntent().getStringExtra("title");
        if (stringExtra.equals("操课课程")) {
            this.url = "https://www.zijianshen.com/index.php/app/friendship/get_friend_classes_CK";
        } else {
            this.url = "https://www.zijianshen.com/index.php/app/friendship/get_friend_classes_SK";
        }
        this.userId = getIntent().getStringExtra(FinalTools.USER_ID);
        this.mTitleMiddle.setText(stringExtra);
        this.mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
        FriendCourseAdapter friendCourseAdapter = new FriendCourseAdapter();
        this.adapter = friendCourseAdapter;
        this.mRecyclerView.setAdapter(friendCourseAdapter);
    }

    public void initData() {
        ViewUtils.showLoading(this, "加载中...");
        HttpHelper.getInstance().getRetrofitService(this).friendCourse(this.url, getToken(), this.userId).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Subscriber<FriendsCourseEntity>() {
            public void onCompleted() {
            }

            public void onError(Throwable e) {
                ViewUtils.hideLoading();
            }

            public void onNext(FriendsCourseEntity friendsCourseEntity) {
                ViewUtils.hideLoading();
                FriendCourseDetailActivity.this.adapter.setNewData(friendsCourseEntity.getData());
            }
        });
    }

    @OnClick({R.id.title_left})
    public void onViewClicked() {
        finish();
    }
}