1
0
mirror of https://github.com/oliexdev/openScale.git synced 2025-08-22 00:06:48 +02:00

Don't override and use setNameView to set name

as it makes name contain the delta value as well (as setNameView is
called to set name + delta).
This commit is contained in:
Erik Johansson
2018-05-14 22:17:58 +02:00
parent ff39f3f2e6
commit 26ccbf8afd
4 changed files with 8 additions and 10 deletions

View File

@@ -31,7 +31,7 @@ public class Caliper1MeasurementView extends FloatMeasurementView {
super(context, R.string.label_caliper1_female, R.drawable.ic_caliper1); super(context, R.string.label_caliper1_female, R.drawable.ic_caliper1);
if (getScaleUser().getGender().isMale()) { if (getScaleUser().getGender().isMale()) {
setNameView(getResources().getText(R.string.label_caliper1_male)); setName(R.string.label_caliper1_male);
} }
} }

View File

@@ -31,7 +31,7 @@ public class Caliper2MeasurementView extends FloatMeasurementView {
super(context, R.string.label_caliper2_female, R.drawable.ic_caliper2); super(context, R.string.label_caliper2_female, R.drawable.ic_caliper2);
if (getScaleUser().getGender().isMale()) { if (getScaleUser().getGender().isMale()) {
setNameView(getResources().getText(R.string.label_caliper2_male)); setName(R.string.label_caliper2_male);
} }
} }

View File

@@ -31,7 +31,7 @@ public class Caliper3MeasurementView extends FloatMeasurementView {
super(context, R.string.label_caliper3_female, R.drawable.ic_caliper3); super(context, R.string.label_caliper3_female, R.drawable.ic_caliper3);
if (getScaleUser().getGender().isMale()) { if (getScaleUser().getGender().isMale()) {
setNameView(getResources().getText(R.string.label_caliper3_male)); setName(R.string.label_caliper3_male);
} }
} }

View File

@@ -413,6 +413,11 @@ public abstract class FloatMeasurementView extends MeasurementView {
return nameText; return nameText;
} }
protected void setName(int textId) {
nameText = getResources().getString(textId);
setNameView(nameText);
}
@Override @Override
public void appendDiffValue(SpannableStringBuilder text, boolean newLine) { public void appendDiffValue(SpannableStringBuilder text, boolean newLine) {
if (previousValue < 0.0f) { if (previousValue < 0.0f) {
@@ -474,13 +479,6 @@ public abstract class FloatMeasurementView extends MeasurementView {
} }
} }
@Override
protected void setNameView(CharSequence text) {
super.setNameView(text);
nameText = text.toString();
}
@Override @Override
public void setExpand(boolean state) { public void setExpand(boolean state) {
final boolean show = state && isVisible() && evaluationResult != null; final boolean show = state && isVisible() && evaluationResult != null;