import com.github.mikephil.charting.charts.BarChart; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_scoreboard);
dbInit(getIntent());
sparkAddressMap = new HashMap();
sparkAddressMap.put("BlackMage", "53ff70065075535143191087");
sparkAddressMap.put("WhiteMage", "50ff6e065067545631270587");
sparkAddressMap.put("GreenMage", "48ff70065067555028111587");
mChart = (BarChart) findViewById(R.id.chart1);
mChart.setOnChartValueSelectedListener(this);
mChart.setOnChartGestureListener(this);
mChart.setDrawValueAboveBar(true);
mChart.setDescription("");
// Dario flag changes
mChart.setDragEnabled(false);
mChart.setScaleEnabled(false);
// Set max on the chart to 10 for now, should never go above 3 on demo
mChart.setMaxVisibleValueCount(10);
// Scaling can now only be done on the x and y-axis separately
mChart.setPinchZoom(false);
// Disable background
mChart.setDrawGridBackground(false);
XAxis xAxis = mChart.getXAxis();
xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
xAxis.setDrawGridLines(false);
intFormat = new MyValueFormatter();
YAxis leftAxis = mChart.getAxisLeft();
leftAxis.setValueFormatter(intFormat);
YAxis rightAxis = mChart.getAxisRight();
rightAxis.setEnabled(false);
setData();
Legend l = mChart.getLegend();
l.setEnabled(false);
/*** Begin Repeating Alarm Setup ***/
int pollFrequencySeconds = 5;
Context context = getApplicationContext();
alarmMgr = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
Intent intent = new Intent(context, AlarmReceiver.class);
intent.putExtra("myGlass", myGlass);
// Log.d(TAG, "Input to alarm: " + myGlass);
intent.putExtra("myAddr", sparkAddressMap.get(myGlass));
alarmIntent = PendingIntent.getBroadcast(context, 0, intent, 0);
alarmMgr.setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP,
1000 * pollFrequencySeconds,
1000 * pollFrequencySeconds,
alarmIntent);
Toast.makeText(this, "Alarm Set", Toast.LENGTH_SHORT).show();
/*** Begin UI Update Listener ***/
receiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
setDataFromJSON(intent.getStringExtra(PollGameStatusService.SCORE_KEY));
}
};
}