1
0
mirror of https://github.com/oliexdev/openScale.git synced 2025-08-29 02:59:57 +02:00

Merge pull request #181 from erijo/data-entry-misc

Data entry misc
This commit is contained in:
OliE
2018-02-10 07:25:41 +01:00
committed by GitHub

View File

@@ -191,15 +191,13 @@ public class DataEntryActivity extends AppCompatActivity {
final Drawable wrapped = DrawableCompat.wrap(drawable.mutate()); final Drawable wrapped = DrawableCompat.wrap(drawable.mutate());
String menuTitle = item.getTitle().toString(); if (item.getItemId() == R.id.saveButton) {
if (menuTitle == getResources().getString(R.string.save)) {
DrawableCompat.setTint(wrapped, Color.parseColor("#FFFFFF")); DrawableCompat.setTint(wrapped, Color.parseColor("#FFFFFF"));
} else if (menuTitle == getResources().getString(R.string.edit)) { } else if (item.getItemId() == R.id.editButton) {
DrawableCompat.setTint(wrapped, Color.parseColor("#99CC00")); DrawableCompat.setTint(wrapped, Color.parseColor("#99CC00"));
} else if (menuTitle == getResources().getString(R.string.toggle_expand)) { } else if (item.getItemId() == R.id.expandButton) {
DrawableCompat.setTint(wrapped, Color.parseColor("#FFBB33")); DrawableCompat.setTint(wrapped, Color.parseColor("#FFBB33"));
} else if (menuTitle == getResources().getString(R.string.label_delete)) { } else if (item.getItemId() == R.id.deleteButton) {
DrawableCompat.setTint(wrapped, Color.parseColor("#FF4444")); DrawableCompat.setTint(wrapped, Color.parseColor("#FF4444"));
} }
@@ -267,6 +265,9 @@ public class DataEntryActivity extends AppCompatActivity {
public void onBackPressed() { public void onBackPressed() {
if (measurementViewMode == MeasurementView.MeasurementViewMode.EDIT) { if (measurementViewMode == MeasurementView.MeasurementViewMode.EDIT) {
setViewMode(MeasurementView.MeasurementViewMode.VIEW); setViewMode(MeasurementView.MeasurementViewMode.VIEW);
if (isDirty) {
scaleMeasurement = null;
}
updateOnView(); updateOnView();
} }
else { else {
@@ -327,6 +328,7 @@ public class DataEntryActivity extends AppCompatActivity {
measurement.loadFrom(scaleMeasurement, previousMeasurement); measurement.loadFrom(scaleMeasurement, previousMeasurement);
} }
txtDataNr.setMinWidth(txtDataNr.getWidth());
txtDataNr.setText(DateFormat.getDateTimeInstance( txtDataNr.setText(DateFormat.getDateTimeInstance(
DateFormat.LONG, DateFormat.SHORT).format(scaleMeasurement.getDateTime())); DateFormat.LONG, DateFormat.SHORT).format(scaleMeasurement.getDateTime()));
} }
@@ -344,8 +346,8 @@ public class DataEntryActivity extends AppCompatActivity {
btnLeft.setVisibility(View.VISIBLE); btnLeft.setVisibility(View.VISIBLE);
btnRight.setVisibility(View.VISIBLE); btnRight.setVisibility(View.VISIBLE);
btnLeft.setEnabled(true); btnLeft.setEnabled(previousMeasurement != null);
btnRight.setEnabled(true); btnRight.setEnabled(nextMeasurement != null);
dateTimeVisibility = View.GONE; dateTimeVisibility = View.GONE;
break; break;