导航菜单

页面标题

页面副标题

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

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

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


package com.mu.gymtrain.Activity.MainPackage;

import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.PopupWindow;
import android.widget.TextView;
import androidx.fragment.app.FragmentActivity;
import butterknife.BindView;
import butterknife.ButterKnife;
import com.mu.gymtrain.Base.BaseActivity;
import com.mu.gymtrain.Bean.PermissionEntity;
import com.mu.gymtrain.Fragment.PermissionFragment;
import com.mu.gymtrain.R;
import com.mu.gymtrain.Utils.PermissionUtils;
import com.mu.gymtrain.view.DialogUtils;

public class DisplayWeightActivity extends BaseActivity {
    private final PermissionEntity[] cameraPermission = {new PermissionEntity("android.permission.CAMERA", "相机权限"), new PermissionEntity("android.permission.WRITE_EXTERNAL_STORAGE", "文件写入权限")};

    @BindView(R.id.imgBg1)
    ImageView imgBg1;

    @BindView(R.id.imgBg2)
    ImageView imgBg2;

    @BindView(2131296747)
    View line1;
    private DialogUtils mDialog;
    private PopupWindow popupWindow;

    @BindView(R.id.title1)
    TextView title1;

    @BindView(R.id.title3)
    TextView title3;

    @BindView(R.id.title3_1)
    TextView title3_1;

    @BindView(R.id.title5)
    TextView title5;

    @BindView(R.id.title5_1)
    TextView title5_1;

    @BindView(R.id.title7)
    TextView title7;

    @BindView(R.id.title7_1)
    TextView title7_1;

    @BindView(R.id.titleBottom1)
    TextView titleBottom1;

    @BindView(R.id.titleBottom2)
    TextView titleBottom2;
    private TextView tvScan;
    private TextView tvSuccess;

    private void initScan() {
    }

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

    public void initData() {
    }

    public void initView() {
        this.tvScan = (TextView) findViewById(R.id.imgScan);
        TextView textView = (TextView) findViewById(R.id.title_righttext);
        textView.setText("历史记录");
        textView.setOnClickListener(this);
        this.tvScan.setOnClickListener(this);
        findViewById(R.id.title_left).setOnClickListener(this);
        ((TextView) findViewById(R.id.title_middle)).setText("体质数据");
        initState();
        initDialog();
        initScan();
        initPop();
    }

    private void initState() {
        this.imgBg1.setBackgroundResource(R.drawable.bg_weight_grey);
        this.imgBg2.setBackgroundResource(R.drawable.bg_weight_grey);
        this.title3.setTextColor(getResources().getColor(R.color.gray_e8));
        this.title3_1.setTextColor(getResources().getColor(R.color.gray_e8));
        this.title5.setTextColor(getResources().getColor(R.color.gray_e8));
        this.title5_1.setTextColor(getResources().getColor(R.color.gray_e8));
        this.title7.setTextColor(getResources().getColor(R.color.gray_e8));
        this.title7_1.setTextColor(getResources().getColor(R.color.gray_e8));
        this.titleBottom1.setText("填写准确资料后即可测量体重");
        this.titleBottom2.setText("资料有误,会影响测量准确性");
        this.tvScan.setText("填写资料");
        this.tvScan.setBackgroundResource(R.drawable.bg_btn_orange);
    }

    private void initDialog() {
        View inflate = LayoutInflater.from(this).inflate(R.layout.dialog_pay_success_layout, (ViewGroup) null, false);
        this.mDialog = new DialogUtils.Builder(this).setGravity(17).setOutCancelEnable(false).setContentView(inflate).create();
        inflate.findViewById(R.id.imgCloseDialog).setOnClickListener(this);
        this.tvSuccess = (TextView) inflate.findViewById(R.id.tvSuccess);
        this.mDialog.show();
    }

    private void initPop() {
        View inflate = LayoutInflater.from(this).inflate(R.layout.pop_view_push_weight_layout, (ViewGroup) null, false);
        inflate.findViewById(R.id.imgClose).setOnClickListener(this);
        inflate.findViewById(R.id.tvChangeDate).setOnClickListener(this);
        inflate.findViewById(R.id.tvSubmit).setOnClickListener(this);
        PopupWindow popupWindow = new PopupWindow((Context) this);
        this.popupWindow = popupWindow;
        popupWindow.setContentView(inflate);
        this.popupWindow.setWidth(-2);
        this.popupWindow.setHeight(-2);
        this.popupWindow.setOutsideTouchable(true);
        this.popupWindow.setFocusable(true);
        this.popupWindow.setBackgroundDrawable(new ColorDrawable(0));
        this.popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
            @Override
            public void onDismiss() {
                DisplayWeightActivity.this.setBackground(Float.valueOf(1.0f));
            }
        });
    }

    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.imgClose:
                this.popupWindow.dismiss();
                break;
            case R.id.imgCloseDialog:
                this.mDialog.dismiss();
                break;
            case R.id.imgScan:
                PermissionUtils.requestPermission((FragmentActivity) this, this.cameraPermission, new PermissionFragment.IPermissionListener() {
                    @Override
                    public void granted() {
                        DisplayWeightActivity.this.setBackground(Float.valueOf(0.618f));
                        DisplayWeightActivity.this.popupWindow.showAsDropDown(DisplayWeightActivity.this.title3, 85, 0, 8388611);
                    }
                });
                break;
            case R.id.title_left:
                finish();
                break;
            case R.id.title_righttext:
                startActivity(new Intent((Context) this, (Class<?>) WeightHistoryActivity.class));
                break;
            case R.id.tvChangeDate:
                this.popupWindow.dismiss();
                break;
            case R.id.tvSubmit:
                this.popupWindow.dismiss();
                break;
        }
    }

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ButterKnife.bind(this);
    }
}