mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-24 01:03:20 +02:00
catch user input NumberFormatException
add lean body weight icons
This commit is contained in:
@@ -29,6 +29,7 @@ import android.widget.Button;
|
|||||||
import android.widget.DatePicker;
|
import android.widget.DatePicker;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.RadioGroup;
|
import android.widget.RadioGroup;
|
||||||
|
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;
|
||||||
@@ -253,8 +254,8 @@ public class UserSettingsActivity extends Activity {
|
|||||||
private class onClickListenerOk implements View.OnClickListener {
|
private class onClickListenerOk implements View.OnClickListener {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (validateInput())
|
try {
|
||||||
{
|
if (validateInput()) {
|
||||||
OpenScale openScale = OpenScale.getInstance(getApplicationContext());
|
OpenScale openScale = OpenScale.getInstance(getApplicationContext());
|
||||||
|
|
||||||
String name = txtUserName.getText().toString();
|
String name = txtUserName.getText().toString();
|
||||||
@@ -294,12 +295,10 @@ public class UserSettingsActivity extends Activity {
|
|||||||
|
|
||||||
int id = 0;
|
int id = 0;
|
||||||
|
|
||||||
if (getIntent().getExtras().getInt("mode") == EDIT_USER_REQUEST)
|
if (getIntent().getExtras().getInt("mode") == EDIT_USER_REQUEST) {
|
||||||
{
|
|
||||||
id = getIntent().getExtras().getInt("id");
|
id = getIntent().getExtras().getInt("id");
|
||||||
openScale.updateScaleUser(id, name, date, body_height, scale_unit, gender, initial_weight, goal_weight, goal_date);
|
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);
|
openScale.addScaleUser(name, date, body_height, scale_unit, gender, initial_weight, goal_weight, goal_date);
|
||||||
|
|
||||||
id = openScale.getScaleUserList().get(openScale.getScaleUserList().size() - 1).id;
|
id = openScale.getScaleUserList().get(openScale.getScaleUserList().size() - 1).id;
|
||||||
@@ -315,6 +314,9 @@ public class UserSettingsActivity extends Activity {
|
|||||||
|
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
} catch (NumberFormatException ex) {
|
||||||
|
Toast.makeText(context, getResources().getString(R.string.error_value_range) + "(" + ex.getMessage() + ")", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BIN
android_app/app/src/main/res/drawable-hdpi/ic_lbw.png
Normal file
BIN
android_app/app/src/main/res/drawable-hdpi/ic_lbw.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 954 B |
BIN
android_app/app/src/main/res/drawable-ldpi/ic_lbw.png
Normal file
BIN
android_app/app/src/main/res/drawable-ldpi/ic_lbw.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 367 B |
BIN
android_app/app/src/main/res/drawable-mdpi/ic_lbw.png
Normal file
BIN
android_app/app/src/main/res/drawable-mdpi/ic_lbw.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 548 B |
BIN
android_app/app/src/main/res/drawable-xhdpi/ic_lbw.png
Normal file
BIN
android_app/app/src/main/res/drawable-xhdpi/ic_lbw.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
BIN
android_app/app/src/main/res/drawable-xxhdpi/ic_lbw.png
Normal file
BIN
android_app/app/src/main/res/drawable-xxhdpi/ic_lbw.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
BIN
android_app/app/src/main/res/drawable-xxxhdpi/ic_lbw.png
Normal file
BIN
android_app/app/src/main/res/drawable-xxxhdpi/ic_lbw.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.5 KiB |
Reference in New Issue
Block a user