正在查看: xDrip+ v04633772025.07.16 应用的 BGHistory.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: xDrip+ v04633772025.07.16 应用的 BGHistory.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.eveningoutpost.dexdrip;
import android.R;
import android.app.DatePickerDialog;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.Spinner;
import android.widget.SpinnerAdapter;
import android.widget.TextView;
import android.widget.Toast;
import com.eveningoutpost.dexdrip.utilitymodels.BgGraphBuilder;
import com.eveningoutpost.dexdrip.utilitymodels.Pref;
import com.eveningoutpost.dexdrip.utils.ActivityWithMenu;
import java.text.DateFormat;
import java.util.GregorianCalendar;
import java.util.Locale;
import lecho.lib.hellocharts.gesture.ZoomType;
import lecho.lib.hellocharts.listener.ViewportChangeListener;
import lecho.lib.hellocharts.model.Viewport;
import lecho.lib.hellocharts.view.LineChartView;
import lecho.lib.hellocharts.view.PreviewLineChartView;
public class BGHistory extends ActivityWithMenu {
private LineChartView chart;
private GregorianCalendar date1;
private Button dateButton1;
private Spinner daysSpinner;
private PreviewLineChartView previewChart;
private TextView statisticsTextView;
private boolean updatingPreviewViewport = false;
private boolean updatingChartViewport = false;
private DateFormat dateFormatter = DateFormat.getDateInstance(2, Locale.getDefault());
private int noDays = 1;
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(2131492898);
this.statisticsTextView = (TextView) findViewById(2131296646);
Bundle extras = getIntent().getExtras();
long currentTimeMillis = System.currentTimeMillis() - 86400000;
if (extras != null) {
currentTimeMillis = extras.getLong("BGHistory.open_on_time", currentTimeMillis);
}
GregorianCalendar gregorianCalendar = new GregorianCalendar();
this.date1 = gregorianCalendar;
gregorianCalendar.setTimeInMillis(currentTimeMillis);
this.date1.set(11, 0);
this.date1.set(12, 0);
this.date1.set(13, 0);
this.date1.set(14, 0);
setupButtons();
setupCharts();
Toast.makeText(this, 2131755485, 1).show();
}
private void setupButtons() {
Button button = (Button) findViewById(2131296467);
Button button2 = (Button) findViewById(2131296466);
this.dateButton1 = (Button) findViewById(2131296461);
this.daysSpinner = (Spinner) findViewById(2131296534);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
BGHistory.this.date1.add(5, -BGHistory.this.noDays);
BGHistory.this.setupCharts();
}
});
button2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
BGHistory.this.date1.add(5, BGHistory.this.noDays);
BGHistory.this.setupCharts();
}
});
this.dateButton1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
new DatePickerDialog(BGHistory.this, new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker datePicker, int i, int i2, int i3) {
BGHistory.this.date1.set(i, i2, i3);
BGHistory.this.setupCharts();
}
}, BGHistory.this.date1.get(1), BGHistory.this.date1.get(2), BGHistory.this.date1.get(5)).show();
}
});
String[] strArr = new String[14];
strArr[0] = "1 day";
int i = 1;
while (i < 14) {
StringBuilder sb = new StringBuilder();
int i2 = i + 1;
sb.append(i2);
sb.append(" days");
strArr[i] = sb.toString();
i = i2;
}
this.daysSpinner.setAdapter((SpinnerAdapter) new ArrayAdapter(this, R.layout.simple_dropdown_item_1line, strArr));
this.daysSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i3, long j) {
BGHistory.this.noDays = i3 + 1;
BGHistory.this.setupCharts();
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
BGHistory.this.noDays = 1;
BGHistory.this.setupCharts();
}
});
}
@Override
public String getMenuName() {
return getString(2131755664);
}
public void setupCharts() {
this.dateButton1.setText(this.dateFormatter.format(this.date1.getTime()));
GregorianCalendar gregorianCalendar = (GregorianCalendar) this.date1.clone();
gregorianCalendar.add(5, this.noDays);
BgGraphBuilder bgGraphBuilder = new BgGraphBuilder(this, this.date1.getTimeInMillis(), gregorianCalendar.getTimeInMillis(), this.noDays * 1442, false);
LineChartView findViewById = findViewById(2131296489);
this.chart = findViewById;
ZoomType zoomType = ZoomType.HORIZONTAL;
findViewById.setZoomType(zoomType);
PreviewLineChartView findViewById2 = findViewById(2131296490);
this.previewChart = findViewById2;
findViewById2.setZoomType(zoomType);
this.chart.setLineChartData(bgGraphBuilder.lineData());
this.chart.setOnValueTouchListener(bgGraphBuilder.getOnValueSelectTooltipListener(this));
this.previewChart.setLineChartData(bgGraphBuilder.previewLineData(this.chart.getLineChartData()));
this.previewChart.setViewportCalculationEnabled(true);
this.chart.setViewportCalculationEnabled(true);
this.previewChart.setViewportChangeListener(new ViewportListener());
this.chart.setViewportChangeListener(new ChartViewPortListener());
setupStatistics(this.date1.getTimeInMillis(), gregorianCalendar.getTimeInMillis());
}
private void setupStatistics(long r17, long r19) {
throw new UnsupportedOperationException("Method not decompiled: com.eveningoutpost.dexdrip.BGHistory.setupStatistics(long, long):void");
}
private class ChartViewPortListener implements ViewportChangeListener {
private ChartViewPortListener() {
}
public void onViewportChanged(Viewport viewport) {
if (BGHistory.this.updatingPreviewViewport) {
return;
}
BGHistory.this.updatingChartViewport = true;
BGHistory.this.previewChart.setZoomType(ZoomType.HORIZONTAL);
BGHistory.this.previewChart.setCurrentViewport(viewport);
BGHistory.this.updatingChartViewport = false;
}
}
private class ViewportListener implements ViewportChangeListener {
private ViewportListener() {
}
public void onViewportChanged(Viewport viewport) {
if (BGHistory.this.updatingChartViewport) {
return;
}
BGHistory.this.updatingPreviewViewport = true;
BGHistory.this.chart.setZoomType(ZoomType.HORIZONTAL);
BGHistory.this.chart.setCurrentViewport(viewport);
BGHistory.this.updatingPreviewViewport = false;
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(2131558406, menu);
menu.findItem(2131296341).setChecked(Pref.getBoolean("show_history_stats", true));
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem menuItem) {
if (menuItem.getItemId() == 2131296341) {
Pref.setBoolean("show_history_stats", !Pref.getBoolean("show_history_stats", true));
invalidateOptionsMenu();
setupCharts();
return true;
}
return super.onOptionsItemSelected(menuItem);
}
}