wear full status support and product flavour with/without controls on wear
This commit is contained in:
parent
6fcee9ea3f
commit
e85e651c56
6 changed files with 143 additions and 21 deletions
|
@ -97,10 +97,18 @@ android {
|
|||
wear {
|
||||
dimension "wear"
|
||||
buildConfigField "boolean", "WEAR", "true"
|
||||
buildConfigField "boolean", "WEAR_CONTROL", "false"
|
||||
|
||||
}
|
||||
wearcontrol {
|
||||
dimension "wear"
|
||||
buildConfigField "boolean", "WEAR", "true"
|
||||
buildConfigField "boolean", "WEAR_CONTROL", "true"
|
||||
}
|
||||
nowear {
|
||||
dimension "wear"
|
||||
buildConfigField "boolean", "WEAR", "false"
|
||||
buildConfigField "boolean", "WEAR_CONTROL", "false"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -115,7 +123,9 @@ allprojects {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
wearWearApp project(path: ':wear', configuration: 'fullRelease')
|
||||
wearWearApp project(path: ':wear', configuration: 'restrictedRelease')
|
||||
wearcontrolWearApp project(path: ':wear', configuration: 'fullRelease')
|
||||
|
||||
compile fileTree(include: ['*.jar'], dir: 'libs')
|
||||
compile('com.crashlytics.sdk.android:crashlytics:2.5.7@aar') {
|
||||
transitive = true;
|
||||
|
|
|
@ -20,6 +20,7 @@ import java.sql.SQLException;
|
|||
import java.text.DecimalFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import info.nightscout.androidaps.BuildConfig;
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
|
@ -28,9 +29,11 @@ import info.nightscout.androidaps.data.GlucoseStatus;
|
|||
import info.nightscout.androidaps.data.PumpEnactResult;
|
||||
import info.nightscout.androidaps.db.BgReading;
|
||||
import info.nightscout.androidaps.db.TempTarget;
|
||||
import info.nightscout.androidaps.interfaces.APSInterface;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.plugins.Actions.dialogs.FillDialog;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
|
||||
import info.nightscout.androidaps.plugins.Overview.QuickWizard;
|
||||
import info.nightscout.androidaps.plugins.TempTargetRange.TempTargetRangePlugin;
|
||||
import info.nightscout.androidaps.plugins.TempTargetRange.events.EventTempTargetRangeChange;
|
||||
|
@ -63,6 +66,9 @@ public class ActionStringHandler {
|
|||
|
||||
public synchronized static void handleInitiate(String actionstring){
|
||||
|
||||
if(!BuildConfig.WEAR_CONTROL) return;
|
||||
|
||||
|
||||
lastBolusWizard = null;
|
||||
|
||||
String rTitle = "CONFIRM"; //TODO: i18n
|
||||
|
@ -164,11 +170,7 @@ public class ActionStringHandler {
|
|||
////////////////////////////////////////////// STATUS
|
||||
rTitle = "STATUS";
|
||||
rAction = "statusmessage";
|
||||
//TODO: add meaningful status
|
||||
|
||||
if("general".equals(act[1])){
|
||||
rMessage = getGeneralStatus();
|
||||
} else if("pump".equals(act[1])){
|
||||
if("pump".equals(act[1])){
|
||||
rTitle += " PUMP";
|
||||
rMessage = getPumpStatus();
|
||||
} else if("loop".equals(act[1])){
|
||||
|
@ -179,7 +181,6 @@ public class ActionStringHandler {
|
|||
rTitle += " TARGETS";
|
||||
rMessage = getTargetsStatus();
|
||||
}
|
||||
rMessage += "\n\n\nTODO:\nAdd some meaningful status.";
|
||||
|
||||
} else if ("wizard".equals(act[0])) {
|
||||
////////////////////////////////////////////// WIZARD
|
||||
|
@ -245,19 +246,40 @@ public class ActionStringHandler {
|
|||
lastConfirmActionString = rAction;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
private static String getGeneralStatus() {
|
||||
return "Today is going to be a good day!";
|
||||
}
|
||||
|
||||
@NonNull
|
||||
private static String getPumpStatus() {
|
||||
return "I'm feeling pumped!";
|
||||
return MainApp.getConfigBuilder().shortStatus(false);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
private static String getLoopStatus() {
|
||||
return "A loop di loop di loop!";
|
||||
String ret = "";
|
||||
// decide if enabled/disabled closed/open; what Plugin as APS?
|
||||
final LoopPlugin activeloop = MainApp.getConfigBuilder().getActiveLoop();
|
||||
if(activeloop != null && activeloop.isEnabled(activeloop.getType())) {
|
||||
if (MainApp.getConfigBuilder().isClosedModeEnabled()) {
|
||||
ret += "CLOSED LOOP\n";
|
||||
} else {
|
||||
ret += "OPEN LOOP\n";
|
||||
}
|
||||
final APSInterface aps = MainApp.getConfigBuilder().getActiveAPS();
|
||||
ret += "APS: " + ((aps==null)?"NO APS SELECTED!":((PluginBase) aps).getName());
|
||||
if(activeloop.lastRun != null){
|
||||
if(activeloop.lastRun.lastAPSRun != null)
|
||||
ret += "\nLast Run: " + DateUtil.timeString(activeloop.lastRun.lastAPSRun);
|
||||
|
||||
if(activeloop.lastRun.lastEnact != null)
|
||||
ret += "\nLast Enact: " + DateUtil.timeString(activeloop.lastRun.lastEnact);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
ret += "LOOP DISABLED\n";
|
||||
}
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
@ -300,6 +322,9 @@ public class ActionStringHandler {
|
|||
|
||||
public synchronized static void handleConfirmation(String actionString){
|
||||
|
||||
if(!BuildConfig.WEAR_CONTROL) return;
|
||||
|
||||
|
||||
//Guard from old or duplicate confirmations
|
||||
if (lastConfirmActionString == null) return;
|
||||
if (!lastConfirmActionString.equals(actionString)) return;
|
||||
|
|
|
@ -30,6 +30,20 @@ android {
|
|||
resValue "string", "label_xdrip_circle", "AAPS(Circle)"
|
||||
resValue "string", "label_xdrip_activity", "AAPS Prefs."
|
||||
resValue "string", "app_settings", "AAPS Settings"
|
||||
buildConfigField "boolean", "WEAR_CONTROL", "true"
|
||||
|
||||
}
|
||||
|
||||
restricted {
|
||||
applicationId = "info.nightscout.androidaps"
|
||||
resValue "string", "label_xdrip", "AAPS"
|
||||
resValue "string", "label_xdrip_large", "AAPS(Large)"
|
||||
resValue "string", "label_xdrip_big_chart", "AAPS(BigChart)"
|
||||
resValue "string", "label_xdrip_circle", "AAPS(Circle)"
|
||||
resValue "string", "label_xdrip_activity", "AAPS Prefs."
|
||||
resValue "string", "app_settings", "AAPS Settings"
|
||||
buildConfigField "boolean", "WEAR_CONTROL", "false"
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import android.content.SharedPreferences;
|
|||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
import info.nightscout.androidaps.BuildConfig;
|
||||
import info.nightscout.androidaps.data.ListenerService;
|
||||
import info.nightscout.androidaps.interaction.AAPSPreferences;
|
||||
import info.nightscout.androidaps.interaction.actions.BolusActivity;
|
||||
|
@ -30,8 +31,14 @@ public class MainMenuActivity extends MenuListActivity {
|
|||
@Override
|
||||
protected String[] getElements() {
|
||||
|
||||
boolean showPrimeFill = sp.getBoolean("primefill", false);
|
||||
if(!BuildConfig.WEAR_CONTROL){
|
||||
return new String[] {
|
||||
"Settings",
|
||||
"Re-Sync"};
|
||||
}
|
||||
|
||||
|
||||
boolean showPrimeFill = sp.getBoolean("primefill", false);
|
||||
return new String[] {
|
||||
"TempT",
|
||||
"Bolus",
|
||||
|
@ -46,6 +53,22 @@ public class MainMenuActivity extends MenuListActivity {
|
|||
protected void doAction(int position) {
|
||||
|
||||
Intent intent;
|
||||
|
||||
if(!BuildConfig.WEAR_CONTROL) {
|
||||
switch (position) {
|
||||
case 0:
|
||||
intent = new Intent(this, AAPSPreferences.class);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
this.startActivity(intent);
|
||||
break;
|
||||
case 1:
|
||||
ListenerService.requestData(this);
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
switch (position) {
|
||||
case 0:
|
||||
intent = new Intent(this, TempTargetActivity.class);
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
package info.nightscout.androidaps.interaction.menus;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
import info.nightscout.androidaps.data.ListenerService;
|
||||
import info.nightscout.androidaps.interaction.AAPSPreferences;
|
||||
import info.nightscout.androidaps.interaction.actions.BolusActivity;
|
||||
import info.nightscout.androidaps.interaction.actions.TempTargetActivity;
|
||||
import info.nightscout.androidaps.interaction.actions.WizardActivity;
|
||||
import info.nightscout.androidaps.interaction.utils.MenuListActivity;
|
||||
|
||||
/**
|
||||
* Created by adrian on 09/02/17.
|
||||
*/
|
||||
|
||||
public class MainMenuRestrictedActivity extends MenuListActivity {
|
||||
|
||||
SharedPreferences sp;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
sp = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
super.onCreate(savedInstanceState);
|
||||
ListenerService.requestData(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String[] getElements() {
|
||||
return new String[] {
|
||||
"Settings",
|
||||
"Re-Sync"};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doAction(int position) {
|
||||
|
||||
Intent intent;
|
||||
switch (position) {
|
||||
case 0:
|
||||
intent = new Intent(this, AAPSPreferences.class);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
this.startActivity(intent);
|
||||
break;
|
||||
case 1:
|
||||
ListenerService.requestData(this);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -12,7 +12,6 @@ public class StatusMenuActivity extends MenuListActivity {
|
|||
@Override
|
||||
protected String[] getElements() {
|
||||
return new String[] {
|
||||
"General",
|
||||
"Pump",
|
||||
"Loop",
|
||||
"Targets"};
|
||||
|
@ -21,16 +20,14 @@ public class StatusMenuActivity extends MenuListActivity {
|
|||
@Override
|
||||
protected void doAction(int position) {
|
||||
switch (position) {
|
||||
|
||||
case 0:
|
||||
ListenerService.initiateAction(this, "status general");
|
||||
break;
|
||||
case 1:
|
||||
ListenerService.initiateAction(this, "status pump");
|
||||
break;
|
||||
case 2:
|
||||
case 1:
|
||||
ListenerService.initiateAction(this, "status loop");
|
||||
break;
|
||||
case 3:
|
||||
case 2:
|
||||
ListenerService.initiateAction(this, "status targets");
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue