导航菜单

页面标题

页面副标题

六分钟步行测试管理软件 v1.1.0.2112120029 - ReviewActivity.java 源代码

正在查看: 六分钟步行测试管理软件 v1.1.0.2112120029 应用的 ReviewActivity.java JAVA 源代码文件

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


package cn.neoprint.padmonitor.ui;

import android.app.Activity;
import android.graphics.Typeface;
import android.os.Bundle;
import android.os.Environment;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import android.widget.Toast;
import cn.neoprint.padmonitor.R;
import cn.neoprint.padmonitor.app.AppGlobal;
import cn.neoprint.padmonitor.data.DataRepository;
import cn.neoprint.padmonitor.data.entity.NibpDataEntity;
import cn.neoprint.padmonitor.utils.FontManager;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

public class ReviewActivity extends Activity implements GestureDetector.OnGestureListener, View.OnTouchListener {
    private TextView backButton;
    private SimpleAdapter listAdapter;
    private ListView listView;
    private ArrayList<HashMap<String, String>> listtemp;
    private GestureDetector mGestureDetector;
    private int nItemCount;
    private List<NibpDataEntity> nibpDataEntityList;
    public int nPageno = 0;
    public int nPageCount = 0;
    public final int nPageItem = 10;
    public int verticalMinDistance = 20;
    public int minVelocity = 0;
    private final String SD_PATH = Environment.getExternalStorageDirectory().getAbsolutePath();
    public AppGlobal myApp = null;
    private View.OnClickListener listener = new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (view.getId() != 2131361814) {
                return;
            }
            ReviewActivity.this.finish();
        }
    };

    @Override
    public boolean onDown(MotionEvent motionEvent) {
        return false;
    }

    @Override
    public void onLongPress(MotionEvent motionEvent) {
    }

    @Override
    public boolean onScroll(MotionEvent motionEvent, MotionEvent motionEvent2, float f, float f2) {
        return false;
    }

    @Override
    public void onShowPress(MotionEvent motionEvent) {
    }

    @Override
    public boolean onSingleTapUp(MotionEvent motionEvent) {
        return false;
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        requestWindowFeature(1);
        AppGlobal appGlobal = (AppGlobal) getApplication();
        this.myApp = appGlobal;
        appGlobal.setSystemBarVisible(this, false);
        this.myApp.SetBackgroundLight(this, -255, 78, true);
        setFinishOnTouchOutside(false);
        setContentView(R.layout.nibpreview);
        this.listtemp = new ArrayList<>();
        this.listView = (ListView) findViewById(R.id.Lv_message);
        TextView textView = (TextView) findViewById(R.id.Btn_back);
        this.backButton = textView;
        textView.setOnClickListener(this.listener);
        List<NibpDataEntity> queryAll = DataRepository.getInstance().getNibpDataDao().queryAll();
        this.nibpDataEntityList = queryAll;
        int size = queryAll.size();
        this.nItemCount = size;
        if (size % 10 == 0) {
            this.nPageCount = size / 10;
        } else {
            this.nPageCount = (size / 10) + 1;
        }
        this.listtemp.clear();
        if (this.nibpDataEntityList.size() > 0) {
            for (int i = 0; i < this.nItemCount; i++) {
                HashMap<String, String> hashMap = new HashMap<>();
                hashMap.put("id", String.valueOf(this.nibpDataEntityList.get(i).getId()));
                hashMap.put("sys_pressure", String.valueOf(this.nibpDataEntityList.get(i).getSys()));
                hashMap.put("map_pressure", String.valueOf(this.nibpDataEntityList.get(i).getMap()));
                hashMap.put("dia_pressure", String.valueOf(this.nibpDataEntityList.get(i).getDia()));
                hashMap.put("date", this.nibpDataEntityList.get(i).getDatetime().split(" ")[0]);
                hashMap.put("time", this.nibpDataEntityList.get(i).getDatetime().split(" ")[1]);
                this.listtemp.add(hashMap);
            }
        }
        SimpleAdapter simpleAdapter = new SimpleAdapter(this, this.listtemp, R.layout.reviewlistview, new String[]{"id", "sys_pressure", "map_pressure", "dia_pressure", "date", "time"}, new int[]{R.id.Tv_ID, R.id.Tv_sys_pressure, R.id.Tv_map_pressure, R.id.Tv_dia_pressure, R.id.Tv_date, R.id.Tv_time});
        this.listAdapter = simpleAdapter;
        this.listView.setAdapter((ListAdapter) simpleAdapter);
        this.mGestureDetector = new GestureDetector(null, this, null);
        this.listView.setOnTouchListener(this);
        FontManager.changeFonts((ViewGroup) getWindow().getDecorView(), this, Typeface.createFromAsset(getAssets(), "fonts/MSBlack.ttf"));
    }

    @Override
    public void onResume() {
        super.onResume();
        this.listView.setAdapter((ListAdapter) this.listAdapter);
    }

    @Override
    public void finish() {
        super.finish();
        overridePendingTransition(0, R.anim.zoomout);
    }

    public void GotoNextPage(int i) {
        if (this.nPageno >= this.nPageCount) {
            ShowMessage(R.string.FinalAlarmRecordTip);
            this.nPageno = this.nPageCount - 1;
            return;
        }
        this.listtemp.clear();
        for (int i2 = this.nPageno * 10; i2 < (this.nPageno + 1) * 10 && i2 < this.nItemCount; i2++) {
            HashMap<String, String> hashMap = new HashMap<>();
            hashMap.put("id", String.valueOf(this.nibpDataEntityList.get(i2).getId()));
            hashMap.put("sys_pressure", String.valueOf(this.nibpDataEntityList.get(i2).getSys()));
            hashMap.put("map_pressure", String.valueOf(this.nibpDataEntityList.get(i2).getMap()));
            hashMap.put("dia_pressure", String.valueOf(this.nibpDataEntityList.get(i2).getDia()));
            hashMap.put("date", this.nibpDataEntityList.get(i2).getDatetime().split(" ")[0]);
            hashMap.put("time", this.nibpDataEntityList.get(i2).getDatetime().split(" ")[1]);
            this.listtemp.add(hashMap);
        }
        this.listAdapter = null;
        SimpleAdapter simpleAdapter = new SimpleAdapter(this, this.listtemp, R.layout.reviewlistview, new String[]{"id", "sys_pressure", "map_pressure", "dia_pressure", "date", "time"}, new int[]{R.id.Tv_ID, R.id.Tv_sys_pressure, R.id.Tv_map_pressure, R.id.Tv_dia_pressure, R.id.Tv_date, R.id.Tv_time});
        this.listAdapter = simpleAdapter;
        this.listView.setAdapter((ListAdapter) simpleAdapter);
    }

    public void GotoLastPage(int i) {
        if (this.nPageno < 0) {
            ShowMessage(R.string.FirstAlarmRecordTip);
            this.nPageno = 0;
            return;
        }
        this.listtemp.clear();
        for (int i2 = this.nPageno * 10; i2 < (this.nPageno + 1) * 10 && i2 < this.nItemCount; i2++) {
            HashMap<String, String> hashMap = new HashMap<>();
            hashMap.put("id", String.valueOf(this.nibpDataEntityList.get(i2).getId()));
            hashMap.put("sys_pressure", String.valueOf(this.nibpDataEntityList.get(i2).getSys()));
            hashMap.put("map_pressure", String.valueOf(this.nibpDataEntityList.get(i2).getMap()));
            hashMap.put("dia_pressure", String.valueOf(this.nibpDataEntityList.get(i2).getDia()));
            hashMap.put("date", this.nibpDataEntityList.get(i2).getDatetime().split(" ")[0]);
            hashMap.put("time", this.nibpDataEntityList.get(i2).getDatetime().split(" ")[1]);
            this.listtemp.add(hashMap);
        }
        this.listAdapter = null;
        SimpleAdapter simpleAdapter = new SimpleAdapter(this, this.listtemp, R.layout.reviewlistview, new String[]{"id", "sys_pressure", "map_pressure", "dia_pressure", "date", "time"}, new int[]{R.id.Tv_ID, R.id.Tv_sys_pressure, R.id.Tv_map_pressure, R.id.Tv_dia_pressure, R.id.Tv_date, R.id.Tv_time});
        this.listAdapter = simpleAdapter;
        this.listView.setAdapter((ListAdapter) simpleAdapter);
    }

    public void ShowMessage(int i) {
        View inflate = getLayoutInflater().inflate(R.layout.mytoast, (ViewGroup) null);
        Toast toast = new Toast(getApplicationContext());
        toast.setView(inflate);
        toast.setGravity(17, -150, 0);
        ((TextView) inflate.findViewById(R.id.toastInfo)).setText(i);
        toast.show();
    }

    @Override
    public boolean onFling(MotionEvent motionEvent, MotionEvent motionEvent2, float f, float f2) {
        if (motionEvent.getY() - motionEvent2.getY() > this.verticalMinDistance && Math.abs(f2) > this.minVelocity && Math.abs(motionEvent.getX() - motionEvent2.getX()) < 100.0f) {
            System.out.println("向上手势");
            int i = this.nPageno + 1;
            this.nPageno = i;
            GotoNextPage(i);
        }
        if (motionEvent2.getY() - motionEvent.getY() <= this.verticalMinDistance || Math.abs(f2) <= this.minVelocity || Math.abs(motionEvent.getX() - motionEvent2.getX()) >= 100.0f) {
            return false;
        }
        System.out.println("向下手势");
        int i2 = this.nPageno - 1;
        this.nPageno = i2;
        GotoLastPage(i2);
        return false;
    }

    @Override
    public boolean onTouchEvent(MotionEvent motionEvent) {
        return this.mGestureDetector.onTouchEvent(motionEvent);
    }

    @Override
    public boolean onTouch(View view, MotionEvent motionEvent) {
        return this.mGestureDetector.onTouchEvent(motionEvent);
    }
}