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

Create fewer temporary strings

This commit is contained in:
Erik Johansson
2018-04-06 01:08:33 +02:00
parent ad46f50886
commit 46a10275b2
5 changed files with 11 additions and 9 deletions

View File

@@ -128,11 +128,12 @@ public class BluetoothBeurerBF700_800 extends BluetoothCommunication {
@Override @Override
public boolean checkDeviceName(String btDeviceName) { public boolean checkDeviceName(String btDeviceName) {
if (btDeviceName.toLowerCase().startsWith(new String("BEURER BF700").toLowerCase()) || String name = btDeviceName.toLowerCase();
btDeviceName.toLowerCase().startsWith(new String("BEURER BF800").toLowerCase())|| if (name.startsWith("BEURER BF700".toLowerCase())
btDeviceName.toLowerCase().startsWith(new String("BF-800").toLowerCase())|| || name.startsWith("BEURER BF800".toLowerCase())
btDeviceName.toLowerCase().startsWith(new String("BF-700").toLowerCase())|| || name.startsWith("BF-800".toLowerCase())
btDeviceName.toLowerCase().startsWith(new String("RT-Libra-B").toLowerCase())) { || name.startsWith("BF-700".toLowerCase())
|| name.startsWith("RT-Libra-B".toLowerCase())) {
return true; return true;
} }

View File

@@ -382,7 +382,7 @@ public abstract class BluetoothCommunication {
protected String byteInHex(byte[] data) { protected String byteInHex(byte[] data) {
if (data == null) { if (data == null) {
Log.e("BluetoothCommunication", "Data is null"); Log.e("BluetoothCommunication", "Data is null");
return new String(); return "";
} }
final StringBuilder stringBuilder = new StringBuilder(data.length); final StringBuilder stringBuilder = new StringBuilder(data.length);

View File

@@ -126,7 +126,8 @@ public class BluetoothSanitasSbf70 extends BluetoothCommunication {
@Override @Override
public boolean checkDeviceName(String btDeviceName) { public boolean checkDeviceName(String btDeviceName) {
// SilverCrest SBF75 (also known as HealthForYou by SilverCrest) // SilverCrest SBF75 (also known as HealthForYou by SilverCrest)
if (btDeviceName.toLowerCase().startsWith(new String("SANITAS SBF70").toLowerCase()) || btDeviceName.toLowerCase().startsWith("sbf75")) { String name = btDeviceName.toLowerCase();
if (name.startsWith("SANITAS SBF70".toLowerCase()) || name.startsWith("sbf75")) {
return true; return true;
} }

View File

@@ -89,7 +89,7 @@ public class ScaleMeasurement implements Cloneable {
bone = 0.0f; bone = 0.0f;
waist = 0.0f; waist = 0.0f;
hip = 0.0f; hip = 0.0f;
comment = new String(); comment = "";
} }
@Override @Override

View File

@@ -52,7 +52,7 @@ public class ScaleUser {
private Date goalDate; private Date goalDate;
public ScaleUser() { public ScaleUser() {
userName = new String(); userName = "";
birthday = new Date(); birthday = new Date();
bodyHeight = -1; bodyHeight = -1;
scaleUnit = Converters.WeightUnit.KG; scaleUnit = Converters.WeightUnit.KG;