From 1a94d3d55e12594460d9cc777379431bb85520d9 Mon Sep 17 00:00:00 2001 From: Philoul Date: Thu, 28 May 2020 16:26:57 +0200 Subject: [PATCH 1/4] Add Strings for secondary graph title for translation --- .../plugins/general/overview/OverviewMenus.kt | 22 +++++++++---------- app/src/main/res/values/strings.xml | 6 +++++ 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewMenus.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewMenus.kt index 1cc60f0400..02e66e4ae8 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewMenus.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewMenus.kt @@ -61,16 +61,16 @@ class OverviewMenus @Inject constructor( private val config: Config ) { - enum class CharType(@StringRes val nameId: Int, @ColorRes val colorId: Int, val primary: Boolean, val secondary: Boolean) { - PRE(R.string.overview_show_predictions, R.color.prediction, primary = true, secondary = false), - BAS(R.string.overview_show_basals, R.color.basal, primary = true, secondary = false), - IOB(R.string.overview_show_iob, R.color.iob, primary = false, secondary = true), - COB(R.string.overview_show_cob, R.color.cob, primary = false, secondary = true), - DEV(R.string.overview_show_deviations, R.color.deviations, primary = false, secondary = true), - SEN(R.string.overview_show_sensitivity, R.color.ratio, primary = false, secondary = true), - ACT(R.string.overview_show_activity, R.color.activity, primary = true, secondary = true), - ABS(R.string.overview_show_absinsulin, R.color.iob, primary = false, secondary = true), - DEVSLOPE(R.string.overview_show_deviationslope, R.color.devslopepos, primary = false, secondary = true) + enum class CharType(@StringRes val nameId: Int, @ColorRes val colorId: Int, val primary: Boolean, val secondary: Boolean, @StringRes val shortnameId: Int) { + PRE(R.string.overview_show_predictions, R.color.prediction, primary = true, secondary = false, shortnameId = R.string.prediction_shortname), + BAS(R.string.overview_show_basals, R.color.basal, primary = true, secondary = false,shortnameId = R.string.basal_shortname), + IOB(R.string.overview_show_iob, R.color.iob, primary = false, secondary = true,shortnameId = R.string.iob), + COB(R.string.overview_show_cob, R.color.cob, primary = false, secondary = true,shortnameId = R.string.cob), + DEV(R.string.overview_show_deviations, R.color.deviations, primary = false, secondary = true,shortnameId = R.string.deviation_shortname), + SEN(R.string.overview_show_sensitivity, R.color.ratio, primary = false, secondary = true,shortnameId = R.string.sensitivity_shortname), + ACT(R.string.overview_show_activity, R.color.activity, primary = true, secondary = true,shortnameId = R.string.activity_shortname), + ABS(R.string.overview_show_absinsulin, R.color.iob, primary = false, secondary = true,shortnameId = R.string.abs_insulin_shortname), + DEVSLOPE(R.string.overview_show_deviationslope, R.color.devslopepos, primary = false, secondary = true,shortnameId = R.string.devslope_shortname) } companion object { @@ -80,7 +80,7 @@ class OverviewMenus @Inject constructor( fun enabledTypes(graph: Int): String { val r = StringBuilder() for (type in CharType.values()) if (setting[graph][type.ordinal]) { - r.append(type.name) + r.append(resourceHelper.gs(type.shortnameId)) r.append(" ") } return r.toString() diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 4a4595fab4..7c3923fd9f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -527,8 +527,14 @@ Threshold warning battery level [%] statuslights_bat_critical Threshold critical battery level [%] + PRED IOB COB + BAS + DEV + ACT + ABS + DEVSLOPE About Missing SMS permission Missing phone state permission From 31b31775610cd6080ce2a9f64bddcddd44c61595 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Sun, 31 May 2020 10:12:36 +0200 Subject: [PATCH 2/4] upgrade fabric to firebase --- app/build.gradle | 13 +---- .../info/nightscout/androidaps/MainApp.java | 4 +- build.gradle | 3 +- core/build.gradle | 7 ++- .../nightscout/androidaps/data/Profile.java | 2 +- .../androidaps/utils/FabricPrivacy.kt | 52 ++----------------- 6 files changed, 13 insertions(+), 68 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index ddd3aae0cc..eb0b57bd1d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,13 +1,10 @@ buildscript { repositories { - maven { url 'https://maven.fabric.io/public' } jcenter() } dependencies { - classpath 'io.fabric.tools:gradle:1.+' classpath 'com.dicedmelon.gradle:jacoco-android:0.1.4' - classpath 'de.undercouch:gradle-download-task:3.4.3' } } apply plugin: 'com.android.application' @@ -15,10 +12,8 @@ apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-kapt' apply plugin: 'com.google.gms.google-services' -apply plugin: 'io.fabric' apply plugin: 'jacoco-android' -apply plugin: 'de.undercouch.download' - +apply plugin: 'com.google.firebase.crashlytics' jacoco { toolVersion = "0.8.3" @@ -33,7 +28,6 @@ ext { repositories { - maven { url 'https://maven.fabric.io/public' } jcenter { url "https://jcenter.bintray.com/" } mavenCentral() } @@ -249,12 +243,9 @@ dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') implementation 'com.google.android.gms:play-services-wearable:17.0.0' implementation "com.google.android.gms:play-services-location:17.0.0" - implementation 'com.google.firebase:firebase-core:17.4.0' + implementation 'com.google.firebase:firebase-core:17.4.2' implementation 'com.google.firebase:firebase-auth:19.3.1' implementation 'com.google.firebase:firebase-database:19.3.0' - implementation('com.crashlytics.sdk.android:crashlytics:2.10.1@aar') { - transitive = true; - } implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'androidx.legacy:legacy-support-v13:1.0.0' diff --git a/app/src/main/java/info/nightscout/androidaps/MainApp.java b/app/src/main/java/info/nightscout/androidaps/MainApp.java index 6b78a50599..85bfd24f44 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainApp.java +++ b/app/src/main/java/info/nightscout/androidaps/MainApp.java @@ -69,7 +69,7 @@ public class MainApp extends DaggerApplication { sResources = getResources(); LocaleHelper.INSTANCE.update(this); sDatabaseHelper = OpenHelperManager.getHelper(sInstance, DatabaseHelper.class); - +/* Thread.setDefaultUncaughtExceptionHandler((thread, ex) -> { if (ex instanceof InternalError) { // usually the app trying to spawn a thread while being killed @@ -77,7 +77,7 @@ public class MainApp extends DaggerApplication { } aapsLogger.error("Uncaught exception crashing app", ex); }); - +*/ registerActivityLifecycleCallbacks(activityMonitor); JodaTimeAndroid.init(this); diff --git a/build.gradle b/build.gradle index d33f0f9437..e4561df725 100644 --- a/build.gradle +++ b/build.gradle @@ -17,12 +17,11 @@ buildscript { repositories { google() jcenter() - maven { url 'https://maven.fabric.io/public' } } dependencies { classpath 'com.android.tools.build:gradle:3.6.3' classpath 'com.google.gms:google-services:4.3.3' - classpath 'io.fabric.tools:gradle:1.31.2' + classpath 'com.google.firebase:firebase-crashlytics-gradle:2.1.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/core/build.gradle b/core/build.gradle index b05a44d655..dd41752442 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -58,10 +58,9 @@ dependencies { //Logger implementation 'org.slf4j:slf4j-api:1.7.30' //Fabric - implementation 'com.google.firebase:firebase-core:17.4.0' - implementation('com.crashlytics.sdk.android:crashlytics:2.10.1@aar') { - transitive = true; - } + implementation 'com.google.firebase:firebase-analytics-ktx:17.4.2' + implementation 'com.google.firebase:firebase-crashlytics:17.0.0' + //RxBus implementation "io.reactivex.rxjava2:rxandroid:2.1.1" implementation 'org.apache.commons:commons-lang3:3.10' diff --git a/core/src/main/java/info/nightscout/androidaps/data/Profile.java b/core/src/main/java/info/nightscout/androidaps/data/Profile.java index 21eb288c09..7f583663bb 100644 --- a/core/src/main/java/info/nightscout/androidaps/data/Profile.java +++ b/core/src/main/java/info/nightscout/androidaps/data/Profile.java @@ -82,7 +82,7 @@ public class Profile { if (units != null) this.units = units; else { - fabricPrivacy.log("Profile failover failed too"); + fabricPrivacy.logCustom("Profile failover failed too"); this.units = Constants.MGDL; } } diff --git a/core/src/main/java/info/nightscout/androidaps/utils/FabricPrivacy.kt b/core/src/main/java/info/nightscout/androidaps/utils/FabricPrivacy.kt index c5e16878f5..744c692541 100644 --- a/core/src/main/java/info/nightscout/androidaps/utils/FabricPrivacy.kt +++ b/core/src/main/java/info/nightscout/androidaps/utils/FabricPrivacy.kt @@ -2,13 +2,12 @@ package info.nightscout.androidaps.utils import android.content.Context import android.os.Bundle -import com.crashlytics.android.Crashlytics import com.google.firebase.analytics.FirebaseAnalytics +import com.google.firebase.crashlytics.FirebaseCrashlytics import info.nightscout.androidaps.core.R import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.utils.sharedPreferences.SP -import io.fabric.sdk.android.Fabric import javax.inject.Inject import javax.inject.Singleton @@ -27,21 +26,9 @@ class FabricPrivacy @Inject constructor( var firebaseAnalytics: FirebaseAnalytics init { - instance = this firebaseAnalytics = FirebaseAnalytics.getInstance(context) firebaseAnalytics.setAnalyticsCollectionEnabled(!java.lang.Boolean.getBoolean("disableFirebase") && fabricEnabled()) - - if (fabricEnabled()) { - Fabric.with(context, Crashlytics()) - } - } - - companion object { - private lateinit var instance: FabricPrivacy - - @JvmStatic - @Deprecated("Use Dagger") - fun getInstance(): FabricPrivacy = instance + FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(!java.lang.Boolean.getBoolean("disableFirebase") && fabricEnabled()) } // Analytics logCustom @@ -76,39 +63,8 @@ class FabricPrivacy @Inject constructor( // Crashlytics logException fun logException(throwable: Throwable) { - try { - val crashlytics = Crashlytics.getInstance() - crashlytics.core.logException(throwable) - aapsLogger.debug(LTag.CORE, "Exception: ", throwable) - } catch (e: NullPointerException) { - aapsLogger.debug(LTag.CORE, "Ignoring opted out non-initialized log: $throwable") - } catch (e: IllegalStateException) { - aapsLogger.debug(LTag.CORE, "Ignoring opted out non-initialized log: $throwable") - } - } - - // Crashlytics log - fun log(msg: String) { - try { - val crashlytics = Crashlytics.getInstance() - crashlytics.core.log(msg) - } catch (e: NullPointerException) { - aapsLogger.debug(LTag.CORE, "Ignoring opted out non-initialized log: $msg") - } catch (e: IllegalStateException) { - aapsLogger.debug(LTag.CORE, "Ignoring opted out non-initialized log: $msg") - } - } - - // Crashlytics log - fun log(priority: Int, tag: String?, msg: String) { - try { - val crashlytics = Crashlytics.getInstance() - crashlytics.core.log(priority, tag, msg) - } catch (e: NullPointerException) { - aapsLogger.debug(LTag.CORE, "Ignoring opted out non-initialized log: $msg") - } catch (e: IllegalStateException) { - aapsLogger.debug(LTag.CORE, "Ignoring opted out non-initialized log: $msg") - } + FirebaseCrashlytics.getInstance().recordException(throwable) + aapsLogger.debug(LTag.CORE, "Exception: ", throwable) } fun fabricEnabled(): Boolean { From 09de329934c6d438175279eb9e38bb6684e35585 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Sun, 31 May 2020 11:27:12 +0200 Subject: [PATCH 3/4] libs update & cleanup --- app/build.gradle | 10 +++++----- .../plugins/general/maintenance/ImportExportPrefs.kt | 5 ++--- build.gradle | 6 +++--- core/build.gradle | 2 +- dana/build.gradle | 3 +-- danar/build.gradle | 8 +------- danars/build.gradle | 5 +---- wear/build.gradle | 2 +- 8 files changed, 15 insertions(+), 26 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index eb0b57bd1d..5bda0b7b45 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -22,8 +22,8 @@ jacoco { ext { powermockVersion = "1.7.3" dexmakerVersion = "1.2" - retrofit2Version = '2.8.1' - okhttp3Version = '4.6.0' + retrofit2Version = '2.9.0' + okhttp3Version = '4.7.2' } @@ -256,12 +256,11 @@ dependencies { implementation 'androidx.gridlayout:gridlayout:1.0.0' implementation 'androidx.percentlayout:percentlayout:1.0.0' implementation "androidx.preference:preference-ktx:1.1.1" - implementation "androidx.activity:activity:${activityVersion}" implementation "androidx.activity:activity-ktx:${activityVersion}" implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'com.google.android.material:material:1.1.0' - implementation "io.reactivex.rxjava2:rxandroid:2.1.1" + implementation "io.reactivex.rxjava2:rxandroid:${rxandroid_version}" implementation "com.j256.ormlite:ormlite-core:${ormLiteVersion}" implementation "com.j256.ormlite:ormlite-android:${ormLiteVersion}" @@ -274,6 +273,7 @@ dependencies { implementation "com.jjoe64:graphview:4.0.1" implementation "com.joanzapata.iconify:android-iconify-fontawesome:2.2.2" implementation 'com.madgag.spongycastle:core:1.58.0.0' + // Omnipod wizard implementation(name: "com.atech-software.android.library.wizardpager-1.1.1", ext: "aar") implementation("com.google.android:flexbox:0.3.0") { @@ -299,7 +299,7 @@ dependencies { implementation 'com.eatthepath:java-otp:0.2.0' testImplementation "junit:junit:4.13" - testImplementation "org.json:json:20190722" + testImplementation 'org.json:json:20200518' testImplementation "org.mockito:mockito-core:2.8.47" testImplementation "org.powermock:powermock-api-mockito2:${powermockVersion}" testImplementation "org.powermock:powermock-module-junit4-rule-agent:${powermockVersion}" diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/ImportExportPrefs.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/ImportExportPrefs.kt index 4fa6c43fce..565b33b77b 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/ImportExportPrefs.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/ImportExportPrefs.kt @@ -7,7 +7,6 @@ import android.content.Context import android.content.Intent import android.content.pm.PackageManager import android.provider.Settings -import androidx.activity.invoke import androidx.annotation.StringRes import androidx.core.content.ContextCompat import androidx.fragment.app.Fragment @@ -221,7 +220,7 @@ class ImportExportPrefs @Inject constructor( importSharedPreferences(fragmentAct, it) } } - callForPrefFile.invoke() + callForPrefFile.launch(null) } } @@ -231,7 +230,7 @@ class ImportExportPrefs @Inject constructor( importSharedPreferences(activity, it) } } - callForPrefFile.invoke() + callForPrefFile.launch(null) } private fun importSharedPreferences(activity: Activity, importFile: PrefsFile) { diff --git a/build.gradle b/build.gradle index e4561df725..1e9b924fc7 100644 --- a/build.gradle +++ b/build.gradle @@ -9,9 +9,9 @@ buildscript { rxkotlin_version = '2.4.0' room_version = '2.2.5' lifecycle_version = '2.2.0' - dagger_version = '2.27' - coroutinesVersion = '1.3.5' - activityVersion = '1.2.0-alpha04' + dagger_version = '2.28' + coroutinesVersion = '1.3.7' + activityVersion = '1.2.0-alpha05' ormLiteVersion = "4.46" } repositories { diff --git a/core/build.gradle b/core/build.gradle index dd41752442..5f2fed073e 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -62,7 +62,7 @@ dependencies { implementation 'com.google.firebase:firebase-crashlytics:17.0.0' //RxBus - implementation "io.reactivex.rxjava2:rxandroid:2.1.1" + implementation "io.reactivex.rxjava2:rxandroid:${rxandroid_version}" implementation 'org.apache.commons:commons-lang3:3.10' // Graphview cannot be upgraded diff --git a/dana/build.gradle b/dana/build.gradle index 4450b57df6..09205a9337 100644 --- a/dana/build.gradle +++ b/dana/build.gradle @@ -51,10 +51,9 @@ dependencies { implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'androidx.core:core-ktx:1.2.0' implementation "androidx.preference:preference-ktx:1.1.1" - implementation "androidx.activity:activity:${activityVersion}" implementation "androidx.activity:activity-ktx:${activityVersion}" - implementation "io.reactivex.rxjava2:rxandroid:2.1.1" + implementation "io.reactivex.rxjava2:rxandroid:${rxandroid_version}" // Graphview cannot be upgraded implementation "com.jjoe64:graphview:4.0.1" diff --git a/danar/build.gradle b/danar/build.gradle index 83399cc43a..878641c87a 100644 --- a/danar/build.gradle +++ b/danar/build.gradle @@ -53,14 +53,8 @@ dependencies { implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'androidx.core:core-ktx:1.2.0' implementation "androidx.preference:preference-ktx:1.1.1" - implementation "androidx.activity:activity:${activityVersion}" implementation "androidx.activity:activity-ktx:${activityVersion}" - implementation "io.reactivex.rxjava2:rxandroid:2.1.1" - - // remove after conversion to aapslogger - implementation 'org.slf4j:slf4j-api:1.7.30' - // Graphview cannot be upgraded implementation "com.jjoe64:graphview:4.0.1" @@ -74,7 +68,7 @@ dependencies { kapt "com.google.dagger:dagger-compiler:$dagger_version" //RxBus - implementation "io.reactivex.rxjava2:rxandroid:2.1.1" + implementation "io.reactivex.rxjava2:rxandroid:${rxandroid_version}" testImplementation 'junit:junit:4.13' androidTestImplementation 'androidx.test.ext:junit:1.1.1' diff --git a/danars/build.gradle b/danars/build.gradle index 80a5623e04..4e991b502d 100644 --- a/danars/build.gradle +++ b/danars/build.gradle @@ -52,11 +52,8 @@ dependencies { implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'androidx.core:core-ktx:1.2.0' implementation "androidx.preference:preference-ktx:1.1.1" - implementation "androidx.activity:activity:${activityVersion}" implementation "androidx.activity:activity-ktx:${activityVersion}" - implementation "io.reactivex.rxjava2:rxandroid:2.1.1" - // Graphview cannot be upgraded implementation "com.jjoe64:graphview:4.0.1" @@ -70,7 +67,7 @@ dependencies { kapt "com.google.dagger:dagger-compiler:$dagger_version" //RxBus - implementation "io.reactivex.rxjava2:rxandroid:2.1.1" + implementation "io.reactivex.rxjava2:rxandroid:${rxandroid_version}" testImplementation 'junit:junit:4.13' androidTestImplementation 'androidx.test.ext:junit:1.1.1' diff --git a/wear/build.gradle b/wear/build.gradle index fbfeeccfbc..94441d025d 100644 --- a/wear/build.gradle +++ b/wear/build.gradle @@ -124,7 +124,7 @@ dependencies { implementation('com.github.lecho:hellocharts-library:1.5.8@aar') testImplementation 'junit:junit:4.13' - testImplementation 'org.json:json:20190722' + testImplementation 'org.json:json:20200518' testImplementation ("org.mockito:mockito-core:2.8.47") { exclude group: 'net.bytebuddy', module: 'byte-buddy' exclude group: 'net.bytebuddy', module: 'byte-buddy-android' From 55bccafef5d246bc1255d8db622eb43ca565c817 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Sun, 31 May 2020 12:02:42 +0200 Subject: [PATCH 4/4] Large display skin --- .../nightscout/androidaps/MainActivity.kt | 1 + .../dependencyInjection/SkinsModule.kt | 7 ++++++ .../general/overview/OverviewFragment.kt | 3 ++- .../androidaps/skins/SkinButtonsOn.kt | 4 +++- .../androidaps/skins/SkinClassic.kt | 4 +++- .../androidaps/skins/SkinInterface.kt | 2 ++ .../androidaps/skins/SkinLargeDisplay.kt | 23 +++++++++++++++++++ app/src/main/res/values/strings.xml | 5 ++-- 8 files changed, 44 insertions(+), 5 deletions(-) create mode 100644 app/src/main/java/info/nightscout/androidaps/skins/SkinLargeDisplay.kt diff --git a/app/src/main/java/info/nightscout/androidaps/MainActivity.kt b/app/src/main/java/info/nightscout/androidaps/MainActivity.kt index f25cf49fc9..7881fea604 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainActivity.kt +++ b/app/src/main/java/info/nightscout/androidaps/MainActivity.kt @@ -174,6 +174,7 @@ class MainActivity : NoSplashAppCompatActivity() { private fun processPreferenceChange(ev: EventPreferenceChange) { if (ev.isChanged(resourceHelper, R.string.key_keep_screen_on)) setWakeLock() + if (ev.isChanged(resourceHelper, R.string.key_skin)) recreate() } private fun setupViews() { diff --git a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/SkinsModule.kt b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/SkinsModule.kt index ebd4691f38..cd71cc8fd2 100644 --- a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/SkinsModule.kt +++ b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/SkinsModule.kt @@ -8,6 +8,7 @@ import dagger.multibindings.IntoMap import info.nightscout.androidaps.skins.SkinButtonsOn import info.nightscout.androidaps.skins.SkinClassic import info.nightscout.androidaps.skins.SkinInterface +import info.nightscout.androidaps.skins.SkinLargeDisplay import javax.inject.Qualifier @Module @@ -25,6 +26,12 @@ open class SkinsModule { @IntKey(10) fun bindsSkinButtonsOn(skinButtonsOn: SkinButtonsOn): SkinInterface = skinButtonsOn + @Provides + @Skin + @IntoMap + @IntKey(20) + fun bindsSkinLargeDisplay(skinLargeDisplay: SkinLargeDisplay): SkinInterface = skinLargeDisplay + @Qualifier annotation class Skin } \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt index c9ea872345..07dbc14b94 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt @@ -184,6 +184,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList overview_bggraph?.gridLabelRenderer?.gridColor = resourceHelper.gc(R.color.graphgrid) overview_bggraph?.gridLabelRenderer?.reloadStyles() overview_bggraph?.gridLabelRenderer?.labelVerticalWidth = axisWidth + overview_bggraph?.layoutParams?.height = resourceHelper.dpToPx(skinProvider.activeSkin().mainGraphHeight) rangeToDisplay = sp.getInt(R.string.key_rangetodisplay, 6) @@ -482,7 +483,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList overview_iobgraph.addView(label) secondaryGraphsLabel.add(label) val graph = GraphView(context) - graph.layoutParams = LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, resourceHelper.dpToPx(100)).also { it.setMargins(0, resourceHelper.dpToPx(35), 0, resourceHelper.dpToPx(15)) } + graph.layoutParams = LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, resourceHelper.dpToPx(skinProvider.activeSkin().secondaryGraphHeight)).also { it.setMargins(0, resourceHelper.dpToPx(35), 0, resourceHelper.dpToPx(15)) } graph.gridLabelRenderer?.gridColor = resourceHelper.gc(R.color.graphgrid) graph.gridLabelRenderer?.reloadStyles() graph.gridLabelRenderer?.isHorizontalLabelsVisible = false diff --git a/app/src/main/java/info/nightscout/androidaps/skins/SkinButtonsOn.kt b/app/src/main/java/info/nightscout/androidaps/skins/SkinButtonsOn.kt index b2243d3336..9584ce2f4b 100644 --- a/app/src/main/java/info/nightscout/androidaps/skins/SkinButtonsOn.kt +++ b/app/src/main/java/info/nightscout/androidaps/skins/SkinButtonsOn.kt @@ -8,7 +8,9 @@ import javax.inject.Singleton @Singleton class SkinButtonsOn @Inject constructor(private val config: Config) : SkinInterface { - override val description: Int get() = R.string.buttonson_desrciption + override val description: Int get() = R.string.buttonson_description + override val mainGraphHeight: Int get() = 200 + override val secondaryGraphHeight: Int get() = 100 override fun overviewLayout(isLandscape: Boolean, isTablet: Boolean, isSmallHeight: Boolean): Int = when { diff --git a/app/src/main/java/info/nightscout/androidaps/skins/SkinClassic.kt b/app/src/main/java/info/nightscout/androidaps/skins/SkinClassic.kt index deef2440f3..9388843db8 100644 --- a/app/src/main/java/info/nightscout/androidaps/skins/SkinClassic.kt +++ b/app/src/main/java/info/nightscout/androidaps/skins/SkinClassic.kt @@ -8,7 +8,9 @@ import javax.inject.Singleton @Singleton class SkinClassic @Inject constructor(private val config: Config): SkinInterface { - override val description: Int get() = R.string.classic_desrciption + override val description: Int get() = R.string.classic_description + override val mainGraphHeight: Int get() = 200 + override val secondaryGraphHeight: Int get() = 100 override fun overviewLayout(isLandscape: Boolean, isTablet: Boolean, isSmallHeight: Boolean): Int = when { diff --git a/app/src/main/java/info/nightscout/androidaps/skins/SkinInterface.kt b/app/src/main/java/info/nightscout/androidaps/skins/SkinInterface.kt index 6a9d055a13..73c047d100 100644 --- a/app/src/main/java/info/nightscout/androidaps/skins/SkinInterface.kt +++ b/app/src/main/java/info/nightscout/androidaps/skins/SkinInterface.kt @@ -6,5 +6,7 @@ import androidx.annotation.StringRes interface SkinInterface { @get:StringRes val description : Int + val mainGraphHeight : Int // in dp + val secondaryGraphHeight : Int // in dp @LayoutRes fun overviewLayout(isLandscape : Boolean, isTablet : Boolean, isSmallHeight : Boolean): Int } \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/skins/SkinLargeDisplay.kt b/app/src/main/java/info/nightscout/androidaps/skins/SkinLargeDisplay.kt new file mode 100644 index 0000000000..b28a0e3e0a --- /dev/null +++ b/app/src/main/java/info/nightscout/androidaps/skins/SkinLargeDisplay.kt @@ -0,0 +1,23 @@ +package info.nightscout.androidaps.skins + +import info.nightscout.androidaps.Config +import info.nightscout.androidaps.R +import javax.inject.Inject +import javax.inject.Singleton + +@Singleton +class SkinLargeDisplay @Inject constructor(private val config: Config): SkinInterface { + + override val description: Int get() = R.string.largedisplay_description + override val mainGraphHeight: Int get() = 400 + override val secondaryGraphHeight: Int get() = 150 + + override fun overviewLayout(isLandscape: Boolean, isTablet: Boolean, isSmallHeight: Boolean): Int = + when { + config.NSCLIENT && isTablet -> R.layout.overview_fragment_nsclient_tablet + config.NSCLIENT -> R.layout.overview_fragment_nsclient + isSmallHeight || isLandscape -> R.layout.overview_fragment_landscape + else -> R.layout.overview_fragment + } + +} \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 8f40ffbbe3..01a74eb73e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1548,8 +1548,9 @@ statuslights_copy_ns Copy NS settings (if exists)? statuslights_overview_advanced - Original skin - Buttons are always displayed on bottom of screen + Original skin + Buttons are always displayed on bottom of screen + Large display skin Skin