Merge branch 'master' into mm640g
|
@ -37,7 +37,7 @@
|
|||
<ConfirmationsSetting value="0" id="Add" />
|
||||
<ConfirmationsSetting value="0" id="Remove" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
|
18
.travis.yml
Normal file
|
@ -0,0 +1,18 @@
|
|||
language: android
|
||||
jdk: oraclejdk8
|
||||
env:
|
||||
matrix:
|
||||
- ANDROID_TARGET=android-23 ANDROID_ABI=x86
|
||||
android:
|
||||
components:
|
||||
- platform-tools
|
||||
- tools
|
||||
- build-tools-25.0.2
|
||||
- android-23
|
||||
- extra-google-m2repository
|
||||
- extra-android-m2repository
|
||||
- extra-google-google_play_services
|
||||
|
||||
script:
|
||||
# Unit Test
|
||||
- ./gradlew test
|
|
@ -37,7 +37,7 @@ def generateGitBuild = { ->
|
|||
|
||||
android {
|
||||
compileSdkVersion 23
|
||||
buildToolsVersion "23.0.3"
|
||||
buildToolsVersion "25.0.2"
|
||||
|
||||
defaultConfig {
|
||||
applicationId "info.nightscout.androidaps"
|
||||
|
|
|
@ -40,6 +40,7 @@ import info.nightscout.androidaps.plugins.TempBasals.TempBasalsFragment;
|
|||
import info.nightscout.androidaps.plugins.Treatments.TreatmentsFragment;
|
||||
import info.nightscout.androidaps.plugins.VirtualPump.VirtualPumpFragment;
|
||||
import info.nightscout.androidaps.plugins.Wear.WearFragment;
|
||||
import info.nightscout.androidaps.plugins.persistentnotification.PersistentNotificationPlugin;
|
||||
import info.nightscout.androidaps.receivers.KeepAliveReceiver;
|
||||
import io.fabric.sdk.android.Fabric;
|
||||
|
||||
|
@ -95,6 +96,7 @@ public class MainApp extends Application {
|
|||
pluginsList.add(SmsCommunicatorFragment.getPlugin());
|
||||
|
||||
if (Config.WEAR) pluginsList.add(WearFragment.getPlugin(this));
|
||||
pluginsList.add(new PersistentNotificationPlugin(this));
|
||||
|
||||
pluginsList.add(sConfigBuilder = ConfigBuilderFragment.getPlugin());
|
||||
|
||||
|
|
|
@ -554,11 +554,11 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
|||
public PumpEnactResult setExtendedBolus(Double insulin, Integer durationInMinutes) {
|
||||
ConfigBuilderPlugin configBuilderPlugin = MainApp.getConfigBuilder();
|
||||
insulin = configBuilderPlugin.applyBolusConstraints(insulin);
|
||||
// needs to be rounded to 0.1
|
||||
insulin = Round.roundTo(insulin, 0.1d);
|
||||
// needs to be rounded
|
||||
insulin = Round.roundTo(insulin, getPumpDescription().extendedBolusStep);
|
||||
|
||||
PumpEnactResult result = new PumpEnactResult();
|
||||
if (getDanaRPump().isExtendedInProgress && Math.abs(getDanaRPump().extendedBolusAmount - insulin) < 0.1d) {
|
||||
if (getDanaRPump().isExtendedInProgress && Math.abs(getDanaRPump().extendedBolusAmount - insulin) < getPumpDescription().extendedBolusStep) {
|
||||
result.enacted = false;
|
||||
result.success = true;
|
||||
result.comment = MainApp.instance().getString(R.string.virtualpump_resultok);
|
||||
|
@ -567,12 +567,12 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
|||
result.isPercent = false;
|
||||
result.isTempCancel = false;
|
||||
if (Config.logPumpActions)
|
||||
log.debug("setExtendedBolus: Correct extended bolus already set");
|
||||
log.debug("setExtendedBolus: Correct extended bolus already set. Current: " + getDanaRPump().extendedBolusAmount + " Asked: " + insulin);
|
||||
return result;
|
||||
}
|
||||
int durationInHalfHours = Math.max(durationInMinutes / 30, 1);
|
||||
boolean connectionOK = sExecutionService.extendedBolus(insulin, durationInHalfHours);
|
||||
if (connectionOK && getDanaRPump().isExtendedInProgress && Math.abs(getDanaRPump().extendedBolusAmount - insulin) < 0.1d) {
|
||||
if (connectionOK && getDanaRPump().isExtendedInProgress && Math.abs(getDanaRPump().extendedBolusAmount - insulin) < getPumpDescription().extendedBolusStep) {
|
||||
result.enacted = true;
|
||||
result.success = true;
|
||||
result.comment = MainApp.instance().getString(R.string.virtualpump_resultok);
|
||||
|
|
|
@ -554,11 +554,11 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, Constraints
|
|||
public PumpEnactResult setExtendedBolus(Double insulin, Integer durationInMinutes) {
|
||||
ConfigBuilderPlugin configBuilderPlugin = MainApp.getConfigBuilder();
|
||||
insulin = configBuilderPlugin.applyBolusConstraints(insulin);
|
||||
// needs to be rounded to 0.1
|
||||
insulin = Round.roundTo(insulin, 0.1d);
|
||||
// needs to be rounded
|
||||
insulin = Round.roundTo(insulin, getPumpDescription().extendedBolusStep);
|
||||
|
||||
PumpEnactResult result = new PumpEnactResult();
|
||||
if (getDanaRPump().isExtendedInProgress && Math.abs(getDanaRPump().extendedBolusAmount - insulin) < 0.1d) {
|
||||
if (getDanaRPump().isExtendedInProgress && Math.abs(getDanaRPump().extendedBolusAmount - insulin) < getPumpDescription().extendedBolusStep) {
|
||||
result.enacted = false;
|
||||
result.success = true;
|
||||
result.comment = MainApp.instance().getString(R.string.virtualpump_resultok);
|
||||
|
@ -567,12 +567,12 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, Constraints
|
|||
result.isPercent = false;
|
||||
result.isTempCancel = false;
|
||||
if (Config.logPumpActions)
|
||||
log.debug("setExtendedBolus: Correct extended bolus already set");
|
||||
log.debug("setExtendedBolus: Correct extended bolus already set. Current: " + getDanaRPump().extendedBolusAmount + " Asked: " + insulin);
|
||||
return result;
|
||||
}
|
||||
int durationInHalfHours = Math.max(durationInMinutes / 30, 1);
|
||||
boolean connectionOK = sExecutionService.extendedBolus(insulin, durationInHalfHours);
|
||||
if (connectionOK && getDanaRPump().isExtendedInProgress && Math.abs(getDanaRPump().extendedBolusAmount - insulin) < 0.1d) {
|
||||
if (connectionOK && getDanaRPump().isExtendedInProgress && Math.abs(getDanaRPump().extendedBolusAmount - insulin) < getPumpDescription().extendedBolusStep) {
|
||||
result.enacted = true;
|
||||
result.success = true;
|
||||
result.comment = MainApp.instance().getString(R.string.virtualpump_resultok);
|
||||
|
|
|
@ -168,7 +168,7 @@ public class LoopPlugin implements PluginBase {
|
|||
@Override
|
||||
public void run() {
|
||||
final PumpEnactResult applyResult = configBuilder.applyAPSRequest(resultAfterConstraints);
|
||||
if (applyResult.enacted) {
|
||||
if (applyResult.enacted || applyResult.success) {
|
||||
lastRun.setByPump = applyResult;
|
||||
lastRun.lastEnact = lastRun.lastAPSRun;
|
||||
} else {
|
||||
|
|
|
@ -99,6 +99,7 @@ public class OverviewFragment extends Fragment {
|
|||
TextView arrowView;
|
||||
TextView timeAgoView;
|
||||
TextView deltaView;
|
||||
TextView avgdeltaView;
|
||||
TextView runningTempView;
|
||||
TextView baseBasalView;
|
||||
TextView activeProfileView;
|
||||
|
@ -143,6 +144,7 @@ public class OverviewFragment extends Fragment {
|
|||
arrowView = (TextView) view.findViewById(R.id.overview_arrow);
|
||||
timeAgoView = (TextView) view.findViewById(R.id.overview_timeago);
|
||||
deltaView = (TextView) view.findViewById(R.id.overview_delta);
|
||||
avgdeltaView = (TextView) view.findViewById(R.id.overview_avgdelta);
|
||||
runningTempView = (TextView) view.findViewById(R.id.overview_runningtemp);
|
||||
baseBasalView = (TextView) view.findViewById(R.id.overview_basebasal);
|
||||
activeProfileView = (TextView) view.findViewById(R.id.overview_activeprofile);
|
||||
|
@ -570,8 +572,11 @@ public class OverviewFragment extends Fragment {
|
|||
bgView.setText(lastBG.valueToUnitsToString(profile.getUnits()));
|
||||
arrowView.setText(lastBG.directionToSymbol());
|
||||
DatabaseHelper.GlucoseStatus glucoseStatus = MainApp.getDbHelper().getGlucoseStatusData();
|
||||
if (glucoseStatus != null)
|
||||
if (glucoseStatus != null){
|
||||
deltaView.setText("Δ " + NSProfile.toUnitsString(glucoseStatus.delta, glucoseStatus.delta * Constants.MGDL_TO_MMOLL, units) + " " + units);
|
||||
avgdeltaView.setText("øΔ " + NSProfile.toUnitsString(glucoseStatus.avgdelta, glucoseStatus.avgdelta * Constants.MGDL_TO_MMOLL, units) + " " + units);
|
||||
}
|
||||
|
||||
BgReading.units = profile.getUnits();
|
||||
} else
|
||||
return;
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package info.nightscout.androidaps.plugins.persistentnotification;
|
||||
|
||||
import android.support.v4.app.Fragment;
|
||||
|
||||
import info.nightscout.androidaps.interfaces.FragmentBase;
|
||||
|
||||
/**
|
||||
* Created by adrian on 23/12/16.
|
||||
*/
|
||||
|
||||
public class PersistentNotificationFragment extends Fragment implements FragmentBase {
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,241 @@
|
|||
package info.nightscout.androidaps.plugins.persistentnotification;
|
||||
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.support.v4.app.TaskStackBuilder;
|
||||
import android.support.v7.app.NotificationCompat;
|
||||
|
||||
import com.squareup.otto.Subscribe;
|
||||
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainActivity;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.db.BgReading;
|
||||
import info.nightscout.androidaps.db.DatabaseHelper;
|
||||
import info.nightscout.androidaps.db.TempBasal;
|
||||
import info.nightscout.androidaps.events.EventInitializationChanged;
|
||||
import info.nightscout.androidaps.events.EventNewBG;
|
||||
import info.nightscout.androidaps.events.EventNewBasalProfile;
|
||||
import info.nightscout.androidaps.events.EventPreferenceChange;
|
||||
import info.nightscout.androidaps.events.EventRefreshGui;
|
||||
import info.nightscout.androidaps.events.EventTempBasalChange;
|
||||
import info.nightscout.androidaps.events.EventTreatmentChange;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||
import info.nightscout.androidaps.plugins.OpenAPSMA.IobTotal;
|
||||
import info.nightscout.androidaps.plugins.Overview.Notification;
|
||||
import info.nightscout.client.data.NSProfile;
|
||||
import info.nightscout.utils.DecimalFormatter;
|
||||
|
||||
/**
|
||||
* Created by adrian on 23/12/16.
|
||||
*/
|
||||
|
||||
public class PersistentNotificationPlugin implements PluginBase{
|
||||
|
||||
private static final int ONGOING_NOTIFICATION_ID = 4711;
|
||||
static boolean fragmentEnabled = false;
|
||||
private final Context ctx;
|
||||
|
||||
public PersistentNotificationPlugin(Context ctx) {
|
||||
this.ctx = ctx;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getType() {
|
||||
return GENERAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFragmentClass() {
|
||||
return PersistentNotificationFragment.class.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return ctx.getString(R.string.ongoingnotificaction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled(int type) {
|
||||
return fragmentEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisibleInTabs(int type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeHidden(int type) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
||||
|
||||
if(getType() == type){
|
||||
this.fragmentEnabled = fragmentEnabled;
|
||||
checkBusRegistration();
|
||||
updateNotification();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void updateNotification() {
|
||||
|
||||
if(!fragmentEnabled){
|
||||
NotificationManager mNotificationManager =
|
||||
(NotificationManager) ctx.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
mNotificationManager.cancel(ONGOING_NOTIFICATION_ID);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
String line1 = ctx.getString(R.string.noprofile);
|
||||
NSProfile profile = MainApp.getConfigBuilder().getActiveProfile().getProfile();
|
||||
|
||||
|
||||
BgReading lastBG = MainApp.getDbHelper().lastBg();
|
||||
DatabaseHelper.GlucoseStatus glucoseStatus = MainApp.getDbHelper().getGlucoseStatusData();
|
||||
|
||||
if(profile != null && lastBG != null) {
|
||||
line1 = lastBG.valueToUnitsToString(profile.getUnits());
|
||||
}
|
||||
if (glucoseStatus != null) {
|
||||
line1 += " Δ" + deltastring(glucoseStatus.delta, glucoseStatus.delta * Constants.MGDL_TO_MMOLL, profile.getUnits())
|
||||
+ " avgΔ" + deltastring(glucoseStatus.avgdelta, glucoseStatus.avgdelta * Constants.MGDL_TO_MMOLL, profile.getUnits());
|
||||
} else {
|
||||
line1 += " " +
|
||||
ctx.getString(R.string.old_data) +
|
||||
" ";
|
||||
}
|
||||
|
||||
PumpInterface pump = MainApp.getConfigBuilder();
|
||||
|
||||
if (pump.isTempBasalInProgress()) {
|
||||
TempBasal activeTemp = pump.getTempBasal();
|
||||
line1 += " " + activeTemp.toStringShort();
|
||||
}
|
||||
|
||||
//IOB
|
||||
MainApp.getConfigBuilder().getActiveTreatments().updateTotalIOB();
|
||||
IobTotal bolusIob = MainApp.getConfigBuilder().getActiveTreatments().getLastCalculation().round();
|
||||
if (bolusIob == null) bolusIob = new IobTotal();
|
||||
MainApp.getConfigBuilder().getActiveTempBasals().updateTotalIOB();
|
||||
IobTotal basalIob = MainApp.getConfigBuilder().getActiveTempBasals().getLastCalculation().round();
|
||||
if (basalIob == null) basalIob = new IobTotal();
|
||||
String line2 = ctx.getString(R.string.treatments_iob_label_string) + " " + DecimalFormatter.to2Decimal(bolusIob.iob + basalIob.basaliob) + "U ("
|
||||
+ ctx.getString(R.string.bolus) + ": " + DecimalFormatter.to2Decimal(bolusIob.iob) + "U "
|
||||
+ ctx.getString(R.string.basal) + ": " + DecimalFormatter.to2Decimal(basalIob.basaliob) + "U)";
|
||||
|
||||
|
||||
String line3 = DecimalFormatter.to2Decimal(pump.getBaseBasalRate()) + " U/h";
|
||||
|
||||
|
||||
if (profile != null && profile.getActiveProfile() != null)
|
||||
line3 += " - " + profile.getActiveProfile();
|
||||
|
||||
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(ctx);
|
||||
builder.setOngoing(true);
|
||||
builder.setCategory(NotificationCompat.CATEGORY_STATUS);
|
||||
builder.setSmallIcon(R.drawable.ic_notification);
|
||||
Bitmap largeIcon = BitmapFactory.decodeResource(ctx.getResources(), R.mipmap.ic_launcher);
|
||||
builder.setLargeIcon(largeIcon);
|
||||
builder.setContentTitle(line1);
|
||||
builder.setContentText(line2);
|
||||
builder.setSubText(line3);
|
||||
|
||||
Intent resultIntent = new Intent(ctx, MainActivity.class);
|
||||
|
||||
TaskStackBuilder stackBuilder = TaskStackBuilder.create(ctx);
|
||||
stackBuilder.addParentStack(MainActivity.class);
|
||||
stackBuilder.addNextIntent(resultIntent);
|
||||
PendingIntent resultPendingIntent =
|
||||
stackBuilder.getPendingIntent(
|
||||
0,
|
||||
PendingIntent.FLAG_UPDATE_CURRENT
|
||||
);
|
||||
builder.setContentIntent(resultPendingIntent);
|
||||
NotificationManager mNotificationManager =
|
||||
(NotificationManager) ctx.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
|
||||
android.app.Notification notification = builder.build();
|
||||
mNotificationManager.notify(ONGOING_NOTIFICATION_ID, notification);
|
||||
|
||||
}
|
||||
|
||||
private void checkBusRegistration() {
|
||||
if(fragmentEnabled){
|
||||
MainApp.bus().register(this);
|
||||
} else {
|
||||
MainApp.bus().unregister(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFragmentVisible(int type, boolean fragmentVisible) {
|
||||
//no visible fragment
|
||||
}
|
||||
|
||||
private String deltastring(double deltaMGDL, double deltaMMOL, String units) {
|
||||
String deltastring = "";
|
||||
if (deltaMGDL >=0){
|
||||
deltastring += "+";
|
||||
} else{
|
||||
deltastring += "-";
|
||||
|
||||
}
|
||||
if (units.equals(Constants.MGDL)){
|
||||
deltastring += DecimalFormatter.to1Decimal(Math.abs(deltaMGDL));
|
||||
}
|
||||
else {
|
||||
deltastring += DecimalFormatter.to1Decimal(Math.abs(deltaMMOL));
|
||||
}
|
||||
return deltastring;
|
||||
}
|
||||
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventPreferenceChange ev) {
|
||||
updateNotification();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventTreatmentChange ev) {
|
||||
updateNotification();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventTempBasalChange ev) {
|
||||
updateNotification();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventNewBG ev) {
|
||||
updateNotification();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventNewBasalProfile ev) {
|
||||
updateNotification();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventInitializationChanged ev) {
|
||||
updateNotification();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventRefreshGui ev) {
|
||||
updateNotification();
|
||||
}
|
||||
|
||||
}
|
BIN
app/src/main/res/drawable-hdpi-v11/ic_notification.png
Normal file
After Width: | Height: | Size: 972 B |
BIN
app/src/main/res/drawable-hdpi-v9/ic_notification.png
Normal file
After Width: | Height: | Size: 907 B |
BIN
app/src/main/res/drawable-hdpi/ic_notification.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
app/src/main/res/drawable-mdpi-v11/ic_notification.png
Normal file
After Width: | Height: | Size: 569 B |
BIN
app/src/main/res/drawable-mdpi-v9/ic_notification.png
Normal file
After Width: | Height: | Size: 506 B |
BIN
app/src/main/res/drawable-mdpi/ic_notification.png
Normal file
After Width: | Height: | Size: 836 B |
BIN
app/src/main/res/drawable-xhdpi-v11/ic_notification.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
app/src/main/res/drawable-xhdpi-v9/ic_notification.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_notification.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
app/src/main/res/drawable-xxhdpi-v11/ic_notification.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
app/src/main/res/drawable-xxhdpi-v9/ic_notification.png
Normal file
After Width: | Height: | Size: 2 KiB |
BIN
app/src/main/res/drawable-xxhdpi/ic_notification.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
app/src/main/res/drawable/notif_icon.png
Normal file
After Width: | Height: | Size: 4.7 KiB |
|
@ -20,6 +20,38 @@
|
|||
|
||||
</android.support.v7.widget.RecyclerView>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingTop="2dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_apsmode"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="@drawable/loopmodeborder"
|
||||
android:gravity="center_vertical|center_horizontal"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:text="Open Loop"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_activeprofile"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="@drawable/pillborder"
|
||||
android:gravity="center_vertical|center_horizontal"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="@color/colorProfileSwitchButton" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -32,7 +64,7 @@
|
|||
android:layout_gravity="top|left"
|
||||
android:gravity="center_vertical"
|
||||
android:text="00.0"
|
||||
android:textSize="80dp"
|
||||
android:textSize="70dp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
|
@ -42,10 +74,11 @@
|
|||
android:layout_gravity="top|left"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="-5dp"
|
||||
android:paddingRight="-5dp"
|
||||
android:paddingRight="-10dp"
|
||||
android:text="→"
|
||||
android:textSize="80dp"
|
||||
android:textStyle="bold" />
|
||||
android:textSize="70dp"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginTop="-15dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -55,33 +88,13 @@
|
|||
android:gravity="top"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
<TextView
|
||||
android:id="@+id/overview_timeago"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_timeago"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_weight="0.5"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_apsmode"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_weight="0.5"
|
||||
android:background="@drawable/loopmodeborder"
|
||||
android:gravity="center_vertical|center_horizontal"
|
||||
android:paddingLeft="5dp"
|
||||
android:paddingRight="5dp"
|
||||
android:text="Medium Text"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
|
||||
</LinearLayout>
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_weight="0.5"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_delta"
|
||||
|
@ -91,18 +104,13 @@
|
|||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_activeprofile"
|
||||
android:id="@+id/overview_avgdelta"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_weight="0.5"
|
||||
android:background="@drawable/pillborder"
|
||||
android:gravity="center_vertical|center_horizontal"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="@color/colorProfileSwitchButton" />
|
||||
android:layout_marginLeft="10dp"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -209,7 +209,7 @@
|
|||
<string name="syncprofiletopump_title">Синхронизирай помпата с профила в Nightscout</string>
|
||||
<string name="nobtadapter">Няма bluetooth адаптер</string>
|
||||
<string name="nightscout">Nightscout</string>
|
||||
<string name="dismiss">ПРЕКРАТИ</string>
|
||||
<string name="dismiss">Разбрах</string>
|
||||
<string name="end_user_license_agreement">End User License Agreement</string>
|
||||
<string name="end_user_license_agreement_text">MUST NOT BE USED TO MAKE MEDICAL DECISIONS. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.</string>
|
||||
<string name="smscommunicator_allowednumbers_summary">+XXXXXXXXXX;+YYYYYYYYYY</string>
|
||||
|
@ -275,7 +275,7 @@
|
|||
<string name="enacted">Приложено</string>
|
||||
<string name="danar_sbolus">S bolus</string>
|
||||
<string name="failedupdatebasalprofile">Не може да се обнови базалния профил</string>
|
||||
<string name="hoursago">ч. преди</string>
|
||||
<string name="hoursago">h ago</string>
|
||||
<string name="objectives_0_gate">Потвърдете, че КЗ и данните от помпата са достъпни в Nightscout</string>
|
||||
<string name="danar_debolus">DE bolus</string>
|
||||
<string name="danar_dsbolus">DS bolus</string>
|
||||
|
@ -331,7 +331,7 @@
|
|||
<string name="circadian_percentage_profile">Процентен профил</string>
|
||||
<string name="send_to_pump">Изпрати към помпата</string>
|
||||
<string name="edit_base_basal">Редактирай базални стойности</string>
|
||||
<string name="dia">"DIA "</string>
|
||||
<string name="dia">DIA:</string>
|
||||
<string name="edit_base_ic">Редактирай Инс./ВХ</string>
|
||||
<string name="edit_base_isf">Редактирай Инс. чувствителност</string>
|
||||
<string name="fillbolus_title">Fill/Prime стандарта стойност</string>
|
||||
|
@ -350,4 +350,30 @@
|
|||
<string name="ns_upload_only_enabled">Моля изключете "NS upload only" за да използвате това.</string>
|
||||
<string name="ns_upload_only_summary">NS upload only. Not effective on SGV unless a local source like xDrip is selected. Not effective on Profiles while NS-Profiles is used.</string>
|
||||
<string name="absorption_rate">Усвояване на ВХ (ч):</string>
|
||||
<string name="alert_dialog_storage_permission_text">Моля рестартирайте телефона или AndroidAPS, в противен случай информацията за грешки няма да се запише(важно за да се потвърди, че алгоритъмът работи правилно)</string>
|
||||
<string name="androidaps_tempbasalendnote">Край на временен базал</string>
|
||||
<string name="androidaps_tempbasalstartnote">Старт на временен базал</string>
|
||||
<string name="basal_rate">Базал:</string>
|
||||
<string name="basalvaluebelowminimum">Базалните стойности са под минимума. Не е зададен профил!</string>
|
||||
<string name="batterydischarged">Батерията на помпата е изтощена</string>
|
||||
<string name="actualbg">КЗ:</string>
|
||||
<string name="danar_disableeasymode">Забрани EasyUI режим в помпата</string>
|
||||
<string name="danar_enableextendedbolus">Разреши удължен болус в помпата</string>
|
||||
<string name="danar_switchtouhmode">Промени режима от U/d на U/h в помпата</string>
|
||||
<string name="danarkoreanpump">DanaR за Корея</string>
|
||||
<string name="high_mark">Горна линия</string>
|
||||
<string name="lastbg">Последна КЗ:</string>
|
||||
<string name="low_mark">Долна линия</string>
|
||||
<string name="lowbattery">Изтощена батерия</string>
|
||||
<string name="open_settings_on_wear">Отвори Опции на часовника</string>
|
||||
<string name="prefs_range_summary">Горна и долна линия на диаграмата на часовника</string>
|
||||
<string name="prefs_range_title">Диапазон на визуализация</string>
|
||||
<string name="profile_set_failed">Неуспешно задаване на базален профил</string>
|
||||
<string name="profile_set_ok">Базалният профил е обновен</string>
|
||||
<string name="pumpNotInitializedProfileNotSet">Помпата не е инициализирана, профила не е зададен!</string>
|
||||
<string name="pumperror">Грешка на помпата</string>
|
||||
<string name="pumpshutdown">Помпата е изключена</string>
|
||||
<string name="resend_all_data">Изпрати всички данни отново</string>
|
||||
<string name="wear">Wear</string>
|
||||
<string name="wrongpumpdriverselected">Избран е грешен тип помпа</string>
|
||||
</resources>
|
||||
|
|
|
@ -238,7 +238,6 @@
|
|||
<string name="absolute">Absolute</string>
|
||||
<string name="canceltemp">임시기초주입 취소하기</string>
|
||||
<string name="smscommunicator">SMS 전송</string>
|
||||
<string name="mm640g">MM 640g</string>
|
||||
<string name="waitingforpumpresult">결과 기다리는 중</string>
|
||||
<string name="smscommunicator_allowednumbers">허가된 전화번호</string>
|
||||
<string name="smscommunicator_allowednumbers_summary">+XXXXXXXXXX;+YYYYYYYYYY</string>
|
||||
|
|
|
@ -388,4 +388,6 @@
|
|||
<string name="lastbg">Last BG:</string>
|
||||
<string name="mdi">MDI</string>
|
||||
<string name="MM640g">MM640g</string>
|
||||
<string name="ongoingnotificaction">Ongoing Notification</string>
|
||||
<string name="old_data">OLD DATA</string>
|
||||
</resources>
|
||||
|
|
27
app/src/test/info/nightscout/utils/RoundTest.java
Normal file
|
@ -0,0 +1,27 @@
|
|||
package info.nightscout.utils;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class RoundTest {
|
||||
|
||||
@Test
|
||||
public void roundTo() {
|
||||
assertEquals( 0.55d, Round.roundTo(0.54d, 0.05d), 0.00000001d );
|
||||
assertEquals( 1d, Round.roundTo(1.49d, 1d), 0.00000001d );
|
||||
}
|
||||
|
||||
@Test
|
||||
public void floorTo() {
|
||||
assertEquals( 0.5d, Round.floorTo(0.54d, 0.05d), 0.00000001d );
|
||||
assertEquals( 1d, Round.floorTo(1.59d, 1d), 0.00000001d );
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ceilTo() {
|
||||
assertEquals( 0.6d, Round.ceilTo(0.54d, 0.1d), 0.00000001d );
|
||||
assertEquals( 2d, Round.ceilTo(1.49999d, 1d), 0.00000001d );
|
||||
}
|
||||
|
||||
}
|
|
@ -3,7 +3,7 @@ apply plugin: 'com.android.application'
|
|||
|
||||
android {
|
||||
compileSdkVersion 23
|
||||
buildToolsVersion "23.0.3"
|
||||
buildToolsVersion "25.0.2"
|
||||
|
||||
defaultConfig {
|
||||
applicationId "info.nightscout.androidaps"
|
||||
|
|
|
@ -106,14 +106,6 @@
|
|||
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
|
||||
|
@ -122,6 +114,15 @@
|
|||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
|
||||
|
@ -134,10 +135,14 @@
|
|||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/ustwo-clockwise-debug/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-safeguard" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
|
||||
</content>
|
||||
|
|