@Override protected void onStart() { super.onStart(); workRadioButton.setChecked(true); currentBlockoutTimes = new ArrayList<>(); blockoutTimesListAdapter = new SectionArrayAdapter( SelectBlockoutTimes.this, R.layout.section_list_display, currentBlockoutTimes); blockoutTimesListAdapter.setDeleteButtonVisibility(true); blockoutTimesListAdapter.setNotifyOnChange(true); sectionListView.setAdapter(blockoutTimesListAdapter); // Set buttons to toggle colors. These can all be discarded if a proper style is setup and used // for buttons. sundayToggleButton.setOnCheckedChangeListener( new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { buttonView.setBackgroundColor(getResources().getColor(R.color.utaOrange)); } else buttonView.setBackgroundColor(getResources().getColor(R.color.button_material_light)); } }); mondayToggleButton.setOnCheckedChangeListener( new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { buttonView.setBackgroundColor(getResources().getColor(R.color.utaOrange)); } else buttonView.setBackgroundColor(getResources().getColor(R.color.button_material_light)); } }); tuesdayToggleButton.setOnCheckedChangeListener( new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { buttonView.setBackgroundColor(getResources().getColor(R.color.utaOrange)); } else buttonView.setBackgroundColor(getResources().getColor(R.color.button_material_light)); } }); wednesdayToggleButton.setOnCheckedChangeListener( new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { buttonView.setBackgroundColor(getResources().getColor(R.color.utaOrange)); } else buttonView.setBackgroundColor(getResources().getColor(R.color.button_material_light)); } }); thursdayToggleButton.setOnCheckedChangeListener( new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { buttonView.setBackgroundColor(getResources().getColor(R.color.utaOrange)); } else buttonView.setBackgroundColor(getResources().getColor(R.color.button_material_light)); } }); fridayToggleButton.setOnCheckedChangeListener( new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { buttonView.setBackgroundColor(getResources().getColor(R.color.utaOrange)); } else buttonView.setBackgroundColor(getResources().getColor(R.color.button_material_light)); } }); saturdayToggleButton.setOnCheckedChangeListener( new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { buttonView.setBackgroundColor(getResources().getColor(R.color.utaOrange)); } else buttonView.setBackgroundColor(getResources().getColor(R.color.button_material_light)); } }); // Check to see if creating intent had blocout times stored in it. Intent intent = getIntent(); if (intent.hasExtra("BLOCKOUT TIMES")) { String blockOutTimes = intent.getStringExtra("BLOCKOUT TIMES"); try { JSONObject jsonObject = new JSONObject(blockOutTimes); Course course = new Course(jsonObject); for (Section section : course.getSectionList()) { currentBlockoutTimes.add(section); } } catch (JSONException e) { e.printStackTrace(); } blockoutTimesListAdapter.notifyDataSetChanged(); } }