@OnClick(R.id.countUpButton) protected void OnCountUpClick(View view) { statsAggregator = ((MainActivity) getActivity()).getStatsAggregator(); data = statsAggregator.newEvent(); refreshPercent(votersEditText.getText().toString()); bucketAdapter.notifyDataSetChanged(); listView.smoothScrollToPosition(statsAggregator.getFilteredBuckets().size()); view.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY); }
private void refreshPercent(String votersText) { if (votersText != null && !votersText.isEmpty()) { try { float value = Integer.parseInt(votersText); String text = String.format("%.2f", 100 * statsAggregator.getEvents().size() / value) + "%"; percentText.setText(text); } catch (Exception ignored) { } } }
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); statsAggregator = ((MainActivity) getActivity()).getStatsAggregator(); data = statsAggregator.getFilteredBuckets(); }