commit
96a0d25183
13 changed files with 80 additions and 55 deletions
|
@ -5,7 +5,7 @@
|
|||
<GradleProjectSettings>
|
||||
<option name="distributionType" value="LOCAL" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleHome" value="C:\Program Files\Android\Android Studio\gradle\gradle-2.10" />
|
||||
<option name="gradleHome" value="C:\Program Files\Android\Android Studio\gradle\gradle-2.14.1" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
|
|
|
@ -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">
|
||||
|
|
|
@ -23,8 +23,8 @@ android {
|
|||
applicationId "info.nightscout.androidaps"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 23
|
||||
versionCode 1010
|
||||
versionName "1.0.10"
|
||||
versionCode 1011
|
||||
versionName "1.0.11"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
|
@ -33,6 +33,11 @@ android {
|
|||
}
|
||||
}
|
||||
productFlavors {
|
||||
danarcontrol {
|
||||
buildConfigField "boolean", "APS", "false"
|
||||
buildConfigField "boolean", "PUMPDRIVERS", "true"
|
||||
buildConfigField "boolean", "CLOSEDLOOP", "false"
|
||||
}
|
||||
careportal {
|
||||
buildConfigField "boolean", "APS", "false"
|
||||
buildConfigField "boolean", "PUMPDRIVERS", "false"
|
||||
|
|
|
@ -32,10 +32,6 @@ import info.nightscout.utils.LocaleHelper;
|
|||
public class MainActivity extends AppCompatActivity {
|
||||
private static Logger log = LoggerFactory.getLogger(MainActivity.class);
|
||||
|
||||
private Toolbar toolbar;
|
||||
private SlidingTabLayout mTabs;
|
||||
private ViewPager mPager;
|
||||
private static TabPageAdapter pageAdapter;
|
||||
private static KeepAliveReceiver keepAliveReceiver;
|
||||
|
||||
@Override
|
||||
|
@ -50,16 +46,15 @@ public class MainActivity extends AppCompatActivity {
|
|||
|
||||
// show version in toolbar
|
||||
try {
|
||||
setTitle(getString(R.string.app_name) + " v" + getPackageManager().getPackageInfo(getPackageName(), 0).versionName);
|
||||
setTitle(getString(R.string.app_name) + " " + getPackageManager().getPackageInfo(getPackageName(), 0).versionName);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
registerBus();
|
||||
|
||||
if (keepAliveReceiver == null) {
|
||||
|
||||
keepAliveReceiver = new KeepAliveReceiver();
|
||||
startService(new Intent(this, ExecutionService.class));
|
||||
keepAliveReceiver.setAlarm(this);
|
||||
|
@ -76,17 +71,18 @@ public class MainActivity extends AppCompatActivity {
|
|||
try { // activity may be destroyed
|
||||
setUpTabs(true);
|
||||
} catch (IllegalStateException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void setUpTabs(boolean switchToLast) {
|
||||
pageAdapter = new TabPageAdapter(getSupportFragmentManager(), this);
|
||||
TabPageAdapter pageAdapter = new TabPageAdapter(getSupportFragmentManager(), this);
|
||||
for (PluginBase p : MainApp.getPluginsList()) {
|
||||
pageAdapter.registerNewFragment(p);
|
||||
}
|
||||
mPager = (ViewPager) findViewById(R.id.pager);
|
||||
ViewPager mPager = (ViewPager) findViewById(R.id.pager);
|
||||
mPager.setAdapter(pageAdapter);
|
||||
mTabs = (SlidingTabLayout) findViewById(R.id.tabs);
|
||||
SlidingTabLayout mTabs = (SlidingTabLayout) findViewById(R.id.tabs);
|
||||
mTabs.setViewPager(mPager);
|
||||
if (switchToLast)
|
||||
mPager.setCurrentItem(pageAdapter.getCount() - 1, false);
|
||||
|
|
|
@ -301,7 +301,7 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
|
|||
|
||||
@Override
|
||||
public void onDateSet(DatePickerDialog view, int year, int monthOfYear, int dayOfMonth) {
|
||||
eventTime.setYear(year);
|
||||
eventTime.setYear(year - 1900);
|
||||
eventTime.setMonth(monthOfYear);
|
||||
eventTime.setDate(dayOfMonth);
|
||||
DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT);
|
||||
|
|
|
@ -24,7 +24,8 @@ public class MsgSettingShippingInfo extends MessageBase {
|
|||
DanaRPlugin.getDanaRPump().shippingCountry = asciiStringFromBuff(bytes, 13, 3);
|
||||
if (DanaRPlugin.getDanaRPump().shippingDate.getTime() > new Date(116, 4, 1).getTime()) {
|
||||
DanaRPlugin.getDanaRPump().isNewPump = true;
|
||||
}
|
||||
} else
|
||||
DanaRPlugin.getDanaRPump().isNewPump = false;
|
||||
if (Config.logDanaMessageDetail) {
|
||||
log.debug("Serial number: " + DanaRPlugin.getDanaRPump().serialNumber);
|
||||
log.debug("Shipping date: " + DanaRPlugin.getDanaRPump().shippingDate);
|
||||
|
|
|
@ -177,6 +177,13 @@ public class OpenAPSMAPlugin implements PluginBase, APSInterface {
|
|||
DetermineBasalResult determineBasalResult = determineBasalAdapterJS.invoke();
|
||||
// Fix bug determine basal
|
||||
if (determineBasalResult.rate == 0d && determineBasalResult.duration == 0 && !MainApp.getConfigBuilder().isTempBasalInProgress()) determineBasalResult.changeRequested = false;
|
||||
// limit requests on openloop mode
|
||||
if (!MainApp.getConfigBuilder().isClosedModeEnabled()) {
|
||||
if (MainApp.getConfigBuilder().isTempBasalInProgress() && Math.abs(determineBasalResult.rate - MainApp.getConfigBuilder().getTempBasalAbsoluteRate()) < 0.1)
|
||||
determineBasalResult.changeRequested = false;
|
||||
if (!MainApp.getConfigBuilder().isTempBasalInProgress() && Math.abs(determineBasalResult.rate - MainApp.getConfigBuilder().getBaseBasalRate()) < 0.1)
|
||||
determineBasalResult.changeRequested = false;
|
||||
}
|
||||
|
||||
determineBasalResult.iob = iobTotal;
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package info.nightscout.androidaps.plugins.Overview.Dialogs;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
|
@ -89,7 +90,8 @@ public class NewExtendedBolusDialog extends DialogFragment implements View.OnCli
|
|||
final Double finalInsulin = insulin;
|
||||
final int finalDurationInMinutes = durationInMinutes;
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this.getContext());
|
||||
final Context context = getContext();
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
builder.setTitle(this.getContext().getString(R.string.confirmation));
|
||||
builder.setMessage(confirmMessage);
|
||||
builder.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
|
@ -100,7 +102,7 @@ public class NewExtendedBolusDialog extends DialogFragment implements View.OnCli
|
|||
public void run() {
|
||||
PumpEnactResult result = pump.setExtendedBolus(finalInsulin, finalDurationInMinutes);
|
||||
if (!result.success) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
builder.setTitle(getContext().getString(R.string.treatmentdeliveryerror));
|
||||
builder.setMessage(result.comment);
|
||||
builder.setPositiveButton(getContext().getString(R.string.ok), null);
|
||||
|
|
|
@ -26,6 +26,8 @@ import android.widget.TextView;
|
|||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
|
@ -51,6 +53,7 @@ import info.nightscout.utils.SafeParse;
|
|||
import info.nightscout.utils.ToastUtils;
|
||||
|
||||
public class WizardDialog extends DialogFragment implements OnClickListener {
|
||||
private static Logger log = LoggerFactory.getLogger(WizardDialog.class);
|
||||
|
||||
Button wizardDialogDeliverButton;
|
||||
TextView correctionInput;
|
||||
|
@ -208,40 +211,44 @@ public class WizardDialog extends DialogFragment implements OnClickListener {
|
|||
final Double finalInsulinAfterConstraints = insulinAfterConstraints;
|
||||
final Integer finalCarbsAfterConstraints = carbsAfterConstraints;
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(parentContext);
|
||||
builder.setTitle(MainApp.sResources.getString(R.string.confirmation));
|
||||
builder.setMessage(confirmMessage);
|
||||
builder.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
if (finalInsulinAfterConstraints > 0 || finalCarbsAfterConstraints > 0) {
|
||||
final ConfigBuilderPlugin pump = MainApp.getConfigBuilder();
|
||||
mHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PumpEnactResult result = pump.deliverTreatmentFromBolusWizard(
|
||||
parentContext,
|
||||
finalInsulinAfterConstraints,
|
||||
finalCarbsAfterConstraints,
|
||||
SafeParse.stringToDouble(bgInput.getText().toString()),
|
||||
"Manual",
|
||||
SafeParse.stringToInt(carbTimeEdit.getText().toString()),
|
||||
boluscalcJSON
|
||||
);
|
||||
if (!result.success) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(parentContext);
|
||||
builder.setTitle(MainApp.sResources.getString(R.string.treatmentdeliveryerror));
|
||||
builder.setMessage(result.comment);
|
||||
builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), null);
|
||||
builder.show();
|
||||
if (parentContext != null) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(parentContext);
|
||||
builder.setTitle(MainApp.sResources.getString(R.string.confirmation));
|
||||
builder.setMessage(confirmMessage);
|
||||
builder.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
if (finalInsulinAfterConstraints > 0 || finalCarbsAfterConstraints > 0) {
|
||||
final ConfigBuilderPlugin pump = MainApp.getConfigBuilder();
|
||||
mHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PumpEnactResult result = pump.deliverTreatmentFromBolusWizard(
|
||||
parentContext,
|
||||
finalInsulinAfterConstraints,
|
||||
finalCarbsAfterConstraints,
|
||||
SafeParse.stringToDouble(bgInput.getText().toString()),
|
||||
"Manual",
|
||||
SafeParse.stringToInt(carbTimeEdit.getText().toString()),
|
||||
boluscalcJSON
|
||||
);
|
||||
if (!result.success) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(parentContext);
|
||||
builder.setTitle(MainApp.sResources.getString(R.string.treatmentdeliveryerror));
|
||||
builder.setMessage(result.comment);
|
||||
builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), null);
|
||||
builder.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(getString(R.string.cancel), null);
|
||||
builder.show();
|
||||
dismiss();
|
||||
});
|
||||
builder.setNegativeButton(getString(R.string.cancel), null);
|
||||
builder.show();
|
||||
dismiss();
|
||||
} else {
|
||||
log.error("parentContext == null");
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -247,6 +247,7 @@ public class OverviewFragment extends Fragment {
|
|||
}
|
||||
};
|
||||
sLoopHandler.postDelayed(sRefreshLoop, 60 * 1000L);
|
||||
updateGUIIfVisible();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
|
|
|
@ -12,6 +12,7 @@ import com.squareup.otto.Subscribe;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.text.Normalizer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
@ -226,11 +227,16 @@ public class SmsCommunicatorPlugin implements PluginBase {
|
|||
bolusWaitingForConfirmation = null;
|
||||
newSms.processed = true;
|
||||
}
|
||||
smsManager.sendTextMessage(newSms.phoneNumber, null, newSms.text, null, null);
|
||||
smsManager.sendTextMessage(newSms.phoneNumber, null, stripAccents(newSms.text), null, null);
|
||||
messages.add(newSms);
|
||||
}
|
||||
MainApp.bus().post(new EventSmsCommunicatorUpdateGui());
|
||||
}
|
||||
|
||||
|
||||
public static String stripAccents(String s)
|
||||
{
|
||||
s = Normalizer.normalize(s, Normalizer.Form.NFD);
|
||||
s = s.replaceAll("[\\p{InCombiningDiacriticalMarks}]", "");
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ buildscript {
|
|||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:2.1.2'
|
||||
classpath 'com.android.tools.build:gradle:2.1.3'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
|
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,6 +1,6 @@
|
|||
#Mon Dec 28 10:00:20 PST 2015
|
||||
#Thu Aug 18 17:59:31 CEST 2016
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
|
||||
|
|
Loading…
Reference in a new issue