导航菜单

页面标题

页面副标题

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

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

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


package cn.neoprint.padmonitor.ui;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.exifinterface.media.ExifInterface;
import cn.neoprint.padmonitor.R;
import cn.neoprint.padmonitor.app.AppGlobal;
import cn.neoprint.padmonitor.datetimeselecter.NumericWheelAdapter;
import cn.neoprint.padmonitor.datetimeselecter.OnWheelChangedListener;
import cn.neoprint.padmonitor.datetimeselecter.WheelView;
import cn.neoprint.padmonitor.utils.FontManager;
import cn.neoprint.padmonitor.utils.constant.ConstDefine;
import com.bigkoo.pickerview.utils.LunarCalendar;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.List;

public class DateTimeSelector extends Activity implements View.OnClickListener {
    private static int END_YEAR = 2200;
    private static int START_YEAR = 1970;
    AppGlobal myApp = null;
    private TextView tx_Goback;
    private TextView tx_Yes;
    private TextView tx_nowtime;
    private WheelView wv_day;
    private WheelView wv_hours;
    private WheelView wv_mins;
    private WheelView wv_month;
    private WheelView wv_seconds;
    private WheelView wv_year;

    @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);
        setContentView(R.layout.datetimeselecter);
        this.tx_nowtime = (TextView) findViewById(R.id.nowtime);
        TextView textView = (TextView) findViewById(R.id.set);
        this.tx_Yes = textView;
        textView.setOnClickListener(this);
        TextView textView2 = (TextView) findViewById(R.id.cancel);
        this.tx_Goback = textView2;
        textView2.setOnClickListener(this);
        FontManager.changeFonts((ViewGroup) getWindow().getDecorView(), this, Typeface.createFromAsset(getAssets(), "fonts/MSBlack.ttf"));
        Bundle extras = getIntent().getExtras();
        long currentTimeMillis = System.currentTimeMillis();
        if (extras != null) {
            currentTimeMillis = extras.getLong("nowtime");
        }
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date date = new Date(currentTimeMillis);
        this.tx_nowtime.setText(simpleDateFormat.format(date));
        int year = date.getYear() + LunarCalendar.MIN_YEAR;
        int month = date.getMonth();
        int date2 = date.getDate();
        int hours = date.getHours();
        int minutes = date.getMinutes();
        int seconds = date.getSeconds();
        final List asList = Arrays.asList("1", ExifInterface.GPS_MEASUREMENT_3D, "5", "7", "8", "10", "12");
        final List asList2 = Arrays.asList("4", "6", "9", "11");
        float f = ConstDefine.widthDip / 1280.0f;
        WheelView.ADDITIONAL_ITEM_HEIGHT = Math.round(20.0f * f);
        int round = Math.round(f * 36.0f);
        WheelView wheelView = (WheelView) findViewById(2131363822);
        this.wv_year = wheelView;
        wheelView.TEXT_SIZE = round;
        this.wv_year.setAdapter(new NumericWheelAdapter(START_YEAR, END_YEAR));
        this.wv_year.setCyclic(true);
        this.wv_year.setCurrentItem(year - START_YEAR);
        WheelView wheelView2 = (WheelView) findViewById(R.id.months);
        this.wv_month = wheelView2;
        wheelView2.TEXT_SIZE = round;
        this.wv_month.setAdapter(new NumericWheelAdapter(1, 12));
        this.wv_month.setCyclic(true);
        this.wv_month.setCurrentItem(month);
        WheelView wheelView3 = (WheelView) findViewById(R.id.days);
        this.wv_day = wheelView3;
        wheelView3.TEXT_SIZE = round;
        this.wv_day.setCyclic(true);
        int i = month + 1;
        if (asList.contains(String.valueOf(i))) {
            this.wv_day.setAdapter(new NumericWheelAdapter(1, 31));
        } else if (asList2.contains(String.valueOf(i))) {
            this.wv_day.setAdapter(new NumericWheelAdapter(1, 30));
        } else if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {
            this.wv_day.setAdapter(new NumericWheelAdapter(1, 29));
        } else {
            this.wv_day.setAdapter(new NumericWheelAdapter(1, 28));
        }
        this.wv_day.setCurrentItem(date2 - 1);
        WheelView wheelView4 = (WheelView) findViewById(R.id.hours);
        this.wv_hours = wheelView4;
        wheelView4.TEXT_SIZE = round;
        this.wv_hours.setAdapter(new NumericWheelAdapter(0, 23));
        this.wv_hours.setCyclic(true);
        this.wv_hours.setCurrentItem(hours);
        WheelView wheelView5 = (WheelView) findViewById(R.id.minutes);
        this.wv_mins = wheelView5;
        wheelView5.TEXT_SIZE = round;
        this.wv_mins.setAdapter(new NumericWheelAdapter(0, 59));
        this.wv_mins.setCyclic(true);
        this.wv_mins.setCurrentItem(minutes);
        WheelView wheelView6 = (WheelView) findViewById(R.id.seconds);
        this.wv_seconds = wheelView6;
        wheelView6.TEXT_SIZE = round;
        this.wv_seconds.setAdapter(new NumericWheelAdapter(0, 59));
        this.wv_seconds.setCyclic(true);
        this.wv_seconds.setCurrentItem(seconds);
        OnWheelChangedListener onWheelChangedListener = new OnWheelChangedListener() {
            @Override
            public void onChanged(WheelView wheelView7, int i2, int i3) {
                int i4 = i3 + DateTimeSelector.START_YEAR;
                if (asList.contains(String.valueOf(DateTimeSelector.this.wv_month.getCurrentItem() + 1))) {
                    DateTimeSelector.this.wv_day.setAdapter(new NumericWheelAdapter(1, 31));
                } else if (asList2.contains(String.valueOf(DateTimeSelector.this.wv_month.getCurrentItem() + 1))) {
                    DateTimeSelector.this.wv_day.setAdapter(new NumericWheelAdapter(1, 30));
                } else if ((i4 % 4 != 0 || i4 % 100 == 0) && i4 % 400 != 0) {
                    DateTimeSelector.this.wv_day.setAdapter(new NumericWheelAdapter(1, 28));
                } else {
                    DateTimeSelector.this.wv_day.setAdapter(new NumericWheelAdapter(1, 29));
                }
                DateTimeSelector.this.tx_nowtime.setText(DateTimeSelector.this.getTime());
            }
        };
        OnWheelChangedListener onWheelChangedListener2 = new OnWheelChangedListener() {
            @Override
            public void onChanged(WheelView wheelView7, int i2, int i3) {
                int i4 = i3 + 1;
                if (asList.contains(String.valueOf(i4))) {
                    DateTimeSelector.this.wv_day.setAdapter(new NumericWheelAdapter(1, 31));
                } else if (asList2.contains(String.valueOf(i4))) {
                    DateTimeSelector.this.wv_day.setAdapter(new NumericWheelAdapter(1, 30));
                } else if (((DateTimeSelector.this.wv_year.getCurrentItem() + DateTimeSelector.START_YEAR) % 4 != 0 || (DateTimeSelector.this.wv_year.getCurrentItem() + DateTimeSelector.START_YEAR) % 100 == 0) && (DateTimeSelector.this.wv_year.getCurrentItem() + DateTimeSelector.START_YEAR) % 400 != 0) {
                    DateTimeSelector.this.wv_day.setAdapter(new NumericWheelAdapter(1, 28));
                } else {
                    DateTimeSelector.this.wv_day.setAdapter(new NumericWheelAdapter(1, 29));
                }
                DateTimeSelector.this.tx_nowtime.setText(DateTimeSelector.this.getTime());
            }
        };
        OnWheelChangedListener onWheelChangedListener3 = new OnWheelChangedListener() {
            @Override
            public void onChanged(WheelView wheelView7, int i2, int i3) {
                DateTimeSelector.this.tx_nowtime.setText(DateTimeSelector.this.getTime());
            }
        };
        OnWheelChangedListener onWheelChangedListener4 = new OnWheelChangedListener() {
            @Override
            public void onChanged(WheelView wheelView7, int i2, int i3) {
                DateTimeSelector.this.tx_nowtime.setText(DateTimeSelector.this.getTime());
            }
        };
        OnWheelChangedListener onWheelChangedListener5 = new OnWheelChangedListener() {
            @Override
            public void onChanged(WheelView wheelView7, int i2, int i3) {
                DateTimeSelector.this.tx_nowtime.setText(DateTimeSelector.this.getTime());
            }
        };
        OnWheelChangedListener onWheelChangedListener6 = new OnWheelChangedListener() {
            @Override
            public void onChanged(WheelView wheelView7, int i2, int i3) {
                DateTimeSelector.this.tx_nowtime.setText(DateTimeSelector.this.getTime());
            }
        };
        this.wv_year.addChangingListener(onWheelChangedListener);
        this.wv_month.addChangingListener(onWheelChangedListener2);
        this.wv_day.addChangingListener(onWheelChangedListener3);
        this.wv_hours.addChangingListener(onWheelChangedListener4);
        this.wv_mins.addChangingListener(onWheelChangedListener5);
        this.wv_seconds.addChangingListener(onWheelChangedListener6);
    }

    public String getYear() {
        String str = (this.wv_year.getCurrentItem() + START_YEAR) + "";
        return Integer.parseInt(str) < 10 ? "0" + str : str;
    }

    public String getMonth() {
        String str = (this.wv_month.getCurrentItem() + 1) + "";
        return Integer.parseInt(str) < 10 ? "0" + str : str;
    }

    public String getDay() {
        String str = (this.wv_day.getCurrentItem() + 1) + "";
        return Integer.parseInt(str) < 10 ? "0" + str : str;
    }

    public String getHoure() {
        String str = this.wv_hours.getCurrentItem() + "";
        return Integer.parseInt(str) < 10 ? "0" + str : str;
    }

    public String getMinute() {
        String str = this.wv_mins.getCurrentItem() + "";
        return Integer.parseInt(str) < 10 ? "0" + str : str;
    }

    public String getSeconds() {
        String str = this.wv_seconds.getCurrentItem() + "";
        return Integer.parseInt(str) < 10 ? "0" + str : str;
    }

    public String getTime() {
        StringBuffer stringBuffer = new StringBuffer();
        stringBuffer.append(getYear()).append("-").append(getMonth()).append("-").append(getDay()).append(" ").append(getHoure()).append(":").append(getMinute()).append(":").append(getSeconds());
        return stringBuffer.toString();
    }

    public void RefreshTime() {
        long j;
        String time = getTime();
        System.out.println(time);
        try {
            j = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(time).getTime();
        } catch (ParseException e) {
            e.printStackTrace();
            j = 0;
        }
        Bundle bundle = new Bundle();
        bundle.putLong("TimeReturn", j);
        Intent intent = new Intent();
        intent.putExtras(bundle);
        setResult(10, intent);
        finish();
    }

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

    @Override
    public void onClick(View view) {
        int id = view.getId();
        if (id == 2131362266) {
            finish();
        } else {
            if (id != 2131363300) {
                return;
            }
            RefreshTime();
        }
    }
}