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' }
}
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 {
compileSdkVersion 23
@ -25,6 +45,7 @@ android {
targetSdkVersion 23
versionCode 1020
versionName "1.0.20"
buildConfigField "String", "BUILDVERSION", generateGitBuild()
}
lintOptions {
disable 'MissingTranslation'

View file

@ -54,6 +54,9 @@ public class MainApp extends Application {
public void onCreate() {
super.onCreate();
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);
sInstance = this;

View file

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

View file

@ -281,8 +281,6 @@ public class DanaRHistoryActivity extends Activity {
holder.stringvalue.setText(record.getStringRecordValue());
holder.bolustype.setText(record.getBolusType());
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());
switch (showingType) {
case RecordTypes.RECORD_TYPE_ALARM:
@ -293,6 +291,7 @@ public class DanaRHistoryActivity extends Activity {
holder.duration.setVisibility(View.GONE);
holder.dailybasal.setVisibility(View.GONE);
holder.dailybolus.setVisibility(View.GONE);
holder.dailytotal.setVisibility(View.GONE);
holder.alarm.setVisibility(View.VISIBLE);
break;
case RecordTypes.RECORD_TYPE_BOLUS:
@ -303,9 +302,15 @@ public class DanaRHistoryActivity extends Activity {
holder.duration.setVisibility(View.VISIBLE);
holder.dailybasal.setVisibility(View.GONE);
holder.dailybolus.setVisibility(View.GONE);
holder.dailytotal.setVisibility(View.GONE);
holder.alarm.setVisibility(View.GONE);
break;
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.value.setVisibility(View.GONE);
holder.stringvalue.setVisibility(View.GONE);
@ -313,6 +318,7 @@ public class DanaRHistoryActivity extends Activity {
holder.duration.setVisibility(View.GONE);
holder.dailybasal.setVisibility(View.VISIBLE);
holder.dailybolus.setVisibility(View.VISIBLE);
holder.dailytotal.setVisibility(View.VISIBLE);
holder.alarm.setVisibility(View.GONE);
break;
case RecordTypes.RECORD_TYPE_GLUCOSE:
@ -331,6 +337,7 @@ public class DanaRHistoryActivity extends Activity {
holder.duration.setVisibility(View.GONE);
holder.dailybasal.setVisibility(View.GONE);
holder.dailybolus.setVisibility(View.GONE);
holder.dailytotal.setVisibility(View.GONE);
holder.alarm.setVisibility(View.GONE);
break;
case RecordTypes.RECORD_TYPE_SUSPEND:
@ -341,6 +348,7 @@ public class DanaRHistoryActivity extends Activity {
holder.duration.setVisibility(View.GONE);
holder.dailybasal.setVisibility(View.GONE);
holder.dailybolus.setVisibility(View.GONE);
holder.dailytotal.setVisibility(View.GONE);
holder.alarm.setVisibility(View.GONE);
break;
}
@ -365,6 +373,7 @@ public class DanaRHistoryActivity extends Activity {
TextView duration;
TextView dailybasal;
TextView dailybolus;
TextView dailytotal;
TextView alarm;
HistoryViewHolder(View itemView) {
@ -377,6 +386,7 @@ public class DanaRHistoryActivity extends Activity {
duration = (TextView) itemView.findViewById(R.id.danar_history_duration);
dailybasal = (TextView) itemView.findViewById(R.id.danar_history_dailybasal);
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);
}
}

View file

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

View file

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

View file

@ -72,6 +72,14 @@
android:paddingLeft="5dp"
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
android:id="@+id/danar_history_alarm"
android:layout_width="100dp"