1
0
mirror of https://github.com/oliexdev/openScale.git synced 2025-08-23 16:53:04 +02:00

catch user input NumberFormatException

add lean body weight icons
This commit is contained in:
OliE
2017-11-08 18:18:43 +01:00
parent 0a0d338829
commit 481eb17d36
7 changed files with 59 additions and 57 deletions

View File

@@ -29,6 +29,7 @@ import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.RadioGroup;
import android.widget.Toast;
import com.health.openscale.R;
import com.health.openscale.core.OpenScale;
@@ -253,8 +254,8 @@ public class UserSettingsActivity extends Activity {
private class onClickListenerOk implements View.OnClickListener {
@Override
public void onClick(View v) {
if (validateInput())
{
try {
if (validateInput()) {
OpenScale openScale = OpenScale.getInstance(getApplicationContext());
String name = txtUserName.getText().toString();
@@ -294,12 +295,10 @@ public class UserSettingsActivity extends Activity {
int id = 0;
if (getIntent().getExtras().getInt("mode") == EDIT_USER_REQUEST)
{
if (getIntent().getExtras().getInt("mode") == EDIT_USER_REQUEST) {
id = getIntent().getExtras().getInt("id");
openScale.updateScaleUser(id, name, date, body_height, scale_unit, gender, initial_weight, goal_weight, goal_date);
} else
{
} else {
openScale.addScaleUser(name, date, body_height, scale_unit, gender, initial_weight, goal_weight, goal_date);
id = openScale.getScaleUserList().get(openScale.getScaleUserList().size() - 1).id;
@@ -315,6 +314,9 @@ public class UserSettingsActivity extends Activity {
finish();
}
} catch (NumberFormatException ex) {
Toast.makeText(context, getResources().getString(R.string.error_value_range) + "(" + ex.getMessage() + ")", Toast.LENGTH_SHORT).show();
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 954 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 367 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 548 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB