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

show toast text if weight was added

fix bug if last entry was deleted in the table fragment
This commit is contained in:
OliE
2017-10-03 14:53:39 +02:00
parent f60db2ac02
commit b0fe50c365
4 changed files with 10 additions and 0 deletions

View File

@@ -24,6 +24,7 @@ import android.support.v4.app.Fragment;
import android.util.Log;
import android.widget.Toast;
import com.health.openscale.R;
import com.health.openscale.core.alarm.AlarmHandler;
import com.health.openscale.core.bluetooth.BluetoothCommunication;
import com.health.openscale.core.database.ScaleDatabase;
@@ -188,6 +189,10 @@ public class OpenScale {
}
if (scaleDB.insertEntry(scaleData)) {
ScaleUser scaleUser = getScaleUser(scaleData.getUserId());
String infoText = String.format(context.getString(R.string.info_new_data_added), scaleData.getConvertedWeight(scaleUser.scale_unit), scaleUser.UNIT_STRING[scaleUser.scale_unit], dateTimeFormat.format(scaleData.getDateTime()), scaleUser.user_name);
Toast.makeText(context, infoText, Toast.LENGTH_LONG).show();
alarmHandler.entryChanged(context, scaleData);
updateScaleData();
}

View File

@@ -133,6 +133,8 @@ public class TableFragment extends Fragment implements FragmentUpdateListener {
@Override
public void updateOnView(ArrayList<ScaleData> scaleDataList)
{
tableDataView.setAdapter(new ListViewAdapter(new ArrayList<HashMap<Integer, String>>())); // delete all data in the table with an empty adapter array list
if (scaleDataList.isEmpty()) {
return;
}

View File

@@ -133,4 +133,6 @@
<string name="label_bluetooth_searching">Suche nach Bluetooth Waagen</string>
<string name="label_bone">Knochenmasse</string>
<string name="label_bmr">Grundumsatz (BMR)</string>
<string name="info_measuring">Messe Gewicht: %.2f</string>
<string name="info_new_data_added">%1$.2f%2$s [%3$s] zu %4$s hinzugefügt</string>
</resources>

View File

@@ -100,6 +100,7 @@
<string name="info_bluetooth_connection_successful">Connection successful established</string>
<string name="info_bluetooth_init">Initialize Bluetooth device</string>
<string name="info_bluetooth_connection_error">Bluetooth has an unexpected error</string>
<string name="info_new_data_added">%1$.2f%2$s [%3$s] to %4$s added</string>
<string name="info_enter_user_name">Enter your name</string>
<string name="info_no_selected_user">No user exists. Please create a new user in the settings.</string>