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

Refactor measurement settings

- Make it possible to disable all measurements (except weight). Fixes
  #226 and fixes #224.

- Add separate preference screens to all measurements to configure
  e.g. if the measurement should be displayed in the overview graph
  (this fixes #225 in a different way compared to previously), if
  relative or absolute weight should be used etc.

- Include reordering of measurements in the main measurement
  preference screen.
This commit is contained in:
Erik Johansson
2018-03-23 07:14:34 +01:00
parent 13d8850802
commit ebe2d6dfa0
19 changed files with 332 additions and 400 deletions

View File

@@ -227,8 +227,7 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
for (MeasurementView view : measurementViews) { for (MeasurementView view : measurementViews) {
if (!view.isVisible() if (!view.isVisible()
|| !prefs.getBoolean(String.valueOf("actionButton" + view.getName()), true) || !view.getSettings().isOnOverviewGraph()
|| view.getName().equals(getString(R.string.label_bmr))
|| !(view instanceof FloatMeasurementView)) { || !(view instanceof FloatMeasurementView)) {
continue; continue;
} }

View File

@@ -1,4 +1,5 @@
/* Copyright (C) 2014 olie.xdev <olie.xdev@googlemail.com> /* Copyright (C) 2014 olie.xdev <olie.xdev@googlemail.com>
* Copyright (C) 2018 Erik Johansson <erik@ejohansson.se>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -16,75 +17,46 @@
package com.health.openscale.gui.preferences; package com.health.openscale.gui.preferences;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.SharedPreferences; import android.database.DataSetObserver;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.Point; import android.graphics.Point;
import android.graphics.PorterDuff; import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Bundle; import android.os.Bundle;
import android.preference.CheckBoxPreference;
import android.preference.EditTextPreference;
import android.preference.ListPreference;
import android.preference.MultiSelectListPreference;
import android.preference.Preference; import android.preference.Preference;
import android.preference.PreferenceCategory; import android.preference.PreferenceCategory;
import android.preference.PreferenceFragment; import android.preference.PreferenceFragment;
import android.preference.PreferenceGroup; import android.preference.PreferenceGroup;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.preference.SwitchPreference; import android.preference.PreferenceScreen;
import android.util.TypedValue;
import android.view.DragEvent; import android.view.DragEvent;
import android.view.GestureDetector;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.widget.CompoundButton;
import android.widget.ListAdapter;
import android.widget.Switch;
import android.widget.Toast; import android.widget.Toast;
import com.health.openscale.R; import com.health.openscale.R;
import com.health.openscale.core.OpenScale; import com.health.openscale.core.OpenScale;
import com.health.openscale.core.bodymetric.EstimatedFatMetric;
import com.health.openscale.core.bodymetric.EstimatedLBWMetric;
import com.health.openscale.core.bodymetric.EstimatedWaterMetric;
import com.health.openscale.gui.views.MeasurementView; import com.health.openscale.gui.views.MeasurementView;
import com.health.openscale.gui.views.WeightMeasurementView;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set;
public class MeasurementPreferences extends PreferenceFragment implements SharedPreferences.OnSharedPreferenceChangeListener { public class MeasurementPreferences extends PreferenceFragment {
public static final String PREFERENCE_KEY_DELETE_ALL = "deleteAll"; public static final String PREFERENCE_KEY_DELETE_ALL = "deleteAll";
public static final String PREFERENCE_KEY_FAT = "fatEnable";
public static final String PREFERENCE_KEY_FAT_PERCENTAGE = "fatPercentageEnable";
public static final String PREFERENCE_KEY_WATER = "waterEnable";
public static final String PREFERENCE_KEY_WATER_PERCENTAGE = "waterPercentageEnable";
public static final String PREFERENCE_KEY_MUSCLE = "muscleEnable";
public static final String PREFERENCE_KEY_MUSCLE_PERCENTAGE = "musclePercentageEnable";
public static final String PREFERENCE_KEY_ESTIMATE_WATER = "estimateWaterEnable";
public static final String PREFERENCE_KEY_ESTIMATE_WATER_FORMULA = "estimateWaterFormula";
public static final String PREFERENCE_KEY_ESTIMATE_LBW = "estimateLBWEnable";
public static final String PREFERENCE_KEY_ESTIMATE_LBW_FORMULA = "estimateLBWFormula";
public static final String PREFERENCE_KEY_ESTIMATE_FAT = "estimateFatEnable";
public static final String PREFERENCE_KEY_ESTIMATE_FAT_FORMULA = "estimateFatFormula";
public static final String PREFERENCE_KEY_RESET_ORDER = "resetOrder"; public static final String PREFERENCE_KEY_RESET_ORDER = "resetOrder";
public static final String PREFERENCE_KEY_ORDER_CATEGORY = "orderCategory"; public static final String PREFERENCE_KEY_MEASUREMENTS = "measurements";
private Preference deleteAll; private Preference deleteAll;
private PreferenceCategory measurementCategory;
private PreferenceCategory measurementOrderCategory;
private CheckBoxPreference fatEnable;
private SwitchPreference fatPercentageEnable;
private CheckBoxPreference waterEnable;
private SwitchPreference waterPercentageEnable;
private CheckBoxPreference muscleEnable;
private SwitchPreference musclePercentageEnable;
private CheckBoxPreference estimateWaterEnable;
private ListPreference estimateWaterFormula;
private CheckBoxPreference estimateLBWEnable;
private ListPreference estimateLBWFormula;
private CheckBoxPreference estimateFatEnable;
private ListPreference estimateFatFormula;
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
@@ -92,203 +64,46 @@ public class MeasurementPreferences extends PreferenceFragment implements Shared
addPreferencesFromResource(R.xml.measurement_preferences); addPreferencesFromResource(R.xml.measurement_preferences);
deleteAll = (Preference) findPreference(PREFERENCE_KEY_DELETE_ALL); deleteAll = findPreference(PREFERENCE_KEY_DELETE_ALL);
deleteAll.setOnPreferenceClickListener(new onClickListenerDeleteAll()); deleteAll.setOnPreferenceClickListener(new onClickListenerDeleteAll());
final Context context = getActivity().getBaseContext(); measurementCategory = (PreferenceCategory) findPreference(PREFERENCE_KEY_MEASUREMENTS);
measurementOrderCategory = (PreferenceCategory) findPreference(PREFERENCE_KEY_ORDER_CATEGORY);
measurementOrderCategory.setOrderingAsAdded(true);
Preference resetOrder = findPreference(PREFERENCE_KEY_RESET_ORDER); Preference resetOrder = findPreference(PREFERENCE_KEY_RESET_ORDER);
resetOrder.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { resetOrder.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override @Override
public boolean onPreferenceClick(Preference preference) { public boolean onPreferenceClick(Preference preference) {
PreferenceManager.getDefaultSharedPreferences(context).edit() PreferenceManager.getDefaultSharedPreferences(getActivity()).edit()
.remove(MeasurementView.PREF_MEASUREMENT_ORDER).commit(); .remove(MeasurementView.PREF_MEASUREMENT_ORDER).apply();
measurementOrderCategory.removeAll(); updateMeasurementPreferences();
updateMeasurementOrderScreen(context, measurementOrderCategory);
return true; return true;
} }
}); });
updateMeasurementOrderScreen(context, measurementOrderCategory); updateMeasurementPreferences();
estimateWaterEnable = (CheckBoxPreference) findPreference(PREFERENCE_KEY_ESTIMATE_WATER);
estimateWaterFormula = (ListPreference) findPreference(PREFERENCE_KEY_ESTIMATE_WATER_FORMULA);
estimateLBWEnable = (CheckBoxPreference) findPreference(PREFERENCE_KEY_ESTIMATE_LBW);
estimateLBWFormula = (ListPreference) findPreference(PREFERENCE_KEY_ESTIMATE_LBW_FORMULA);
estimateFatEnable = (CheckBoxPreference) findPreference(PREFERENCE_KEY_ESTIMATE_FAT);
estimateFatFormula = (ListPreference) findPreference(PREFERENCE_KEY_ESTIMATE_FAT_FORMULA);
fatEnable = (CheckBoxPreference) findPreference(PREFERENCE_KEY_FAT);
fatPercentageEnable = (SwitchPreference) findPreference(PREFERENCE_KEY_FAT_PERCENTAGE);
waterEnable = (CheckBoxPreference) findPreference(PREFERENCE_KEY_WATER);
waterPercentageEnable = (SwitchPreference) findPreference(PREFERENCE_KEY_WATER_PERCENTAGE);
muscleEnable = (CheckBoxPreference) findPreference(PREFERENCE_KEY_MUSCLE);
musclePercentageEnable = (SwitchPreference) findPreference(PREFERENCE_KEY_MUSCLE_PERCENTAGE);
updateWaterListPreferences();
updateLBWListPreferences();
updateFatListPreferences();
initSummary(getPreferenceScreen());
} }
private void updateMeasurementOrderScreen(Context context, PreferenceCategory category) { private void updateMeasurementPreferences() {
measurementCategory.removeAll();
List<MeasurementView> measurementViews = MeasurementView.getMeasurementList( List<MeasurementView> measurementViews = MeasurementView.getMeasurementList(
context, MeasurementView.DateTimeOrder.NONE); getActivity(), MeasurementView.DateTimeOrder.NONE);
for (MeasurementView measurement : measurementViews) { for (MeasurementView measurement : measurementViews) {
Preference preference = new MeasurementOrderPreference(context, category, measurement); Preference preference = new MeasurementOrderPreference(
preference.setShouldDisableView(true); getActivity(), measurementCategory, measurement);
preference.setEnabled(measurement.isVisible()); preference.setKey(measurement.getSettings().getEnabledKey());
category.addPreference(preference); preference.setDefaultValue(measurement.getSettings().isEnabled());
} preference.setPersistent(true);
} preference.setEnabled(!measurement.getIsDisabledByDependency());
public void updateWaterListPreferences() { Drawable icon = measurement.getIcon();
ArrayList<String> listEntries = new ArrayList(); icon.setColorFilter(measurement.getForegroundColor(), PorterDuff.Mode.SRC_IN);
ArrayList<String> listEntryValues = new ArrayList(); preference.setIcon(icon);
for (EstimatedWaterMetric.FORMULA formulaWater : EstimatedWaterMetric.FORMULA.values()) { preference.setTitle(measurement.getName());
EstimatedWaterMetric waterMetric = EstimatedWaterMetric.getEstimatedMetric(formulaWater);
listEntries.add(waterMetric.getName()); measurementCategory.addPreference(preference);
listEntryValues.add(formulaWater.toString());
}
estimateWaterFormula.setEntries(listEntries.toArray(new CharSequence[listEntries.size()]));
estimateWaterFormula.setEntryValues(listEntryValues.toArray(new CharSequence[listEntryValues.size()]));
}
public void updateLBWListPreferences() {
ArrayList<String> listEntries = new ArrayList();
ArrayList<String> listEntryValues = new ArrayList();
for (EstimatedLBWMetric.FORMULA formulaLBW : EstimatedLBWMetric.FORMULA.values()) {
EstimatedLBWMetric muscleMetric = EstimatedLBWMetric.getEstimatedMetric(formulaLBW);
listEntries.add(muscleMetric.getName());
listEntryValues.add(formulaLBW.toString());
}
estimateLBWFormula.setEntries(listEntries.toArray(new CharSequence[listEntries.size()]));
estimateLBWFormula.setEntryValues(listEntryValues.toArray(new CharSequence[listEntryValues.size()]));
}
public void updateFatListPreferences() {
ArrayList<String> listEntries = new ArrayList();
ArrayList<String> listEntryValues = new ArrayList();
for (EstimatedFatMetric.FORMULA formulaFat : EstimatedFatMetric.FORMULA.values()) {
EstimatedFatMetric fatMetric = EstimatedFatMetric.getEstimatedMetric(formulaFat);
listEntries.add(fatMetric.getName());
listEntryValues.add(formulaFat.toString());
}
estimateFatFormula.setEntries(listEntries.toArray(new CharSequence[listEntries.size()]));
estimateFatFormula.setEntryValues(listEntryValues.toArray(new CharSequence[listEntryValues.size()]));
}
private void initSummary(Preference p) {
if (p instanceof PreferenceGroup) {
PreferenceGroup pGrp = (PreferenceGroup) p;
for (int i = 0; i < pGrp.getPreferenceCount(); i++) {
initSummary(pGrp.getPreference(i));
}
} else {
updatePrefSummary(p);
}
}
@Override
public void onResume() {
super.onResume();
getPreferenceManager().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
}
@Override
public void onPause() {
getPreferenceManager().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this);
super.onPause();
}
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
updatePrefSummary(findPreference(key));
if (!key.equals(MeasurementView.PREF_MEASUREMENT_ORDER)) {
measurementOrderCategory.removeAll();
updateMeasurementOrderScreen(getActivity().getApplicationContext(), measurementOrderCategory);
}
}
private void updatePrefSummary(Preference p) {
if (estimateWaterEnable.isChecked()) {
estimateWaterFormula.setEnabled(true);
} else {
estimateWaterFormula.setEnabled(false);
}
if (estimateLBWEnable.isChecked()) {
estimateLBWFormula.setEnabled(true);
} else {
estimateLBWFormula.setEnabled(false);
}
if (estimateFatEnable.isChecked()) {
estimateFatFormula.setEnabled(true);
} else {
estimateFatFormula.setEnabled(false);
}
if (fatEnable.isChecked()) {
fatPercentageEnable.setEnabled(true);
} else {
fatPercentageEnable.setEnabled(false);
}
if (waterEnable.isChecked()) {
waterPercentageEnable.setEnabled(true);
} else {
waterPercentageEnable.setEnabled(false);
}
if (muscleEnable.isChecked()) {
musclePercentageEnable.setEnabled(true);
} else {
musclePercentageEnable.setEnabled(false);
}
estimateWaterFormula.setSummary(EstimatedWaterMetric.getEstimatedMetric(EstimatedWaterMetric.FORMULA.valueOf(estimateWaterFormula.getValue())).getName());
estimateLBWFormula.setSummary(EstimatedLBWMetric.getEstimatedMetric(EstimatedLBWMetric.FORMULA.valueOf(estimateLBWFormula.getValue())).getName());
estimateFatFormula.setSummary(EstimatedFatMetric.getEstimatedMetric(EstimatedFatMetric.FORMULA.valueOf(estimateFatFormula.getValue())).getName());
if (p instanceof EditTextPreference) {
EditTextPreference editTextPref = (EditTextPreference) p;
if (p.getTitle().toString().contains("assword"))
{
p.setSummary("******");
} else {
p.setSummary(editTextPref.getText());
}
}
if (p instanceof MultiSelectListPreference) {
MultiSelectListPreference editMultiListPref = (MultiSelectListPreference) p;
CharSequence[] entries = editMultiListPref.getEntries();
CharSequence[] entryValues = editMultiListPref.getEntryValues();
List<String> currentEntries = new ArrayList<>();
Set<String> currentEntryValues = editMultiListPref.getValues();
for (int i = 0; i < entries.length; i++)
if (currentEntryValues.contains(entryValues[i]))
currentEntries.add(entries[i].toString());
p.setSummary(currentEntries.toString());
} }
} }
@@ -323,19 +138,25 @@ public class MeasurementPreferences extends PreferenceFragment implements Shared
} }
} }
private class MeasurementOrderPreference extends Preference { private class MeasurementOrderPreference extends Preference
implements GestureDetector.OnGestureListener {
PreferenceGroup parentGroup; PreferenceGroup parentGroup;
MeasurementView measurement; MeasurementView measurement;
GestureDetector gestureDetector;
View boundView; View boundView;
Switch measurementSwitch;
MeasurementOrderPreference(Context context, PreferenceGroup parent, MeasurementView measurementView) { MeasurementOrderPreference(Context context, PreferenceGroup parent, MeasurementView measurementView) {
super(context); super(context);
parentGroup = parent; parentGroup = parent;
measurement = measurementView; measurement = measurementView;
Drawable icon = measurement.getIcon();
icon.setColorFilter(measurementView.getForegroundColor(), PorterDuff.Mode.SRC_IN); gestureDetector = new GestureDetector(getContext(), this);
setIcon(icon); gestureDetector.setIsLongpressEnabled(true);
setTitle(measurement.getName());
setWidgetLayoutResource(R.layout.measurement_preferences_widget_layout);
} }
public PreferenceGroup getParent() { public PreferenceGroup getParent() {
@@ -347,46 +168,146 @@ public class MeasurementPreferences extends PreferenceFragment implements Shared
super.onBindView(view); super.onBindView(view);
boundView = view; boundView = view;
onTouchClickListener touchClickListener = new onTouchClickListener(this); measurementSwitch = view.findViewById(R.id.measurement_switch);
view.setOnTouchListener(touchClickListener); if (measurement instanceof WeightMeasurementView) {
view.setOnLongClickListener(touchClickListener); measurementSwitch.setVisibility(View.INVISIBLE);
}
else {
measurementSwitch.setChecked(getPersistedBoolean(true));
measurementSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
persistBoolean(isChecked);
setEnableOnDependants(isChecked);
}
});
}
if (!measurement.hasExtraPreferences()) {
view.findViewById(R.id.measurement_switch_separator).setVisibility(View.GONE);
}
TypedValue outValue = new TypedValue();
getActivity().getTheme().resolveAttribute(R.attr.selectableItemBackground, outValue, true);
boundView.setBackgroundResource(outValue.resourceId);
view.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
return gestureDetector.onTouchEvent(event);
}
});
view.setOnDragListener(new onDragListener()); view.setOnDragListener(new onDragListener());
} }
private class onTouchClickListener implements View.OnTouchListener, View.OnLongClickListener { private void setEnableOnDependants(boolean enable) {
MeasurementOrderPreference preference; for (int i = 0; i < getParent().getPreferenceCount(); ++i) {
int x = 0; MeasurementOrderPreference preference =
int y = 0; (MeasurementOrderPreference) getParent().getPreference(i);
for (String dep : preference.measurement.getDependencyKeys()) {
onTouchClickListener(MeasurementOrderPreference pref) { if (dep.equals(measurement.getKey())) {
preference = pref; preference.setEnabled(enable);
} break;
}
@Override
public boolean onTouch(View view, MotionEvent event) {
if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
x = Math.round(event.getX());
y = Math.round(event.getY());
} }
return false;
} }
}
@Override @Override
public boolean onLongClick(View view) { public boolean onDown(MotionEvent e) {
return view.startDrag(null, new dragShadowBuilder(view), preference, 0); return isEnabled();
} }
private class dragShadowBuilder extends View.DragShadowBuilder { @Override
public dragShadowBuilder(View view) { public void onShowPress(MotionEvent e) {
super(view); boundView.setPressed(true);
}
@Override
public boolean onSingleTapUp(MotionEvent e) {
boundView.setPressed(false);
if (!measurement.hasExtraPreferences()) {
if (measurementSwitch.getVisibility() == View.VISIBLE) {
measurementSwitch.toggle();
} }
return true;
}
// Must be enabled to show extra preferences screen
if (!getPersistedBoolean(true)) {
return true;
}
final PreferenceScreen screen = getPreferenceManager().createPreferenceScreen(getActivity());
// Register as an observer so that the loop to getItem() below will find the new
// preference screen added at the end. The add is done on another thread so we must
// wait for it to complete.
final ListAdapter adapter = getPreferenceScreen().getRootAdapter();
adapter.registerDataSetObserver(new DataSetObserver() {
@Override @Override
public void onProvideShadowMetrics(Point outShadowSize, Point outShadowTouchPoint) { public void onChanged() {
super.onProvideShadowMetrics(outShadowSize, outShadowTouchPoint); adapter.unregisterDataSetObserver(this);
outShadowTouchPoint.set(x, y);
// Simulate a click to have the preference screen open
for (int i = adapter.getCount() - 1; i >= 0; --i) {
if (adapter.getItem(i) == screen) {
getPreferenceScreen().onItemClick(null, null, i, 0);
break;
}
}
// Remove the preference when the dialog is dismissed
Dialog dialog = screen.getDialog();
dialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
screen.onDismiss(dialog);
getPreferenceScreen().removePreference(screen);
}
});
} }
});
getPreferenceScreen().addPreference(screen);
measurement.prepareExtraPreferencesScreen(screen);
return true;
}
@Override
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
return false;
}
@Override
public void onLongPress(MotionEvent event) {
int x = Math.round(event.getX());
int y = Math.round(event.getY());
boundView.startDrag(null, new dragShadowBuilder(boundView, x, y), this, 0);
}
private class dragShadowBuilder extends View.DragShadowBuilder {
private int x;
private int y;
public dragShadowBuilder(View view, int x, int y) {
super(view);
this.x = x;
this.y = y;
} }
@Override
public void onProvideShadowMetrics(Point outShadowSize, Point outShadowTouchPoint) {
super.onProvideShadowMetrics(outShadowSize, outShadowTouchPoint);
outShadowTouchPoint.set(x, y);
}
}
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
return false;
} }
private class onDragListener implements View.OnDragListener { private class onDragListener implements View.OnDragListener {
@@ -422,9 +343,6 @@ public class MeasurementPreferences extends PreferenceFragment implements Shared
public boolean onDrag(View view, DragEvent event) { public boolean onDrag(View view, DragEvent event) {
switch (event.getAction()) { switch (event.getAction()) {
case DragEvent.ACTION_DRAG_STARTED: case DragEvent.ACTION_DRAG_STARTED:
if (isDraggedView(view, event)) {
setTemporaryBackgroundColor(view, Color.GRAY);
}
break; break;
case DragEvent.ACTION_DRAG_ENTERED: case DragEvent.ACTION_DRAG_ENTERED:
if (!isDraggedView(view, event)) { if (!isDraggedView(view, event)) {
@@ -472,6 +390,5 @@ public class MeasurementPreferences extends PreferenceFragment implements Shared
return true; return true;
} }
} }
} }
} }

View File

@@ -17,9 +17,11 @@ package com.health.openscale.gui.views;
import android.content.Context; import android.content.Context;
import android.graphics.Color; import android.graphics.Color;
import android.preference.ListPreference;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import com.health.openscale.R; import com.health.openscale.R;
import com.health.openscale.core.bodymetric.EstimatedFatMetric;
import com.health.openscale.core.datatypes.ScaleMeasurement; import com.health.openscale.core.datatypes.ScaleMeasurement;
import com.health.openscale.core.evaluation.EvaluationResult; import com.health.openscale.core.evaluation.EvaluationResult;
import com.health.openscale.core.evaluation.EvaluationSheet; import com.health.openscale.core.evaluation.EvaluationSheet;
@@ -79,6 +81,22 @@ public class FatMeasurementView extends FloatMeasurementView {
@Override @Override
protected boolean isEstimationSupported() { return true; } protected boolean isEstimationSupported() { return true; }
@Override
protected void prepareEstimationFormulaPreference(ListPreference preference) {
String[] entries = new String[EstimatedFatMetric.FORMULA.values().length];
String[] values = new String[entries.length];
int idx = 0;
for (EstimatedFatMetric.FORMULA formula : EstimatedFatMetric.FORMULA.values()) {
entries[idx] = EstimatedFatMetric.getEstimatedMetric(formula).getName();
values[idx] = formula.name();
++idx;
}
preference.setEntries(entries);
preference.setEntryValues(values);
}
@Override @Override
protected EvaluationResult evaluateSheet(EvaluationSheet evalSheet, float value) { protected EvaluationResult evaluateSheet(EvaluationSheet evalSheet, float value) {
return evalSheet.evaluateBodyFat(value); return evalSheet.evaluateBodyFat(value);

View File

@@ -17,10 +17,16 @@
package com.health.openscale.gui.views; package com.health.openscale.gui.views;
import android.content.Context; import android.content.Context;
import android.database.DataSetObserver;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.preference.CheckBoxPreference;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceScreen;
import android.preference.SwitchPreference;
import android.text.SpannableStringBuilder; import android.text.SpannableStringBuilder;
import android.text.Spanned; import android.text.Spanned;
import android.text.style.ForegroundColorSpan; import android.text.style.ForegroundColorSpan;
@@ -31,6 +37,7 @@ import android.view.View;
import android.widget.Button; import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.TableRow; import android.widget.TableRow;
import android.widget.TextView; import android.widget.TextView;
@@ -228,6 +235,7 @@ public abstract class FloatMeasurementView extends MeasurementView {
public abstract int getColor(); public abstract int getColor();
protected boolean isEstimationSupported() { return false; } protected boolean isEstimationSupported() { return false; }
protected void prepareEstimationFormulaPreference(ListPreference preference) {}
protected abstract EvaluationResult evaluateSheet(EvaluationSheet evalSheet, float value); protected abstract EvaluationResult evaluateSheet(EvaluationSheet evalSheet, float value);
@@ -406,6 +414,70 @@ public abstract class FloatMeasurementView extends MeasurementView {
showEvaluatorRow(show); showEvaluatorRow(show);
} }
@Override
public boolean hasExtraPreferences() { return true; }
@Override
public void prepareExtraPreferencesScreen(PreferenceScreen screen) {
MeasurementViewSettings settings = getSettings();
CheckBoxPreference overview = new CheckBoxPreference(screen.getContext());
overview.setKey(settings.getInOverviewGraphKey());
overview.setTitle(R.string.label_include_in_overview_graph);
overview.setPersistent(true);
overview.setDefaultValue(settings.isOnOverviewGraph());
screen.addPreference(overview);
if (canConvertPercentageToAbsoluteWeight()) {
SwitchPreference percentage = new SwitchPreference(screen.getContext());
percentage.setKey(settings.getPercentageEnabledKey());
percentage.setTitle(R.string.label_measurement_in_percent);
percentage.setPersistent(true);
percentage.setDefaultValue(settings.isPercentageEnabled());
screen.addPreference(percentage);
}
if (isEstimationSupported()) {
final CheckBoxPreference estimate = new CheckBoxPreference(screen.getContext());
estimate.setKey(settings.getEstimationEnabledKey());
estimate.setTitle(R.string.label_estimate_measurement);
estimate.setPersistent(true);
estimate.setDefaultValue(settings.isEstimationEnabled());
screen.addPreference(estimate);
final ListPreference formula = new ListPreference(screen.getContext());
formula.setKey(settings.getEstimationFormulaKey());
formula.setTitle(R.string.label_estimation_formula);
formula.setPersistent(true);
formula.setDefaultValue(settings.getEstimationFormula());
prepareEstimationFormulaPreference(formula);
formula.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
ListPreference list = (ListPreference) preference;
int idx = list.findIndexOfValue((String) newValue);
if (idx == -1) {
return false;
}
preference.setSummary(list.getEntries()[idx]);
return true;
}
});
final ListAdapter adapter = screen.getRootAdapter();
adapter.registerDataSetObserver(new DataSetObserver() {
@Override
public void onChanged() {
adapter.unregisterDataSetObserver(this);
formula.setDependency(estimate.getKey());
formula.setSummary(formula.getEntry());
}
});
screen.addPreference(formula);
}
}
private float validateAndGetInput(View view) { private float validateAndGetInput(View view) {
EditText editText = view.findViewById(R.id.float_input); EditText editText = view.findViewById(R.id.float_input);
String text = editText.getText().toString(); String text = editText.getText().toString();

View File

@@ -17,9 +17,11 @@ package com.health.openscale.gui.views;
import android.content.Context; import android.content.Context;
import android.graphics.Color; import android.graphics.Color;
import android.preference.ListPreference;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import com.health.openscale.R; import com.health.openscale.R;
import com.health.openscale.core.bodymetric.EstimatedLBWMetric;
import com.health.openscale.core.datatypes.ScaleMeasurement; import com.health.openscale.core.datatypes.ScaleMeasurement;
import com.health.openscale.core.evaluation.EvaluationResult; import com.health.openscale.core.evaluation.EvaluationResult;
import com.health.openscale.core.evaluation.EvaluationSheet; import com.health.openscale.core.evaluation.EvaluationSheet;
@@ -70,6 +72,22 @@ public class LBWMeasurementView extends FloatMeasurementView {
@Override @Override
protected boolean isEstimationSupported() { return true; } protected boolean isEstimationSupported() { return true; }
@Override
protected void prepareEstimationFormulaPreference(ListPreference preference) {
String[] entries = new String[EstimatedLBWMetric.FORMULA.values().length];
String[] values = new String[entries.length];
int idx = 0;
for (EstimatedLBWMetric.FORMULA formula : EstimatedLBWMetric.FORMULA.values()) {
entries[idx] = EstimatedLBWMetric.getEstimatedMetric(formula).getName();
values[idx] = formula.name();
++idx;
}
preference.setEntries(entries);
preference.setEntryValues(values);
}
@Override @Override
protected EvaluationResult evaluateSheet(EvaluationSheet evalSheet, float value) { protected EvaluationResult evaluateSheet(EvaluationSheet evalSheet, float value) {
return null; return null;

View File

@@ -23,6 +23,7 @@ import android.graphics.Color;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.preference.PreferenceScreen;
import android.support.annotation.CallSuper; import android.support.annotation.CallSuper;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import android.text.SpannableStringBuilder; import android.text.SpannableStringBuilder;
@@ -411,6 +412,9 @@ public abstract class MeasurementView extends TableLayout {
return openScale.getSelectedScaleUser(); return openScale.getSelectedScaleUser();
} }
public boolean hasExtraPreferences() { return false; }
public void prepareExtraPreferencesScreen(PreferenceScreen screen) { };
protected abstract View getInputView(); protected abstract View getInputView();
protected abstract boolean validateAndSetInput(View view); protected abstract boolean validateAndSetInput(View view);

View File

@@ -17,9 +17,11 @@ package com.health.openscale.gui.views;
import android.content.Context; import android.content.Context;
import android.graphics.Color; import android.graphics.Color;
import android.preference.ListPreference;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import com.health.openscale.R; import com.health.openscale.R;
import com.health.openscale.core.bodymetric.EstimatedWaterMetric;
import com.health.openscale.core.datatypes.ScaleMeasurement; import com.health.openscale.core.datatypes.ScaleMeasurement;
import com.health.openscale.core.evaluation.EvaluationResult; import com.health.openscale.core.evaluation.EvaluationResult;
import com.health.openscale.core.evaluation.EvaluationSheet; import com.health.openscale.core.evaluation.EvaluationSheet;
@@ -79,6 +81,22 @@ public class WaterMeasurementView extends FloatMeasurementView {
@Override @Override
protected boolean isEstimationSupported() { return true; } protected boolean isEstimationSupported() { return true; }
@Override
protected void prepareEstimationFormulaPreference(ListPreference preference) {
String[] entries = new String[EstimatedWaterMetric.FORMULA.values().length];
String[] values = new String[entries.length];
int idx = 0;
for (EstimatedWaterMetric.FORMULA formula : EstimatedWaterMetric.FORMULA.values()) {
entries[idx] = EstimatedWaterMetric.getEstimatedMetric(formula).getName();
values[idx] = formula.name();
++idx;
}
preference.setEntries(entries);
preference.setEntryValues(values);
}
@Override @Override
protected EvaluationResult evaluateSheet(EvaluationSheet evalSheet, float value) { protected EvaluationResult evaluateSheet(EvaluationSheet evalSheet, float value) {
return evalSheet.evaluateBodyWater(value); return evalSheet.evaluateBodyWater(value);

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<View
android:id="@+id/measurement_switch_separator"
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="?android:attr/listDivider" />
<Switch
android:id="@+id/measurement_switch"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_weight="1" />
</LinearLayout>

View File

@@ -113,21 +113,12 @@
<string name="label_delete_confirmation">Confirmació d\'eliminació</string> <string name="label_delete_confirmation">Confirmació d\'eliminació</string>
<string name="label_estimate_water">Estimació d\'aigua corporal</string>
<string name="label_estimate_lbw">Estimació de massa corporal magra</string>
<string name="label_estimate_fat">Estimació de greix corporal</string>
<string name="label_category_display">Mostreu</string>
<string name="label_category_body_metrics_estimation">Estimació de mètriques corporals</string>
<string name="label_category_measurement_database">Base de dades de mesures</string> <string name="label_category_measurement_database">Base de dades de mesures</string>
<string name="label_maintainer">Responsable</string> <string name="label_maintainer">Responsable</string>
<string name="label_website">Pàgina Web</string> <string name="label_website">Pàgina Web</string>
<string name="label_license">Llicència</string> <string name="label_license">Llicència</string>
<string name="label_estimate_water_formula">Fórmula d\'aigua corporal</string>
<string name="label_estimate_lbw_formula">Fórmula de massa corporal magra</string>
<string name="label_estimate_fat_formula">Fórmula de greix corporal</string>
<string name="label_automatic">automàtic</string> <string name="label_automatic">automàtic</string>
<string name="label_reminder">Recordatori</string> <string name="label_reminder">Recordatori</string>

View File

@@ -29,10 +29,6 @@
<string name="label_comment">Komentář</string> <string name="label_comment">Komentář</string>
<string name="label_smartUserAssign">Chytré přiřazení uživatele</string> <string name="label_smartUserAssign">Chytré přiřazení uživatele</string>
<string name="label_fat_percentage">Tělesný tuk v %</string>
<string name="label_water_percentage">Tělesná voda v %</string>
<string name="label_muscle_percentage">Svalová hmota v %</string>
<plurals name="label_days"> <plurals name="label_days">
<item quantity="one">%d den</item> <item quantity="one">%d den</item>
<item quantity="few">%d dny</item> <item quantity="few">%d dny</item>
@@ -100,10 +96,6 @@
<string name="label_delete_confirmation">Potvrzení smazání</string> <string name="label_delete_confirmation">Potvrzení smazání</string>
<string name="label_estimate_water">Odhadnout vodu v těle</string>
<string name="label_estimate_fat">Odhadnout tělesný tuk</string>
<string name="label_category_display">Zobrazit</string>
<string name="label_maintainer">Správce</string> <string name="label_maintainer">Správce</string>
<string name="label_website">Webové stránky</string> <string name="label_website">Webové stránky</string>
<string name="label_license">Licence</string> <string name="label_license">Licence</string>

View File

@@ -122,15 +122,7 @@
<string name="error_max_scale_users">Maximale Anzahl gleichzeitiger Benutzer erreicht</string> <string name="error_max_scale_users">Maximale Anzahl gleichzeitiger Benutzer erreicht</string>
<string name="info_step_on_scale">Bitte steigen Sie barfuß auf die Waage zur Referenzmessung</string> <string name="info_step_on_scale">Bitte steigen Sie barfuß auf die Waage zur Referenzmessung</string>
<string name="label_automatic">auto</string> <string name="label_automatic">auto</string>
<string name="label_category_body_metrics_estimation">Körpermetriken abschätzen</string>
<string name="label_category_display">Anzeige</string>
<string name="label_category_measurement_database">Messwertedatenbank</string> <string name="label_category_measurement_database">Messwertedatenbank</string>
<string name="label_estimate_fat">Körperfettschätzung</string>
<string name="label_estimate_fat_formula">Körperfettformel</string>
<string name="label_estimate_water">Körperwasserschätzung</string>
<string name="label_estimate_water_formula">Körperwasserformel</string>
<string name="label_estimate_lbw">Fettfreie Körpermassenschätzung</string>
<string name="label_estimate_lbw_formula">Fettfreie Körpermassenformel</string>
<string name="label_lbw">Fettfreie Körpermasse</string> <string name="label_lbw">Fettfreie Körpermasse</string>
<string name="label_license">Lizenz</string> <string name="label_license">Lizenz</string>
<string name="label_maintainer">Hauptentwickler</string> <string name="label_maintainer">Hauptentwickler</string>
@@ -140,9 +132,6 @@
<string name="close_drawer">schließen</string> <string name="close_drawer">schließen</string>
<string name="info_bluetooth_no_device_set">Kein Bluetooth Gerät ausgewählt</string> <string name="info_bluetooth_no_device_set">Kein Bluetooth Gerät ausgewählt</string>
<string name="info_new_data_duplicated">Messung mit gleichen Datum und Uhrzeit exisitiert bereits</string> <string name="info_new_data_duplicated">Messung mit gleichen Datum und Uhrzeit exisitiert bereits</string>
<string name="label_fat_percentage">Körperfett in %</string>
<string name="label_water_percentage">Wasseranteil in %</string>
<string name="label_muscle_percentage">Muskelanteil in %</string>
<string name="label_feedback_message_enjoying">Gefällt Dir openScale?</string> <string name="label_feedback_message_enjoying">Gefällt Dir openScale?</string>
<string name="label_feedback_message_rate_app">Wie wäre es dann mit einer Bewertung bei GooglePlay oder bei GitHub?</string> <string name="label_feedback_message_rate_app">Wie wäre es dann mit einer Bewertung bei GooglePlay oder bei GitHub?</string>
<string name="label_feedback_message_yes">Ja!</string> <string name="label_feedback_message_yes">Ja!</string>
@@ -174,7 +163,6 @@
<string name="permission_bluetooth_info">openScale benötigt die Erlaubnis, auf den ungefähren Standort zuzugreifen, um nach Bluetooth-Geräten suchen zu können.</string> <string name="permission_bluetooth_info">openScale benötigt die Erlaubnis, auf den ungefähren Standort zuzugreifen, um nach Bluetooth-Geräten suchen zu können.</string>
<string name="permission_bluetooth_info_title">Information</string> <string name="permission_bluetooth_info_title">Information</string>
<string name="label_next">Weiter</string> <string name="label_next">Weiter</string>
<string name="label_measurement_order">Messwert Reihenfolge</string>
<string name="label_press_hold_reorder">Halten Sie die Taste gedrückt, um die Reihenfolge zu ändern</string> <string name="label_press_hold_reorder">Halten Sie die Taste gedrückt, um die Reihenfolge zu ändern</string>
<string name="label_set_default_order">Default Reihenfolge wiederherstellen</string> <string name="label_set_default_order">Default Reihenfolge wiederherstellen</string>
<string name="label_share_subject">openScale CSV Datenexport (%s)</string> <string name="label_share_subject">openScale CSV Datenexport (%s)</string>

View File

@@ -113,21 +113,12 @@
<string name="label_delete_confirmation">Confirmación de borrado</string> <string name="label_delete_confirmation">Confirmación de borrado</string>
<string name="label_estimate_water">Estimación de agua corporal</string>
<string name="label_estimate_lbw">Estimación de masa corporal magra</string>
<string name="label_estimate_fat">Estimación de grasa coporal</string>
<string name="label_category_display">Mostrar</string>
<string name="label_category_body_metrics_estimation">Estimación de métricas corporales</string>
<string name="label_category_measurement_database">Base de datos de mediciones</string> <string name="label_category_measurement_database">Base de datos de mediciones</string>
<string name="label_maintainer">Responsable</string> <string name="label_maintainer">Responsable</string>
<string name="label_website">Página Web</string> <string name="label_website">Página Web</string>
<string name="label_license">Licencia</string> <string name="label_license">Licencia</string>
<string name="label_estimate_water_formula">Fórmula de agua corporal</string>
<string name="label_estimate_lbw_formula">Fórmula de masa corporal magra</string>
<string name="label_estimate_fat_formula">Fórmula de grasa corporal</string>
<string name="label_automatic">automático</string> <string name="label_automatic">automático</string>
<string name="label_reminder">Recordatorio</string> <string name="label_reminder">Recordatorio</string>
@@ -169,10 +160,6 @@
<string name="label_share">Compartir</string> <string name="label_share">Compartir</string>
<string name="label_fat_percentage">Grasa corporal en %</string>
<string name="label_water_percentage">Porcentaje de agua en %</string>
<string name="label_muscle_percentage">Porcentaje muscular en %</string>
<string name="error_user_name_too_short">Error: el nombre de usuario tiene que tener al menos 3 carácteres</string> <string name="error_user_name_too_short">Error: el nombre de usuario tiene que tener al menos 3 carácteres</string>
<string name="info_bluetooth_no_device_set">"No hay dispositivo Bluetooth seleccionado "</string> <string name="info_bluetooth_no_device_set">"No hay dispositivo Bluetooth seleccionado "</string>
<string name="info_new_data_duplicated">Medición con al misma fecha y hora ya existe</string> <string name="info_new_data_duplicated">Medición con al misma fecha y hora ya existe</string>

View File

@@ -115,21 +115,12 @@
<string name="label_delete_confirmation">Bevestiging verwijderen</string> <string name="label_delete_confirmation">Bevestiging verwijderen</string>
<string name="label_estimate_water">Geschat vochtmassa</string>
<string name="label_estimate_lbw">Geschat vetvrije massa</string>
<string name="label_estimate_fat">Geschat vetmassa</string>
<string name="label_category_display">Scherm</string>
<string name="label_category_body_metrics_estimation">Schatting Lichaamssamenstelling</string>
<string name="label_category_measurement_database">Metingen database</string> <string name="label_category_measurement_database">Metingen database</string>
<string name="label_maintainer">Beheerder</string> <string name="label_maintainer">Beheerder</string>
<string name="label_website">Website</string> <string name="label_website">Website</string>
<string name="label_license">Licentie</string> <string name="label_license">Licentie</string>
<string name="label_estimate_water_formula">Formule vochtmassa</string>
<string name="label_estimate_lbw_formula">Formule vetvrije massa</string>
<string name="label_estimate_fat_formula">Formule vetmassa</string>
<string name="label_automatic">auto</string> <string name="label_automatic">auto</string>
<string name="label_reminder">Herinnering</string> <string name="label_reminder">Herinnering</string>
@@ -169,10 +160,6 @@
<string name="label_share">Delen</string> <string name="label_share">Delen</string>
<string name="label_share_subject">openScale CSV data exporteren (%s)</string> <string name="label_share_subject">openScale CSV data exporteren (%s)</string>
<string name="label_fat_percentage">Lichaamsvet in %</string>
<string name="label_water_percentage">Lichaamsvocht in %</string>
<string name="label_muscle_percentage">Spiermassa in %</string>
<string name="error_user_name_too_short">Fout: Gebruikersnaam dient minimaal 3 karakters lang te zijn</string> <string name="error_user_name_too_short">Fout: Gebruikersnaam dient minimaal 3 karakters lang te zijn</string>
<string name="info_bluetooth_no_device_set">Geen Bluetooth apparaat geselecteerd</string> <string name="info_bluetooth_no_device_set">Geen Bluetooth apparaat geselecteerd</string>
<string name="info_new_data_duplicated">Meting met een zelfde datum en tijd bestaat al</string> <string name="info_new_data_duplicated">Meting met een zelfde datum en tijd bestaat al</string>
@@ -214,7 +201,6 @@
<string name="permission_bluetooth_info">openScale heeft toestemming nodig tot uw locatie om te kunnen zoeken naar Bluetooth apparaten</string> <string name="permission_bluetooth_info">openScale heeft toestemming nodig tot uw locatie om te kunnen zoeken naar Bluetooth apparaten</string>
<string name="permission_bluetooth_info_title">Informatie</string> <string name="permission_bluetooth_info_title">Informatie</string>
<string name="label_next">Volgende</string> <string name="label_next">Volgende</string>
<string name="label_measurement_order">Meting volgorde</string>
<string name="label_press_hold_reorder">Indrukken en vasthouden om opnieuw in te delen</string> <string name="label_press_hold_reorder">Indrukken en vasthouden om opnieuw in te delen</string>
<string name="label_set_default_order">Stel standaard volgorde in</string> <string name="label_set_default_order">Stel standaard volgorde in</string>
<string name="label_export_overwrite">Vorige export \"%s\" overschrijven?</string> <string name="label_export_overwrite">Vorige export \"%s\" overschrijven?</string>

View File

@@ -38,11 +38,7 @@
<string name="label_whr">Stosunek obwodu talii do obwodu bioder</string> <string name="label_whr">Stosunek obwodu talii do obwodu bioder</string>
<string name="label_bone">Masa kostna</string> <string name="label_bone">Masa kostna</string>
<string name="label_smartUserAssign">Inteligente przypisywanie użytkowników</string> <string name="label_smartUserAssign">Inteligente przypisywanie użytkowników</string>
<string name="label_fat_percentage">Tkanka tłusczowa w %</string>
<string name="label_water_percentage">Woda w organizmie w %</string>
<string name="label_muscle_percentage">Masa mięśniowa w %</string>
<plurals name="label_days"> <plurals name="label_days">
<item quantity="other">%d dni</item> <item quantity="other">%d dni</item>
</plurals> </plurals>
@@ -126,21 +122,12 @@
<string name="label_delete_confirmation">Potwierdzenie usnięcia</string> <string name="label_delete_confirmation">Potwierdzenie usnięcia</string>
<string name="label_estimate_water">Wznaczaj procent wody w organizmie</string>
<string name="label_estimate_lbw">Wyznaczaj beztłuszczową masę ciała</string>
<string name="label_estimate_fat">Wyznaczaj procent tkanki tłuszczowej</string>
<string name="label_category_display">Wyświetl</string>
<string name="label_category_body_metrics_estimation">Wyznaczanie wskaźników dla ciała</string>
<string name="label_category_measurement_database">Baza pomiarów</string> <string name="label_category_measurement_database">Baza pomiarów</string>
<string name="label_maintainer">Opiekun</string> <string name="label_maintainer">Opiekun</string>
<string name="label_website">Strona internetowa</string> <string name="label_website">Strona internetowa</string>
<string name="label_license">Licencja</string> <string name="label_license">Licencja</string>
<string name="label_estimate_water_formula">Formuła wyznaczania wody w organizmie</string>
<string name="label_estimate_lbw_formula">Formuła wyznaczania beztłuszczowej masy ciała</string>
<string name="label_estimate_fat_formula">Formuła wyznaczania tkanki tłuszczowej</string>
<string name="label_automatic">auto</string> <string name="label_automatic">auto</string>
<string name="label_theme">Motyw</string> <string name="label_theme">Motyw</string>
@@ -205,7 +192,6 @@
<string name="permission_bluetooth_info">openScale requires permission to access the coarse location to search for Bluetooth devices</string> <string name="permission_bluetooth_info">openScale requires permission to access the coarse location to search for Bluetooth devices</string>
<string name="permission_bluetooth_info_title">Informacje</string> <string name="permission_bluetooth_info_title">Informacje</string>
<string name="label_next">Następny</string> <string name="label_next">Następny</string>
<string name="label_measurement_order">Kolejność pomiarów</string>
<string name="label_press_hold_reorder">Naciśnij i przytrzymaj by zmienić kolejność</string> <string name="label_press_hold_reorder">Naciśnij i przytrzymaj by zmienić kolejność</string>
<string name="label_set_default_order">Ustaw domyślną kolejność</string> <string name="label_set_default_order">Ustaw domyślną kolejność</string>
<string name="label_export_overwrite">Nadpisać poprzedni eksport \"%s\"?</string> <string name="label_export_overwrite">Nadpisać poprzedni eksport \"%s\"?</string>

View File

@@ -129,20 +129,13 @@
<string name="label_share">Zdieľať</string> <string name="label_share">Zdieľať</string>
<string name="label_share_subject">openScale CSV export údajov (%s)</string> <string name="label_share_subject">openScale CSV export údajov (%s)</string>
<string name="label_fat_percentage">Telesný tuk v %</string>
<string name="label_water_percentage">Voda v tele v %</string>
<string name="label_muscle_percentage">Svalstvo v %</string>
<string name="error_user_name_too_short">Chyba: používateľské meno musí obsahovať minimálne 3 znaky</string> <string name="error_user_name_too_short">Chyba: používateľské meno musí obsahovať minimálne 3 znaky</string>
<string name="info_bluetooth_no_device_set">Nevybrali ste žiadne bluetooth zariadenie</string> <string name="info_bluetooth_no_device_set">Nevybrali ste žiadne bluetooth zariadenie</string>
<string name="info_new_data_duplicated">meranie s rovnakým dátumom a časom už existuje</string> <string name="info_new_data_duplicated">meranie s rovnakým dátumom a časom už existuje</string>
<string name="label_mergeWithLastMeasurement">Zlúčiť s posledným meraním</string> <string name="label_mergeWithLastMeasurement">Zlúčiť s posledným meraním</string>
<string name="label_bluetooth_searching_finished">Hľadanie bluetooth váh sa dokončilo</string> <string name="label_bluetooth_searching_finished">Hľadanie bluetooth váh sa dokončilo</string>
<string name="label_estimate_water">Odhadnúť vodu v tele</string>
<string name="label_estimate_fat">Odhadnúť telesný tuk</string>
<string name="label_category_display">Zobraziť</string>
<string name="label_category_measurement_database">Databáza meraní</string> <string name="label_category_measurement_database">Databáza meraní</string>
<string name="label_maintainer">Správca</string> <string name="label_maintainer">Správca</string>
@@ -185,7 +178,6 @@
<string name="permission_bluetooth_info">openScale vyžaduje povolenie prístupu k približnej polohe na vyhľadávanie bluetooth zariadení</string> <string name="permission_bluetooth_info">openScale vyžaduje povolenie prístupu k približnej polohe na vyhľadávanie bluetooth zariadení</string>
<string name="permission_bluetooth_info_title">Informácie</string> <string name="permission_bluetooth_info_title">Informácie</string>
<string name="label_next">Ďalej</string> <string name="label_next">Ďalej</string>
<string name="label_measurement_order">Radenie meraní</string>
<string name="label_press_hold_reorder">Stlačte a podržte pre zmenu radenia</string> <string name="label_press_hold_reorder">Stlačte a podržte pre zmenu radenia</string>
<string name="label_set_default_order">Nastaviť predvolené radenie</string> <string name="label_set_default_order">Nastaviť predvolené radenie</string>
<string name="label_export_overwrite">Prepísať predchádzajúci export \"%s\"?</string> <string name="label_export_overwrite">Prepísať predchádzajúci export \"%s\"?</string>

View File

@@ -109,16 +109,8 @@
<string name="label_enable_labels">Etikett på datapunkt</string> <string name="label_enable_labels">Etikett på datapunkt</string>
<string name="label_enable_points">Punkt på datapunkt</string> <string name="label_enable_points">Punkt på datapunkt</string>
<string name="label_delete_confirmation">Borttagningsbekräftelse</string> <string name="label_delete_confirmation">Borttagningsbekräftelse</string>
<string name="label_estimate_water">Estimera kroppsvatten</string>
<string name="label_estimate_lbw">Estimera fettfri kroppsvikt</string>
<string name="label_estimate_fat">Estimera kroppsfett</string>
<string name="label_category_display">Visa</string>
<string name="label_category_body_metrics_estimation">Uppskatta mätvärden</string>
<string name="label_category_measurement_database">Mätningsdatabas</string> <string name="label_category_measurement_database">Mätningsdatabas</string>
<string name="label_maintainer">Utvecklare</string> <string name="label_maintainer">Utvecklare</string>
<string name="label_estimate_water_formula">Formel för kroppsvatten</string>
<string name="label_estimate_lbw_formula">Formel för fettfri kroppsvikt</string>
<string name="label_estimate_fat_formula">Formel för kroppsfett</string>
<string name="label_automatic">auto</string> <string name="label_automatic">auto</string>
<string name="label_reminder">Påminnelse</string> <string name="label_reminder">Påminnelse</string>
<string name="label_reminder_notify_text">Meddelandetext</string> <string name="label_reminder_notify_text">Meddelandetext</string>
@@ -138,9 +130,6 @@
<string name="info_measuring">Mäter vikt: %.2f</string> <string name="info_measuring">Mäter vikt: %.2f</string>
<string name="open_drawer">öppna</string> <string name="open_drawer">öppna</string>
<string name="close_drawer">stäng</string> <string name="close_drawer">stäng</string>
<string name="label_fat_percentage">Kroppsfett i %</string>
<string name="label_muscle_percentage">Muskler i %</string>
<string name="label_water_percentage">Kroppsvatten i %</string>
<string name="info_bluetooth_no_device_set">Ingen Bluetooth-enhet vald</string> <string name="info_bluetooth_no_device_set">Ingen Bluetooth-enhet vald</string>
<string name="info_new_data_duplicated">mätning med samma datum och tid existerar redan</string> <string name="info_new_data_duplicated">mätning med samma datum och tid existerar redan</string>
<string name="title_general">Allmänt</string> <string name="title_general">Allmänt</string>
@@ -180,7 +169,6 @@
<string name="label_share_subject">openScale CSV dataexport (%s)</string> <string name="label_share_subject">openScale CSV dataexport (%s)</string>
<string name="label_next">Nästa</string> <string name="label_next">Nästa</string>
<string name="label_measurement_order">Mätordning</string>
<string name="label_press_hold_reorder">Tryck och håll för att ändra ordning</string> <string name="label_press_hold_reorder">Tryck och håll för att ändra ordning</string>
<string name="label_set_default_order">Ställ in standardordning</string> <string name="label_set_default_order">Ställ in standardordning</string>

View File

@@ -111,21 +111,12 @@
<string name="label_delete_confirmation">Delete confirmation</string> <string name="label_delete_confirmation">Delete confirmation</string>
<string name="label_estimate_water">Tahmini Vücüt suyu oraný</string>
<string name="label_estimate_lbw">Tahmini Yaðsýz vücüt oraný</string>
<string name="label_estimate_fat">Tahmini Vücüt yað oraný</string>
<string name="label_category_display">Display</string>
<string name="label_category_body_metrics_estimation">Vücüt ölçütleri tahmini</string>
<string name="label_category_measurement_database">Ölçüm veritabaný</string> <string name="label_category_measurement_database">Ölçüm veritabaný</string>
<string name="label_maintainer">Maintainer</string> <string name="label_maintainer">Maintainer</string>
<string name="label_website">Websitesi</string> <string name="label_website">Websitesi</string>
<string name="label_license">Lisan</string> <string name="label_license">Lisan</string>
<string name="label_estimate_water_formula">Vücüt oraný hesaplama formulü</string>
<string name="label_estimate_lbw_formula">Yað oraný hesaplama formulü</string>
<string name="label_estimate_fat_formula">Vücut yaðý formülü</string>
<string name="label_automatic">otomatik</string> <string name="label_automatic">otomatik</string>
<string name="label_reminder">Hatýrlatma</string> <string name="label_reminder">Hatýrlatma</string>

View File

@@ -40,10 +40,6 @@
<string name="label_bone">Bone mass</string> <string name="label_bone">Bone mass</string>
<string name="label_smartUserAssign">Smart User assignment</string> <string name="label_smartUserAssign">Smart User assignment</string>
<string name="label_fat_percentage">Body fat in %</string>
<string name="label_water_percentage">Body water in %</string>
<string name="label_muscle_percentage">Muscle in %</string>
<plurals name="label_days"> <plurals name="label_days">
<item quantity="one">%d day</item> <item quantity="one">%d day</item>
<item quantity="other">%d days</item> <item quantity="other">%d days</item>
@@ -127,21 +123,12 @@
<string name="label_delete_confirmation">Delete confirmation</string> <string name="label_delete_confirmation">Delete confirmation</string>
<string name="label_estimate_water">Estimate body water</string>
<string name="label_estimate_lbw">Estimate lean body weight</string>
<string name="label_estimate_fat">Estimate body fat</string>
<string name="label_category_display">Display</string>
<string name="label_category_body_metrics_estimation">Body metrics estimation</string>
<string name="label_category_measurement_database">Measurement database</string> <string name="label_category_measurement_database">Measurement database</string>
<string name="label_maintainer">Maintainer</string> <string name="label_maintainer">Maintainer</string>
<string name="label_website">Website</string> <string name="label_website">Website</string>
<string name="label_license">License</string> <string name="label_license">License</string>
<string name="label_estimate_water_formula">Body water formula</string>
<string name="label_estimate_lbw_formula">Lean body weight formula</string>
<string name="label_estimate_fat_formula">Body fat formula</string>
<string name="label_automatic">auto</string> <string name="label_automatic">auto</string>
<string name="label_theme">Theme</string> <string name="label_theme">Theme</string>
@@ -206,10 +193,11 @@
<string name="permission_bluetooth_info">openScale requires permission to access the coarse location to search for Bluetooth devices</string> <string name="permission_bluetooth_info">openScale requires permission to access the coarse location to search for Bluetooth devices</string>
<string name="permission_bluetooth_info_title">Information</string> <string name="permission_bluetooth_info_title">Information</string>
<string name="label_next">Next</string> <string name="label_next">Next</string>
<string name="label_measurement_order">Measurement order</string>
<string name="label_press_hold_reorder">Press and hold to reorder</string> <string name="label_press_hold_reorder">Press and hold to reorder</string>
<string name="label_set_default_order">Set default order</string> <string name="label_set_default_order">Set default order</string>
<string name="label_export_overwrite">Overwrite previous export \"%s\"?</string> <string name="label_export_overwrite">Overwrite previous export \"%s\"?</string>
<string name="label_include_in_overview_graph">Include in overview graph</string>
<string name="label_measurement_in_percent">Measurement in %</string>
<string name="label_estimate_measurement">Estimate measurement</string>
<string name="label_estimation_formula">Estimation formula</string>
</resources> </resources>

View File

@@ -1,29 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory android:title="@string/label_category_display"> <Preference android:key="resetOrder" android:title="@string/label_set_default_order"/>
<PreferenceScreen android:title="@string/label_measurement_order"> <PreferenceCategory android:title="@string/label_press_hold_reorder" android:key="measurements" />
<Preference android:key="resetOrder" android:title="@string/label_set_default_order"/>
<PreferenceCategory android:key="orderCategory" android:title="@string/label_press_hold_reorder"/>
</PreferenceScreen>
<CheckBoxPreference android:title="@string/label_fat" android:summaryOn="@string/info_is_enable" android:summaryOff="@string/info_is_not_enable" android:key="fatEnable" android:defaultValue="true"/>
<SwitchPreference android:title="@string/label_fat_percentage" android:summaryOn="@string/info_is_enable" android:summaryOff="@string/info_is_not_enable" android:key ="fatPercentageEnable" android:defaultValue="true"/>
<CheckBoxPreference android:title="@string/label_water" android:summaryOn="@string/info_is_enable" android:summaryOff="@string/info_is_not_enable" android:key="waterEnable" android:defaultValue="true"/>
<SwitchPreference android:title="@string/label_water_percentage" android:summaryOn="@string/info_is_enable" android:summaryOff="@string/info_is_not_enable" android:key ="waterPercentageEnable" android:defaultValue="true"/>
<CheckBoxPreference android:title="@string/label_muscle" android:summaryOn="@string/info_is_enable" android:summaryOff="@string/info_is_not_enable" android:key="muscleEnable" android:defaultValue="true"/>
<SwitchPreference android:title="@string/label_muscle_percentage" android:summaryOn="@string/info_is_enable" android:summaryOff="@string/info_is_not_enable" android:key ="musclePercentageEnable" android:defaultValue="true"/>
<CheckBoxPreference android:title="@string/label_lbw" android:summaryOn="@string/info_is_enable" android:summaryOff="@string/info_is_not_enable" android:key="lbwEnable" android:defaultValue="false"/>
<CheckBoxPreference android:title="@string/label_bone" android:summaryOn="@string/info_is_enable" android:summaryOff="@string/info_is_not_enable" android:key="boneEnable" android:defaultValue="false"/>
<CheckBoxPreference android:title="@string/label_waist" android:summaryOn="@string/info_is_enable" android:summaryOff="@string/info_is_not_enable" android:key="waistEnable" android:defaultValue="false"/>
<CheckBoxPreference android:title="@string/label_hip" android:summaryOn="@string/info_is_enable" android:summaryOff="@string/info_is_not_enable" android:key="hipEnable" android:defaultValue="false"/>
</PreferenceCategory>
<PreferenceCategory android:title="@string/label_category_body_metrics_estimation">
<CheckBoxPreference android:title="@string/label_estimate_water" android:summaryOn="@string/info_is_enable" android:summaryOff="@string/info_is_not_enable" android:key="estimateWaterEnable" android:defaultValue="false"/>
<ListPreference android:title="@string/label_estimate_water_formula" android:key="estimateWaterFormula" android:defaultValue="TBW_LEESONGKIM"/>
<CheckBoxPreference android:title="@string/label_estimate_lbw" android:summaryOn="@string/info_is_enable" android:summaryOff="@string/info_is_not_enable" android:key="estimateLBWEnable" android:defaultValue="false"/>
<ListPreference android:title="@string/label_estimate_lbw_formula" android:key="estimateLBWFormula" android:defaultValue="LBW_HUME"/>
<CheckBoxPreference android:title="@string/label_estimate_fat" android:summaryOn="@string/info_is_enable" android:summaryOff="@string/info_is_not_enable" android:key="estimateFatEnable" android:defaultValue="false"/>
<ListPreference android:title="@string/label_estimate_fat_formula" android:key="estimateFatFormula" android:defaultValue="BF_GALLAGHER"/>
</PreferenceCategory>
<PreferenceCategory android:title="@string/label_category_measurement_database"> <PreferenceCategory android:title="@string/label_category_measurement_database">
<Preference android:title="@string/label_delete_all" android:key="deleteAll"></Preference> <Preference android:title="@string/label_delete_all" android:key="deleteAll"></Preference>
</PreferenceCategory> </PreferenceCategory>