From 87d49c03c84c13a39fbe8a5f8f0d5ede84fd998e Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Sat, 26 Nov 2016 05:31:23 +0100 Subject: [PATCH] wear product flavors --- app/build.gradle | 17 ++++++++++- .../info/nightscout/androidaps/Config.java | 1 + .../info/nightscout/androidaps/MainApp.java | 2 +- wear/wear.iml | 30 +++++++++---------- 4 files changed, 33 insertions(+), 17 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index faa095502d..74f1b69f37 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -57,47 +57,62 @@ android { } } productFlavors { + flavorDimensions "standard", "wear" full { + dimension "standard" buildConfigField "boolean", "APS", "true" buildConfigField "boolean", "PUMPDRIVERS", "true" buildConfigField "boolean", "CLOSEDLOOP", "true" buildConfigField "int", "MAXBOLUS", "17" } fullteenage { + dimension "standard" buildConfigField "boolean", "APS", "true" buildConfigField "boolean", "PUMPDRIVERS", "true" buildConfigField "boolean", "CLOSEDLOOP", "true" buildConfigField "int", "MAXBOLUS", "10" } fullchild { + dimension "standard" buildConfigField "boolean", "APS", "true" buildConfigField "boolean", "PUMPDRIVERS", "true" buildConfigField "boolean", "CLOSEDLOOP", "true" buildConfigField "int", "MAXBOLUS", "5" } danarcontrol { + dimension "standard" buildConfigField "boolean", "APS", "false" buildConfigField "boolean", "PUMPDRIVERS", "true" buildConfigField "boolean", "CLOSEDLOOP", "false" buildConfigField "int", "MAXBOLUS", "17" } careportal { + dimension "standard" buildConfigField "boolean", "APS", "false" buildConfigField "boolean", "PUMPDRIVERS", "false" buildConfigField "boolean", "CLOSEDLOOP", "false" buildConfigField "int", "MAXBOLUS", "17" } openloop { + dimension "standard" buildConfigField "boolean", "APS", "true" buildConfigField "boolean", "PUMPDRIVERS", "true" buildConfigField "boolean", "CLOSEDLOOP", "false" buildConfigField "int", "MAXBOLUS", "17" } + wear { + dimension "wear" + buildConfigField "boolean", "WEAR", "true" + } + nowear { + dimension "wear" + buildConfigField "boolean", "WEAR", "false" + } } } dependencies { - fullWearApp project(path: ':wear', configuration: 'fullRelease') + wearWearApp project(path: ':wear', configuration: 'fullRelease') compile fileTree(dir: 'libs', include: ['*.jar']) compile('com.crashlytics.sdk.android:crashlytics:2.5.7@aar') { transitive = true; diff --git a/app/src/main/java/info/nightscout/androidaps/Config.java b/app/src/main/java/info/nightscout/androidaps/Config.java index eeffc2a729..851ecdb39c 100644 --- a/app/src/main/java/info/nightscout/androidaps/Config.java +++ b/app/src/main/java/info/nightscout/androidaps/Config.java @@ -9,6 +9,7 @@ public class Config { // PLUGINS public static final boolean OPENAPSMAENABLED = APS; public static final boolean LOOPENABLED = APS; + public static final boolean WEAR = BuildConfig.WEAR; public static final boolean CAREPORTALENABLED = true; public static final boolean SMSCOMMUNICATORENABLED = true; diff --git a/app/src/main/java/info/nightscout/androidaps/MainApp.java b/app/src/main/java/info/nightscout/androidaps/MainApp.java index 7a0a00004b..b2f46cddb8 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainApp.java +++ b/app/src/main/java/info/nightscout/androidaps/MainApp.java @@ -87,7 +87,7 @@ public class MainApp extends Application { if (Config.SMSCOMMUNICATORENABLED) pluginsList.add(SmsCommunicatorFragment.getPlugin()); - pluginsList.add(WearFragment.getPlugin(this)); + if (Config.WEAR) pluginsList.add(WearFragment.getPlugin(this)); pluginsList.add(sConfigBuilder = ConfigBuilderFragment.getPlugin()); diff --git a/wear/wear.iml b/wear/wear.iml index 6bcf7b706c..7db2f0c9ea 100644 --- a/wear/wear.iml +++ b/wear/wear.iml @@ -43,6 +43,13 @@ + + + + + + + @@ -51,13 +58,6 @@ - - - - - - - @@ -66,14 +66,6 @@ - - - - - - - - @@ -82,6 +74,14 @@ + + + + + + + +