diff --git a/app/build.gradle b/app/build.gradle index c365119f31..6283dd81ae 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -99,19 +99,19 @@ android { applicationId "info.nightscout.androidaps" dimension "standard" resValue "string", "app_name", "AndroidAPS" - versionName version + versionName version + "-pumpcontrol" manifestPlaceholders = [ appIcon: "@mipmap/ic_launcher", appIconRound: "@mipmap/ic_launcher_round" ] } pumpcontrol { - applicationId "info.nightscout.androidaps" + applicationId "info.nightscout.aapspumpcontrol" dimension "standard" - resValue "string", "app_name", "AndroidAPS" + resValue "string", "app_name", "Pumpcontrol" versionName version manifestPlaceholders = [ - appIcon: "@mipmap/blueowl", + appIcon: "@mipmap/ic_pumpcontrol", appIconRound: "@null" ] } @@ -121,7 +121,7 @@ android { resValue "string", "app_name", "NSClient" versionName version + "-nsclient" manifestPlaceholders = [ - appIcon: "@mipmap/yellowowl", + appIcon: "@mipmap/ic_yellowowl", appIconRound: "@null" ] } @@ -131,7 +131,7 @@ android { resValue "string", "app_name", "NSClient2" versionName version + "-nsclient" manifestPlaceholders = [ - appIcon: "@mipmap/yellowowl", + appIcon: "@mipmap/ic_yellowowl", appIconRound: "@null" ] } diff --git a/app/src/main/java/info/nightscout/androidaps/MainActivity.java b/app/src/main/java/info/nightscout/androidaps/MainActivity.java index 480ef0e325..ad4a28c1f3 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainActivity.java +++ b/app/src/main/java/info/nightscout/androidaps/MainActivity.java @@ -378,10 +378,7 @@ public class MainActivity extends AppCompatActivity { case R.id.nav_about: AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(MainApp.gs(R.string.app_name) + " " + BuildConfig.VERSION); - if (Config.NSCLIENT) - builder.setIcon(R.mipmap.yellowowl); - else - builder.setIcon(R.mipmap.blueowl); + builder.setIcon(MainApp.getIcon()); String message = "Build: " + BuildConfig.BUILDVERSION + "\n"; message += "Flavor: " + BuildConfig.FLAVOR + BuildConfig.BUILD_TYPE + "\n"; message += MainApp.gs(R.string.configbuilder_nightscoutversion_label) + " " + NSSettingsStatus.getInstance().nightscoutVersionName; diff --git a/app/src/main/java/info/nightscout/androidaps/MainApp.java b/app/src/main/java/info/nightscout/androidaps/MainApp.java index c54fa2b4bd..7ec6481545 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainApp.java +++ b/app/src/main/java/info/nightscout/androidaps/MainApp.java @@ -29,27 +29,31 @@ import info.nightscout.androidaps.interfaces.PluginBase; import info.nightscout.androidaps.interfaces.PluginType; import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.logging.L; -import info.nightscout.androidaps.plugins.general.actions.ActionsFragment; -import info.nightscout.androidaps.plugins.general.careportal.CareportalPlugin; +import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin; +import info.nightscout.androidaps.plugins.aps.openAPSAMA.OpenAPSAMAPlugin; +import info.nightscout.androidaps.plugins.aps.openAPSMA.OpenAPSMAPlugin; +import info.nightscout.androidaps.plugins.aps.openAPSSMB.OpenAPSSMBPlugin; import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.constraints.objectives.ObjectivesPlugin; import info.nightscout.androidaps.plugins.constraints.safety.SafetyPlugin; +import info.nightscout.androidaps.plugins.general.actions.ActionsFragment; +import info.nightscout.androidaps.plugins.general.careportal.CareportalPlugin; import info.nightscout.androidaps.plugins.general.food.FoodPlugin; -import info.nightscout.androidaps.plugins.insulin.InsulinOrefFreePeakPlugin; -import info.nightscout.androidaps.plugins.insulin.InsulinOrefRapidActingPlugin; -import info.nightscout.androidaps.plugins.insulin.InsulinOrefUltraRapidActingPlugin; -import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin; +import info.nightscout.androidaps.plugins.general.maintenance.LoggerUtils; import info.nightscout.androidaps.plugins.general.maintenance.MaintenancePlugin; -import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin; import info.nightscout.androidaps.plugins.general.nsclient.NSClientPlugin; import info.nightscout.androidaps.plugins.general.nsclient.NSUpload; import info.nightscout.androidaps.plugins.general.nsclient.receivers.AckAlarmReceiver; import info.nightscout.androidaps.plugins.general.nsclient.receivers.DBAccessReceiver; -import info.nightscout.androidaps.plugins.aps.openAPSAMA.OpenAPSAMAPlugin; -import info.nightscout.androidaps.plugins.aps.openAPSMA.OpenAPSMAPlugin; -import info.nightscout.androidaps.plugins.aps.openAPSSMB.OpenAPSSMBPlugin; import info.nightscout.androidaps.plugins.general.overview.OverviewPlugin; import info.nightscout.androidaps.plugins.general.persistentNotification.PersistentNotificationPlugin; +import info.nightscout.androidaps.plugins.general.smsCommunicator.SmsCommunicatorPlugin; +import info.nightscout.androidaps.plugins.general.wear.WearPlugin; +import info.nightscout.androidaps.plugins.general.xdripStatusline.StatuslinePlugin; +import info.nightscout.androidaps.plugins.insulin.InsulinOrefFreePeakPlugin; +import info.nightscout.androidaps.plugins.insulin.InsulinOrefRapidActingPlugin; +import info.nightscout.androidaps.plugins.insulin.InsulinOrefUltraRapidActingPlugin; +import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin; import info.nightscout.androidaps.plugins.profile.local.LocalProfilePlugin; import info.nightscout.androidaps.plugins.profile.ns.NSProfilePlugin; import info.nightscout.androidaps.plugins.profile.simple.SimpleProfilePlugin; @@ -65,7 +69,6 @@ import info.nightscout.androidaps.plugins.sensitivity.SensitivityAAPSPlugin; import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref0Plugin; import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref1Plugin; import info.nightscout.androidaps.plugins.sensitivity.SensitivityWeightedAveragePlugin; -import info.nightscout.androidaps.plugins.general.smsCommunicator.SmsCommunicatorPlugin; import info.nightscout.androidaps.plugins.source.SourceDexcomG5Plugin; import info.nightscout.androidaps.plugins.source.SourceDexcomG6Plugin; import info.nightscout.androidaps.plugins.source.SourceEversensePlugin; @@ -76,14 +79,11 @@ import info.nightscout.androidaps.plugins.source.SourcePoctechPlugin; import info.nightscout.androidaps.plugins.source.SourceTomatoPlugin; import info.nightscout.androidaps.plugins.source.SourceXdripPlugin; import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin; -import info.nightscout.androidaps.plugins.general.wear.WearPlugin; -import info.nightscout.androidaps.plugins.general.xdripStatusline.StatuslinePlugin; import info.nightscout.androidaps.receivers.DataReceiver; import info.nightscout.androidaps.receivers.KeepAliveReceiver; import info.nightscout.androidaps.receivers.NSAlarmReceiver; import info.nightscout.androidaps.services.Intents; import info.nightscout.androidaps.utils.FabricPrivacy; -import info.nightscout.androidaps.plugins.general.maintenance.LoggerUtils; import io.fabric.sdk.android.Fabric; @@ -390,6 +390,24 @@ public class MainApp extends Application { return devBranch; } + public static int getIcon() { + if (Config.NSCLIENT) + return R.mipmap.ic_yellowowl; + else if (Config.PUMPCONTROL) + return R.mipmap.ic_pumpcontrol; + else + return R.mipmap.ic_launcher; + } + + public static int getNotificationIcon() { + if (Config.NSCLIENT) + return R.drawable.ic_notif_nsclient; + else if (Config.PUMPCONTROL) + return R.drawable.ic_notif_pumpcontrol; + else + return R.drawable.ic_notif_aaps; + } + @Override public void onTerminate() { if (L.isEnabled(L.CORE)) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/Overview/notifications/NotificationStore.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/Overview/notifications/NotificationStore.java index 66b17e1cdd..8d327bf29f 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/Overview/notifications/NotificationStore.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/Overview/notifications/NotificationStore.java @@ -126,12 +126,8 @@ public class NotificationStore { private void raiseSystemNotification(Notification n) { Context context = MainApp.instance().getApplicationContext(); NotificationManager mgr = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); - Bitmap largeIcon = BitmapFactory.decodeResource(context.getResources(), R.mipmap.blueowl); - int smallIcon = R.drawable.ic_notification; - if (Config.NSCLIENT) { - largeIcon = BitmapFactory.decodeResource(MainApp.instance().getResources(), R.mipmap.yellowowl); - smallIcon = R.drawable.nsclient_smallicon; - } + Bitmap largeIcon = BitmapFactory.decodeResource(context.getResources(), MainApp.getIcon()); + int smallIcon = MainApp.getNotificationIcon(); Uri sound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM); NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context, CHANNEL_ID) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/persistentNotification/PersistentNotificationPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/persistentNotification/PersistentNotificationPlugin.java index 4838fda69a..04d5e9ffbe 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/persistentNotification/PersistentNotificationPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/persistentNotification/PersistentNotificationPlugin.java @@ -11,17 +11,11 @@ import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Build; import android.support.v4.app.NotificationCompat; -import android.support.v4.app.TaskStackBuilder; - -// Android Auto import android.support.v4.app.RemoteInput; - - - +import android.support.v4.app.TaskStackBuilder; import com.squareup.otto.Subscribe; -import info.nightscout.androidaps.Config; import info.nightscout.androidaps.Constants; import info.nightscout.androidaps.MainActivity; import info.nightscout.androidaps.MainApp; @@ -165,8 +159,8 @@ public class PersistentNotificationPlugin extends PluginBase { IobTotal basalIob = TreatmentsPlugin.getPlugin().getLastCalculationTempBasals().round(); - String line2 = MainApp.gs(R.string.treatments_iob_label_string) + " " + DecimalFormatter.to2Decimal(bolusIob.iob + basalIob.basaliob) + "U " + MainApp.gs(R.string.cob)+": " + IobCobCalculatorPlugin.getPlugin().getCobInfo(false, "PersistentNotificationPlugin").generateCOBString(); - String line2_aa = MainApp.gs(R.string.treatments_iob_label_string) + " " + DecimalFormatter.to2Decimal(bolusIob.iob + basalIob.basaliob) + "U. " + MainApp.gs(R.string.cob)+": " + IobCobCalculatorPlugin.getPlugin().getCobInfo(false, "PersistentNotificationPlugin").generateCOBString() + "."; + String line2 = MainApp.gs(R.string.treatments_iob_label_string) + " " + DecimalFormatter.to2Decimal(bolusIob.iob + basalIob.basaliob) + "U " + MainApp.gs(R.string.cob) + ": " + IobCobCalculatorPlugin.getPlugin().getCobInfo(false, "PersistentNotificationPlugin").generateCOBString(); + String line2_aa = MainApp.gs(R.string.treatments_iob_label_string) + " " + DecimalFormatter.to2Decimal(bolusIob.iob + basalIob.basaliob) + "U. " + MainApp.gs(R.string.cob) + ": " + IobCobCalculatorPlugin.getPlugin().getCobInfo(false, "PersistentNotificationPlugin").generateCOBString() + "."; String line3 = DecimalFormatter.to2Decimal(ConfigBuilderPlugin.getPlugin().getActivePump().getBaseBasalRate()) + " U/h"; @@ -210,7 +204,7 @@ public class PersistentNotificationPlugin extends PluginBase { .setLatestTimestamp(System.currentTimeMillis()) .setReadPendingIntent(msgReadPendingIntent) .setReplyAction(msgReplyPendingIntent, remoteInput); - + /// Add dot to produce a "more natural sounding result" unreadConversationBuilder.addMessage(line3_aa); /// End Android Auto @@ -220,15 +214,9 @@ public class PersistentNotificationPlugin extends PluginBase { builder.setOngoing(true); builder.setOnlyAlertOnce(true); builder.setCategory(NotificationCompat.CATEGORY_STATUS); - if (Config.NSCLIENT){ - builder.setSmallIcon(R.drawable.nsclient_smallicon); - Bitmap largeIcon = BitmapFactory.decodeResource(ctx.getResources(), R.mipmap.yellowowl); - builder.setLargeIcon(largeIcon); - } else { - builder.setSmallIcon(R.drawable.ic_notification); - Bitmap largeIcon = BitmapFactory.decodeResource(ctx.getResources(), R.mipmap.blueowl); - builder.setLargeIcon(largeIcon); - } + builder.setSmallIcon(MainApp.getNotificationIcon()); + Bitmap largeIcon = BitmapFactory.decodeResource(ctx.getResources(), MainApp.getIcon()); + builder.setLargeIcon(largeIcon); builder.setContentTitle(line1); builder.setContentText(line2); builder.setSubText(line3); diff --git a/app/src/main/res/drawable-hdpi/ic_notification.png b/app/src/main/res/drawable-hdpi/ic_notif_aaps.png similarity index 100% rename from app/src/main/res/drawable-hdpi/ic_notification.png rename to app/src/main/res/drawable-hdpi/ic_notif_aaps.png diff --git a/app/src/main/res/drawable-hdpi/nsclient_smallicon.png b/app/src/main/res/drawable-hdpi/ic_notif_nsclient.png similarity index 100% rename from app/src/main/res/drawable-hdpi/nsclient_smallicon.png rename to app/src/main/res/drawable-hdpi/ic_notif_nsclient.png diff --git a/app/src/main/res/drawable-hdpi/ic_notif_pumpcontrol.png b/app/src/main/res/drawable-hdpi/ic_notif_pumpcontrol.png new file mode 100644 index 0000000000..5562fef378 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_notif_pumpcontrol.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_notification.png b/app/src/main/res/drawable-mdpi/ic_notif_aaps.png similarity index 100% rename from app/src/main/res/drawable-mdpi/ic_notification.png rename to app/src/main/res/drawable-mdpi/ic_notif_aaps.png diff --git a/app/src/main/res/drawable-mdpi/nsclient_smallicon.png b/app/src/main/res/drawable-mdpi/ic_notif_nsclient.png similarity index 100% rename from app/src/main/res/drawable-mdpi/nsclient_smallicon.png rename to app/src/main/res/drawable-mdpi/ic_notif_nsclient.png diff --git a/app/src/main/res/drawable-mdpi/ic_notif_pumpcontrol.png b/app/src/main/res/drawable-mdpi/ic_notif_pumpcontrol.png new file mode 100644 index 0000000000..3feb5d6248 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_notif_pumpcontrol.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_notification.png b/app/src/main/res/drawable-xhdpi/ic_notif_aaps.png similarity index 100% rename from app/src/main/res/drawable-xhdpi/ic_notification.png rename to app/src/main/res/drawable-xhdpi/ic_notif_aaps.png diff --git a/app/src/main/res/drawable-xhdpi/nsclient_smallicon.png b/app/src/main/res/drawable-xhdpi/ic_notif_nsclient.png similarity index 100% rename from app/src/main/res/drawable-xhdpi/nsclient_smallicon.png rename to app/src/main/res/drawable-xhdpi/ic_notif_nsclient.png diff --git a/app/src/main/res/drawable-xhdpi/ic_notif_pumpcontrol.png b/app/src/main/res/drawable-xhdpi/ic_notif_pumpcontrol.png new file mode 100644 index 0000000000..e5eb24b9da Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_notif_pumpcontrol.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_notification.png b/app/src/main/res/drawable-xxhdpi/ic_notif_aaps.png similarity index 100% rename from app/src/main/res/drawable-xxhdpi/ic_notification.png rename to app/src/main/res/drawable-xxhdpi/ic_notif_aaps.png diff --git a/app/src/main/res/drawable-xxhdpi/nsclient_smallicon.png b/app/src/main/res/drawable-xxhdpi/ic_notif_nsclient.png similarity index 100% rename from app/src/main/res/drawable-xxhdpi/nsclient_smallicon.png rename to app/src/main/res/drawable-xxhdpi/ic_notif_nsclient.png diff --git a/app/src/main/res/drawable-xxhdpi/ic_notif_pumpcontrol.png b/app/src/main/res/drawable-xxhdpi/ic_notif_pumpcontrol.png new file mode 100644 index 0000000000..12bf9fd364 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_notif_pumpcontrol.png differ diff --git a/app/src/main/res/drawable/ic_notification.png b/app/src/main/res/drawable/ic_notif_aaps.png similarity index 100% rename from app/src/main/res/drawable/ic_notification.png rename to app/src/main/res/drawable/ic_notif_aaps.png diff --git a/app/src/main/res/drawable/ic_notif_pumpcontrol.png b/app/src/main/res/drawable/ic_notif_pumpcontrol.png new file mode 100644 index 0000000000..5562fef378 Binary files /dev/null and b/app/src/main/res/drawable/ic_notif_pumpcontrol.png differ diff --git a/app/src/main/res/mipmap-hdpi/blueowl.png b/app/src/main/res/mipmap-hdpi/blueowl.png deleted file mode 100644 index 799c3b90e2..0000000000 Binary files a/app/src/main/res/mipmap-hdpi/blueowl.png and /dev/null differ diff --git a/app/src/main/res/mipmap-hdpi/ic_pumpcontrol.png b/app/src/main/res/mipmap-hdpi/ic_pumpcontrol.png new file mode 100644 index 0000000000..4e971b0980 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_pumpcontrol.png differ diff --git a/app/src/main/res/mipmap-hdpi/yellowowl.png b/app/src/main/res/mipmap-hdpi/ic_yellowowl.png similarity index 100% rename from app/src/main/res/mipmap-hdpi/yellowowl.png rename to app/src/main/res/mipmap-hdpi/ic_yellowowl.png diff --git a/app/src/main/res/mipmap-mdpi/blueowl.png b/app/src/main/res/mipmap-mdpi/blueowl.png deleted file mode 100644 index 584d65de70..0000000000 Binary files a/app/src/main/res/mipmap-mdpi/blueowl.png and /dev/null differ diff --git a/app/src/main/res/mipmap-mdpi/ic_pumpcontrol.png b/app/src/main/res/mipmap-mdpi/ic_pumpcontrol.png new file mode 100644 index 0000000000..06d41d2eed Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_pumpcontrol.png differ diff --git a/app/src/main/res/mipmap-mdpi/yellowowl.png b/app/src/main/res/mipmap-mdpi/ic_yellowowl.png similarity index 100% rename from app/src/main/res/mipmap-mdpi/yellowowl.png rename to app/src/main/res/mipmap-mdpi/ic_yellowowl.png diff --git a/app/src/main/res/mipmap-xhdpi/blueowl.png b/app/src/main/res/mipmap-xhdpi/blueowl.png deleted file mode 100644 index 132eaac5df..0000000000 Binary files a/app/src/main/res/mipmap-xhdpi/blueowl.png and /dev/null differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_pumpcontrol.png b/app/src/main/res/mipmap-xhdpi/ic_pumpcontrol.png new file mode 100644 index 0000000000..1b61fc5e9c Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_pumpcontrol.png differ diff --git a/app/src/main/res/mipmap-xhdpi/yellowowl.png b/app/src/main/res/mipmap-xhdpi/ic_yellowowl.png similarity index 100% rename from app/src/main/res/mipmap-xhdpi/yellowowl.png rename to app/src/main/res/mipmap-xhdpi/ic_yellowowl.png diff --git a/app/src/main/res/mipmap-xxhdpi/blueowl.png b/app/src/main/res/mipmap-xxhdpi/blueowl.png deleted file mode 100644 index 2543131880..0000000000 Binary files a/app/src/main/res/mipmap-xxhdpi/blueowl.png and /dev/null differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_pumpcontrol.png b/app/src/main/res/mipmap-xxhdpi/ic_pumpcontrol.png new file mode 100644 index 0000000000..dd26bd7976 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_pumpcontrol.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/yellowowl.png b/app/src/main/res/mipmap-xxhdpi/ic_yellowowl.png similarity index 100% rename from app/src/main/res/mipmap-xxhdpi/yellowowl.png rename to app/src/main/res/mipmap-xxhdpi/ic_yellowowl.png diff --git a/app/src/main/res/mipmap-xxxhdpi/blueowl.png b/app/src/main/res/mipmap-xxxhdpi/blueowl.png deleted file mode 100644 index a4701d5443..0000000000 Binary files a/app/src/main/res/mipmap-xxxhdpi/blueowl.png and /dev/null differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_pumpcontrol.png b/app/src/main/res/mipmap-xxxhdpi/ic_pumpcontrol.png new file mode 100644 index 0000000000..a4d796ce1a Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_pumpcontrol.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/yellowowl.png b/app/src/main/res/mipmap-xxxhdpi/ic_yellowowl.png similarity index 100% rename from app/src/main/res/mipmap-xxxhdpi/yellowowl.png rename to app/src/main/res/mipmap-xxxhdpi/ic_yellowowl.png