ComboFragment: i18n last bolus.

This commit is contained in:
Johannes Mockenhaupt 2018-01-29 19:05:39 +01:00
parent 5fbd9097d8
commit 2468f23e97
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1
14 changed files with 16 additions and 25 deletions

View file

@ -75,8 +75,6 @@ public class ComboFragment extends SubscriberFragment implements View.OnClickLis
public void onClick(View view) { public void onClick(View view) {
switch (view.getId()) { switch (view.getId()) {
case R.id.combo_refresh_button: case R.id.combo_refresh_button:
// TODO why is activity in ComboPump?
ComboPlugin.getPlugin().getPump().activity = MainApp.gs(R.string.combo_pump_action_refreshing);
ConfigBuilderPlugin.getCommandQueue().readStatus("User request", null); ConfigBuilderPlugin.getCommandQueue().readStatus("User request", null);
break; break;
case R.id.combo_alerts_button: case R.id.combo_alerts_button:
@ -213,19 +211,16 @@ public class ComboFragment extends SubscriberFragment implements View.OnClickLis
if (bolus != null && bolus.timestamp + 6 * 60 * 60 * 1000 >= System.currentTimeMillis()) { if (bolus != null && bolus.timestamp + 6 * 60 * 60 * 1000 >= System.currentTimeMillis()) {
long agoMsc = System.currentTimeMillis() - bolus.timestamp; long agoMsc = System.currentTimeMillis() - bolus.timestamp;
double bolusMinAgo = agoMsc / 60d / 1000d; double bolusMinAgo = agoMsc / 60d / 1000d;
double bolusHoursAgo = agoMsc / 60d / 60d / 1000d; String unit = MainApp.gs(R.string.treatments_wizard_unit_label);
// TODO i18n String ago;
if ((agoMsc < 60 * 1000)) { if ((agoMsc < 60 * 1000)) {
lastBolusView.setText(String.format("%.1f U (now)", bolus.amount)); ago = MainApp.gs(R.string.combo_pump_connected_now);
} else if (bolusMinAgo < 60) { } else if (bolusMinAgo < 60) {
lastBolusView.setText(String.format("%.1f U (%d min ago)", bolus.amount, (int) bolusMinAgo)); ago = DateUtil.minAgo(bolus.timestamp);
// lastBolusView.setText(getString(R.string.combo_last_bolus, bolus.amount,
// getString(R.string.minago, bolusMinAgo), DateUtil.timeString(bolus.timestamp)));
} else { } else {
lastBolusView.setText(String.format("%.1f U (%.1f h ago)", bolus.amount, bolusHoursAgo)); ago = DateUtil.hourAgo(bolus.timestamp);
// lastBolusView.setText(getString(R.string.combo_last_bolus, bolus.amount,
// String.format("%.1f", bolusHoursAgo) + getString(R.string.hoursago), DateUtil.timeString(bolus.timestamp)));
} }
lastBolusView.setText(MainApp.gs(R.string.combo_last_bolus, bolus.amount, unit, ago));
} else { } else {
lastBolusView.setText(""); lastBolusView.setText("");
} }

View file

@ -633,7 +633,7 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
if (pumpHistoryChanged && percent > 110) { if (pumpHistoryChanged && percent > 110) {
return new PumpEnactResult().success(false).enacted(false) return new PumpEnactResult().success(false).enacted(false)
.comment("Rejecting high temp since calculation didn't consider recently changed pump history"); .comment(MainApp.gs(R.string.combo_high_temp_rejected_due_to_pump_history_changes));
} }
int adjustedPercent = percent; int adjustedPercent = percent;

View file

@ -127,6 +127,11 @@ public class DateUtil {
return String.format(MainApp.sResources.getString(R.string.minago), mins); return String.format(MainApp.sResources.getString(R.string.minago), mins);
} }
public static String hourAgo(long time) {
double hours = (System.currentTimeMillis() - time) / 1000d / 60 / 60;
return String.format(MainApp.sResources.getString(R.string.hoursago), hours);
}
private static LongSparseArray<String> timeStrings = new LongSparseArray<>(); private static LongSparseArray<String> timeStrings = new LongSparseArray<>();
public static String timeStringFromSeconds(int seconds) { public static String timeStringFromSeconds(int seconds) {

View file

@ -224,7 +224,6 @@
<string name="danar_iob_label">IOB на помпата</string> <string name="danar_iob_label">IOB на помпата</string>
<string name="danar_dailyunits">Инсулин за деня</string> <string name="danar_dailyunits">Инсулин за деня</string>
<string name="pump_lastbolus_label">Последен болус:</string> <string name="pump_lastbolus_label">Последен болус:</string>
<string name="hoursago">ч по-рано</string>
<string name="danar_invalidinput">Грешни входящи данни</string> <string name="danar_invalidinput">Грешни входящи данни</string>
<string name="danar_valuenotsetproperly">Неправилна стойност</string> <string name="danar_valuenotsetproperly">Неправилна стойност</string>
<string name="reloadprofile">Презареди профил</string> <string name="reloadprofile">Презареди профил</string>

View file

@ -206,7 +206,6 @@
<string name="enacted">Provedeno</string> <string name="enacted">Provedeno</string>
<string name="end_user_license_agreement">Licenční ujednání</string> <string name="end_user_license_agreement">Licenční ujednání</string>
<string name="end_user_license_agreement_i_understand">ROZUMÍM A PORVZUJI</string> <string name="end_user_license_agreement_i_understand">ROZUMÍM A PORVZUJI</string>
<string name="hoursago">h zpět</string>
<string name="nobtadapter">Nenalezen bluetooth adaptér</string> <string name="nobtadapter">Nenalezen bluetooth adaptér</string>
<string name="percent">Procent</string> <string name="percent">Procent</string>
<string name="reloadprofile">Obnovit profil</string> <string name="reloadprofile">Obnovit profil</string>

View file

@ -222,7 +222,6 @@
<string name="end_user_license_agreement_i_understand">Ich verstehe und stimme zu</string> <string name="end_user_license_agreement_i_understand">Ich verstehe und stimme zu</string>
<string name="end_user_license_agreement_text">DAS PROGRAMM DARF NICHT FÜR MEDIZINISCHE ENTSCHEIDUNGEN BENUTZT WERDEN. ES GIBT IN DIESEM PROJEKT KEINE GEWÄHRLEISTUNG ODER GARANTIERTE UNTERSTÜTZUNG IN IRGENDEINER ART. WENN DU DICH ENTSCHEIDEST ES ZU NUTZEN, HÄNGT DIE QUALITÄT UND LEISTUNGSFÄHIGKEIT DIESES PROJEKTES VON DIR SELBST AB. ES WIRD \"WIE BESEHEN\" ZUR VERFÜGUNG GESTELLT. SOLLTE SICH DAS PROGRAMM ALS FEHLERHAFT ERWEISEN, ÜBERNEHMEN SIE DIE KOSTEN ALLER NOTWENDIGEN KRANKHEITSKOSTEN, SERVICELEISTUNGEN, REPARATUREN ODER KORREKTUREN.</string> <string name="end_user_license_agreement_text">DAS PROGRAMM DARF NICHT FÜR MEDIZINISCHE ENTSCHEIDUNGEN BENUTZT WERDEN. ES GIBT IN DIESEM PROJEKT KEINE GEWÄHRLEISTUNG ODER GARANTIERTE UNTERSTÜTZUNG IN IRGENDEINER ART. WENN DU DICH ENTSCHEIDEST ES ZU NUTZEN, HÄNGT DIE QUALITÄT UND LEISTUNGSFÄHIGKEIT DIESES PROJEKTES VON DIR SELBST AB. ES WIRD \"WIE BESEHEN\" ZUR VERFÜGUNG GESTELLT. SOLLTE SICH DAS PROGRAMM ALS FEHLERHAFT ERWEISEN, ÜBERNEHMEN SIE DIE KOSTEN ALLER NOTWENDIGEN KRANKHEITSKOSTEN, SERVICELEISTUNGEN, REPARATUREN ODER KORREKTUREN.</string>
<string name="failedupdatebasalprofile">Fehler beim Aktualisieren der Basalrate</string> <string name="failedupdatebasalprofile">Fehler beim Aktualisieren der Basalrate</string>
<string name="hoursago">"h her "</string>
<string name="smscommunicator">SMS-Kommunikator</string> <string name="smscommunicator">SMS-Kommunikator</string>
<string name="smscommunicator_allowednumbers">Erlaubte Telefonnummern</string> <string name="smscommunicator_allowednumbers">Erlaubte Telefonnummern</string>
<string name="waitingforpumpresult">Auf Pumpenergebnis warten</string> <string name="waitingforpumpresult">Auf Pumpenergebnis warten</string>

View file

@ -220,7 +220,6 @@
<string name="danar_iob_label">IOB αντλίας</string> <string name="danar_iob_label">IOB αντλίας</string>
<string name="danar_dailyunits">"Μονάδες ανά ημέρα "</string> <string name="danar_dailyunits">"Μονάδες ανά ημέρα "</string>
<string name="pump_lastbolus_label">Τελευταίο Bolus:</string> <string name="pump_lastbolus_label">Τελευταίο Bolus:</string>
<string name="hoursago">ώρες πριν</string>
<string name="danar_invalidinput">Μη έγκυρα δεδομένα</string> <string name="danar_invalidinput">Μη έγκυρα δεδομένα</string>
<string name="danar_valuenotsetproperly">Η τιμή δεν μπήκε σωστά</string> <string name="danar_valuenotsetproperly">Η τιμή δεν μπήκε σωστά</string>
<string name="reloadprofile">Ξαναφορτώστε το προφίλ</string> <string name="reloadprofile">Ξαναφορτώστε το προφίλ</string>

View file

@ -214,7 +214,6 @@
<string name="danar_iob_label">Bomba IOB</string> <string name="danar_iob_label">Bomba IOB</string>
<string name="danar_dailyunits">Unidades diarias</string> <string name="danar_dailyunits">Unidades diarias</string>
<string name="pump_lastbolus_label">Último bolo:</string> <string name="pump_lastbolus_label">Último bolo:</string>
<string name="hoursago">h antes</string>
<string name="danar_invalidinput">Datos invalidos</string> <string name="danar_invalidinput">Datos invalidos</string>
<string name="danar_valuenotsetproperly">Valor no establecido correctamente</string> <string name="danar_valuenotsetproperly">Valor no establecido correctamente</string>
<string name="reloadprofile">Recargar Perfil</string> <string name="reloadprofile">Recargar Perfil</string>

View file

@ -178,7 +178,6 @@
<string name="gettingpumpstatus">Stato Micro</string> <string name="gettingpumpstatus">Stato Micro</string>
<string name="glucose">Glucosio</string> <string name="glucose">Glucosio</string>
<string name="glucosetype_sensor">Sensore</string> <string name="glucosetype_sensor">Sensore</string>
<string name="hoursago">h fa</string>
<string name="import_from">Importa impstazioni da</string> <string name="import_from">Importa impstazioni da</string>
<string name="initializing">Inizzializzazione</string> <string name="initializing">Inizzializzazione</string>
<string name="insulin_shortname">INS</string> <string name="insulin_shortname">INS</string>

View file

@ -225,7 +225,6 @@
<string name="danar_iob_label">펌프 IOB</string> <string name="danar_iob_label">펌프 IOB</string>
<string name="danar_dailyunits">일 인슐린 총량</string> <string name="danar_dailyunits">일 인슐린 총량</string>
<string name="pump_lastbolus_label">최근 식사주입:</string> <string name="pump_lastbolus_label">최근 식사주입:</string>
<string name="hoursago">시간 전</string>
<string name="danar_invalidinput">사용할수 없는 입력 데이터</string> <string name="danar_invalidinput">사용할수 없는 입력 데이터</string>
<string name="danar_valuenotsetproperly">값이 제대로 설정되지 않았습니다</string> <string name="danar_valuenotsetproperly">값이 제대로 설정되지 않았습니다</string>
<string name="reloadprofile">Reload profile</string> <string name="reloadprofile">Reload profile</string>

View file

@ -419,7 +419,6 @@
<string name="overview_bolusprogress_stoppressed">STOP INGEDRUKT</string> <string name="overview_bolusprogress_stoppressed">STOP INGEDRUKT</string>
<string name="overview_calibration">Kalibratie</string> <string name="overview_calibration">Kalibratie</string>
<string name="danar_stats_olddata_Message">Oude gegevens druk \"VERNIEUW\" a.u.b.</string> <string name="danar_stats_olddata_Message">Oude gegevens druk \"VERNIEUW\" a.u.b.</string>
<string name="hoursago">u geleden</string>
<string name="minago">%d min geleden</string> <string name="minago">%d min geleden</string>
<string name="reason">Berekening</string> <string name="reason">Berekening</string>
<string name="rate">Dosis</string> <string name="rate">Dosis</string>

View file

@ -221,7 +221,6 @@
<string name="glucosetype_finger">палец</string> <string name="glucosetype_finger">палец</string>
<string name="glucosetype_sensor">сенсор</string> <string name="glucosetype_sensor">сенсор</string>
<string name="high_mark">ВЕРХНЯЯ отметка</string> <string name="high_mark">ВЕРХНЯЯ отметка</string>
<string name="hoursago">час. назад</string>
<string name="import_from">импортировать настройки из</string> <string name="import_from">импортировать настройки из</string>
<string name="initializing">инициализация...</string> <string name="initializing">инициализация...</string>
<string name="insulin_shortname">ИНС</string> <string name="insulin_shortname">ИНС</string>

View file

@ -206,9 +206,8 @@
<string name="glucosetype_sensor">Sensor</string> <string name="glucosetype_sensor">Sensor</string>
<string name="high_mark">HÖG markering</string> <string name="high_mark">HÖG markering</string>
<string name="hours">timmar</string> <string name="hours">timmar</string>
<string name="hoursago">h sedan</string>
<string name="import_from">Importera inställningar från</string> <string name="import_from">Importera inställningar från</string>
<string name="initializing">Startar...</string> <string name="initializing">Startar</string>
<string name="invalidprofile">Ogiltig profil !!!</string> <string name="invalidprofile">Ogiltig profil !!!</string>
<string name="iob">IOB</string> <string name="iob">IOB</string>
<string name="it_lang">Italienska</string> <string name="it_lang">Italienska</string>

View file

@ -235,7 +235,7 @@
<string name="danar_iob_label">Pump IOB</string> <string name="danar_iob_label">Pump IOB</string>
<string name="danar_dailyunits">Daily units</string> <string name="danar_dailyunits">Daily units</string>
<string name="pump_lastbolus_label">Last bolus</string> <string name="pump_lastbolus_label">Last bolus</string>
<string name="hoursago">h ago</string> <string name="hoursago">%dh ago</string>
<string name="danar_invalidinput">Invalid input data</string> <string name="danar_invalidinput">Invalid input data</string>
<string name="danar_valuenotsetproperly">Value not set properly</string> <string name="danar_valuenotsetproperly">Value not set properly</string>
<string name="reloadprofile">Reload profile</string> <string name="reloadprofile">Reload profile</string>
@ -820,7 +820,7 @@
<string name="combo_pump_activity_label">Activity</string> <string name="combo_pump_activity_label">Activity</string>
<string name="combo_no_pump_connection">No connection for %d min</string> <string name="combo_no_pump_connection">No connection for %d min</string>
<string name="combo_tbr_remaining">%d%% (%d min remaining)</string> <string name="combo_tbr_remaining">%d%% (%d min remaining)</string>
<string name="combo_last_bolus">%.1f U (%s, %s)</string> <string name="combo_last_bolus">%.1f %s (%s)</string>
<string name="combo_pump_state_initializing">Initializing</string> <string name="combo_pump_state_initializing">Initializing</string>
<string name="combo_pump_state_disconnected">Disconnected</string> <string name="combo_pump_state_disconnected">Disconnected</string>
<string name="combo_pump_state_suspended_due_to_error">Suspended due to error</string> <string name="combo_pump_state_suspended_due_to_error">Suspended due to error</string>
@ -869,5 +869,6 @@
<string name="combo_actvity_reading_basal_profile">Reading basal profile</string> <string name="combo_actvity_reading_basal_profile">Reading basal profile</string>
<string name="combo_bolus_rejected_due_to_pump_history_change">The pump history has changed after the bolus calculation was performed. The bolus was not delivered. Please recalculate if a bolus is still needed. If the same bolus amount is required, please wait a minute since boluses with the same amount are blocked when requested with less than tow minutes between them for safety (regardless of whether they were administered or not).</string> <string name="combo_bolus_rejected_due_to_pump_history_change">The pump history has changed after the bolus calculation was performed. The bolus was not delivered. Please recalculate if a bolus is still needed. If the same bolus amount is required, please wait a minute since boluses with the same amount are blocked when requested with less than tow minutes between them for safety (regardless of whether they were administered or not).</string>
<string name="combo_error_updating_treatment_record">Bolus successfully delivered, but adding the treatment entry failed. This can happen if two small boluses of the same size are administered within the last two minutes. Please check the pump history and treatment entries and use the Careportal to add missing entries. Make sure not to add any entries for the exact same minute and same amount.</string> <string name="combo_error_updating_treatment_record">Bolus successfully delivered, but adding the treatment entry failed. This can happen if two small boluses of the same size are administered within the last two minutes. Please check the pump history and treatment entries and use the Careportal to add missing entries. Make sure not to add any entries for the exact same minute and same amount.</string>
<string name="combo_high_temp_rejected_due_to_pump_history_changes">Rejecting high temp since calculation didn\'t consider recently changed pump history</string>
</resources> </resources>