Source:
protected void onCreate(Bundle savedInstanceState) { boolean needUnitConversion = false; super.onCreate(savedInstanceState); setContentView(R.layout.activity_add_weight); Toolbar toolbar = (Toolbar) findViewById(R.id.activity_main_toolbar); if (toolbar != null) { setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setElevation(2); } this.retrieveExtra(); AddWeightPresenter presenter = new AddWeightPresenter(this); this.setPresenter(presenter); presenter.setReadingTimeNow(); readingTextView = (TextView) findViewById(R.id.weight_add_value); TextView unitTextView = (TextView) findViewById(R.id.weight_add_unit_measurement); this.createDateTimeViewAndListener(); this.createFANViewAndListener(); if (!"kilograms".equals(presenter.getWeightUnitMeasuerement())) { unitTextView.setText("lbs"); needUnitConversion = true; } FormatDateTime formatDateTime = new FormatDateTime(getApplicationContext()); if (this.isEditing()) { setTitle(R.string.title_activity_add_weight_edit); WeightReading readingToEdit = presenter.getWeightReadingById(this.getEditId()); double weightVal = readingToEdit.getReading(); if (needUnitConversion) weightVal = GlucosioConverter.kgToLb(weightVal); readingTextView.setText(numberFormat.format(weightVal)); Calendar cal = Calendar.getInstance(); cal.setTime(readingToEdit.getCreated()); this.getAddDateTextView().setText(formatDateTime.getDate(cal)); this.getAddTimeTextView().setText(formatDateTime.getTime(cal)); presenter.updateReadingSplitDateTime(readingToEdit.getCreated()); } else { this.getAddDateTextView().setText(formatDateTime.getCurrentDate()); this.getAddTimeTextView().setText(formatDateTime.getCurrentTime()); } }

Target:
protected void onCreate(Bundle savedInstanceState) { boolean needUnitConversion = false; super.onCreate(savedInstanceState); setContentView(R.layout.activity_add_weight); Toolbar toolbar = findViewById(R.id.activity_main_toolbar); if (toolbar != null) { setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setElevation(2); } this.retrieveExtra(); AddWeightPresenter presenter = new AddWeightPresenter(this); this.setPresenter(presenter); presenter.setReadingTimeNow(); readingTextView = findViewById(R.id.weight_add_value); TextView unitTextView = findViewById(R.id.weight_add_unit_measurement); this.createDateTimeViewAndListener(); this.createFANViewAndListener(); if (!"kilograms".equals(presenter.getWeightUnitMeasuerement())) { unitTextView.setText("lbs"); needUnitConversion = true; } FormatDateTime formatDateTime = new FormatDateTime(getApplicationContext()); if (this.isEditing()) { setTitle(R.string.title_activity_add_weight_edit); WeightReading readingToEdit = presenter.getWeightReadingById(this.getEditId()); double weightVal = readingToEdit.getReading(); if (needUnitConversion) weightVal = GlucosioConverter.kgToLb(weightVal); readingTextView.setText(numberFormat.format(weightVal)); Calendar cal = Calendar.getInstance(); cal.setTime(readingToEdit.getCreated()); this.getAddDateTextView().setText(formatDateTime.getDate(cal)); this.getAddTimeTextView().setText(formatDateTime.getTime(cal)); presenter.updateReadingSplitDateTime(readingToEdit.getCreated()); } else { this.getAddDateTextView().setText(formatDateTime.getCurrentDate()); this.getAddTimeTextView().setText(formatDateTime.getCurrentTime()); } }