Merge pull request #8 from MilosKozak/master

Update to milos master
This commit is contained in:
AdrianLxM 2016-11-08 22:34:07 +01:00 committed by GitHub
commit d3582dab36
8 changed files with 56 additions and 8 deletions

View file

@ -14,6 +14,26 @@ repositories {
maven { url 'https://maven.fabric.io/public' } maven { url 'https://maven.fabric.io/public' }
} }
def generateGitBuild = { ->
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append('"')
try {
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'describe', '--always'
standardOutput = stdout
}
String commitObject = stdout.toString().trim()
stringBuilder.append(commitObject)
} catch (ignored) {
return "NoGitSystemAvailable";
}
stringBuilder.append('-')
stringBuilder.append((new Date()).format('yyyy.MM.dd'))
stringBuilder.append('"')
return stringBuilder.toString()
}
android { android {
compileSdkVersion 23 compileSdkVersion 23
@ -25,6 +45,7 @@ android {
targetSdkVersion 23 targetSdkVersion 23
versionCode 1020 versionCode 1020
versionName "1.0.20" versionName "1.0.20"
buildConfigField "String", "BUILDVERSION", generateGitBuild()
} }
lintOptions { lintOptions {
disable 'MissingTranslation' disable 'MissingTranslation'

View file

@ -54,6 +54,9 @@ public class MainApp extends Application {
public void onCreate() { public void onCreate() {
super.onCreate(); super.onCreate();
Fabric.with(this, new Crashlytics()); Fabric.with(this, new Crashlytics());
Crashlytics.setString("BUILDVERSION", BuildConfig.BUILDVERSION);
log.info("Version: " + BuildConfig.VERSION_NAME);
log.info("BuildVersion: " + BuildConfig.BUILDVERSION);
sBus = new Bus(ThreadEnforcer.ANY); sBus = new Bus(ThreadEnforcer.ANY);
sInstance = this; sInstance = this;

View file

@ -20,6 +20,7 @@ import java.text.DateFormat;
import java.util.Date; import java.util.Date;
import java.util.Objects; import java.util.Objects;
import info.nightscout.androidaps.BuildConfig;
import info.nightscout.androidaps.Config; import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.Constants; import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
@ -592,19 +593,20 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
battery.put("percent", getDanaRPump().batteryRemaining); battery.put("percent", getDanaRPump().batteryRemaining);
status.put("status", "normal"); status.put("status", "normal");
status.put("timestamp", DateUtil.toISOString(getDanaRPump().lastConnection)); status.put("timestamp", DateUtil.toISOString(getDanaRPump().lastConnection));
extended.put("Version", BuildConfig.VERSION_NAME + "-" + BuildConfig.BUILDVERSION);
extended.put("PumpIOB", getDanaRPump().iob);
extended.put("LastBolus", getDanaRPump().lastBolusTime.toLocaleString());
extended.put("LastBolusAmount", getDanaRPump().lastBolusAmount);
if (isTempBasalInProgress()) { if (isTempBasalInProgress()) {
extended.put("TempBasalAbsoluteRate", getTempBasalAbsoluteRate()); extended.put("TempBasalAbsoluteRate", getTempBasalAbsoluteRate());
extended.put("TempBasalStart", getTempBasal().timeStart.toLocaleString()); extended.put("TempBasalStart", getTempBasal().timeStart.toLocaleString());
extended.put("TempBasalRemaining", getTempBasal().getPlannedRemainingMinutes()); extended.put("TempBasalRemaining", getTempBasal().getPlannedRemainingMinutes());
extended.put("IsExtended", getTempBasal().isExtended); extended.put("IsExtended", getTempBasal().isExtended);
extended.put("BaseBasalRate", getBaseBasalRate());
try { try {
extended.put("ActiveProfile", MainApp.getConfigBuilder().getActiveProfile().getProfile().getActiveProfile()); extended.put("ActiveProfile", MainApp.getConfigBuilder().getActiveProfile().getProfile().getActiveProfile());
} catch (Exception e) {} } catch (Exception e) {}
} }
extended.put("PumpIOB", getDanaRPump().iob); extended.put("BaseBasalRate", getBaseBasalRate());
extended.put("LastBolus", getDanaRPump().lastBolusTime.toLocaleString());
extended.put("LastBolusAmount", getDanaRPump().lastBolusAmount);
pump.put("battery", battery); pump.put("battery", battery);
pump.put("status", status); pump.put("status", status);

View file

@ -281,8 +281,6 @@ public class DanaRHistoryActivity extends Activity {
holder.stringvalue.setText(record.getStringRecordValue()); holder.stringvalue.setText(record.getStringRecordValue());
holder.bolustype.setText(record.getBolusType()); holder.bolustype.setText(record.getBolusType());
holder.duration.setText(DecimalFormatter.to0Decimal(record.getRecordDuration())); holder.duration.setText(DecimalFormatter.to0Decimal(record.getRecordDuration()));
holder.dailybasal.setText(DecimalFormatter.to2Decimal(record.getRecordDailyBasal()) + "U");
holder.dailybolus.setText(DecimalFormatter.to2Decimal(record.getRecordDailyBolus()) + "U");
holder.alarm.setText(record.getRecordAlarm()); holder.alarm.setText(record.getRecordAlarm());
switch (showingType) { switch (showingType) {
case RecordTypes.RECORD_TYPE_ALARM: case RecordTypes.RECORD_TYPE_ALARM:
@ -293,6 +291,7 @@ public class DanaRHistoryActivity extends Activity {
holder.duration.setVisibility(View.GONE); holder.duration.setVisibility(View.GONE);
holder.dailybasal.setVisibility(View.GONE); holder.dailybasal.setVisibility(View.GONE);
holder.dailybolus.setVisibility(View.GONE); holder.dailybolus.setVisibility(View.GONE);
holder.dailytotal.setVisibility(View.GONE);
holder.alarm.setVisibility(View.VISIBLE); holder.alarm.setVisibility(View.VISIBLE);
break; break;
case RecordTypes.RECORD_TYPE_BOLUS: case RecordTypes.RECORD_TYPE_BOLUS:
@ -303,9 +302,15 @@ public class DanaRHistoryActivity extends Activity {
holder.duration.setVisibility(View.VISIBLE); holder.duration.setVisibility(View.VISIBLE);
holder.dailybasal.setVisibility(View.GONE); holder.dailybasal.setVisibility(View.GONE);
holder.dailybolus.setVisibility(View.GONE); holder.dailybolus.setVisibility(View.GONE);
holder.dailytotal.setVisibility(View.GONE);
holder.alarm.setVisibility(View.GONE); holder.alarm.setVisibility(View.GONE);
break; break;
case RecordTypes.RECORD_TYPE_DAILY: case RecordTypes.RECORD_TYPE_DAILY:
df = DateFormat.getDateInstance(DateFormat.SHORT);
holder.dailybasal.setText(DecimalFormatter.to2Decimal(record.getRecordDailyBasal()) + "U");
holder.dailybolus.setText(DecimalFormatter.to2Decimal(record.getRecordDailyBolus()) + "U");
holder.dailytotal.setText(DecimalFormatter.to2Decimal(record.getRecordDailyBolus()+ record.getRecordDailyBasal()) + "U");
holder.time.setText(df.format(new Date(record.getRecordDate())));
holder.time.setVisibility(View.VISIBLE); holder.time.setVisibility(View.VISIBLE);
holder.value.setVisibility(View.GONE); holder.value.setVisibility(View.GONE);
holder.stringvalue.setVisibility(View.GONE); holder.stringvalue.setVisibility(View.GONE);
@ -313,6 +318,7 @@ public class DanaRHistoryActivity extends Activity {
holder.duration.setVisibility(View.GONE); holder.duration.setVisibility(View.GONE);
holder.dailybasal.setVisibility(View.VISIBLE); holder.dailybasal.setVisibility(View.VISIBLE);
holder.dailybolus.setVisibility(View.VISIBLE); holder.dailybolus.setVisibility(View.VISIBLE);
holder.dailytotal.setVisibility(View.VISIBLE);
holder.alarm.setVisibility(View.GONE); holder.alarm.setVisibility(View.GONE);
break; break;
case RecordTypes.RECORD_TYPE_GLUCOSE: case RecordTypes.RECORD_TYPE_GLUCOSE:
@ -331,6 +337,7 @@ public class DanaRHistoryActivity extends Activity {
holder.duration.setVisibility(View.GONE); holder.duration.setVisibility(View.GONE);
holder.dailybasal.setVisibility(View.GONE); holder.dailybasal.setVisibility(View.GONE);
holder.dailybolus.setVisibility(View.GONE); holder.dailybolus.setVisibility(View.GONE);
holder.dailytotal.setVisibility(View.GONE);
holder.alarm.setVisibility(View.GONE); holder.alarm.setVisibility(View.GONE);
break; break;
case RecordTypes.RECORD_TYPE_SUSPEND: case RecordTypes.RECORD_TYPE_SUSPEND:
@ -341,6 +348,7 @@ public class DanaRHistoryActivity extends Activity {
holder.duration.setVisibility(View.GONE); holder.duration.setVisibility(View.GONE);
holder.dailybasal.setVisibility(View.GONE); holder.dailybasal.setVisibility(View.GONE);
holder.dailybolus.setVisibility(View.GONE); holder.dailybolus.setVisibility(View.GONE);
holder.dailytotal.setVisibility(View.GONE);
holder.alarm.setVisibility(View.GONE); holder.alarm.setVisibility(View.GONE);
break; break;
} }
@ -365,6 +373,7 @@ public class DanaRHistoryActivity extends Activity {
TextView duration; TextView duration;
TextView dailybasal; TextView dailybasal;
TextView dailybolus; TextView dailybolus;
TextView dailytotal;
TextView alarm; TextView alarm;
HistoryViewHolder(View itemView) { HistoryViewHolder(View itemView) {
@ -377,6 +386,7 @@ public class DanaRHistoryActivity extends Activity {
duration = (TextView) itemView.findViewById(R.id.danar_history_duration); duration = (TextView) itemView.findViewById(R.id.danar_history_duration);
dailybasal = (TextView) itemView.findViewById(R.id.danar_history_dailybasal); dailybasal = (TextView) itemView.findViewById(R.id.danar_history_dailybasal);
dailybolus = (TextView) itemView.findViewById(R.id.danar_history_dailybolus); dailybolus = (TextView) itemView.findViewById(R.id.danar_history_dailybolus);
dailytotal = (TextView) itemView.findViewById(R.id.danar_history_dailytotal);
alarm = (TextView) itemView.findViewById(R.id.danar_history_alarm); alarm = (TextView) itemView.findViewById(R.id.danar_history_alarm);
} }
} }

View file

@ -64,7 +64,7 @@ public class IobTotal {
public JSONObject json() { public JSONObject json() {
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
try { try {
json.put("iob", iob + basaliob); json.put("iob", iob);
json.put("basaliob", basaliob); json.put("basaliob", basaliob);
json.put("activity", activity); json.put("activity", activity);
json.put("time", DateUtil.toISOString(new Date())); json.put("time", DateUtil.toISOString(new Date()));

View file

@ -10,6 +10,7 @@ import org.slf4j.LoggerFactory;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.Date; import java.util.Date;
import info.nightscout.androidaps.BuildConfig;
import info.nightscout.androidaps.Config; import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
@ -330,9 +331,11 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
JSONObject pump = new JSONObject(); JSONObject pump = new JSONObject();
JSONObject battery = new JSONObject(); JSONObject battery = new JSONObject();
JSONObject status = new JSONObject(); JSONObject status = new JSONObject();
JSONObject extended = new JSONObject();
try { try {
battery.put("percent", batteryPercent); battery.put("percent", batteryPercent);
status.put("status", "normal"); status.put("status", "normal");
extended.put("Version", BuildConfig.VERSION_NAME + "-" + BuildConfig.BUILDVERSION);
TempBasal tb; TempBasal tb;
if ((tb = getTempBasal()) != null) { if ((tb = getTempBasal()) != null) {
status.put("tempbasalpct", tb.percent); status.put("tempbasalpct", tb.percent);
@ -343,6 +346,7 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
pump.put("battery", battery); pump.put("battery", battery);
pump.put("status", status); pump.put("status", status);
pump.put("extended", extended);
pump.put("reservoir", reservoirInUnits); pump.put("reservoir", reservoirInUnits);
pump.put("clock", DateUtil.toISOString(new Date())); pump.put("clock", DateUtil.toISOString(new Date()));
} catch (JSONException e) { } catch (JSONException e) {

View file

@ -60,7 +60,7 @@ public class SlidingTabLayout extends HorizontalScrollView {
} }
private static final int TITLE_OFFSET_DIPS = 24; private static final int TITLE_OFFSET_DIPS = 24;
private static final int TAB_VIEW_PADDING_DIPS = 16; private static final int TAB_VIEW_PADDING_DIPS = 9;
private static final int TAB_VIEW_TEXT_SIZE_SP = 12; private static final int TAB_VIEW_TEXT_SIZE_SP = 12;
private int mTitleOffset; private int mTitleOffset;

View file

@ -72,6 +72,14 @@
android:paddingLeft="5dp" android:paddingLeft="5dp"
android:gravity="right" /> android:gravity="right" />
<TextView
android:id="@+id/danar_history_dailytotal"
android:layout_width="56dp"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:gravity="right"
android:visibility="gone"/>
<TextView <TextView
android:id="@+id/danar_history_alarm" android:id="@+id/danar_history_alarm"
android:layout_width="100dp" android:layout_width="100dp"