Merge remote-tracking branch 'origin/dev' into combo-scripter-v2

* origin/dev:
  Cleanup gradle build files
  Add null check in ConfigBuildPlugin.getTempBasalFromHistory.
  Avoid race condition checking for an active TBR.
  Steampunk watch face: Chart readability improvement; point size increases when chert is highly zoomed in (less than 3 hours shown).

# Conflicts:
#	app/build.gradle
This commit is contained in:
Johannes Mockenhaupt 2018-01-13 23:18:44 +01:00
commit d54b99c559
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1
7 changed files with 96 additions and 71 deletions

View file

@ -9,9 +9,17 @@ buildscript {
classpath 'com.dicedmelon.gradle:jacoco-android:0.1.2' classpath 'com.dicedmelon.gradle:jacoco-android:0.1.2'
} }
} }
apply plugin: 'com.android.application' apply plugin: "com.android.application"
apply plugin: 'io.fabric' apply plugin: "io.fabric"
apply plugin: 'jacoco-android' apply plugin: "jacoco-android"
ext {
supportLibraryVersion = "23.4.0"
ormLiteVersion = "4.46"
powermockVersion = "1.7.3"
dexmakerVersion = "1.2"
}
repositories { repositories {
maven { url 'https://maven.fabric.io/public' } maven { url 'https://maven.fabric.io/public' }
@ -154,56 +162,58 @@ allprojects {
dependencies { dependencies {
wearApp project(':wear') wearApp project(':wear')
compile fileTree(include: ['*.jar'], dir: 'libs')
compile('com.crashlytics.sdk.android:crashlytics:2.6.7@aar') {
transitive = true;
}
compile('com.crashlytics.sdk.android:answers:1.3.12@aar') {
transitive = true;
}
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.android.support:gridlayout-v7:23.4.0'
compile "com.android.support:design:23.4.0"
compile "com.android.support:percent:23.4.0"
compile 'com.wdullaer:materialdatetimepicker:2.3.0'
compile 'com.squareup:otto:1.3.7'
compile 'com.j256.ormlite:ormlite-core:4.46'
compile 'com.j256.ormlite:ormlite-android:4.46'
compile('com.github.tony19:logback-android-classic:1.1.1-6') {
exclude group: 'com.google.android', module: 'android'
}
compile 'org.apache.commons:commons-lang3:3.6'
compile 'org.slf4j:slf4j-api:1.7.12'
compile 'com.jjoe64:graphview:4.0.1'
compile 'com.joanzapata.iconify:android-iconify-fontawesome:2.1.1'
compile 'com.google.android.gms:play-services-wearable:7.5.0'
compile 'junit:junit:4.12'
testCompile 'org.json:json:20140107'
testCompile 'org.mockito:mockito-core:2.7.22'
testCompile 'org.powermock:powermock-api-mockito2:1.7.3'
testCompile 'org.powermock:powermock-module-junit4-rule-agent:1.7.3'
testCompile 'org.powermock:powermock-module-junit4-rule:1.7.3'
testCompile 'org.powermock:powermock-module-junit4:1.7.3'
androidTestCompile 'org.mockito:mockito-core:2.7.22'
androidTestCompile 'com.google.dexmaker:dexmaker:1.2'
androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.2'
compile(name: 'android-edittext-validator-v1.3.4-mod', ext: 'aar')
compile('com.google.android:flexbox:0.3.0') {
exclude group: 'com.android.support'
}
compile('io.socket:socket.io-client:0.8.3') {
// excluding org.json which is provided by Android
exclude group: 'org.json', module: 'json'
}
compile 'com.google.code.gson:gson:2.7'
compile 'com.google.guava:guava:20.0'
compile project(path: ':ruffyscripter') compile project(path: ':ruffyscripter')
compile 'net.danlew:android.joda:2.9.9.1' compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'joda-time:joda-time:2.9.4.2' compile("com.crashlytics.sdk.android:crashlytics:2.6.7@aar") {
transitive = true;
}
compile("com.crashlytics.sdk.android:answers:1.3.12@aar") {
transitive = true;
}
compile "com.android.support:appcompat-v7:${supportLibraryVersion}"
compile "com.android.support:support-v4:${supportLibraryVersion}"
compile "com.android.support:cardview-v7:${supportLibraryVersion}"
compile "com.android.support:recyclerview-v7:${supportLibraryVersion}"
compile "com.android.support:gridlayout-v7:${supportLibraryVersion}"
compile "com.android.support:design:${supportLibraryVersion}"
compile "com.android.support:percent:${supportLibraryVersion}"
compile "com.wdullaer:materialdatetimepicker:2.3.0"
compile "com.squareup:otto:1.3.7"
compile "com.j256.ormlite:ormlite-core:${ormLiteVersion}"
compile "com.j256.ormlite:ormlite-android:${ormLiteVersion}"
compile("com.github.tony19:logback-android-classic:1.1.1-6") {
exclude group: "com.google.android", module: "android"
}
compile "org.apache.commons:commons-lang3:3.6"
compile "org.slf4j:slf4j-api:1.7.12"
compile "com.jjoe64:graphview:4.0.1"
compile "com.joanzapata.iconify:android-iconify-fontawesome:2.1.1"
compile "com.google.android.gms:play-services-wearable:7.5.0"
compile(name: "android-edittext-validator-v1.3.4-mod", ext: "aar")
compile("com.google.android:flexbox:0.3.0") {
exclude group: "com.android.support"
}
compile("io.socket:socket.io-client:0.8.3") {
// excluding org.json which is provided by Android
exclude group: "org.json", module: "json"
}
compile "com.google.code.gson:gson:2.7"
compile "com.google.guava:guava:20.0"
compile "net.danlew:android.joda:2.9.9.1"
testCompile "junit:junit:4.12"
testCompile "org.json:json:20140107"
testCompile "org.mockito:mockito-core:2.7.22"
testCompile "org.powermock:powermock-api-mockito2:${powermockVersion}"
testCompile "org.powermock:powermock-module-junit4-rule-agent:${powermockVersion}"
testCompile "org.powermock:powermock-module-junit4-rule:${powermockVersion}"
testCompile "org.powermock:powermock-module-junit4:${powermockVersion}"
testCompile "joda-time:joda-time:2.9.4.2"
androidTestCompile "org.mockito:mockito-core:2.7.22"
androidTestCompile "com.google.dexmaker:dexmaker:${dexmakerVersion}"
androidTestCompile "com.google.dexmaker:dexmaker-mockito:${dexmakerVersion}"
} }

View file

@ -631,7 +631,7 @@ public class ConfigBuilderPlugin implements PluginBase, ConstraintsInterface, Tr
@Override @Override
@Nullable @Nullable
public TemporaryBasal getTempBasalFromHistory(long time) { public TemporaryBasal getTempBasalFromHistory(long time) {
return activeTreatments.getTempBasalFromHistory(time); return activeTreatments != null ? activeTreatments.getTempBasalFromHistory(time) : null;
} }
@Override @Override

View file

@ -139,8 +139,8 @@ public class PersistentNotificationPlugin implements PluginBase {
} }
} }
if (MainApp.getConfigBuilder().isTempBasalInProgress()) { TemporaryBasal activeTemp = MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis());
TemporaryBasal activeTemp = MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis()); if (activeTemp != null) {
line1 += " " + activeTemp.toStringShort(); line1 += " " + activeTemp.toStringShort();
} }

View file

@ -403,8 +403,10 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
@Override @Override
public double getTempBasalRemainingMinutesFromHistory() { public double getTempBasalRemainingMinutesFromHistory() {
if (isTempBasalInProgress()) TemporaryBasal activeTemp = getTempBasalFromHistory(System.currentTimeMillis());
return getTempBasalFromHistory(System.currentTimeMillis()).getPlannedRemainingMinutes(); if (activeTemp != null) {
return activeTemp.getPlannedRemainingMinutes();
}
return 0; return 0;
} }

View file

@ -182,10 +182,9 @@ public class StatuslinePlugin implements PluginBase {
//Temp basal //Temp basal
TreatmentsInterface treatmentsInterface = MainApp.getConfigBuilder(); TreatmentsInterface treatmentsInterface = MainApp.getConfigBuilder();
if (treatmentsInterface.isTempBasalInProgress()) { TemporaryBasal activeTemp = treatmentsInterface.getTempBasalFromHistory(System.currentTimeMillis());
TemporaryBasal activeTemp = treatmentsInterface.getTempBasalFromHistory(System.currentTimeMillis()); if (activeTemp != null) {
status += activeTemp.toStringShort(); status += activeTemp.toStringShort();
} }
//IOB //IOB

View file

@ -1,5 +1,10 @@
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
ext {
supportLibraryVersion = "23.0.1"
wearableVersion = "2.0.1"
}
def generateGitBuild = { -> def generateGitBuild = { ->
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
@ -60,12 +65,12 @@ allprojects {
dependencies { dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs') compile fileTree(include: ['*.jar'], dir: 'libs')
//compile 'com.ustwo.android:clockwise-wearable:1.0.2' compile files("libs/hellocharts-library-1.5.5.jar")
provided 'com.google.android.wearable:wearable:2.0.1' //compile "com.ustwo.android:clockwise-wearable:1.0.2"
compile 'com.google.android.support:wearable:2.0.1' provided "com.google.android.wearable:wearable:${wearableVersion}"
compile 'com.google.android.gms:play-services-wearable:7.3.0' compile "com.google.android.support:wearable:${wearableVersion}"
compile files('libs/hellocharts-library-1.5.5.jar') compile "com.google.android.gms:play-services-wearable:7.3.0"
compile(name:'ustwo-clockwise-debug', ext:'aar') compile(name:"ustwo-clockwise-debug", ext:"aar")
compile 'com.android.support:support-v4:23.0.1' compile "com.android.support:support-v4:23.0.1"
compile 'me.denley.wearpreferenceactivity:wearpreferenceactivity:0.5.0' compile "me.denley.wearpreferenceactivity:wearpreferenceactivity:0.5.0"
} }

View file

@ -178,7 +178,11 @@ public class Steampunk extends BaseWatchFace {
gridColor = ContextCompat.getColor(getApplicationContext(), R.color.grey_steampunk); gridColor = ContextCompat.getColor(getApplicationContext(), R.color.grey_steampunk);
basalBackgroundColor = ContextCompat.getColor(getApplicationContext(), R.color.basal_dark); basalBackgroundColor = ContextCompat.getColor(getApplicationContext(), R.color.basal_dark);
basalCenterColor = ContextCompat.getColor(getApplicationContext(), R.color.basal_dark); basalCenterColor = ContextCompat.getColor(getApplicationContext(), R.color.basal_dark);
pointSize = 1; if (Integer.parseInt(sharedPrefs.getString("chart_timeframe", "3")) < 3) {
pointSize = 2;
} else {
pointSize = 1;
}
setupCharts(); setupCharts();
} }
@ -237,7 +241,12 @@ public class Steampunk extends BaseWatchFace {
private void changeChartTimeframe() { private void changeChartTimeframe() {
int timeframe = Integer.parseInt(sharedPrefs.getString("chart_timeframe", "3")); int timeframe = Integer.parseInt(sharedPrefs.getString("chart_timeframe", "3"));
timeframe = (timeframe%5) + 1; timeframe = (timeframe%5) + 1;
if (timeframe < 3) {
pointSize = 2;
} else {
pointSize = 1;
}
setupCharts();
sharedPrefs.edit().putString("chart_timeframe", "" + timeframe).commit(); sharedPrefs.edit().putString("chart_timeframe", "" + timeframe).commit();
} }
} }