导航菜单

页面标题

页面副标题

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

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

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


package com.mu.gymtrain.Activity.MainPackage;

import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;
import com.blankj.utilcode.util.LogUtils;
import com.githang.statusbar.StatusBarCompat;
import com.mu.gymtrain.Adapter.EquipDetailPagerAdapter;
import com.mu.gymtrain.Base.BaseActivity;
import com.mu.gymtrain.Bean.EquipDetailBean;
import com.mu.gymtrain.Fragment.EquipDetailFragment;
import com.mu.gymtrain.Http.HttpCallBack;
import com.mu.gymtrain.Http.HttpHelper;
import com.mu.gymtrain.R;
import com.mu.gymtrain.Utils.DisplayUtil;
import com.mu.gymtrain.Utils.UrlConfig;
import com.mu.gymtrain.view.ScalePageTransformer;
import com.mu.gymtrain.view.ViewPagerWhitePoint;
import java.util.ArrayList;
import java.util.List;

public class EquipDetailActivityNew extends BaseActivity {
    private List<Fragment> fragments = new ArrayList();
    private ViewPagerWhitePoint point;
    private TextView titleMiddle;
    private ViewPager viewPager;

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

    public void initView() {
        StatusBarCompat.setTranslucent(getWindow(), true);
        this.viewPager = findViewById(R.id.viewPager);
        findViewById(R.id.title_left).setOnClickListener(this);
        int i = DisplayUtil.getScreenSize(this).x;
        ViewGroup.LayoutParams layoutParams = this.viewPager.getLayoutParams();
        layoutParams.height = -1;
        double d = i;
        Double.isNaN(d);
        layoutParams.width = (int) (d * 0.8d);
        this.viewPager.setPageTransformer(true, new ScalePageTransformer(true));
        this.viewPager.setOffscreenPageLimit(2);
        this.point = (ViewPagerWhitePoint) findViewById(R.id.point);
    }

    public void initData() {
        showProgress();
        this.titleMiddle = (TextView) findViewById(R.id.title_middle);
        String stringExtra = getIntent().getStringExtra("id");
        this.fragments.clear();
        HttpHelper.getInstance().getRetrofitService(this).getEquipDetail(getToken(), getGymIdFromSP(), stringExtra).enqueue(new HttpCallBack<EquipDetailBean>() {
            @Override
            public void onSuccess(EquipDetailBean adBeen, String json) {
                EquipDetailActivityNew.this.dismissProgress();
                if (adBeen != null) {
                    EquipDetailBean.DataDTO data = adBeen.getData();
                    EquipDetailActivityNew.this.titleMiddle.setText(adBeen.getData().getEquip_name());
                    String equip_main_photo = data.getEquip_main_photo();
                    EquipDetailActivityNew.this.fragments.add(EquipDetailFragment.newInstance(UrlConfig.Path.IMG_URL + equip_main_photo, data.getEquip_name(), data.getEquip_function(), data.getEquip_count()));
                    if (!TextUtils.isEmpty(data.getDescript_video())) {
                        String descript_video = data.getDescript_video();
                        EquipDetailActivityNew.this.fragments.add(EquipDetailFragment.newInstance(UrlConfig.Path.IMG_URL + descript_video, data.getEquip_name(), data.getEquip_function(), data.getEquip_count()));
                    }
                    if (data.getDescript_file() != null && data.getDescript_file().size() > 0) {
                        for (int i = 0; i < data.getDescript_file().size(); i++) {
                            EquipDetailBean.DataDTO.DescriptFileDTO descriptFileDTO = data.getDescript_file().get(i);
                            if (!TextUtils.isEmpty(descriptFileDTO.getPhoto()) || !TextUtils.isEmpty(descriptFileDTO.getText())) {
                                EquipDetailActivityNew.this.fragments.add(EquipDetailFragment.newInstance(UrlConfig.Path.IMG_URL + descriptFileDTO.getPhoto(), data.getEquip_name(), descriptFileDTO.getText(), "-1"));
                            }
                        }
                    }
                    EquipDetailActivityNew.this.viewPager.setAdapter(new EquipDetailPagerAdapter(EquipDetailActivityNew.this.getSupportFragmentManager(), EquipDetailActivityNew.this.fragments));
                    EquipDetailActivityNew.this.point.setViewPager(EquipDetailActivityNew.this.viewPager, EquipDetailActivityNew.this.fragments.size());
                }
            }

            @Override
            public void onFail(String str) {
                EquipDetailActivityNew.this.dismissProgress();
                LogUtils.i(new Object[]{str});
            }
        });
    }

    public void onClick(View v) {
        finish();
    }
}