fix conflict
This commit is contained in:
commit
0048366dcf
34 changed files with 1432 additions and 844 deletions
|
@ -44,7 +44,7 @@ android {
|
|||
minSdkVersion 21
|
||||
targetSdkVersion 23
|
||||
versionCode 1400
|
||||
version "1.41"
|
||||
version "1.42"
|
||||
buildConfigField "String", "VERSION", '"' + version + '"'
|
||||
buildConfigField "String", "BUILDVERSION", generateGitBuild()
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="info.nightscout.androidaps">
|
||||
|
||||
<permission android:name="com.eveningoutpost.dexdrip.permissions.RECEIVE_EXTERNAL_STATUSLINE"/>
|
||||
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
|
||||
|
|
|
@ -292,6 +292,8 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_
|
|||
rT.COB=meal_data.mealCOB;
|
||||
rT.IOB=iob_data.iob;
|
||||
rT.reason="COB: " + meal_data.mealCOB + ", Dev: " + deviation + ", BGI: " + bgi + ", ISF: " + convert_bg(sens, profile) + ", Target: " + convert_bg(target_bg, profile) + "; ";
|
||||
if (typeof autosens_data !== 'undefined' && profile.autosens_adjust_targets && autosens_data.ratio != 1)
|
||||
rT.reason += "Autosens: " + autosens_data.ratio + "; ";
|
||||
if (bg < threshold) { // low glucose suspend mode: BG is < ~80
|
||||
rT.reason += "BG " + convert_bg(bg, profile) + "<" + convert_bg(threshold, profile);
|
||||
if ((glucose_status.delta <= 0 && minDelta <= 0) || (glucose_status.delta < expectedDelta && minDelta < expectedDelta) || bg < 60 ) {
|
||||
|
|
|
@ -57,4 +57,10 @@ public class Constants {
|
|||
|
||||
//NSClientInternal
|
||||
public static final int MAX_LOG_LINES = 100;
|
||||
|
||||
//Screen: Threshold for width to go into small width layout
|
||||
public static final int SMALL_WIDTH = 320;
|
||||
|
||||
//Autosens
|
||||
public static final double DEVIATION_TO_BE_EQUAL = 2.0;
|
||||
}
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package info.nightscout.androidaps;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Rect;
|
||||
|
@ -16,10 +18,15 @@ import android.support.v4.content.ContextCompat;
|
|||
import android.support.v4.view.ViewPager;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.PopupMenu;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageButton;
|
||||
|
||||
import com.joanzapata.iconify.Iconify;
|
||||
import com.joanzapata.iconify.fonts.FontAwesomeModule;
|
||||
|
@ -28,17 +35,21 @@ import com.squareup.otto.Subscribe;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.events.EventAppExit;
|
||||
import info.nightscout.androidaps.events.EventPreferenceChange;
|
||||
import info.nightscout.androidaps.events.EventRefreshGui;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.tabs.SlidingTabLayout;
|
||||
import info.nightscout.androidaps.tabs.TabPageAdapter;
|
||||
import info.nightscout.utils.ImportExportPrefs;
|
||||
import info.nightscout.utils.LocaleHelper;
|
||||
import info.nightscout.utils.LogDialog;
|
||||
import info.nightscout.utils.OKDialog;
|
||||
import info.nightscout.utils.PasswordProtection;
|
||||
import info.nightscout.utils.SP;
|
||||
import info.nightscout.utils.ToastUtils;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
|
||||
private static Logger log = LoggerFactory.getLogger(MainActivity.class);
|
||||
|
||||
static final int CASE_STORAGE = 0x1;
|
||||
|
@ -46,12 +57,18 @@ public class MainActivity extends AppCompatActivity {
|
|||
|
||||
private boolean askForSMS = false;
|
||||
|
||||
ImageButton menuButton;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
Iconify.with(new FontAwesomeModule());
|
||||
LocaleHelper.onCreate(this, "en");
|
||||
setContentView(R.layout.activity_main);
|
||||
menuButton = (ImageButton) findViewById(R.id.overview_menuButton);
|
||||
menuButton.setOnClickListener(this);
|
||||
|
||||
checkEula();
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP_MR1) {
|
||||
askForPermission(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE,
|
||||
|
@ -228,4 +245,81 @@ public class MainActivity extends AppCompatActivity {
|
|||
}
|
||||
return super.dispatchTouchEvent(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(final View v) {
|
||||
final Activity activity = this;
|
||||
switch (v.getId()) {
|
||||
case R.id.overview_menuButton:
|
||||
PopupMenu popup = new PopupMenu(v.getContext(), v);
|
||||
MenuInflater inflater = popup.getMenuInflater();
|
||||
inflater.inflate(R.menu.menu_main, popup.getMenu());
|
||||
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
int id = item.getItemId();
|
||||
switch (id) {
|
||||
case R.id.nav_preferences:
|
||||
PasswordProtection.QueryPassword(v.getContext(), R.string.settings_password, "settings_password", new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Intent i = new Intent(v.getContext(), PreferencesActivity.class);
|
||||
startActivity(i);
|
||||
}
|
||||
}, null);
|
||||
break;
|
||||
case R.id.nav_resetdb:
|
||||
new AlertDialog.Builder(v.getContext())
|
||||
.setTitle(R.string.nav_resetdb)
|
||||
.setMessage(R.string.reset_db_confirm)
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
MainApp.getDbHelper().resetDatabases();
|
||||
}
|
||||
})
|
||||
.create()
|
||||
.show();
|
||||
break;
|
||||
case R.id.nav_export:
|
||||
ImportExportPrefs.verifyStoragePermissions(activity);
|
||||
ImportExportPrefs.exportSharedPreferences(activity);
|
||||
break;
|
||||
case R.id.nav_import:
|
||||
ImportExportPrefs.verifyStoragePermissions(activity);
|
||||
ImportExportPrefs.importSharedPreferences(activity);
|
||||
break;
|
||||
case R.id.nav_show_logcat:
|
||||
LogDialog.showLogcat(v.getContext());
|
||||
break;
|
||||
case R.id.nav_about:
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(v.getContext());
|
||||
builder.setTitle(getString(R.string.app_name) + " " + BuildConfig.VERSION);
|
||||
if (BuildConfig.NSCLIENTOLNY)
|
||||
builder.setIcon(R.mipmap.yellowowl);
|
||||
else
|
||||
builder.setIcon(R.mipmap.blueowl);
|
||||
builder.setMessage("Build: " + BuildConfig.BUILDVERSION);
|
||||
builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), null);
|
||||
AlertDialog alertDialog = builder.create();
|
||||
alertDialog.show();
|
||||
break;
|
||||
case R.id.nav_exit:
|
||||
log.debug("Exiting");
|
||||
MainApp.instance().stopKeepAliveService();
|
||||
MainApp.bus().post(new EventAppExit());
|
||||
MainApp.closeDbHelper();
|
||||
finish();
|
||||
System.runFinalization();
|
||||
System.exit(0);
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
popup.show();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,6 +56,8 @@ import info.nightscout.androidaps.plugins.Treatments.TreatmentsFragment;
|
|||
import info.nightscout.androidaps.plugins.PumpVirtual.VirtualPumpFragment;
|
||||
import info.nightscout.androidaps.plugins.Wear.WearFragment;
|
||||
import info.nightscout.androidaps.plugins.Persistentnotification.PersistentNotificationPlugin;
|
||||
import info.nightscout.androidaps.plugins.XDripStatusline.StatuslineFragment;
|
||||
import info.nightscout.androidaps.plugins.XDripStatusline.StatuslinePlugin;
|
||||
import info.nightscout.androidaps.receivers.KeepAliveReceiver;
|
||||
import io.fabric.sdk.android.Fabric;
|
||||
|
||||
|
@ -122,6 +124,7 @@ public class MainApp extends Application {
|
|||
if (Config.SMSCOMMUNICATORENABLED) pluginsList.add(SmsCommunicatorFragment.getPlugin());
|
||||
|
||||
if (Config.WEAR) pluginsList.add(WearFragment.getPlugin(this));
|
||||
pluginsList.add(StatuslineFragment.getPlugin(this));
|
||||
pluginsList.add(new PersistentNotificationPlugin(this));
|
||||
pluginsList.add(NSClientInternalFragment.getPlugin());
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ import info.nightscout.androidaps.plugins.OpenAPSAMA.OpenAPSAMAPlugin;
|
|||
import info.nightscout.androidaps.plugins.PumpDanaRv2.DanaRv2Plugin;
|
||||
import info.nightscout.androidaps.plugins.PumpVirtual.VirtualPumpPlugin;
|
||||
import info.nightscout.androidaps.plugins.Wear.WearPlugin;
|
||||
import info.nightscout.androidaps.plugins.XDripStatusline.StatuslinePlugin;
|
||||
import info.nightscout.utils.LocaleHelper;
|
||||
|
||||
public class PreferencesActivity extends PreferenceActivity implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
|
@ -143,6 +144,11 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
|
|||
}
|
||||
}
|
||||
|
||||
StatuslinePlugin statuslinePlugin = (StatuslinePlugin) MainApp.getSpecificPlugin(StatuslinePlugin.class);
|
||||
if (statuslinePlugin != null && statuslinePlugin.isEnabled(PluginBase.GENERAL)) {
|
||||
addPreferencesFromResource(R.xml.pref_xdripstatus);
|
||||
}
|
||||
|
||||
initSummary(getPreferenceScreen());
|
||||
}
|
||||
|
||||
|
|
|
@ -78,6 +78,9 @@ public class TempBasal {
|
|||
Long date = (long) (timeStart.getTime() + j * tempBolusSpacing * 60 * 1000 + 0.5d * tempBolusSpacing * 60 * 1000);
|
||||
|
||||
Double basalRate = profile.getBasal(NSProfile.secondsFromMidnight(date));
|
||||
|
||||
if (basalRate == null)
|
||||
continue;
|
||||
if (isExtended) {
|
||||
netBasalRate = this.absolute;
|
||||
} else {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package info.nightscout.androidaps.plugins.Actions.dialogs;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
|
@ -153,6 +154,12 @@ public class NewTempBasalDialog extends DialogFragment implements View.OnClickLi
|
|||
result = pump.setTempBasalAbsolute(finalBasal, finalDurationInMinutes);
|
||||
}
|
||||
if (!result.success) {
|
||||
if (context instanceof Activity) {
|
||||
Activity activity = (Activity) context;
|
||||
if (activity.isFinishing()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
builder.setTitle(MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
|
||||
builder.setMessage(result.comment);
|
||||
|
|
|
@ -5,6 +5,7 @@ import android.content.Context;
|
|||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -21,6 +22,7 @@ import com.crashlytics.android.answers.CustomEvent;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.events.EventConfigBuilderChange;
|
||||
|
@ -78,6 +80,8 @@ public class ConfigBuilderFragment extends Fragment {
|
|||
PluginCustomAdapter constraintsDataAdapter = null;
|
||||
PluginCustomAdapter generalDataAdapter = null;
|
||||
|
||||
boolean smallWidth;
|
||||
|
||||
// TODO: sorting
|
||||
|
||||
@Override
|
||||
|
@ -85,6 +89,12 @@ public class ConfigBuilderFragment extends Fragment {
|
|||
Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.configbuilder_fragment, container, false);
|
||||
|
||||
//check screen width
|
||||
final DisplayMetrics dm = new DisplayMetrics();
|
||||
getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm);
|
||||
int screen_width = dm.widthPixels;
|
||||
smallWidth = screen_width < Constants.SMALL_WIDTH;
|
||||
|
||||
insulinListView = (ListView) view.findViewById(R.id.configbuilder_insulinlistview);
|
||||
bgsourceListView = (ListView) view.findViewById(R.id.configbuilder_bgsourcelistview);
|
||||
pumpListView = (ListView) view.findViewById(R.id.configbuilder_pumplistview);
|
||||
|
@ -134,44 +144,44 @@ public class ConfigBuilderFragment extends Fragment {
|
|||
}
|
||||
|
||||
void setViews() {
|
||||
insulinDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInListByInterface(InsulinInterface.class, PluginBase.INSULIN), PluginBase.INSULIN);
|
||||
insulinDataAdapter = new PluginCustomAdapter(getContext(), smallWidth?R.layout.configbuilder_smallitem :R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInListByInterface(InsulinInterface.class, PluginBase.INSULIN), PluginBase.INSULIN);
|
||||
insulinListView.setAdapter(insulinDataAdapter);
|
||||
setListViewHeightBasedOnChildren(insulinListView);
|
||||
bgsourceDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInListByInterface(BgSourceInterface.class, PluginBase.BGSOURCE), PluginBase.BGSOURCE);
|
||||
bgsourceDataAdapter = new PluginCustomAdapter(getContext(), smallWidth?R.layout.configbuilder_smallitem :R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInListByInterface(BgSourceInterface.class, PluginBase.BGSOURCE), PluginBase.BGSOURCE);
|
||||
bgsourceListView.setAdapter(bgsourceDataAdapter);
|
||||
setListViewHeightBasedOnChildren(bgsourceListView);
|
||||
pumpDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInList(PluginBase.PUMP), PluginBase.PUMP);
|
||||
pumpDataAdapter = new PluginCustomAdapter(getContext(), smallWidth?R.layout.configbuilder_smallitem :R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInList(PluginBase.PUMP), PluginBase.PUMP);
|
||||
pumpListView.setAdapter(pumpDataAdapter);
|
||||
if (MainApp.getSpecificPluginsVisibleInList(PluginBase.PUMP).size() == 0)
|
||||
pumpLabel.setVisibility(View.GONE);
|
||||
setListViewHeightBasedOnChildren(pumpListView);
|
||||
loopDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInList(PluginBase.LOOP), PluginBase.LOOP);
|
||||
loopDataAdapter = new PluginCustomAdapter(getContext(), smallWidth?R.layout.configbuilder_smallitem :R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInList(PluginBase.LOOP), PluginBase.LOOP);
|
||||
loopListView.setAdapter(loopDataAdapter);
|
||||
setListViewHeightBasedOnChildren(loopListView);
|
||||
if (MainApp.getSpecificPluginsVisibleInList(PluginBase.LOOP).size() == 0)
|
||||
loopLabel.setVisibility(View.GONE);
|
||||
treatmentsDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInList(PluginBase.TREATMENT), PluginBase.TREATMENT);
|
||||
treatmentsDataAdapter = new PluginCustomAdapter(getContext(), smallWidth?R.layout.configbuilder_smallitem :R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInList(PluginBase.TREATMENT), PluginBase.TREATMENT);
|
||||
treatmentsListView.setAdapter(treatmentsDataAdapter);
|
||||
setListViewHeightBasedOnChildren(treatmentsListView);
|
||||
tempsDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInList(PluginBase.TEMPBASAL), PluginBase.TEMPBASAL);
|
||||
tempsDataAdapter = new PluginCustomAdapter(getContext(), smallWidth?R.layout.configbuilder_smallitem :R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInList(PluginBase.TEMPBASAL), PluginBase.TEMPBASAL);
|
||||
tempsListView.setAdapter(tempsDataAdapter);
|
||||
setListViewHeightBasedOnChildren(tempsListView);
|
||||
if (MainApp.getSpecificPluginsVisibleInList(PluginBase.TEMPBASAL).size() == 0)
|
||||
tempsLabel.setVisibility(View.GONE);
|
||||
profileDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInListByInterface(ProfileInterface.class, PluginBase.BGSOURCE), PluginBase.PROFILE);
|
||||
profileDataAdapter = new PluginCustomAdapter(getContext(), smallWidth?R.layout.configbuilder_smallitem :R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInListByInterface(ProfileInterface.class, PluginBase.BGSOURCE), PluginBase.PROFILE);
|
||||
profileListView.setAdapter(profileDataAdapter);
|
||||
setListViewHeightBasedOnChildren(profileListView);
|
||||
apsDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInList(PluginBase.APS), PluginBase.APS);
|
||||
apsDataAdapter = new PluginCustomAdapter(getContext(), smallWidth?R.layout.configbuilder_smallitem :R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInList(PluginBase.APS), PluginBase.APS);
|
||||
apsListView.setAdapter(apsDataAdapter);
|
||||
setListViewHeightBasedOnChildren(apsListView);
|
||||
if (MainApp.getSpecificPluginsVisibleInList(PluginBase.APS).size() == 0)
|
||||
apsLabel.setVisibility(View.GONE);
|
||||
constraintsDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInListByInterface(ConstraintsInterface.class, PluginBase.BGSOURCE), PluginBase.CONSTRAINTS);
|
||||
constraintsDataAdapter = new PluginCustomAdapter(getContext(), smallWidth?R.layout.configbuilder_smallitem :R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInListByInterface(ConstraintsInterface.class, PluginBase.BGSOURCE), PluginBase.CONSTRAINTS);
|
||||
constraintsListView.setAdapter(constraintsDataAdapter);
|
||||
setListViewHeightBasedOnChildren(constraintsListView);
|
||||
if (MainApp.getSpecificPluginsVisibleInList(PluginBase.CONSTRAINTS).size() == 0)
|
||||
constraintsLabel.setVisibility(View.GONE);
|
||||
generalDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInList(PluginBase.GENERAL), PluginBase.GENERAL);
|
||||
generalDataAdapter = new PluginCustomAdapter(getContext(), smallWidth?R.layout.configbuilder_smallitem :R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInList(PluginBase.GENERAL), PluginBase.GENERAL);
|
||||
generalListView.setAdapter(generalDataAdapter);
|
||||
setListViewHeightBasedOnChildren(generalListView);
|
||||
|
||||
|
@ -206,7 +216,7 @@ public class ConfigBuilderFragment extends Fragment {
|
|||
PluginViewHolder holder = null;
|
||||
|
||||
if (view == null) {
|
||||
view = LayoutInflater.from(parent.getContext()).inflate(R.layout.configbuilder_simpleitem, null);
|
||||
view = LayoutInflater.from(parent.getContext()).inflate(smallWidth?R.layout.configbuilder_smallitem :R.layout.configbuilder_simpleitem, null);
|
||||
|
||||
holder = new PluginViewHolder();
|
||||
holder.name = (TextView) view.findViewById(R.id.configbuilder_simpleitem_name);
|
||||
|
|
|
@ -8,15 +8,17 @@ import java.util.Date;
|
|||
|
||||
public class AutosensData {
|
||||
long time = 0L;
|
||||
String pastSensitivity = "";
|
||||
double deviation = 0d;
|
||||
public String pastSensitivity = "";
|
||||
public double deviation = 0d;
|
||||
boolean calculateWithDeviation = false;
|
||||
double absorbed = 0d;
|
||||
double carbsFromBolus = 0d;
|
||||
public double cob = 0;
|
||||
public double bgi = 0d;
|
||||
public double delta = 0d;
|
||||
|
||||
public String log(long time) {
|
||||
return "AutosensData: " + new Date(time).toLocaleString() + " " + pastSensitivity + " Deviation=" + deviation + " Absorbed=" + absorbed + " CarbsFromBolus=" + carbsFromBolus + " COB=" + cob;
|
||||
return "AutosensData: " + new Date(time).toLocaleString() + " " + pastSensitivity + " Delta=" + delta + " Bgi=" + bgi + " Deviation=" + deviation + " Absorbed=" + absorbed + " CarbsFromBolus=" + carbsFromBolus + " COB=" + cob;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -234,7 +234,7 @@ public class IobCobCalculatorPlugin implements PluginBase {
|
|||
synchronized (dataLock) {
|
||||
NSProfile profile = ConfigBuilderPlugin.getActiveProfile() != null ? ConfigBuilderPlugin.getActiveProfile().getProfile() : null;
|
||||
|
||||
if (profile == null) {
|
||||
if (profile == null || profile.getIsf(NSProfile.secondsFromMidnight()) == null || profile.getIc(NSProfile.secondsFromMidnight()) == null) {
|
||||
log.debug("calculateSensitivityData: No profile available");
|
||||
return;
|
||||
}
|
||||
|
@ -280,12 +280,11 @@ public class IobCobCalculatorPlugin implements PluginBase {
|
|||
log.error("! value < 39");
|
||||
continue;
|
||||
}
|
||||
avgDelta = (bg - bucketed_data.get(i + 3).value) / 3;
|
||||
delta = (bg - bucketed_data.get(i + 1).value);
|
||||
|
||||
IobTotal iob = calulateFromTreatmentsAndTemps(bgTime);
|
||||
|
||||
double bgi = Math.round((-iob.activity * sens * 5) * 100) / 100d;
|
||||
double bgi = -iob.activity * sens * 5;
|
||||
double deviation = delta - bgi;
|
||||
|
||||
List<Treatment> recentTreatments = treatmentsInterface.getTreatments5MinBack(bgTime);
|
||||
|
@ -304,13 +303,15 @@ public class IobCobCalculatorPlugin implements PluginBase {
|
|||
}
|
||||
autosensData.cob += autosensData.carbsFromBolus;
|
||||
autosensData.deviation = deviation;
|
||||
autosensData.bgi = bgi;
|
||||
autosensData.delta = delta;
|
||||
|
||||
// calculate autosens only without COB
|
||||
if (autosensData.cob <= 0) {
|
||||
if (deviation > 0) {
|
||||
autosensData.pastSensitivity += "+";
|
||||
} else if (deviation == 0) {
|
||||
if (Math.abs(deviation) < Constants.DEVIATION_TO_BE_EQUAL) {
|
||||
autosensData.pastSensitivity += "=";
|
||||
} else if (deviation > 0) {
|
||||
autosensData.pastSensitivity += "+";
|
||||
} else {
|
||||
autosensData.pastSensitivity += "-";
|
||||
}
|
||||
|
@ -352,11 +353,24 @@ public class IobCobCalculatorPlugin implements PluginBase {
|
|||
return iobTotal;
|
||||
}
|
||||
|
||||
private static Long findPreviousTimeFromBucketedData(long time) {
|
||||
if (bucketed_data == null)
|
||||
return null;
|
||||
for (int index = 0; index < bucketed_data.size(); index++) {
|
||||
if (bucketed_data.get(index).timeIndex < time)
|
||||
return bucketed_data.get(index).timeIndex;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static AutosensData getAutosensData(long time) {
|
||||
long now = new Date().getTime();
|
||||
if (time > now)
|
||||
return null;
|
||||
time = roundUpTime(time);
|
||||
Long previous = findPreviousTimeFromBucketedData(time);
|
||||
if (previous == null)
|
||||
return null;
|
||||
time = roundUpTime(previous);
|
||||
AutosensData data = autosensDataTable.get(time);
|
||||
if (data != null) {
|
||||
//log.debug(">>> Cache hit " + data.log(time));
|
||||
|
@ -368,6 +382,8 @@ public class IobCobCalculatorPlugin implements PluginBase {
|
|||
}
|
||||
|
||||
public static AutosensData getLastAutosensData() {
|
||||
if (autosensDataTable.size() < 1)
|
||||
return null;
|
||||
AutosensData data = autosensDataTable.valueAt(autosensDataTable.size() - 1);
|
||||
if (data.time < new Date().getTime() - 5 * 60 * 1000) {
|
||||
return null;
|
||||
|
@ -432,8 +448,20 @@ public class IobCobCalculatorPlugin implements PluginBase {
|
|||
Double[] deviations = new Double[deviationsArray.size()];
|
||||
deviations = deviationsArray.toArray(deviations);
|
||||
|
||||
if (ConfigBuilderPlugin.getActiveProfile() == null || ConfigBuilderPlugin.getActiveProfile().getProfile() == null) {
|
||||
log.debug("No profile available");
|
||||
return new AutosensResult();
|
||||
}
|
||||
|
||||
NSProfile profile = ConfigBuilderPlugin.getActiveProfile().getProfile();
|
||||
|
||||
Double sens = profile.getIsf(NSProfile.secondsFromMidnight());
|
||||
|
||||
if (sens == null || profile.getMaxDailyBasal() == 0) {
|
||||
log.debug("No profile available");
|
||||
return new AutosensResult();
|
||||
}
|
||||
|
||||
double ratio = 1;
|
||||
String ratioLimit = "";
|
||||
String sensResult = "";
|
||||
|
@ -452,10 +480,10 @@ public class IobCobCalculatorPlugin implements PluginBase {
|
|||
double basalOff = 0;
|
||||
|
||||
if (pSensitive < 0) { // sensitive
|
||||
basalOff = pSensitive * (60 / 5) / NSProfile.toMgdl(profile.getIsf(NSProfile.secondsFromMidnight()), profile.getUnits());
|
||||
basalOff = pSensitive * (60 / 5) / NSProfile.toMgdl(sens, profile.getUnits());
|
||||
sensResult = "Excess insulin sensitivity detected";
|
||||
} else if (pResistant > 0) { // resistant
|
||||
basalOff = pResistant * (60 / 5) / NSProfile.toMgdl(profile.getIsf(NSProfile.secondsFromMidnight()), profile.getUnits());
|
||||
basalOff = pResistant * (60 / 5) / NSProfile.toMgdl(sens, profile.getUnits());
|
||||
sensResult = "Excess insulin resistance detected";
|
||||
} else {
|
||||
sensResult = "Sensitivity normal";
|
||||
|
@ -472,9 +500,9 @@ public class IobCobCalculatorPlugin implements PluginBase {
|
|||
log.debug(ratioLimit);
|
||||
}
|
||||
|
||||
double newisf = Math.round(NSProfile.toMgdl(profile.getIsf(NSProfile.secondsFromMidnight()), profile.getUnits()) / ratio);
|
||||
double newisf = Math.round(NSProfile.toMgdl(sens, profile.getUnits()) / ratio);
|
||||
if (ratio != 1) {
|
||||
log.debug("ISF adjusted from " + NSProfile.toMgdl(profile.getIsf(NSProfile.secondsFromMidnight()), profile.getUnits()) + " to " + newisf);
|
||||
log.debug("ISF adjusted from " + NSProfile.toMgdl(sens, profile.getUnits()) + " to " + newisf);
|
||||
}
|
||||
|
||||
AutosensResult output = new AutosensResult();
|
||||
|
|
|
@ -238,7 +238,7 @@ public class NSProfile {
|
|||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return 0D;
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getIsfList() {
|
||||
|
@ -429,7 +429,7 @@ public class NSProfile {
|
|||
}
|
||||
}
|
||||
|
||||
public Double getMaxDailyBasal() {
|
||||
public double getMaxDailyBasal() {
|
||||
Double max = 0d;
|
||||
for (Integer hour = 0; hour < 24; hour++) {
|
||||
double value = getBasal(hour * 60 * 60);
|
||||
|
|
|
@ -23,7 +23,8 @@ public class Notification {
|
|||
public static final int OLD_NSCLIENT = 8;
|
||||
public static final int INVALID_PHONE_NUMBER = 9;
|
||||
public static final int APPROACHING_DAILY_LIMIT = 10;
|
||||
public static final int NSCLIENT_NO_WRITE_PERMISSION = 10;
|
||||
public static final int NSCLIENT_NO_WRITE_PERMISSION = 11;
|
||||
public static final int MISSING_SMS_PERMISSION = 12;
|
||||
|
||||
public int id;
|
||||
public Date date;
|
||||
|
|
|
@ -18,6 +18,8 @@ import android.support.v7.widget.CardView;
|
|||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.PopupMenu;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.TypedValue;
|
||||
import android.view.ContextMenu;
|
||||
import android.view.HapticFeedbackConstants;
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -37,7 +39,9 @@ import com.crashlytics.android.answers.Answers;
|
|||
import com.crashlytics.android.answers.CustomEvent;
|
||||
import com.jjoe64.graphview.GraphView;
|
||||
import com.jjoe64.graphview.LabelFormatter;
|
||||
import com.jjoe64.graphview.ValueDependentColor;
|
||||
import com.jjoe64.graphview.Viewport;
|
||||
import com.jjoe64.graphview.series.BarGraphSeries;
|
||||
import com.jjoe64.graphview.series.DataPoint;
|
||||
import com.jjoe64.graphview.series.LineGraphSeries;
|
||||
import com.jjoe64.graphview.series.PointsGraphSeries;
|
||||
|
@ -145,13 +149,12 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
LinearLayout pumpStatusLayout;
|
||||
GraphView bgGraph;
|
||||
GraphView iobGraph;
|
||||
RelativeLayout iobGraphLayout;
|
||||
ImageButton menuButton;
|
||||
|
||||
CheckBox showPredictionView;
|
||||
CheckBox showBasalsView;
|
||||
CheckBox showIobView;
|
||||
CheckBox showCobView;
|
||||
CheckBox showDeviationsView;
|
||||
|
||||
RecyclerView notificationsView;
|
||||
LinearLayoutManager llm;
|
||||
|
@ -165,6 +168,10 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
Button acceptTempButton;
|
||||
Button quickWizardButton;
|
||||
|
||||
boolean smallWidth;
|
||||
|
||||
private int rangeToDisplay = 6; // for graph
|
||||
|
||||
Handler sLoopHandler = new Handler();
|
||||
Runnable sRefreshLoop = null;
|
||||
|
||||
|
@ -187,10 +194,19 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
//check screen width
|
||||
final DisplayMetrics dm = new DisplayMetrics();
|
||||
getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm);
|
||||
int screen_width = dm.widthPixels;
|
||||
smallWidth = screen_width < Constants.SMALL_WIDTH;
|
||||
|
||||
View view = inflater.inflate(R.layout.overview_fragment, container, false);
|
||||
|
||||
bgView = (TextView) view.findViewById(R.id.overview_bg);
|
||||
arrowView = (TextView) view.findViewById(R.id.overview_arrow);
|
||||
if(smallWidth){
|
||||
arrowView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 35);
|
||||
}
|
||||
timeAgoView = (TextView) view.findViewById(R.id.overview_timeago);
|
||||
deltaView = (TextView) view.findViewById(R.id.overview_delta);
|
||||
avgdeltaView = (TextView) view.findViewById(R.id.overview_avgdelta);
|
||||
|
@ -210,10 +226,6 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
|
||||
bgGraph = (GraphView) view.findViewById(R.id.overview_bggraph);
|
||||
iobGraph = (GraphView) view.findViewById(R.id.overview_iobgraph);
|
||||
iobGraphLayout = (RelativeLayout) view.findViewById(R.id.overview_iobgraphlayout);
|
||||
|
||||
menuButton = (ImageButton) view.findViewById(R.id.overview_menuButton);
|
||||
menuButton.setOnClickListener(this);
|
||||
|
||||
cancelTempButton = (Button) view.findViewById(R.id.overview_canceltempbutton);
|
||||
cancelTempButton.setOnClickListener(this);
|
||||
|
@ -237,14 +249,17 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
showBasalsView = (CheckBox) view.findViewById(R.id.overview_showbasals);
|
||||
showIobView = (CheckBox) view.findViewById(R.id.overview_showiob);
|
||||
showCobView = (CheckBox) view.findViewById(R.id.overview_showcob);
|
||||
showDeviationsView = (CheckBox) view.findViewById(R.id.overview_showdeviations);
|
||||
showPredictionView.setChecked(SP.getBoolean("showprediction", false));
|
||||
showBasalsView.setChecked(SP.getBoolean("showbasals", false));
|
||||
showIobView.setChecked(SP.getBoolean("showiob", false));
|
||||
showCobView.setChecked(SP.getBoolean("showcob", false));
|
||||
showDeviationsView.setChecked(SP.getBoolean("showdeviations", false));
|
||||
showPredictionView.setOnCheckedChangeListener(this);
|
||||
showBasalsView.setOnCheckedChangeListener(this);
|
||||
showIobView.setOnCheckedChangeListener(this);
|
||||
showCobView.setOnCheckedChangeListener(this);
|
||||
showDeviationsView.setOnCheckedChangeListener(this);
|
||||
|
||||
notificationsView = (RecyclerView) view.findViewById(R.id.overview_notifications);
|
||||
notificationsView.setHasFixedSize(true);
|
||||
|
@ -261,6 +276,16 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
iobGraph.getGridLabelRenderer().setLabelVerticalWidth(50);
|
||||
iobGraph.getGridLabelRenderer().setNumVerticalLabels(5);
|
||||
|
||||
bgGraph.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
rangeToDisplay += 6;
|
||||
rangeToDisplay = rangeToDisplay > 24 ? 6 : rangeToDisplay;
|
||||
updateGUI("rangeChange");
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
|
@ -307,9 +332,21 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
scheduleUpdateGUI("onIobCheckedChanged");
|
||||
break;
|
||||
case R.id.overview_showcob:
|
||||
showDeviationsView.setOnCheckedChangeListener(null);
|
||||
showDeviationsView.setChecked(false);
|
||||
showDeviationsView.setOnCheckedChangeListener(this);
|
||||
SP.putBoolean("showcob", showCobView.isChecked());
|
||||
SP.putBoolean("showdeviations", showDeviationsView.isChecked());
|
||||
scheduleUpdateGUI("onCobCheckedChanged");
|
||||
break;
|
||||
case R.id.overview_showdeviations:
|
||||
showCobView.setOnCheckedChangeListener(null);
|
||||
showCobView.setChecked(false);
|
||||
showCobView.setOnCheckedChangeListener(this);
|
||||
SP.putBoolean("showcob", showCobView.isChecked());
|
||||
SP.putBoolean("showdeviations", showDeviationsView.isChecked());
|
||||
scheduleUpdateGUI("onDeviationsCheckedChanged");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -457,76 +494,6 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
}
|
||||
});
|
||||
break;
|
||||
case R.id.overview_menuButton:
|
||||
PopupMenu popup = new PopupMenu(getContext(), v);
|
||||
MenuInflater inflater = popup.getMenuInflater();
|
||||
inflater.inflate(R.menu.menu_main, popup.getMenu());
|
||||
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
int id = item.getItemId();
|
||||
switch (id) {
|
||||
case R.id.nav_preferences:
|
||||
PasswordProtection.QueryPassword(getContext(), R.string.settings_password, "settings_password", new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Intent i = new Intent(getContext(), PreferencesActivity.class);
|
||||
startActivity(i);
|
||||
}
|
||||
}, null);
|
||||
break;
|
||||
case R.id.nav_resetdb:
|
||||
new AlertDialog.Builder(getContext())
|
||||
.setTitle(R.string.nav_resetdb)
|
||||
.setMessage(R.string.reset_db_confirm)
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
MainApp.getDbHelper().resetDatabases();
|
||||
}
|
||||
})
|
||||
.create()
|
||||
.show();
|
||||
break;
|
||||
case R.id.nav_export:
|
||||
ImportExportPrefs.verifyStoragePermissions(getActivity());
|
||||
ImportExportPrefs.exportSharedPreferences(getActivity());
|
||||
break;
|
||||
case R.id.nav_import:
|
||||
ImportExportPrefs.verifyStoragePermissions(getActivity());
|
||||
ImportExportPrefs.importSharedPreferences(getActivity());
|
||||
break;
|
||||
case R.id.nav_show_logcat:
|
||||
LogDialog.showLogcat(getContext());
|
||||
break;
|
||||
case R.id.nav_about:
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
|
||||
builder.setTitle(getString(R.string.app_name) + " " + BuildConfig.VERSION);
|
||||
if (BuildConfig.NSCLIENTOLNY)
|
||||
builder.setIcon(R.mipmap.yellowowl);
|
||||
else
|
||||
builder.setIcon(R.mipmap.blueowl);
|
||||
builder.setMessage("Build: " + BuildConfig.BUILDVERSION);
|
||||
builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), null);
|
||||
AlertDialog alertDialog = builder.create();
|
||||
alertDialog.show();
|
||||
break;
|
||||
case R.id.nav_exit:
|
||||
log.debug("Exiting");
|
||||
MainApp.instance().stopKeepAliveService();
|
||||
MainApp.bus().post(new EventAppExit());
|
||||
MainApp.closeDbHelper();
|
||||
getActivity().finish();
|
||||
System.runFinalization();
|
||||
System.exit(0);
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
popup.show();
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1047,9 +1014,10 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
boolean showPrediction = showPredictionView.isChecked() && finalLastRun != null && finalLastRun.constraintsProcessed.getClass().equals(DetermineBasalResultAMA.class);
|
||||
if (MainApp.getSpecificPlugin(OpenAPSAMAPlugin.class) != null && MainApp.getSpecificPlugin(OpenAPSAMAPlugin.class).isEnabled(PluginBase.APS)) {
|
||||
showPredictionView.setVisibility(View.VISIBLE);
|
||||
getActivity().findViewById(R.id.overview_showprediction_label).setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
showPredictionView.setVisibility(View.GONE);
|
||||
}
|
||||
getActivity().findViewById(R.id.overview_showprediction_label).setVisibility(View.GONE); }
|
||||
|
||||
// ****** GRAPH *******
|
||||
|
||||
|
@ -1069,12 +1037,12 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
int predHours = (int) (Math.ceil(((DetermineBasalResultAMA) finalLastRun.constraintsProcessed).getLatestPredictionsTime() - new Date().getTime()) / (60 * 60 * 1000));
|
||||
predHours = Math.min(2, predHours);
|
||||
predHours = Math.max(0, predHours);
|
||||
hoursToFetch = (int) (6 - predHours);
|
||||
hoursToFetch = (int) (rangeToDisplay - predHours);
|
||||
toTime = calendar.getTimeInMillis() + 100000; // little bit more to avoid wrong rounding
|
||||
fromTime = toTime - hoursToFetch * 60 * 60 * 1000L;
|
||||
endTime = toTime + predHours * 60 * 60 * 1000L;
|
||||
} else {
|
||||
hoursToFetch = 6;
|
||||
hoursToFetch = rangeToDisplay;
|
||||
toTime = calendar.getTimeInMillis() + 100000; // little bit more to avoid wrong rounding
|
||||
fromTime = toTime - hoursToFetch * 60 * 60 * 1000L;
|
||||
endTime = toTime;
|
||||
|
@ -1169,28 +1137,46 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
basalsLineSeries.setCustomPaint(paint);
|
||||
}
|
||||
|
||||
// **** IOB COB graph ****
|
||||
// **** IOB COB DEV graph ****
|
||||
class DeviationDataPoint extends DataPoint {
|
||||
public int color;
|
||||
public DeviationDataPoint(double x, double y, int color) {
|
||||
super(x, y);
|
||||
this.color = color;
|
||||
}
|
||||
}
|
||||
FixedLineGraphSeries<DataPoint> iobSeries;
|
||||
FixedLineGraphSeries<DataPoint> cobSeries;
|
||||
BarGraphSeries<DeviationDataPoint> devSeries;
|
||||
Double maxIobValueFound = 0d;
|
||||
Double maxCobValueFound = 0d;
|
||||
Double maxDevValueFound = 0d;
|
||||
|
||||
if (showIobView.isChecked() || showCobView.isChecked()) {
|
||||
if (showIobView.isChecked() || showCobView.isChecked() || showDeviationsView.isChecked()) {
|
||||
//Date start = new Date();
|
||||
List<DataPoint> iobArray = new ArrayList<>();
|
||||
List<DataPoint> cobArray = new ArrayList<>();
|
||||
List<DeviationDataPoint> devArray = new ArrayList<>();
|
||||
for (long time = fromTime; time <= now; time += 5 * 60 * 1000L) {
|
||||
if (showIobView.isChecked()) {
|
||||
IobTotal iob = IobCobCalculatorPlugin.calulateFromTreatmentsAndTemps(time);
|
||||
iobArray.add(new DataPoint(time, iob.iob));
|
||||
maxIobValueFound = Math.max(maxIobValueFound, Math.abs(iob.iob));
|
||||
}
|
||||
if (showCobView.isChecked()) {
|
||||
if (showCobView.isChecked() || showDeviationsView.isChecked()) {
|
||||
AutosensData autosensData = IobCobCalculatorPlugin.getAutosensData(time);
|
||||
if (autosensData != null) {
|
||||
if (autosensData != null && showCobView.isChecked()) {
|
||||
cobArray.add(new DataPoint(time, autosensData.cob));
|
||||
maxCobValueFound = Math.max(maxCobValueFound, autosensData.cob);
|
||||
}
|
||||
if (autosensData != null && showDeviationsView.isChecked()) {
|
||||
int color = Color.BLACK; // "="
|
||||
if (autosensData.pastSensitivity.equals("C")) color = Color.GRAY;
|
||||
if (autosensData.pastSensitivity.equals("+")) color = Color.GREEN;
|
||||
if (autosensData.pastSensitivity.equals("-")) color = Color.RED;
|
||||
devArray.add(new DeviationDataPoint(time, autosensData.deviation, color));
|
||||
maxDevValueFound = Math.max(maxDevValueFound, Math.abs(autosensData.deviation));
|
||||
}
|
||||
}
|
||||
}
|
||||
//Profiler.log(log, "IOB processed", start);
|
||||
|
@ -1201,17 +1187,21 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
iobSeries.setBackgroundColor(0x80FFFFFF & MainApp.sResources.getColor(R.color.iob)); //50%
|
||||
iobSeries.setColor(MainApp.sResources.getColor(R.color.iob));
|
||||
iobSeries.setThickness(3);
|
||||
iobSeries.setTitle("IOB");
|
||||
iobGraph.getGridLabelRenderer().setVerticalLabelsAlign(Paint.Align.LEFT);
|
||||
|
||||
|
||||
if (showIobView.isChecked() && showCobView.isChecked()) {
|
||||
if (showIobView.isChecked() && (showCobView.isChecked() || showDeviationsView.isChecked())) {
|
||||
List<DataPoint> cobArrayRescaled = new ArrayList<>();
|
||||
List<DeviationDataPoint> devArrayRescaled = new ArrayList<>();
|
||||
for (int ci = 0; ci < cobArray.size(); ci++) {
|
||||
cobArrayRescaled.add(new DataPoint(cobArray.get(ci).getX(), cobArray.get(ci).getY() * maxIobValueFound / maxCobValueFound / 2));
|
||||
}
|
||||
cobArray = cobArrayRescaled;
|
||||
for (int ci = 0; ci < devArray.size(); ci++) {
|
||||
devArrayRescaled.add(new DeviationDataPoint(devArray.get(ci).getX(), devArray.get(ci).getY() * maxIobValueFound / maxDevValueFound, devArray.get(ci).color));
|
||||
}
|
||||
cobArray = cobArrayRescaled;
|
||||
devArray = devArrayRescaled;
|
||||
}
|
||||
// COB
|
||||
DataPoint[] cobData = new DataPoint[cobArray.size()];
|
||||
cobData = cobArray.toArray(cobData);
|
||||
cobSeries = new FixedLineGraphSeries<>(cobData);
|
||||
|
@ -1219,7 +1209,20 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
cobSeries.setBackgroundColor(0xB0FFFFFF & MainApp.sResources.getColor(R.color.cob)); //50%
|
||||
cobSeries.setColor(MainApp.sResources.getColor(R.color.cob));
|
||||
cobSeries.setThickness(3);
|
||||
cobSeries.setTitle("COB");
|
||||
|
||||
// DEVIATIONS
|
||||
DeviationDataPoint[] devData = new DeviationDataPoint[devArray.size()];
|
||||
devData = devArray.toArray(devData);
|
||||
devSeries = new BarGraphSeries<>(devData);
|
||||
devSeries.setValueDependentColor(new ValueDependentColor<DeviationDataPoint>() {
|
||||
@Override
|
||||
public int get(DeviationDataPoint data) {
|
||||
return data.color;
|
||||
}
|
||||
});
|
||||
//devSeries.setBackgroundColor(0xB0FFFFFF & MainApp.sResources.getColor(R.color.cob)); //50%
|
||||
//devSeries.setColor(MainApp.sResources.getColor(R.color.cob));
|
||||
//devSeries.setThickness(3);
|
||||
|
||||
iobGraph.removeAllSeries();
|
||||
|
||||
|
@ -1228,21 +1231,13 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
}
|
||||
if (showCobView.isChecked() && cobData.length > 0) {
|
||||
iobGraph.addSeries(cobSeries);
|
||||
/* iobGraph.getSecondScale().setLabelFormatter(new LabelFormatter() {
|
||||
@Override
|
||||
public String formatLabel(double value, boolean isValueX) {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setViewport(Viewport viewport) {
|
||||
if (showDeviationsView.isChecked() && devData.length > 0) {
|
||||
iobGraph.addSeries(devSeries);
|
||||
}
|
||||
});
|
||||
*/
|
||||
}
|
||||
iobGraphLayout.setVisibility(View.VISIBLE);
|
||||
iobGraph.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
iobGraphLayout.setVisibility(View.GONE);
|
||||
iobGraph.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
// remove old data from graph
|
||||
|
|
|
@ -391,7 +391,7 @@ public class DanaRExecutionService extends Service {
|
|||
return true;
|
||||
}
|
||||
|
||||
public boolean bolus(Double amount, int carbs, Treatment t) {
|
||||
public boolean bolus(double amount, int carbs, Treatment t) {
|
||||
bolusingTreatment = t;
|
||||
MsgBolusStart start = new MsgBolusStart(amount);
|
||||
MsgBolusStop stop = new MsgBolusStop(amount, t);
|
||||
|
@ -405,6 +405,7 @@ public class DanaRExecutionService extends Service {
|
|||
}
|
||||
MsgBolusProgress progress = new MsgBolusProgress(amount, t); // initialize static variables
|
||||
MainApp.bus().post(new EventDanaRBolusStart());
|
||||
long startTime = new Date().getTime();
|
||||
|
||||
if (!stop.stopped) {
|
||||
mSerialIOThread.sendMessage(start);
|
||||
|
@ -422,7 +423,23 @@ public class DanaRExecutionService extends Service {
|
|||
}
|
||||
waitMsec(300);
|
||||
bolusingTreatment = null;
|
||||
// try to find real amount if bolusing was interrupted or comm failed
|
||||
if (t.insulin != amount) {
|
||||
disconnect("bolusingInterrupted");
|
||||
long now = new Date().getTime();
|
||||
long estimatedBolusEnd = (long) (startTime + amount / 5d * 60 * 1000); // std delivery rate 5 U/min
|
||||
waitMsec(Math.max(5000, estimatedBolusEnd - now + 3000));
|
||||
connect("bolusingInterrupted");
|
||||
getPumpStatus();
|
||||
if (danaRPump.lastBolusTime.getTime() > now - 60 * 1000L) { // last bolus max 1 min old
|
||||
t.insulin = danaRPump.lastBolusAmount;
|
||||
log.debug("Used bolus amount from history: " + danaRPump.lastBolusAmount);
|
||||
} else {
|
||||
log.debug("Bolus amount in history too old: " + danaRPump.lastBolusTime.toLocaleString());
|
||||
}
|
||||
} else {
|
||||
getPumpStatus();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -262,6 +262,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
|
|||
Answers.getInstance().logCustom(new CustomEvent("SMS_Bg"));
|
||||
break;
|
||||
case "LOOP":
|
||||
if (splited.length > 1)
|
||||
switch (splited[1].toUpperCase()) {
|
||||
case "DISABLE":
|
||||
case "STOP":
|
||||
|
@ -333,6 +334,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
|
|||
}
|
||||
break;
|
||||
case "TREATMENTS":
|
||||
if (splited.length > 1)
|
||||
switch (splited[1].toUpperCase()) {
|
||||
case "REFRESH":
|
||||
Intent restartNSClient = new Intent(Intents.ACTION_RESTART);
|
||||
|
@ -347,6 +349,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
|
|||
}
|
||||
break;
|
||||
case "NSCLIENT":
|
||||
if (splited.length > 1)
|
||||
switch (splited[1].toUpperCase()) {
|
||||
case "RESTART":
|
||||
Intent restartNSClient = new Intent(Intents.ACTION_RESTART);
|
||||
|
@ -450,7 +453,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
|
|||
PumpInterface pumpInterface = MainApp.getConfigBuilder();
|
||||
if (pumpInterface != null) {
|
||||
danaRPlugin = (DanaRPlugin) MainApp.getSpecificPlugin(DanaRPlugin.class);
|
||||
PumpEnactResult result = pumpInterface.deliverTreatment(MainApp.getConfigBuilder().getActiveInsulin() ,bolusWaitingForConfirmation.bolusRequested, 0, null);
|
||||
PumpEnactResult result = pumpInterface.deliverTreatment(MainApp.getConfigBuilder().getActiveInsulin(), bolusWaitingForConfirmation.bolusRequested, 0, null);
|
||||
if (result.success) {
|
||||
reply = String.format(MainApp.sResources.getString(R.string.smscommunicator_bolusdelivered), result.bolusDelivered);
|
||||
if (danaRPlugin != null)
|
||||
|
@ -557,6 +560,9 @@ public class SmsCommunicatorPlugin implements PluginBase {
|
|||
} catch (IllegalArgumentException e) {
|
||||
Notification notification = new Notification(Notification.INVALID_PHONE_NUMBER, MainApp.sResources.getString(R.string.smscommunicator_invalidphonennumber), Notification.NORMAL);
|
||||
MainApp.bus().post(new EventNewNotification(notification));
|
||||
} catch (java.lang.SecurityException e) {
|
||||
Notification notification = new Notification(Notification.MISSING_SMS_PERMISSION, MainApp.sResources.getString(R.string.smscommunicator_missingsmspermission), Notification.NORMAL);
|
||||
MainApp.bus().post(new EventNewNotification(notification));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
package info.nightscout.androidaps.plugins.XDripStatusline;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import info.nightscout.androidaps.R;
|
||||
|
||||
/**
|
||||
* Created by adrian on 17/11/16.
|
||||
*/
|
||||
|
||||
public class StatuslineFragment extends Fragment {
|
||||
|
||||
private static StatuslinePlugin statuslinePlugin;
|
||||
|
||||
public static StatuslinePlugin getPlugin(Context ctx) {
|
||||
|
||||
if (statuslinePlugin == null) {
|
||||
statuslinePlugin = new StatuslinePlugin(ctx);
|
||||
}
|
||||
|
||||
return statuslinePlugin;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,227 @@
|
|||
package info.nightscout.androidaps.plugins.XDripStatusline;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import com.squareup.otto.Subscribe;
|
||||
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.data.IobTotal;
|
||||
import info.nightscout.androidaps.db.TempBasal;
|
||||
import info.nightscout.androidaps.events.EventNewBG;
|
||||
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.Loop.LoopPlugin;
|
||||
import info.nightscout.utils.DecimalFormatter;
|
||||
|
||||
/**
|
||||
* Created by adrian on 17/11/16.
|
||||
*/
|
||||
|
||||
public class StatuslinePlugin implements PluginBase {
|
||||
|
||||
//broadcast related constants
|
||||
public static final String EXTRA_STATUSLINE = "com.eveningoutpost.dexdrip.Extras.Statusline";
|
||||
public static final String ACTION_NEW_EXTERNAL_STATUSLINE = "com.eveningoutpost.dexdrip.ExternalStatusline";
|
||||
public static final String RECEIVER_PERMISSION = "com.eveningoutpost.dexdrip.permissions.RECEIVE_EXTERNAL_STATUSLINE";
|
||||
|
||||
|
||||
static boolean fragmentEnabled = false;
|
||||
private static boolean lastLoopStatus;
|
||||
|
||||
private final Context ctx;
|
||||
SharedPreferences mPrefs;
|
||||
|
||||
StatuslinePlugin(Context ctx) {
|
||||
this.ctx = ctx;
|
||||
this.mPrefs = PreferenceManager.getDefaultSharedPreferences(ctx);
|
||||
|
||||
if (fragmentEnabled) {
|
||||
MainApp.bus().register(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType() {
|
||||
return PluginBase.GENERAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFragmentClass() {
|
||||
return StatuslineFragment.class.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return ctx.getString(R.string.xdripstatus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNameShort() {
|
||||
String name = MainApp.sResources.getString(R.string.xdripstatus_shortname);
|
||||
if (!name.trim().isEmpty()) {
|
||||
//only if translation exists
|
||||
return name;
|
||||
}
|
||||
// use long name as fallback
|
||||
return getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled(int type) {
|
||||
return type == GENERAL && fragmentEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisibleInTabs(int type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeHidden(int type) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasFragment() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showInList(int type) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
||||
if (type == GENERAL) {
|
||||
this.fragmentEnabled = fragmentEnabled;
|
||||
|
||||
if (fragmentEnabled) {
|
||||
MainApp.bus().register(this);
|
||||
sendStatus();
|
||||
}
|
||||
else{
|
||||
MainApp.bus().unregister(this);
|
||||
sendStatus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFragmentVisible(int type, boolean fragmentVisible) {
|
||||
// do nothing, no gui
|
||||
}
|
||||
|
||||
|
||||
private void sendStatus() {
|
||||
|
||||
|
||||
String status = ""; // sent once on disable
|
||||
|
||||
if(fragmentEnabled) {
|
||||
status = buildStatusString();
|
||||
}
|
||||
|
||||
|
||||
//sendData
|
||||
final Bundle bundle = new Bundle();
|
||||
bundle.putString(EXTRA_STATUSLINE, status);
|
||||
Intent intent = new Intent(ACTION_NEW_EXTERNAL_STATUSLINE);
|
||||
intent.putExtras(bundle);
|
||||
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
|
||||
ctx.sendBroadcast(intent, RECEIVER_PERMISSION);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
private String buildStatusString() {
|
||||
String status = "";
|
||||
boolean shortString = true; // make setting?
|
||||
|
||||
LoopPlugin activeloop = MainApp.getConfigBuilder().getActiveLoop();
|
||||
|
||||
if (activeloop != null && !activeloop.isEnabled(PluginBase.LOOP)) {
|
||||
status += ctx.getString(R.string.disabledloop) + "\n";
|
||||
lastLoopStatus = false;
|
||||
} else if (activeloop != null && activeloop.isEnabled(PluginBase.LOOP)) {
|
||||
lastLoopStatus = true;
|
||||
}
|
||||
|
||||
//Temp basal
|
||||
PumpInterface pump = MainApp.getConfigBuilder();
|
||||
|
||||
if (pump.isTempBasalInProgress()) {
|
||||
TempBasal activeTemp = pump.getTempBasal();
|
||||
if (shortString) {
|
||||
status += activeTemp.toStringShort();
|
||||
} else {
|
||||
status += activeTemp.toStringMedium();
|
||||
}
|
||||
}
|
||||
|
||||
//IOB
|
||||
MainApp.getConfigBuilder().getActiveTreatments().updateTotalIOB();
|
||||
IobTotal bolusIob = MainApp.getConfigBuilder().getActiveTreatments().getLastCalculation().round();
|
||||
MainApp.getConfigBuilder().getActiveTempBasals().updateTotalIOB();
|
||||
IobTotal basalIob = MainApp.getConfigBuilder().getActiveTempBasals().getLastCalculation().round();
|
||||
status += (shortString ? "" : (ctx.getString(R.string.treatments_iob_label_string) + " ")) + DecimalFormatter.to2Decimal(bolusIob.iob + basalIob.basaliob);
|
||||
|
||||
|
||||
if (mPrefs.getBoolean("xdripstatus_detailediob", true)) {
|
||||
status += "("
|
||||
+ DecimalFormatter.to2Decimal(bolusIob.iob) + "|"
|
||||
+ DecimalFormatter.to2Decimal(basalIob.basaliob) + ")";
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventPreferenceChange ev) {
|
||||
// status may be formated differently
|
||||
sendStatus();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventTreatmentChange ev) {
|
||||
sendStatus();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventTempBasalChange ev) {
|
||||
sendStatus();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventNewBG ev) {
|
||||
sendStatus();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventRefreshGui ev) {
|
||||
|
||||
//Filter events where loop is (de)activated
|
||||
|
||||
LoopPlugin activeloop = MainApp.getConfigBuilder().getActiveLoop();
|
||||
if (activeloop == null) return;
|
||||
|
||||
if ((lastLoopStatus != activeloop.isEnabled(PluginBase.LOOP))) {
|
||||
sendStatus();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static boolean isEnabled() {
|
||||
return fragmentEnabled;
|
||||
}
|
||||
|
||||
}
|
|
@ -18,7 +18,6 @@ import info.nightscout.androidaps.interfaces.PluginBase;
|
|||
*/
|
||||
public class TabPageAdapter extends FragmentStatePagerAdapter {
|
||||
|
||||
ArrayList<PluginBase> fragmentList = new ArrayList<>();
|
||||
ArrayList<PluginBase> visibleFragmentList = new ArrayList<>();
|
||||
|
||||
FragmentManager fm;
|
||||
|
@ -62,7 +61,6 @@ public class TabPageAdapter extends FragmentStatePagerAdapter {
|
|||
}
|
||||
|
||||
public void registerNewFragment(PluginBase plugin) {
|
||||
fragmentList.add(plugin);
|
||||
if (plugin.isVisibleInTabs(plugin.getType())) {
|
||||
visibleFragmentList.add(plugin);
|
||||
notifyDataSetChanged();
|
||||
|
|
|
@ -6,7 +6,11 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout xmlns:tools="http://schemas.android.com/tools"
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
@ -16,7 +20,8 @@
|
|||
android:id="@+id/tabs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="10dp" />
|
||||
android:layout_marginBottom="10dp"
|
||||
android:paddingEnd="30dp" />
|
||||
|
||||
<android.support.v4.view.ViewPager
|
||||
android:id="@+id/pager"
|
||||
|
@ -26,4 +31,16 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/overview_menuButton"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:background="@color/tabBgColor"
|
||||
android:paddingTop="5dp"
|
||||
app:srcCompat="@drawable/ic_more_vert_black_24dp" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</android.support.v4.widget.DrawerLayout>
|
48
app/src/main/res/layout/configbuilder_smallitem.xml
Normal file
48
app/src/main/res/layout/configbuilder_smallitem.xml
Normal file
|
@ -0,0 +1,48 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/configbuilder_simpleitem_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text=""
|
||||
android:textStyle="bold" />
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/configbuilder_simpleitem_checkboxenabled"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:focusable="false"
|
||||
android:focusableInTouchMode="false"
|
||||
android:text="@string/enabled" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/configbuilder_simpleitem_checkboxvisible"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:focusable="false"
|
||||
android:focusableInTouchMode="false"
|
||||
android:text="@string/visible" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/configbuilder_simpleitem_upimage"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:src="@android:drawable/arrow_up_float"
|
||||
android:contentDescription="@string/up" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
|
@ -47,6 +47,7 @@
|
|||
android:gravity="start"
|
||||
android:paddingLeft="5dp"
|
||||
android:text="{fa-bluetooth-b}"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="20dp" />
|
||||
|
||||
|
||||
|
@ -92,6 +93,7 @@
|
|||
android:layout_weight="1"
|
||||
android:gravity="start"
|
||||
android:paddingLeft="5dp"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="20dp" />
|
||||
|
||||
|
||||
|
@ -137,6 +139,7 @@
|
|||
android:layout_weight="1"
|
||||
android:gravity="start"
|
||||
android:paddingLeft="5dp"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -181,6 +184,7 @@
|
|||
android:layout_weight="1"
|
||||
android:gravity="start"
|
||||
android:paddingLeft="5dp"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -225,6 +229,7 @@
|
|||
android:layout_weight="1"
|
||||
android:gravity="start"
|
||||
android:paddingLeft="5dp"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -269,6 +274,7 @@
|
|||
android:layout_weight="1"
|
||||
android:gravity="start"
|
||||
android:paddingLeft="5dp"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -313,6 +319,7 @@
|
|||
android:layout_weight="1"
|
||||
android:gravity="start"
|
||||
android:paddingLeft="5dp"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -357,6 +364,7 @@
|
|||
android:layout_weight="1"
|
||||
android:gravity="start"
|
||||
android:paddingLeft="5dp"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -401,6 +409,7 @@
|
|||
android:layout_weight="1"
|
||||
android:gravity="start"
|
||||
android:paddingLeft="5dp"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -445,6 +454,7 @@
|
|||
android:layout_weight="1"
|
||||
android:gravity="start"
|
||||
android:paddingLeft="5dp"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -489,6 +499,7 @@
|
|||
android:layout_weight="1"
|
||||
android:gravity="start"
|
||||
android:paddingLeft="5dp"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -1,5 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="info.nightscout.androidaps.plugins.InsulinFastacting.InsulinFastactingFragment">
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
|
@ -83,4 +93,6 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</FrameLayout>
|
|
@ -78,7 +78,7 @@
|
|||
android:layout_marginRight="5dp"
|
||||
android:gravity="center_vertical|center_horizontal"
|
||||
android:text="@string/initializing"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
|
@ -105,7 +105,7 @@
|
|||
android:layout_marginTop="-15dp"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="-5dp"
|
||||
android:paddingRight="-10dp"
|
||||
android:paddingRight="-5dp"
|
||||
android:text="→"
|
||||
android:textSize="70dp"
|
||||
android:textStyle="bold" />
|
||||
|
@ -118,12 +118,6 @@
|
|||
android:gravity="top"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.5"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
@ -148,16 +142,6 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/overview_menuButton"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="5dp"
|
||||
android:layout_weight="0.5"
|
||||
app:srcCompat="@drawable/ic_more_vert_black_24dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_avgdelta"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -205,112 +189,6 @@
|
|||
android:layout_gravity="center_horizontal"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.jjoe64.graphview.GraphView
|
||||
android:id="@+id/overview_bggraph"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="160dip" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/overview_iobgraphlayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.jjoe64.graphview.GraphView
|
||||
android:id="@+id/overview_iobgraph"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="80dip" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:text="@string/predictionshortlabel"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/prediction"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/overview_showprediction"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="-5dp"
|
||||
android:layout_marginTop="-9dp"
|
||||
app:buttonTint="@color/prediction" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:text="@string/basalshortlabel"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/basal"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/overview_showbasals"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="-5dp"
|
||||
android:layout_marginTop="-9dp"
|
||||
app:buttonTint="@color/basal" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:text="@string/iob"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/iob"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/overview_showiob"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="-5dp"
|
||||
android:layout_marginTop="-9dp"
|
||||
app:buttonTint="@color/iob" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:text="@string/cob"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/cob"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/overview_showcob"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="-5dp"
|
||||
android:layout_marginTop="-9dp"
|
||||
app:buttonTint="@color/cob" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/overview_accepttemplayout"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -418,6 +296,118 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="5dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_showprediction_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:text="@string/predictionshortlabel"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/prediction"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/overview_showprediction"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="-5dp"
|
||||
android:layout_marginTop="-9dp"
|
||||
app:buttonTint="@color/prediction" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:text="@string/basalshortlabel"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/basal"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/overview_showbasals"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="-5dp"
|
||||
android:layout_marginTop="-9dp"
|
||||
app:buttonTint="@color/basal" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:text="@string/iob"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/iob"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/overview_showiob"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="-5dp"
|
||||
android:layout_marginTop="-9dp"
|
||||
app:buttonTint="@color/iob" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:text="@string/cob"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/cob"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/overview_showcob"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="-5dp"
|
||||
android:layout_marginTop="-9dp"
|
||||
app:buttonTint="@color/cob" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:text="@string/dev"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/deviations"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/overview_showdeviations"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="-5dp"
|
||||
android:layout_marginTop="-9dp"
|
||||
app:buttonTint="@color/deviations" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.jjoe64.graphview.GraphView
|
||||
android:id="@+id/overview_bggraph"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="160dip" />
|
||||
|
||||
<com.jjoe64.graphview.GraphView
|
||||
android:id="@+id/overview_iobgraph"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="100dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
|
|
@ -1,5 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="info.nightscout.androidaps.plugins.InsulinFastacting.InsulinFastactingFragment">
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
|
@ -106,4 +116,6 @@
|
|||
android:textSize="20sp" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</FrameLayout>
|
|
@ -1,5 +1,17 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="info.nightscout.androidaps.plugins.InsulinFastacting.InsulinFastactingFragment">
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
|
@ -190,4 +202,6 @@
|
|||
android:textSize="20sp" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</FrameLayout>
|
|
@ -1,5 +1,17 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="info.nightscout.androidaps.plugins.InsulinFastacting.InsulinFastactingFragment">
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:focusableInTouchMode="true"
|
||||
|
@ -123,4 +135,6 @@
|
|||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</FrameLayout>
|
|
@ -544,4 +544,5 @@
|
|||
<string name="enablesuperbolus">Povolit superbolus</string>
|
||||
<string name="enablesuperbolus_summary">Povolení superbolusu v kalkulátoru. Nepovolujte, dokud se nenaučíte, co to opravdu dělá. MŮŽE ZPŮSOBIT PŘEDÁVKOVÁNÍ INZULÍNEM PŘI NESPRÁVNÉM POUŽITÍ!</string>
|
||||
<string name="nav_about">O aplikaci</string>
|
||||
<string name="smscommunicator_missingsmspermission">Chybějící povolení SMS</string>
|
||||
</resources>
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
<color name="high">#FFFF00</color>
|
||||
<color name="listdelimiter">#505050</color>
|
||||
<color name="tabBgColor">#f0003f59</color>
|
||||
<color name="deviations">#FF0000</color>
|
||||
|
||||
<color name="tempTargetBackground">#77dd77</color>
|
||||
<color name="tempTargetDisabledBackground">#303F9F</color>
|
||||
|
|
|
@ -582,11 +582,12 @@
|
|||
<string name="ns_logappstartedevent">Log app start to NS</string>
|
||||
<string name="key_ns_logappstartedevent" translatable="false">ns_logappstartedevent</string>
|
||||
<string name="restartingapp">Exiting application to apply settings.</string>
|
||||
<string name="danarv2pump">DanaRv2</string>
|
||||
<string name="configbuilder_insulin">Insulin</string>
|
||||
<string name="fastactinginsulin">Fast Acting Insulin</string>
|
||||
<string name="fastactinginsulincomment">Novorapid, Novolog, Humalog</string>
|
||||
<string name="insulin_shortname">INS</string>
|
||||
<string name="fastactinginsulinprolonged">Fast Acting Insuin Prolonged</string>
|
||||
<string name="fastactinginsulinprolonged">Fast Acting Insulin Prolonged</string>
|
||||
<string name="key_usesuperbolus" translatable="false">key_usersuperbolus</string>
|
||||
<string name="enablesuperbolus">Enable superbolus in wizard</string>
|
||||
<string name="enablesuperbolus_summary">Enable superbolus functionality in wizard. Do not enable until you learn what it really does. IT MAY CAUSE INSULIN OVERDOSE IF USED BLINDLY!</string>
|
||||
|
@ -598,5 +599,9 @@
|
|||
<string name="virtualpump_lastconnection_label">Last connection</string>
|
||||
<string name="danar_bluetooth_status">Bluetooh status</string>
|
||||
<string name="nav_about">About</string>
|
||||
<string name="danarv2pump">DanaRv2</string>
|
||||
<string name="smscommunicator_missingsmspermission">Missing SMS permission</string>
|
||||
<string name="dev">DEV</string>
|
||||
<string name="xdripstatus_settings">xDrip Status (watch)</string>
|
||||
<string name="xdripstatus">xDrip Statusline (watch)</string>
|
||||
<string name="xdripstatus_shortname">xds</string>
|
||||
</resources>
|
||||
|
|
14
app/src/main/res/xml/pref_xdripstatus.xml
Normal file
14
app/src/main/res/xml/pref_xdripstatus.xml
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<PreferenceCategory
|
||||
android:key="xdripstatus"
|
||||
android:title="@string/xdripstatus_settings">
|
||||
|
||||
<SwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="xdripstatus_detailediob"
|
||||
android:title="@string/wear_detailedIOB_title"
|
||||
android:summary="@string/wear_detailedIOB_summary"/>
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
|
@ -35,6 +35,7 @@ public class TempTargetActivity extends ViewSelectorActivity {
|
|||
PlusMinusEditText highRange;
|
||||
PlusMinusEditText time;
|
||||
boolean isMGDL;
|
||||
boolean isSingleTarget;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -49,6 +50,7 @@ public class TempTargetActivity extends ViewSelectorActivity {
|
|||
|
||||
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
isMGDL = sp.getBoolean("units_mgdl", true);
|
||||
isSingleTarget = sp.getBoolean("singletarget", false);
|
||||
}
|
||||
|
||||
|
||||
|
@ -62,7 +64,7 @@ public class TempTargetActivity extends ViewSelectorActivity {
|
|||
private class MyGridViewPagerAdapter extends GridPagerAdapter {
|
||||
@Override
|
||||
public int getColumnCount(int arg0) {
|
||||
return 4;
|
||||
return isSingleTarget?3:4;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -102,10 +104,14 @@ public class TempTargetActivity extends ViewSelectorActivity {
|
|||
}
|
||||
lowRange = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 4d, 10d, 0.1d, new DecimalFormat("#0.0"), false);
|
||||
}
|
||||
if(isSingleTarget){
|
||||
setLabelToPlusMinusView(view, "target");
|
||||
} else {
|
||||
setLabelToPlusMinusView(view, "low");
|
||||
}
|
||||
container.addView(view);
|
||||
return view;
|
||||
} else if(col == 2){
|
||||
} else if(col == 2 && ! isSingleTarget){
|
||||
final View view = getInflatedPlusMinusView(container);
|
||||
if (isMGDL){
|
||||
double def = 100;
|
||||
|
@ -138,7 +144,7 @@ public class TempTargetActivity extends ViewSelectorActivity {
|
|||
+ " " + isMGDL
|
||||
+ " " + SafeParse.stringToInt(time.editText.getText().toString())
|
||||
+ " " + SafeParse.stringToDouble(lowRange.editText.getText().toString())
|
||||
+ " " + SafeParse.stringToDouble(highRange.editText.getText().toString())
|
||||
+ " " + (isSingleTarget?SafeParse.stringToDouble(lowRange.editText.getText().toString()):SafeParse.stringToDouble(highRange.editText.getText().toString()))
|
||||
;
|
||||
|
||||
ListenerService.initiateAction(TempTargetActivity.this, actionstring);
|
||||
|
|
|
@ -128,4 +128,11 @@
|
|||
android:title="Prime in Menu"
|
||||
app:wear_iconOff="@drawable/settings_off"
|
||||
app:wear_iconOn="@drawable/settings_on"/>
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:key="singletarget"
|
||||
android:summary="Single temp-target instead of a range."
|
||||
android:title="Single Target"
|
||||
app:wear_iconOff="@drawable/settings_off"
|
||||
app:wear_iconOn="@drawable/settings_on"/>
|
||||
</PreferenceScreen>
|
||||
|
|
Loading…
Reference in a new issue