Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/NightscoutFoundation/xDrip
Browse files Browse the repository at this point in the history
…into jamorhamvoice
  • Loading branch information
jamorham committed Nov 29, 2018
2 parents 3dddeb1 + 76e318b commit a094794
Show file tree
Hide file tree
Showing 30 changed files with 237 additions and 57 deletions.
9 changes: 5 additions & 4 deletions app/src/main/java/com/eveningoutpost/dexdrip/GcmActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.eveningoutpost.dexdrip.Models.Treatments;
import com.eveningoutpost.dexdrip.Models.UserError;
import com.eveningoutpost.dexdrip.Models.UserError.Log;
import com.eveningoutpost.dexdrip.R;
import com.eveningoutpost.dexdrip.Services.PlusSyncService;
import com.eveningoutpost.dexdrip.UtilityModels.Constants;
import com.eveningoutpost.dexdrip.UtilityModels.InstalledApps;
Expand Down Expand Up @@ -443,9 +444,9 @@ public static void sendSnoozeToRemote() {
static void sendSnoozeToRemoteWithConfirm(final Context context) {
final long when = JoH.tsl();
final AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle("Confirm Remote Snooze");
builder.setMessage("Are you sure you wish to snooze all other devices in your sync group?");
builder.setPositiveButton("YES, send it!", new DialogInterface.OnClickListener() {
builder.setTitle(xdrip.getAppContext().getString(R.string.confirm_remote_snooze));
builder.setMessage(xdrip.getAppContext().getString(R.string.are_you_sure_you_wish_to_snooze_all_other_devices_in_your_sync_group));
builder.setPositiveButton(xdrip.getAppContext().getString(R.string.yes_send_it), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
if ((JoH.tsl() - when) < 120000) {
Expand All @@ -458,7 +459,7 @@ public void onClick(DialogInterface dialog, int which) {
}
});

builder.setNegativeButton("NO", new DialogInterface.OnClickListener() {
builder.setNegativeButton(xdrip.getAppContext().getString(R.string.no), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
Expand Down
39 changes: 32 additions & 7 deletions app/src/main/java/com/eveningoutpost/dexdrip/Home.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
import com.crashlytics.android.Crashlytics;
import com.eveningoutpost.dexdrip.G5Model.Ob1G5StateMachine;
import com.eveningoutpost.dexdrip.ImportedLibraries.dexcom.Dex_Constants;
import com.eveningoutpost.dexdrip.ImportedLibraries.usbserial.util.HexDump;
import com.eveningoutpost.dexdrip.Models.Accuracy;
import com.eveningoutpost.dexdrip.Models.ActiveBgAlert;
import com.eveningoutpost.dexdrip.Models.ActiveBluetoothDevice;
Expand Down Expand Up @@ -147,6 +148,7 @@
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.text.DecimalFormat;
import java.text.MessageFormat;
import java.text.NumberFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
Expand Down Expand Up @@ -2367,15 +2369,15 @@ public void run() {
notificationText.append("\n USING FAKE DATA SOURCE !!!");
}
if (Pref.getLong("alerts_disabled_until", 0) > new Date().getTime()) {
notificationText.append("\n ALL ALERTS CURRENTLY DISABLED");
notificationText.append("\n " + getString(R.string.all_alerts_currently_disabled));
} else if (Pref.getLong("low_alerts_disabled_until", 0) > new Date().getTime()
&&
Pref.getLong("high_alerts_disabled_until", 0) > new Date().getTime()) {
notificationText.append("\n LOW AND HIGH ALERTS CURRENTLY DISABLED");
notificationText.append("\n " + getString(R.string.low_and_high_alerts_currently_disabled));
} else if (Pref.getLong("low_alerts_disabled_until", 0) > new Date().getTime()) {
notificationText.append("\n LOW ALERTS CURRENTLY DISABLED");
notificationText.append("\n " + getString(R.string.low_alerts_currently_disabled));
} else if (Pref.getLong("high_alerts_disabled_until", 0) > new Date().getTime()) {
notificationText.append("\n HIGH ALERTS CURRENTLY DISABLED");
notificationText.append("\n " + getString(R.string.high_alerts_currently_disabled));
}
NavigationDrawerFragment navigationDrawerFragment = (NavigationDrawerFragment) getFragmentManager().findFragmentById(R.id.navigation_drawer);

Expand Down Expand Up @@ -3110,7 +3112,8 @@ private void displayCurrentInfoFromReading(BgReading lastBgReading, boolean pred

if ((!small_width) || (notificationText.length() > 0)) notificationText.append("\n");
if (!small_width) {
notificationText.append(minutes + ((minutes == 1) ? getString(R.string.space_minute_ago) : getString(R.string.space_minutes_ago)));
final String fmt = getString(R.string.minutes_ago);
notificationText.append(MessageFormat.format(fmt,minutes));
} else {
// small screen
notificationText.append(minutes + getString(R.string.space_mins));
Expand Down Expand Up @@ -3159,13 +3162,35 @@ private void displayCurrentInfoFromReading(BgReading lastBgReading, boolean pred
}
}

// This function is needed in hebrew in order to allow printing the text (for exapmle) -3 mg/dl
// It seems that without this hack, printing it is impossibale. Android will print something like:
// -mg/dl 3 or mg/dl 3- or mg/dl -3. (but never -3 mg/dl)
// The problem seems to happen becaud of the extra 0x0a char that somehow gets to the buffer.
// Since this text has high visabilty, I'm doing it. Will not be done in other places.
private void HebrewAppendDisplayData() {
// Do the append for the hebrew language
String original_text = notificationText.getText().toString();
Log.d(TAG, "original_text = " + HexDump.dumpHexString(original_text.getBytes()));
if(original_text.length() >=1 && original_text.charAt(0) == 0x0a) {
Log.d(TAG,"removing first and appending " + display_delta);
notificationText.setText(display_delta + " " + original_text.substring(1));
} else {
notificationText.setText(display_delta + " " + original_text);
}
}

private void addDisplayDelta() {
if (BgGraphBuilder.isXLargeTablet(getApplicationContext())) {
notificationText.append(" ");
if(Locale.getDefault().getLanguage() == "iw") {
HebrewAppendDisplayData();
} else {
notificationText.append(" ");
notificationText.append(display_delta);
}
} else {
notificationText.append("\n");
notificationText.append(display_delta);
}
notificationText.append(display_delta);
}

@Override
Expand Down
22 changes: 9 additions & 13 deletions app/src/main/java/com/eveningoutpost/dexdrip/SnoozeActivity.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.eveningoutpost.dexdrip;

import java.text.DateFormat;
import java.text.MessageFormat;
import java.util.Date;

import android.app.Dialog;
Expand Down Expand Up @@ -345,10 +346,8 @@ void displayStatus() {
} else {
sendRemoteSnooze.setVisibility(View.GONE);
if(!aba.ready_to_alarm()) {
status = "Active alert exists named \"" + activeBgAlert.name
+ (aba.is_snoozed?"\" Alert snoozed until ":"\" Alert will rerise at ")
+ DateFormat.getTimeInstance(DateFormat.MEDIUM).format(new Date(aba.next_alert_at)) +
" (" + (aba.next_alert_at - now) / 60000 + " minutes left)";
status = MessageFormat.format("Active alert exists named \"{0}\" {1,choice,0#Alert will rerise at|1#Alert snoozed until} {2,time} ({3} minutes left)",
activeBgAlert.name, aba.is_snoozed ? 1 : 0 , new Date(aba.next_alert_at),(aba.next_alert_at - now) / 60000);
} else {
status = getString(R.string.active_alert_exists_named)+" \"" + activeBgAlert.name + "\" "+getString(R.string.bracket_not_snoozed);
}
Expand All @@ -357,21 +356,18 @@ void displayStatus() {

//check if there are disabled alerts and if yes add warning
if (prefs.getLong("alerts_disabled_until", 0) > now) {
String textToAdd = (prefs.getLong("alerts_disabled_until", 0) > now + (infiniteSnoozeValueInMinutes - 365 * 24 * 60) * 60 * 1000)
//if alerts would have been disabled "until you re-enable", and this test is done less than 365 * 24 * 60 minutes later, then this test will give true
? "you re-enable":DateFormat.getTimeInstance(DateFormat.MEDIUM).format(new Date(prefs.getLong("alerts_disabled_until", 0)));
String textToAdd = MessageFormat.format("{0,choice,0#{1,time}|1#you re-enable}",
(prefs.getLong("alerts_disabled_until", 0) > now + (infiniteSnoozeValueInMinutes - 365 * 24 * 60) * 60 * 1000) ? 1 : 0 , new Date(prefs.getLong("alerts_disabled_until", 0)));
status = getString(R.string.all_alerts_disabled_until) + textToAdd;
} else {
if (prefs.getLong("low_alerts_disabled_until", 0) > now) {
String textToAdd = (prefs.getLong("low_alerts_disabled_until", 0) > now + (infiniteSnoozeValueInMinutes - 365 * 24 * 60) * 60 * 1000)
//if low alerts would have been disabled "until you re-enable", and this test is done less than 365 * 24 * 60 minutes later, then this test will give true
? "you re-enable":DateFormat.getTimeInstance(DateFormat.MEDIUM).format(new Date(prefs.getLong("low_alerts_disabled_until", 0)));
String textToAdd = MessageFormat.format("{0,choice,0#{1,time}|1#you re-enable}",
(prefs.getLong("low_alerts_disabled_until", 0) > now + (infiniteSnoozeValueInMinutes - 365 * 24 * 60) * 60 * 1000) ? 1 : 0 , new Date(prefs.getLong("low_alerts_disabled_until", 0)));
status += "\n\n"+getString(R.string.low_alerts_disabled_until) + textToAdd;
}
if (prefs.getLong("high_alerts_disabled_until", 0) > now) {
String textToAdd = (prefs.getLong("high_alerts_disabled_until", 0) > now + (infiniteSnoozeValueInMinutes - 365 * 24 * 60) * 60 * 1000)
//if high alerts would have been disabled "until you re-enable", and this test is done less than 365 * 24 * 60 minutes later, then this test will give true
? "you re-enable":DateFormat.getTimeInstance(DateFormat.MEDIUM).format(new Date(prefs.getLong("high_alerts_disabled_until", 0)));
String textToAdd = MessageFormat.format("{0,choice,0#{1,time}|1#you re-enable}",
(prefs.getLong("high_alerts_disabled_until", 0) > now + (infiniteSnoozeValueInMinutes - 365 * 24 * 60) * 60 * 1000) ? 1 : 0 , new Date(prefs.getLong("high_alerts_disabled_until", 0)));
status += "\n\n"+getString(R.string.high_alerts_disabled_until) + textToAdd;
}
}
Expand Down
10 changes: 5 additions & 5 deletions app/src/main/java/com/eveningoutpost/dexdrip/SystemStatus.java
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public void setCurrentDevice() {

private void setConnectionStatusFollower() {
if (GcmListenerSvc.lastMessageReceived == 0) {
connection_status.setText("No data");
connection_status.setText(getApplicationContext().getString(R.string.no_data));
} else {
connection_status.setText((JoH.qs((JoH.ts() - GcmListenerSvc.lastMessageReceived) / 60000, 0)) + " mins ago");
}
Expand All @@ -244,7 +244,7 @@ private void setConnectionStatusWifiWixel() {
{
connection_status.setText(ParakeetHelper.parakeetStatusString());
} else {
connection_status.setText("No data");
connection_status.setText(getApplicationContext().getString(R.string.no_data));
}
}

Expand All @@ -258,9 +258,9 @@ private void setConnectionStatus() {
}
}
if(connected) {
connection_status.setText("Connected");
connection_status.setText(getApplicationContext().getString(R.string.connected));
} else {
connection_status.setText("Not Connected");
connection_status.setText(getApplicationContext().getString(R.string.not_connected));
}

String collection_method = prefs.getString("dex_collection_method", "BluetoothWixel");
Expand All @@ -286,7 +286,7 @@ private void setConnectionStatus() {
}
}
} else {
connection_status.setText("No bluetooth");
connection_status.setText(getApplicationContext().getString(R.string.no_bluetooth));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ public void setCurrentDevice() {

private void setConnectionStatusFollower() {
if (GcmListenerSvc.lastMessageReceived == 0) {
connection_status.setText("No data");
connection_status.setText(safeGetContext().getString(R.string.no_data));
} else {
connection_status.setText((JoH.qs((JoH.ts() - GcmListenerSvc.lastMessageReceived) / 60000, 0)) + " mins ago");
}
Expand All @@ -359,7 +359,7 @@ private void setConnectionStatusWifiWixel() {
if (ParakeetHelper.isParakeetCheckingIn()) {
connection_status.setText(ParakeetHelper.parakeetStatusString());
} else {
connection_status.setText("No data");
connection_status.setText(safeGetContext().getString(R.string.no_data));
}
}

Expand All @@ -379,9 +379,9 @@ private void setConnectionStatus() {
}
}
if (connected) {
connection_status.setText("Connected");
connection_status.setText(safeGetContext().getString(R.string.connected));
} else {
connection_status.setText("Not Connected");
connection_status.setText(safeGetContext().getString(R.string.not_connected));
}

String collection_method = prefs.getString("dex_collection_method", "BluetoothWixel");
Expand All @@ -407,7 +407,7 @@ private void setConnectionStatus() {
}
}
} else {
connection_status.setText("No bluetooth");
connection_status.setText(safeGetContext().getString(R.string.no_bluetooth));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@ public static void bgUnclearAlert(Context context) {

public static void bgMissedAlert(Context context) {
long otherAlertReraiseSec = MissedReadingService.getOtherAlertReraiseSec(context, "bg_missed_alerts");
OtherAlert(context, "bg_missed_alerts", "BG Readings Missed" + " (@" + JoH.hourMinuteString() + ")", missedAlertNotificationId, NotificationChannels.BG_MISSED_ALERT_CHANNEL, true, otherAlertReraiseSec);
OtherAlert(context, "bg_missed_alerts", context.getString(R.string.bg_reading_missed) + " (@" + JoH.hourMinuteString() + ")", missedAlertNotificationId, NotificationChannels.BG_MISSED_ALERT_CHANNEL, true, otherAlertReraiseSec);
}

public static void RisingAlert(Context context, boolean on) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public class SourceWizard {

}
Tree<Item> other = root.addChild(new Item(gs(R.string.other), gs(R.string.which_type_of_device), R.drawable.wikimedia_question_mark));
other.addChild(new Item("640G / 670G", DexCollectionType.NSEmulator, R.drawable.wikimedia_pump_image_by_ajepbah));
other.addChild(new Item("640G / 670G", DexCollectionType.NSEmulator, R.drawable.mm600_series));
other.addChild(new Item("Medtrum A6", DexCollectionType.Medtrum, R.drawable.a6_icon));
//
other.addChild(new Item("EverSense", DexCollectionType.NSEmulator, R.drawable.wikimedia_eversense_icon_pbroks13));
Expand Down
Binary file added app/src/main/res/drawable-xhdpi/mm600_series.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_snooze.xml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:onClick="setSendRemoteSnoozeOnClick"
android:text="Send Remote Snooze"
android:text="@string/send_remote_snooze"
android:backgroundTint="@color/colorPrimaryDark" />
</LinearLayout>
</LinearLayout>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_system_status.xml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
android:layout_gravity="center_vertical"
android:paddingTop="10dp"

android:text="Connection Status: "
android:text="@string/connection_status"
android:textAppearance="?android:attr/textAppearanceMedium" />

<TextView
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-cs/strings-cs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
<string name="signal_missed">Signál nezachycený</string>
<string name="space_minutes_ago">" Minut zpět"</string>
<string name="space_minute_ago">" Minuta zpět"</string>
<string name="minutes_ago">{0, choice,0#{0, number, integer} Minut zpět|1#{0, number, integer} Minuta zpět|1&lt;{0, number, integer} Minut zpět}</string>
<string name="show_parakeet_map">Zobrazit mapu Parakeetů</string>
<string name="switch_parakeet_to_setup_mode">Přepnout Parakeet do módu nastavování</string>
<string name="view_events_log">Zobrazit logy</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-de/strings-de.xml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@
<string name="signal_missed">Keine Daten empfangen</string>
<string name="space_minutes_ago">" Minuten her"</string>
<string name="space_minute_ago">" Minute her"</string>
<string name="minutes_ago">{0, choice,0#{0, number, integer} Minuten her|1#{0, number, integer} Minute her|1&lt;{0, number, integer} Minuten her}</string>
<string name="show_parakeet_map">Parakeet Map anzeigen</string>
<string name="switch_parakeet_to_setup_mode">Parakeet in Setup-Modus starten</string>
<string name="view_events_log">Log anzeigen</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-es/strings-es.xml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
<string name="signal_missed">Señal omitida</string>
<string name="space_minutes_ago">" Minutos antes"</string>
<string name="space_minute_ago">" Minuto antes"</string>
<string name="minutes_ago">{0, choice,0#{0, number, integer} Minutos antes|1#{0, number, integer} Minuto antes|1&lt;{0, number, integer} Minutos antes}</string>
<string name="show_parakeet_map">Ver mapa Parakeet</string>
<string name="switch_parakeet_to_setup_mode">Parakeet cambiar al modo de configuración</string>
<string name="view_events_log">Ver registro de eventos</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-fi/strings-fi.xml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
<string name="signal_missed">Signal Missed</string>
<string name="space_minutes_ago">" Minuuttia sitten"</string>
<string name="space_minute_ago">" Minute sitten"</string>
<string name="minutes_ago">{0, choice,0#{0, number, integer} Minuuttia sitten|1#{0, number, integer} Minute sitten|1&lt;{0, number, integer} Minuuttia sitten}</string>
<string name="show_parakeet_map">Näytä Parakeet kartta</string>
<string name="switch_parakeet_to_setup_mode">Vaihda Parakeet asetustilaan</string>
<string name="view_events_log">View Tapahtumat Log</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-fr/strings-fr.xml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
<string name="signal_missed">Signal manqué</string>
<string name="space_minutes_ago">" Minutes"</string>
<string name="space_minute_ago">" Minute"</string>
<string name="minutes_ago">{0, choice,0#{0, number, integer} Minutes|1#{0, number, integer} Minute|1&lt;{0, number, integer} Minutes}</string>
<string name="show_parakeet_map">Afficher la carte Parakeet</string>
<string name="switch_parakeet_to_setup_mode">Mettre Parakeet en mode de configuration</string>
<string name="view_events_log">Afficher le journal d\'événements</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-hr/strings-hr.xml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@
<string name="signal_missed">Signal propušten</string>
<string name="space_minutes_ago">" min. prije"</string>
<string name="space_minute_ago">" min. prije"</string>
<string name="minutes_ago">{0, choice,0#{0, number, integer} min. prije|1#{0, number, integer} min. prije|1&lt;{0, number, integer} min. prije}</string>
<string name="show_parakeet_map">Prikaži Parakeet kartu</string>
<string name="switch_parakeet_to_setup_mode">Prebaci Parakeet u način za promjenu postavki</string>
<string name="view_events_log">Pogledaj zapise događaja</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-it/strings-it.xml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
<string name="signal_missed">Segnale Perso</string>
<string name="space_minutes_ago">" Minuti fa"</string>
<string name="space_minute_ago">" Minuto fa"</string>
<string name="minutes_ago">{0, choice,0#{0, number, integer} Minuti fa|1#{0, number, integer} Minuto fa|1&lt;{0, number, integer} Minuti fa}</string>
<string name="show_parakeet_map">Visualizza mappa Parakeet</string>
<string name="switch_parakeet_to_setup_mode">Passare Parakeet alla modalità di installazione</string>
<string name="view_events_log">Visualizza eventi Log</string>
Expand Down
Loading

0 comments on commit a094794

Please sign in to comment.