//TODO Display readings in mmol/L
private void setUpViews() {
        glucometerAttribution = findViewById(R.id.glucometerAttribution);
        glucometerImg = findViewById(R.id.glucometerImg);
        insertStripText = findViewById(R.id.insertStripText);
        upArrow = findViewById(R.id.upArrow);
        droplet = findViewById(R.id.dropletImg);
        attributionText = findViewById(R.id.attributionText);
        placeBloodSweatImg = findViewById(R.id.placeBloodSweatImg);
        placeBloodSweatText = findViewById(R.id.placeBloodSweatText);
        waitForReadingText = findViewById(R.id.waitForReadingText);
        progressBar = findViewById(R.id.progressBar);
        unitsText = findViewById(R.id.unitsText);
        glucoseLevelText = findViewById(R.id.glucoseLevelText);
        descriptionTxt = findViewById(R.id.descriptionTxt);
        detailsBtn = findViewById(R.id.detailsBtn);
        anotherReadingBtn = findViewById(R.id.anotherReadingBtn);
        showBtn = findViewById(R.id.button7);
        dippedBtn = findViewById(R.id.button6);
        stripBtn = findViewById(R.id.button8);
        startButton = findViewById(R.id.btnStripInserted);
        rgMode = findViewById(R.id.rgMode);
        rbBlood = findViewById(R.id.rbBlood);
        rbSweat = findViewById(R.id.rbSweat);
        rb_mg_dL = findViewById(R.id.rb_mg_dL);
        rb_mmol_L = findViewById(R.id.rb_mmol_L);
        glucometerSwitch = findViewById(R.id.glucometerSwitch);
        rgUnits = findViewById(R.id.rgUnits);
        startButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (!rbSweat.isChecked() && !rbBlood.isChecked()) {
                    Toast.makeText(GlucometerActivity.this, "Please select a mode", Toast.LENGTH_SHORT).show();
                }
                else {
                    instance.sendDataToArduino("start");
                    instance.setReading(true);
                    glucometerSwitch.setEnabled(false);
                    rbBlood.setEnabled(false);
                    rbSweat.setEnabled(false);
                    rb_mg_dL.setEnabled(false);
                    rb_mmol_L.setEnabled(false);
                    startButton.setEnabled(false);
                    glucometerImg.setVisibility(View.VISIBLE);
                    glucometerAttribution.setVisibility(View.VISIBLE);
                    insertStripText.setVisibility(View.VISIBLE);
                    upArrow.setVisibility(View.VISIBLE);
                }
            }
        });
        rgMode.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                switch (checkedId) {
                    case R.id.rbBlood:
                        instance.sendDataToArduino("Blood");
                        droplet.setColorFilter(Color.parseColor("#F44336"));
                        placeBloodSweatText.setText("Place blood on the test strip");
                        break;
                    case R.id.rbSweat:
                        instance.sendDataToArduino("Sweat");
                        droplet.setColorFilter(Color.parseColor("#1b95e0"));
                        placeBloodSweatText.setText("Place sweat on the test strip");
                        break;
                }
                viewDelay();
            }
        });
        glucometerSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                if (isChecked){
                    instance.sendDataToArduino("G_on");
                    viewDelay();
                }else {
                    instance.sendDataToArduino("G_off");
                    startButton.setEnabled(false);
                    rbBlood.setEnabled(false);
                    rbSweat.setEnabled(false);
                    rb_mg_dL.setEnabled(false);
                    rb_mmol_L.setEnabled(false);
                    glucometerSwitch.setEnabled(false);
                    viewHandler = new Handler();
                    Runnable delay = new Runnable() {
                        @Override
                        public void run() {
                            glucometerSwitch.setEnabled(true);
                        }
                    };
                    viewHandler.postDelayed(delay, 1000);
                }
            }
        });
        rgUnits.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                switch (checkedId) {
                    case R.id.rb_mg_dL:
                        //TODO Display readings in mg/dL
                        unitsText.setText("mg/dL");
                        break;
                    case R.id.rb_mmol_L:
                        //TODO Display readings in mmol/L
                        unitsText.setText("mmol/L");
                        break;
                }
                viewDelay();
            }
        });
        detailsBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //Move to new activity
                Intent intent = new Intent(GlucometerActivity.this, GlucoseReadingDetailsActivity.class);
                intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
                startActivity(intent);
            }
        });
        anotherReadingBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                instance.setReading(false);
                glucometerSwitch.setEnabled(true);
                rbBlood.setEnabled(true);
                rbSweat.setEnabled(true);
                rb_mg_dL.setEnabled(true);
                rb_mmol_L.setEnabled(true);
                startButton.setEnabled(true);
                instance.setStringData(null);
                instance.setCommand(null);
                unitsText.setVisibility(View.INVISIBLE);
                glucoseLevelText.setVisibility(View.INVISIBLE);
                descriptionTxt.setVisibility(View.INVISIBLE);
                detailsBtn.setVisibility(View.INVISIBLE);
                anotherReadingBtn.setVisibility(View.INVISIBLE);
            }
        });
        showBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                instance.setCommand("show");
            }
        });
        stripBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                instance.setCommand("strip");
            }
        });
        dippedBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                instance.setCommand("dipped");
            }
        });
    }
break;
case R.id.rb_mmol_L:
//TODO Display readings in mmol/L
unitsText.setText("mmol/L");
break;
});
rgUnits.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
switch (checkedId) {
case R.id.rb_mg_dL:
//TODO Display readings in mg/dL
unitsText.setText("mg/dL");
break;
case R.id.rb_mmol_L:
//TODO Display readings in mmol/L
unitsText.setText("mmol/L");
break;
}
viewDelay();
}
});
detailsBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//Move to new activity
viewHandler = new Handler();
Runnable delay = new Runnable() {
@Override
public void run() {
glucometerSwitch.setEnabled(true);
}
};
viewHandler.postDelayed(delay, 1000);
}
}
});
rgUnits.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
switch (checkedId) {
case R.id.rb_mg_dL:
//TODO Display readings in mg/dL
unitsText.setText("mg/dL");
break;
case R.id.rb_mmol_L:
//TODO Display readings in mmol/L
unitsText.setText("mmol/L");
break;
}
viewDelay();
}
});
detailsBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//Move to new activity
Intent intent = new Intent(GlucometerActivity.this, GlucoseReadingDetailsActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
startActivity(intent);
}
});
anotherReadingBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
instance.setReading(false);
glucometerSwitch.setEnabled(true);