Tidepool in engineering mode only

This commit is contained in:
Milos Kozak 2019-06-30 15:38:30 +02:00
commit 323c282b9f
211 changed files with 758 additions and 1022 deletions

View file

@ -2,19 +2,19 @@ language: android
jdk: oraclejdk8 jdk: oraclejdk8
env: env:
matrix: matrix:
- ANDROID_TARGET=android-23 ANDROID_ABI=x86 org.gradle.jvmargs=-XX:-OmitStackTraceInFastThrow - ANDROID_TARGET=android-28 ANDROID_ABI=x86 org.gradle.jvmargs=-XX:-OmitStackTraceInFastThrow
android: android:
components: components:
- platform-tools - platform-tools
- tools - tools
- build-tools-27.0.2 - build-tools-28.0.3
- android-23 - android-28
- extra-google-m2repository - extra-google-m2repository
- extra-android-m2repository - extra-android-m2repository
- extra-google-google_play_services - extra-google-google_play_services
before_install: before_install:
- yes | sdkmanager "platforms;android-27" - yes | sdkmanager "platforms;android-28"
script: script:
# Unit Test # Unit Test

View file

@ -6,23 +6,30 @@ buildscript {
dependencies { dependencies {
classpath 'io.fabric.tools:gradle:1.+' classpath 'io.fabric.tools:gradle:1.+'
classpath 'com.dicedmelon.gradle:jacoco-android:0.1.3' classpath 'com.dicedmelon.gradle:jacoco-android:0.1.4'
classpath 'de.undercouch:gradle-download-task:3.4.3'
} }
} }
apply plugin: "com.android.application" apply plugin: 'com.android.application'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android' apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.google.gms.google-services' apply plugin: 'com.google.gms.google-services'
apply plugin: "io.fabric" apply plugin: 'io.fabric'
apply plugin: "jacoco-android" apply plugin: 'jacoco-android'
apply plugin: 'com.jakewharton.butterknife' apply plugin: 'com.jakewharton.butterknife'
apply plugin: 'de.undercouch.download'
jacoco {
toolVersion = "0.8.3"
}
ext { ext {
supportLibraryVersion = "27.1.1" supportLibraryVersion = "28.0.0"
ormLiteVersion = "4.46" ormLiteVersion = "4.46"
powermockVersion = "1.7.3" powermockVersion = "1.7.3"
dexmakerVersion = "1.2" dexmakerVersion = "1.2"
butterknifeVersion = "8.8.1" butterknifeVersion = "10.1.0"
} }
@ -97,11 +104,11 @@ tasks.matching { it instanceof Test }.all {
} }
android { android {
compileSdkVersion 27 compileSdkVersion 28
defaultConfig { defaultConfig {
minSdkVersion 21 minSdkVersion 23
targetSdkVersion 25 targetSdkVersion 28
multiDexEnabled true multiDexEnabled true
versionCode 1500 versionCode 1500
version "2.3.1-tidepool" version "2.3.1-tidepool"
@ -109,7 +116,7 @@ android {
buildConfigField "String", "BUILDVERSION", '"' + generateGitBuild() + '-' + generateDate() + '"' buildConfigField "String", "BUILDVERSION", '"' + generateGitBuild() + '-' + generateDate() + '"'
buildConfigField "String", "REMOTE", '"' + generateGitRemote() + '"' buildConfigField "String", "REMOTE", '"' + generateGitRemote() + '"'
buildConfigField "String", "HEAD", '"' + generateGitBuild() + '"' buildConfigField "String", "HEAD", '"' + generateGitBuild() + '"'
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
// if you change minSdkVersion to less than 11, you need to change executeTask for wear // if you change minSdkVersion to less than 11, you need to change executeTask for wear
ndk { ndk {
@ -188,8 +195,15 @@ android {
} }
testOptions { testOptions {
unitTests.returnDefaultValues = true unitTests {
unitTests.includeAndroidResources = true returnDefaultValues = true
includeAndroidResources = true
all {
maxParallelForks = 10
forkEvery = 20
}
}
} }
useLibrary "org.apache.http.legacy" useLibrary "org.apache.http.legacy"
@ -204,29 +218,24 @@ allprojects {
} }
} }
configurations {
libs
}
dependencies { dependencies {
wearApp project(':wear') wearApp project(':wear')
implementation fileTree(include: ['*.jar'], dir: 'libs') implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.google.android.gms:play-services-wearable:16.0.1' implementation 'com.google.android.gms:play-services-wearable:16.0.1'
implementation 'com.google.firebase:firebase-core:16.0.8' implementation 'com.google.firebase:firebase-core:16.0.9'
implementation("com.crashlytics.sdk.android:crashlytics:2.9.9@aar") { implementation("com.crashlytics.sdk.android:crashlytics:2.9.9@aar") {
transitive = true; transitive = true;
} }
libs "MilosKozak:danars-support-lib:master@zip"
implementation "com.android.support:appcompat-v7:${supportLibraryVersion}" implementation 'androidx.appcompat:appcompat:1.0.2'
implementation "com.android.support:support-v13:${supportLibraryVersion}" implementation 'androidx.legacy:legacy-support-v13:1.0.0'
implementation "com.android.support:support-v4:${supportLibraryVersion}" implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation "com.android.support:cardview-v7:${supportLibraryVersion}" implementation 'androidx.cardview:cardview:1.0.0'
implementation "com.android.support:recyclerview-v7:${supportLibraryVersion}" implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation "com.android.support:gridlayout-v7:${supportLibraryVersion}" implementation 'androidx.gridlayout:gridlayout:1.0.0'
implementation "com.android.support:design:${supportLibraryVersion}" implementation 'com.google.android.material:material:1.0.0'
implementation "com.android.support:percent:${supportLibraryVersion}" implementation 'androidx.percentlayout:percentlayout:1.0.0'
implementation "com.wdullaer:materialdatetimepicker:2.3.0" implementation "com.wdullaer:materialdatetimepicker:2.3.0"
// Otto bus will be replaced by rx // Otto bus will be replaced by rx
@ -243,7 +252,7 @@ dependencies {
// Graphview cannot be upgraded // Graphview cannot be upgraded
implementation "com.jjoe64:graphview:4.0.1" implementation "com.jjoe64:graphview:4.0.1"
implementation "com.joanzapata.iconify:android-iconify-fontawesome:2.1.1" implementation "com.joanzapata.iconify:android-iconify-fontawesome:2.1.1"
implementation 'com.android.support.constraint:constraint-layout:1.1.3' implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation(name: "android-edittext-validator-v1.3.4-mod", ext: "aar") implementation(name: "android-edittext-validator-v1.3.4-mod", ext: "aar")
implementation 'com.madgag.spongycastle:core:1.58.0.0' implementation 'com.madgag.spongycastle:core:1.58.0.0'
@ -274,7 +283,7 @@ dependencies {
testImplementation "org.powermock:powermock-module-junit4:${powermockVersion}" testImplementation "org.powermock:powermock-module-junit4:${powermockVersion}"
testImplementation "joda-time:joda-time:2.9.9" testImplementation "joda-time:joda-time:2.9.9"
testImplementation "com.google.truth:truth:0.39" testImplementation "com.google.truth:truth:0.39"
testImplementation 'org.robolectric:robolectric:3.8' testImplementation 'org.robolectric:robolectric:4.2.1'
testImplementation "org.skyscreamer:jsonassert:1.5.0" testImplementation "org.skyscreamer:jsonassert:1.5.0"
androidTestImplementation "org.mockito:mockito-core:2.8.47" androidTestImplementation "org.mockito:mockito-core:2.8.47"
@ -293,16 +302,20 @@ dependencies {
} }
task unzip(type: Copy) {
def zipPath = configurations.libs.find { it.name.startsWith("danars") }
def zipFile = file(zipPath)
def outputDir = file("${buildDir}/unpacked/dist")
from zipTree(zipFile) task downloadZipFile(type: Download) {
src 'https://github.com/MilosKozak/danars-support-lib/archive/master.zip'
dest new File(buildDir, 'danars.zip')
}
task downloadAndUnzipFile(dependsOn: downloadZipFile, type: Copy) {
from zipTree(downloadZipFile.dest)
def outputDir = file("${buildDir}/unpacked/dist")
into outputDir into outputDir
} }
task copyLibs(dependsOn: unzip, type: Copy) {
task copyLibs(dependsOn: downloadAndUnzipFile, type: Copy) {
def src = file("${buildDir}/unpacked/dist/danars-support-lib-master") def src = file("${buildDir}/unpacked/dist/danars-support-lib-master")
def target = file("src/main/jniLibs/") def target = file("src/main/jniLibs/")

View file

@ -17,10 +17,11 @@
<uses-permission android:name="android.permission.VIBRATE" /> <uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.google.android.permission.PROVIDE_BACKGROUND" /> <uses-permission android:name="com.google.android.permission.PROVIDE_BACKGROUND" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="sugar.free.sightremote.HISTORY_BROADCASTS" /> <uses-permission android:name="com.dexcom.cgm.EXTERNAL_PERMISSION" />
<uses-permission-sdk-23 android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" /> <uses-permission-sdk-23 android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
@ -34,13 +35,15 @@
android:label="@string/app_name" android:label="@string/app_name"
android:roundIcon="${appIconRound}" android:roundIcon="${appIconRound}"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme.NoActionBar"> android:theme="@style/AppTheme.NoActionBar"
android:fullBackupContent="true">
<meta-data <meta-data
android:name="com.google.android.gms.car.application" android:name="com.google.android.gms.car.application"
android:resource="@xml/automotive_app_desc" /> android:resource="@xml/automotive_app_desc" />
<activity android:name=".MainActivity"> <activity android:name=".MainActivity">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
@ -85,10 +88,8 @@
<action android:name="com.eveningoutpost.dexdrip.NS_EMULATOR"/> <action android:name="com.eveningoutpost.dexdrip.NS_EMULATOR"/>
<!-- Receiver from glimp --> <!-- Receiver from glimp -->
<action android:name="it.ct.glicemia.ACTION_GLUCOSE_MEASURED"/> <action android:name="it.ct.glicemia.ACTION_GLUCOSE_MEASURED"/>
<!-- Receiver from DexcomG5 --> <!-- Receiver from Dexcom -->
<action android:name="com.dexcom.cgm.DATA"/> <action android:name="com.dexcom.cgm.EXTERNAL_BROADCAST"/>
<action android:name="com.dexcom.cgm.AndroidAPSEVGCallback.BROADCAST"/>
<action android:name="com.dexcom.cgm.g5.AndroidAPSEVGCallback.BROADCAST"/>
<!-- Receiver from Poctech --> <!-- Receiver from Poctech -->
<action android:name="com.china.poctech.data"/> <action android:name="com.china.poctech.data"/>
<!-- Receiver from Tomato --> <!-- Receiver from Tomato -->
@ -147,7 +148,7 @@
</receiver> </receiver>
<provider <provider
android:name="android.support.v4.content.FileProvider" android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider" android:authorities="${applicationId}.fileprovider"
android:exported="false" android:exported="false"
android:grantUriPermissions="true"> android:grantUriPermissions="true">
@ -281,6 +282,10 @@
android:name=".plugins.pump.insight.activities.InsightPairingInformationActivity" android:name=".plugins.pump.insight.activities.InsightPairingInformationActivity"
android:label="@string/pairing_information" android:label="@string/pairing_information"
android:theme="@style/AppTheme" /> android:theme="@style/AppTheme" />
<activity android:name=".activities.RequestDexcomPermissionActivity" />
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
</application> </application>
</manifest> </manifest>

View file

@ -7,16 +7,16 @@ import android.graphics.Rect;
import android.os.Bundle; import android.os.Bundle;
import android.os.PersistableBundle; import android.os.PersistableBundle;
import android.os.PowerManager; import android.os.PowerManager;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import android.support.design.widget.NavigationView; import com.google.android.material.navigation.NavigationView;
import android.support.design.widget.TabLayout; import com.google.android.material.tabs.TabLayout;
import android.support.v4.app.ActivityCompat; import androidx.core.app.ActivityCompat;
import android.support.v4.view.ViewPager; import androidx.viewpager.widget.ViewPager;
import android.support.v4.widget.DrawerLayout; import androidx.drawerlayout.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle; import androidx.appcompat.app.ActionBarDrawerToggle;
import android.support.v7.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import android.support.v7.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import android.support.v7.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import android.text.SpannableString; import android.text.SpannableString;
import android.text.method.LinkMovementMethod; import android.text.method.LinkMovementMethod;
import android.text.util.Linkify; import android.text.util.Linkify;

View file

@ -4,9 +4,10 @@ import android.app.Application;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.content.res.Resources; import android.content.res.Resources;
import android.os.SystemClock; import android.os.SystemClock;
import android.support.annotation.Nullable;
import android.support.annotation.PluralsRes; import androidx.annotation.Nullable;
import android.support.v4.content.LocalBroadcastManager; import androidx.annotation.PluralsRes;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.crashlytics.android.Crashlytics; import com.crashlytics.android.Crashlytics;
import com.google.firebase.analytics.FirebaseAnalytics; import com.google.firebase.analytics.FirebaseAnalytics;
@ -73,8 +74,7 @@ import info.nightscout.androidaps.plugins.sensitivity.SensitivityAAPSPlugin;
import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref0Plugin; import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref0Plugin;
import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref1Plugin; import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref1Plugin;
import info.nightscout.androidaps.plugins.sensitivity.SensitivityWeightedAveragePlugin; import info.nightscout.androidaps.plugins.sensitivity.SensitivityWeightedAveragePlugin;
import info.nightscout.androidaps.plugins.source.SourceDexcomG5Plugin; import info.nightscout.androidaps.plugins.source.SourceDexcomPlugin;
import info.nightscout.androidaps.plugins.source.SourceDexcomG6Plugin;
import info.nightscout.androidaps.plugins.source.SourceEversensePlugin; import info.nightscout.androidaps.plugins.source.SourceEversensePlugin;
import info.nightscout.androidaps.plugins.source.SourceGlimpPlugin; import info.nightscout.androidaps.plugins.source.SourceGlimpPlugin;
import info.nightscout.androidaps.plugins.source.SourceMM640gPlugin; import info.nightscout.androidaps.plugins.source.SourceMM640gPlugin;
@ -193,8 +193,7 @@ public class MainApp extends Application {
pluginsList.add(SourceNSClientPlugin.getPlugin()); pluginsList.add(SourceNSClientPlugin.getPlugin());
pluginsList.add(SourceMM640gPlugin.getPlugin()); pluginsList.add(SourceMM640gPlugin.getPlugin());
pluginsList.add(SourceGlimpPlugin.getPlugin()); pluginsList.add(SourceGlimpPlugin.getPlugin());
pluginsList.add(SourceDexcomG5Plugin.getPlugin()); pluginsList.add(SourceDexcomPlugin.INSTANCE);
pluginsList.add(SourceDexcomG6Plugin.getPlugin());
pluginsList.add(SourcePoctechPlugin.getPlugin()); pluginsList.add(SourcePoctechPlugin.getPlugin());
pluginsList.add(SourceTomatoPlugin.getPlugin()); pluginsList.add(SourceTomatoPlugin.getPlugin());
pluginsList.add(SourceEversensePlugin.getPlugin()); pluginsList.add(SourceEversensePlugin.getPlugin());
@ -205,7 +204,8 @@ public class MainApp extends Application {
pluginsList.add(StatuslinePlugin.initPlugin(this)); pluginsList.add(StatuslinePlugin.initPlugin(this));
pluginsList.add(PersistentNotificationPlugin.getPlugin()); pluginsList.add(PersistentNotificationPlugin.getPlugin());
pluginsList.add(NSClientPlugin.getPlugin()); pluginsList.add(NSClientPlugin.getPlugin());
pluginsList.add(TidepoolPlugin.INSTANCE); if (engineeringMode)
pluginsList.add(TidepoolPlugin.INSTANCE);
pluginsList.add(MaintenancePlugin.initPlugin(this)); pluginsList.add(MaintenancePlugin.initPlugin(this));
pluginsList.add(ConfigBuilderPlugin.getPlugin()); pluginsList.add(ConfigBuilderPlugin.getPlugin());

View file

@ -2,9 +2,9 @@ package info.nightscout.androidaps.activities;
import android.os.Bundle; import android.os.Bundle;
import android.os.SystemClock; import android.os.SystemClock;
import android.support.v4.content.res.ResourcesCompat; import androidx.core.content.res.ResourcesCompat;
import android.support.v7.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import android.support.v7.widget.PopupMenu; import androidx.appcompat.widget.PopupMenu;
import android.text.SpannableString; import android.text.SpannableString;
import android.text.style.ForegroundColorSpan; import android.text.style.ForegroundColorSpan;
import android.view.Menu; import android.view.Menu;

View file

@ -42,9 +42,9 @@ import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref0Plugin;
import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref1Plugin; import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref1Plugin;
import info.nightscout.androidaps.plugins.sensitivity.SensitivityWeightedAveragePlugin; import info.nightscout.androidaps.plugins.sensitivity.SensitivityWeightedAveragePlugin;
import info.nightscout.androidaps.plugins.general.smsCommunicator.SmsCommunicatorPlugin; import info.nightscout.androidaps.plugins.general.smsCommunicator.SmsCommunicatorPlugin;
import info.nightscout.androidaps.plugins.source.SourceDexcomG5Plugin;
import info.nightscout.androidaps.plugins.general.wear.WearPlugin; import info.nightscout.androidaps.plugins.general.wear.WearPlugin;
import info.nightscout.androidaps.plugins.general.xdripStatusline.StatuslinePlugin; import info.nightscout.androidaps.plugins.general.xdripStatusline.StatuslinePlugin;
import info.nightscout.androidaps.plugins.source.SourceDexcomPlugin;
import info.nightscout.androidaps.utils.LocaleHelper; import info.nightscout.androidaps.utils.LocaleHelper;
import info.nightscout.androidaps.utils.OKDialog; import info.nightscout.androidaps.utils.OKDialog;
import info.nightscout.androidaps.utils.SP; import info.nightscout.androidaps.utils.SP;
@ -148,7 +148,7 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
addPreferencesFromResource(R.xml.pref_overview); addPreferencesFromResource(R.xml.pref_overview);
addPreferencesFromResourceIfEnabled(SourceDexcomG5Plugin.getPlugin(), PluginType.BGSOURCE); addPreferencesFromResourceIfEnabled(SourceDexcomPlugin.INSTANCE, PluginType.BGSOURCE);
addPreferencesFromResourceIfEnabled(CareportalPlugin.getPlugin(), PluginType.GENERAL); addPreferencesFromResourceIfEnabled(CareportalPlugin.getPlugin(), PluginType.GENERAL);
addPreferencesFromResourceIfEnabled(SafetyPlugin.getPlugin(), PluginType.CONSTRAINTS); addPreferencesFromResourceIfEnabled(SafetyPlugin.getPlugin(), PluginType.CONSTRAINTS);
if (Config.APS) { if (Config.APS) {

View file

@ -0,0 +1,25 @@
package info.nightscout.androidaps.activities
import android.os.Build
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import info.nightscout.androidaps.plugins.source.SourceDexcomPlugin
class RequestDexcomPermissionActivity : AppCompatActivity() {
private val requestCode = "AndroidAPS <3".map { it.toInt() }.sum()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
requestPermissions(arrayOf(SourceDexcomPlugin.PERMISSION), requestCode)
} else {
finish()
}
}
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) {
finish()
}
}

View file

@ -2,9 +2,9 @@ package info.nightscout.androidaps.activities;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import android.support.v4.app.Fragment; import androidx.fragment.app.Fragment;
import android.support.v7.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;

View file

@ -4,7 +4,7 @@ import android.app.Activity;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.Rect; import android.graphics.Rect;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.MotionEvent; import android.view.MotionEvent;

View file

@ -1,11 +1,9 @@
package info.nightscout.androidaps.data; package info.nightscout.androidaps.data;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import java.util.ArrayList; import java.util.ArrayList;
import javax.annotation.Nonnull;
import info.nightscout.androidaps.Constants; import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.interfaces.Constraint; import info.nightscout.androidaps.interfaces.Constraint;

View file

@ -1,7 +1,7 @@
package info.nightscout.androidaps.data; package info.nightscout.androidaps.data;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import android.support.v4.util.LongSparseArray; import androidx.collection.LongSparseArray;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

View file

@ -1,10 +1,8 @@
package info.nightscout.androidaps.data; package info.nightscout.androidaps.data;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import android.support.v4.util.LongSparseArray;
import info.nightscout.androidaps.db.TemporaryBasal;
import info.nightscout.androidaps.interfaces.Interval; import info.nightscout.androidaps.interfaces.Interval;
/** /**

View file

@ -1,7 +1,7 @@
package info.nightscout.androidaps.data; package info.nightscout.androidaps.data;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import info.nightscout.androidaps.interfaces.Interval; import info.nightscout.androidaps.interfaces.Interval;

View file

@ -1,6 +1,6 @@
package info.nightscout.androidaps.data; package info.nightscout.androidaps.data;
import android.support.v4.util.LongSparseArray; import androidx.collection.LongSparseArray;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;

View file

@ -1,7 +1,7 @@
package info.nightscout.androidaps.data; package info.nightscout.androidaps.data;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import android.support.v4.util.LongSparseArray; import androidx.collection.LongSparseArray;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;

View file

@ -1,7 +1,7 @@
package info.nightscout.androidaps.data; package info.nightscout.androidaps.data;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import android.support.v4.util.ArrayMap; import androidx.collection.ArrayMap;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;

View file

@ -3,7 +3,7 @@ package info.nightscout.androidaps.db;
import android.content.Context; import android.content.Context;
import android.database.DatabaseUtils; import android.database.DatabaseUtils;
import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper; import com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper;
import com.j256.ormlite.dao.CloseableIterator; import com.j256.ormlite.dao.CloseableIterator;

View file

@ -1,7 +1,7 @@
package info.nightscout.androidaps.db; package info.nightscout.androidaps.db;
import android.graphics.Color; import android.graphics.Color;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import com.j256.ormlite.field.DatabaseField; import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable; import com.j256.ormlite.table.DatabaseTable;

View file

@ -1,6 +1,6 @@
package info.nightscout.androidaps.events; package info.nightscout.androidaps.events;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import info.nightscout.androidaps.db.BgReading; import info.nightscout.androidaps.db.BgReading;

View file

@ -1,6 +1,6 @@
package info.nightscout.androidaps.events; package info.nightscout.androidaps.events;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import info.nightscout.androidaps.plugins.treatments.Treatment; import info.nightscout.androidaps.plugins.treatments.Treatment;

View file

@ -1,7 +1,7 @@
package info.nightscout.androidaps.interfaces; package info.nightscout.androidaps.interfaces;
import android.os.SystemClock; import android.os.SystemClock;
import android.support.v4.app.FragmentActivity; import androidx.fragment.app.FragmentActivity;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;

View file

@ -1,6 +1,6 @@
package info.nightscout.androidaps.interfaces; package info.nightscout.androidaps.interfaces;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import info.nightscout.androidaps.data.ProfileStore; import info.nightscout.androidaps.data.ProfileStore;

View file

@ -10,8 +10,8 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Build; import android.os.Build;
import android.os.SystemClock; import android.os.SystemClock;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.v4.app.NotificationCompat; import androidx.core.app.NotificationCompat;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;

View file

@ -1,6 +1,6 @@
package info.nightscout.androidaps.plugins.common; package info.nightscout.androidaps.plugins.common;
import android.support.v4.app.Fragment; import androidx.fragment.app.Fragment;
import butterknife.Unbinder; import butterknife.Unbinder;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;

View file

@ -3,8 +3,8 @@ package info.nightscout.androidaps.plugins.configBuilder;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.annotation.StringRes; import androidx.annotation.StringRes;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;

View file

@ -1,6 +1,6 @@
package info.nightscout.androidaps.plugins.configBuilder; package info.nightscout.androidaps.plugins.configBuilder;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;

View file

@ -1,6 +1,6 @@
package info.nightscout.androidaps.plugins.configBuilder; package info.nightscout.androidaps.plugins.configBuilder;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;

View file

@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.configBuilder;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import com.google.firebase.analytics.FirebaseAnalytics; import com.google.firebase.analytics.FirebaseAnalytics;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;

View file

@ -4,11 +4,11 @@ import android.app.Activity;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.v7.widget.CardView; import androidx.cardview.widget.CardView;
import android.support.v7.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import android.support.v7.widget.LinearSmoothScroller; import androidx.recyclerview.widget.LinearSmoothScroller;
import android.support.v7.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import android.text.Html; import android.text.Html;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;

View file

@ -1,6 +1,6 @@
package info.nightscout.androidaps.plugins.constraints.objectives.objectives; package info.nightscout.androidaps.plugins.constraints.objectives.objectives;
import android.support.annotation.StringRes; import androidx.annotation.StringRes;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;

View file

@ -5,8 +5,8 @@ import android.app.Activity;
import android.content.Intent; import android.content.Intent;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.Fragment; import androidx.fragment.app.Fragment;
import android.support.v4.app.FragmentManager; import androidx.fragment.app.FragmentManager;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;

View file

@ -3,8 +3,8 @@ package info.nightscout.androidaps.plugins.general.actions.dialogs;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.DialogFragment; import androidx.fragment.app.DialogFragment;
import android.support.v7.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import android.text.Editable; import android.text.Editable;
import android.text.Html; import android.text.Html;
import android.text.TextWatcher; import android.text.TextWatcher;

View file

@ -4,8 +4,8 @@ import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.DialogFragment; import androidx.fragment.app.DialogFragment;
import android.support.v7.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;

View file

@ -3,8 +3,8 @@ package info.nightscout.androidaps.plugins.general.actions.dialogs;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.DialogFragment; import androidx.fragment.app.DialogFragment;
import android.support.v7.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;

View file

@ -4,7 +4,7 @@ package info.nightscout.androidaps.plugins.general.careportal;
import android.app.Activity; import android.app.Activity;
import android.graphics.Color; import android.graphics.Color;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.FragmentManager; import androidx.fragment.app.FragmentManager;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;

View file

@ -3,8 +3,8 @@ package info.nightscout.androidaps.plugins.general.careportal.Dialogs;
import android.app.Activity; import android.app.Activity;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.DialogFragment; import androidx.fragment.app.DialogFragment;
import android.support.v7.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import android.text.Editable; import android.text.Editable;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.text.format.DateFormat; import android.text.format.DateFormat;

View file

@ -4,9 +4,9 @@ import android.app.Activity;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.graphics.Paint; import android.graphics.Paint;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import android.support.v7.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import android.text.Editable; import android.text.Editable;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.view.LayoutInflater; import android.view.LayoutInflater;

View file

@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.general.food;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.os.IBinder; import android.os.IBinder;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import com.j256.ormlite.android.apptools.OpenHelperManager; import com.j256.ormlite.android.apptools.OpenHelperManager;
import com.j256.ormlite.android.apptools.OrmLiteBaseService; import com.j256.ormlite.android.apptools.OrmLiteBaseService;

View file

@ -8,9 +8,9 @@ import android.content.SharedPreferences;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.os.Environment; import android.os.Environment;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.v4.app.ActivityCompat; import androidx.core.app.ActivityCompat;
import android.support.v4.app.Fragment; import androidx.fragment.app.Fragment;
import android.support.v4.content.ContextCompat; import androidx.core.content.ContextCompat;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;

View file

@ -2,8 +2,8 @@ package info.nightscout.androidaps.plugins.general.maintenance;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.Fragment; import androidx.fragment.app.Fragment;
import android.support.v7.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;

View file

@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.general.maintenance;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.support.v4.content.FileProvider; import androidx.core.content.FileProvider;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;

View file

@ -1,7 +1,7 @@
package info.nightscout.androidaps.plugins.general.maintenance.activities; package info.nightscout.androidaps.plugins.general.maintenance.activities;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import android.view.View; import android.view.View;
import android.widget.CheckBox; import android.widget.CheckBox;
import android.widget.LinearLayout; import android.widget.LinearLayout;

View file

@ -7,8 +7,8 @@ import android.content.pm.ResolveInfo;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import android.support.v4.content.LocalBroadcastManager; import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray; import org.json.JSONArray;

View file

@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.general.nsclient.broadcasts;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.content.LocalBroadcastManager; import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;

View file

@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.general.nsclient.broadcasts;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.content.LocalBroadcastManager; import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import org.json.JSONObject; import org.json.JSONObject;

View file

@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.general.nsclient.broadcasts;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.content.LocalBroadcastManager; import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import org.json.JSONObject; import org.json.JSONObject;

View file

@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.general.nsclient.broadcasts;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.content.LocalBroadcastManager; import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import org.json.JSONArray; import org.json.JSONArray;

View file

@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.general.nsclient.broadcasts;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.content.LocalBroadcastManager; import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import org.json.JSONObject; import org.json.JSONObject;

View file

@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.general.nsclient.broadcasts;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.content.LocalBroadcastManager; import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import org.json.JSONArray; import org.json.JSONArray;

View file

@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.general.nsclient.broadcasts;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.content.LocalBroadcastManager; import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import org.json.JSONArray; import org.json.JSONArray;

View file

@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.general.nsclient.broadcasts;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.content.LocalBroadcastManager; import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import org.json.JSONArray; import org.json.JSONArray;

View file

@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.general.nsclient.broadcasts;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.content.LocalBroadcastManager; import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;

View file

@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.general.nsclient.broadcasts;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.content.LocalBroadcastManager; import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import org.json.JSONArray; import org.json.JSONArray;

View file

@ -4,7 +4,7 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.content.LocalBroadcastManager; import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;

View file

@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.general.nsclient.broadcasts;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.content.LocalBroadcastManager; import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;

View file

@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.general.nsclient.broadcasts;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.content.LocalBroadcastManager; import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import org.json.JSONObject; import org.json.JSONObject;

View file

@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.general.nsclient.data;
import android.content.Intent; import android.content.Intent;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;

View file

@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.general.nsclient.receivers;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.support.v4.content.WakefulBroadcastReceiver; import androidx.legacy.content.WakefulBroadcastReceiver;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientRestart; import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientRestart;

View file

@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.general.overview;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.Activity; import android.app.Activity;
import android.app.NotificationManager; import android.app.NotificationManager;
import android.arch.core.util.Function; import androidx.arch.core.util.Function;
import android.content.ActivityNotFoundException; import android.content.ActivityNotFoundException;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
@ -12,14 +12,14 @@ import android.graphics.Color;
import android.graphics.Paint; import android.graphics.Paint;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.support.v4.app.Fragment; import androidx.fragment.app.Fragment;
import android.support.v4.app.FragmentActivity; import androidx.fragment.app.FragmentActivity;
import android.support.v4.app.FragmentManager; import androidx.fragment.app.FragmentManager;
import android.support.v4.content.res.ResourcesCompat; import androidx.core.content.res.ResourcesCompat;
import android.support.v7.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import android.support.v7.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import android.support.v7.widget.PopupMenu; import androidx.appcompat.widget.PopupMenu;
import android.support.v7.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import android.text.SpannableString; import android.text.SpannableString;
import android.text.style.ForegroundColorSpan; import android.text.style.ForegroundColorSpan;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
@ -108,8 +108,7 @@ import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin; import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventAutosensCalculationFinished; import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventAutosensCalculationFinished;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventIobCalculationProgress; import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventIobCalculationProgress;
import info.nightscout.androidaps.plugins.source.SourceDexcomG5Plugin; import info.nightscout.androidaps.plugins.source.SourceDexcomPlugin;
import info.nightscout.androidaps.plugins.source.SourceDexcomG6Plugin;
import info.nightscout.androidaps.plugins.source.SourceXdripPlugin; import info.nightscout.androidaps.plugins.source.SourceXdripPlugin;
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin; import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
import info.nightscout.androidaps.plugins.treatments.fragments.ProfileViewerDialog; import info.nightscout.androidaps.plugins.treatments.fragments.ProfileViewerDialog;
@ -661,8 +660,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
@Override @Override
public void onClick(View v) { public void onClick(View v) {
boolean xdrip = SourceXdripPlugin.getPlugin().isEnabled(PluginType.BGSOURCE); boolean xdrip = SourceXdripPlugin.getPlugin().isEnabled(PluginType.BGSOURCE);
boolean g5 = SourceDexcomG5Plugin.getPlugin().isEnabled(PluginType.BGSOURCE); boolean dexcom = SourceDexcomPlugin.INSTANCE.isEnabled(PluginType.BGSOURCE);
boolean g6 = SourceDexcomG6Plugin.getPlugin().isEnabled(PluginType.BGSOURCE);
String units = ProfileFunctions.getInstance().getProfileUnits(); String units = ProfileFunctions.getInstance().getProfileUnits();
FragmentManager manager = getFragmentManager(); FragmentManager manager = getFragmentManager();
@ -685,10 +683,16 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
if (xdrip) { if (xdrip) {
CalibrationDialog calibrationDialog = new CalibrationDialog(); CalibrationDialog calibrationDialog = new CalibrationDialog();
calibrationDialog.show(manager, "CalibrationDialog"); calibrationDialog.show(manager, "CalibrationDialog");
} else if (g5 || g6) { } else if (dexcom) {
try { try {
Intent i = new Intent("com.dexcom.cgm.activities.MeterEntryActivity"); String packageName = SourceDexcomPlugin.INSTANCE.findDexcomPackageName();
startActivity(i); if (packageName != null) {
Intent i = new Intent("com.dexcom.cgm.activities.MeterEntryActivity");
i.setPackage(packageName);
startActivity(i);
} else {
ToastUtils.showToastInUiThread(getActivity(), MainApp.gs(R.string.dexcom_app_not_installed));
}
} catch (ActivityNotFoundException e) { } catch (ActivityNotFoundException e) {
ToastUtils.showToastInUiThread(getActivity(), MainApp.gs(R.string.g5appnotdetected)); ToastUtils.showToastInUiThread(getActivity(), MainApp.gs(R.string.g5appnotdetected));
} }
@ -697,14 +701,14 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
case R.id.overview_cgmbutton: case R.id.overview_cgmbutton:
if (xdrip) if (xdrip)
openCgmApp("com.eveningoutpost.dexdrip"); openCgmApp("com.eveningoutpost.dexdrip");
else if (g5 && units.equals(Constants.MGDL)) else if (dexcom) {
openCgmApp("com.dexcom.cgm.region5.mgdl"); String packageName = SourceDexcomPlugin.INSTANCE.findDexcomPackageName();
else if (g5 && units.equals(Constants.MMOL)) if (packageName != null) {
openCgmApp("com.dexcom.cgm.region5.mmol"); openCgmApp(packageName);
else if (g6 && units.equals(Constants.MGDL)) } else {
openCgmApp("com.dexcom.g6.region3.mgdl"); ToastUtils.showToastInUiThread(getActivity(), MainApp.gs(R.string.dexcom_app_not_installed));
else if (g6 && units.equals(Constants.MMOL)) }
openCgmApp("com.dexcom.g6.region3.mmol"); }
break; break;
case R.id.overview_treatmentbutton: case R.id.overview_treatmentbutton:
NewTreatmentDialog treatmentDialogFragment = new NewTreatmentDialog(); NewTreatmentDialog treatmentDialogFragment = new NewTreatmentDialog();
@ -1188,10 +1192,10 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
// **** Calibration & CGM buttons **** // **** Calibration & CGM buttons ****
boolean xDripIsBgSource = MainApp.getSpecificPlugin(SourceXdripPlugin.class) != null && MainApp.getSpecificPlugin(SourceXdripPlugin.class).isEnabled(PluginType.BGSOURCE); boolean xDripIsBgSource = MainApp.getSpecificPlugin(SourceXdripPlugin.class) != null && MainApp.getSpecificPlugin(SourceXdripPlugin.class).isEnabled(PluginType.BGSOURCE);
boolean g5IsBgSource = MainApp.getSpecificPlugin(SourceDexcomG5Plugin.class) != null && MainApp.getSpecificPlugin(SourceDexcomG5Plugin.class).isEnabled(PluginType.BGSOURCE); boolean dexcomIsSource = SourceDexcomPlugin.INSTANCE.isEnabled(PluginType.BGSOURCE);
boolean bgAvailable = DatabaseHelper.actualBg() != null; boolean bgAvailable = DatabaseHelper.actualBg() != null;
if (calibrationButton != null) { if (calibrationButton != null) {
if ((xDripIsBgSource || g5IsBgSource) && bgAvailable && SP.getBoolean(R.string.key_show_calibration_button, true)) { if ((xDripIsBgSource || dexcomIsSource) && bgAvailable && SP.getBoolean(R.string.key_show_calibration_button, true)) {
calibrationButton.setVisibility(View.VISIBLE); calibrationButton.setVisibility(View.VISIBLE);
} else { } else {
calibrationButton.setVisibility(View.GONE); calibrationButton.setVisibility(View.GONE);
@ -1200,7 +1204,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
if (cgmButton != null) { if (cgmButton != null) {
if (xDripIsBgSource && SP.getBoolean(R.string.key_show_cgm_button, false)) { if (xDripIsBgSource && SP.getBoolean(R.string.key_show_cgm_button, false)) {
cgmButton.setVisibility(View.VISIBLE); cgmButton.setVisibility(View.VISIBLE);
} else if (g5IsBgSource && SP.getBoolean(R.string.key_show_cgm_button, false)) { } else if (dexcomIsSource && SP.getBoolean(R.string.key_show_cgm_button, false)) {
cgmButton.setVisibility(View.VISIBLE); cgmButton.setVisibility(View.VISIBLE);
} else { } else {
cgmButton.setVisibility(View.GONE); cgmButton.setVisibility(View.GONE);

View file

@ -2,11 +2,11 @@ package info.nightscout.androidaps.plugins.general.overview.activities;
import android.app.Activity; import android.app.Activity;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.FragmentManager; import androidx.fragment.app.FragmentManager;
import android.support.v7.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import android.support.v7.widget.CardView; import androidx.cardview.widget.CardView;
import android.support.v7.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;

View file

@ -4,7 +4,7 @@ package info.nightscout.androidaps.plugins.general.overview.dialogs;
import android.app.Activity; import android.app.Activity;
import android.os.Bundle; import android.os.Bundle;
import android.os.SystemClock; import android.os.SystemClock;
import android.support.v4.app.DialogFragment; import androidx.fragment.app.DialogFragment;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;

View file

@ -1,7 +1,7 @@
package info.nightscout.androidaps.plugins.general.overview.dialogs; package info.nightscout.androidaps.plugins.general.overview.dialogs;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
/** /**
* Created by adrian on 09/02/17. * Created by adrian on 09/02/17.

View file

@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.general.overview.dialogs;
import android.content.Context; import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.DialogFragment; import androidx.fragment.app.DialogFragment;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;

View file

@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.general.overview.dialogs;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.DialogFragment; import androidx.fragment.app.DialogFragment;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;

View file

@ -2,8 +2,9 @@ package info.nightscout.androidaps.plugins.general.overview.dialogs;
import android.content.Intent; import android.content.Intent;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.DialogFragment; import androidx.fragment.app.DialogFragment;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -98,7 +99,10 @@ public class ErrorDialog extends DialogFragment implements View.OnClickListener
private void startAlarm() { private void startAlarm() {
Intent alarm = new Intent(MainApp.instance().getApplicationContext(), AlarmSoundService.class); Intent alarm = new Intent(MainApp.instance().getApplicationContext(), AlarmSoundService.class);
alarm.putExtra("soundid", soundId); alarm.putExtra("soundid", soundId);
MainApp.instance().startService(alarm); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
MainApp.instance().startForegroundService(alarm);
else
MainApp.instance().startService(alarm);
} }
private void stopAlarm() { private void stopAlarm() {

View file

@ -1,7 +1,7 @@
package info.nightscout.androidaps.plugins.general.overview.dialogs; package info.nightscout.androidaps.plugins.general.overview.dialogs;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload; import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;

View file

@ -2,8 +2,8 @@ package info.nightscout.androidaps.plugins.general.overview.dialogs;
import android.os.Bundle; import android.os.Bundle;
import android.os.HandlerThread; import android.os.HandlerThread;
import android.support.v4.app.DialogFragment; import androidx.fragment.app.DialogFragment;
import android.support.v7.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import android.text.Editable; import android.text.Editable;
import android.text.Html; import android.text.Html;
import android.text.TextWatcher; import android.text.TextWatcher;

View file

@ -4,8 +4,8 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.os.HandlerThread; import android.os.HandlerThread;
import android.support.v4.app.DialogFragment; import androidx.fragment.app.DialogFragment;
import android.support.v7.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import android.text.Editable; import android.text.Editable;
import android.text.Html; import android.text.Html;
import android.text.TextWatcher; import android.text.TextWatcher;

View file

@ -4,8 +4,8 @@ import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.DialogFragment; import androidx.fragment.app.DialogFragment;
import android.support.v7.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import android.text.Editable; import android.text.Editable;
import android.text.Html; import android.text.Html;
import android.text.TextWatcher; import android.text.TextWatcher;

View file

@ -5,8 +5,8 @@ import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.DialogFragment; import androidx.fragment.app.DialogFragment;
import android.support.v7.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import android.text.Editable; import android.text.Editable;
import android.text.Html; import android.text.Html;
import android.text.TextWatcher; import android.text.TextWatcher;

View file

@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.general.overview.notifications;
import android.app.IntentService; import android.app.IntentService;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.content.Intent; import android.content.Intent;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification; import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;

View file

@ -1,8 +1,8 @@
package info.nightscout.androidaps.plugins.general.overview.notifications; package info.nightscout.androidaps.plugins.general.overview.notifications;
import android.support.v4.content.ContextCompat; import androidx.core.content.ContextCompat;
import android.support.v7.widget.CardView; import androidx.cardview.widget.CardView;
import android.support.v7.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;

View file

@ -11,8 +11,8 @@ import android.media.AudioAttributes;
import android.media.RingtoneManager; import android.media.RingtoneManager;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.support.v4.app.NotificationCompat; import androidx.core.app.NotificationCompat;
import android.support.v7.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import android.view.View; import android.view.View;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -69,14 +69,20 @@ public class NotificationStore {
if (usesChannels && n.soundId != null) { if (usesChannels && n.soundId != null) {
Intent alarm = new Intent(MainApp.instance().getApplicationContext(), AlarmSoundService.class); Intent alarm = new Intent(MainApp.instance().getApplicationContext(), AlarmSoundService.class);
alarm.putExtra("soundid", n.soundId); alarm.putExtra("soundid", n.soundId);
MainApp.instance().startService(alarm); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
MainApp.instance().startForegroundService(alarm);
else
MainApp.instance().startService(alarm);
} }
} else { } else {
if (n.soundId != null) { if (n.soundId != null) {
Intent alarm = new Intent(MainApp.instance().getApplicationContext(), AlarmSoundService.class); Intent alarm = new Intent(MainApp.instance().getApplicationContext(), AlarmSoundService.class);
alarm.putExtra("soundid", n.soundId); alarm.putExtra("soundid", n.soundId);
MainApp.instance().startService(alarm); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
MainApp.instance().startForegroundService(alarm);
else
MainApp.instance().startService(alarm);
} }
} }

View file

@ -4,7 +4,8 @@ import android.app.Notification;
import android.app.Service; import android.app.Service;
import android.content.Intent; import android.content.Intent;
import android.os.IBinder; import android.os.IBinder;
import android.support.annotation.Nullable;
import androidx.annotation.Nullable;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
@ -29,9 +30,8 @@ public class DummyService extends Service {
@Override @Override
public int onStartCommand(Intent intent, int flags, int startId) { public int onStartCommand(Intent intent, int flags, int startId) {
Notification notification = PersistentNotificationPlugin.getPlugin().updateNotification(); super.onStartCommand(intent, flags, startId);
if (notification != null) startForeground(PersistentNotificationPlugin.ONGOING_NOTIFICATION_ID, PersistentNotificationPlugin.getPlugin().updateNotification());
startForeground(PersistentNotificationPlugin.ONGOING_NOTIFICATION_ID, notification);
return START_STICKY; return START_STICKY;
} }
@ -45,6 +45,11 @@ public class DummyService extends Service {
@Override @Override
public void onCreate() { public void onCreate() {
super.onCreate();
// TODO: I guess this was moved here in order to adhere to the 5 seconds rule to call "startForeground" after a Service was called as Foreground service?
// As onCreate() is not called every time a service is started, copied to onStartCommand().
Notification notification = PersistentNotificationPlugin.getPlugin().updateNotification();
startForeground(PersistentNotificationPlugin.ONGOING_NOTIFICATION_ID, notification);
MainApp.bus().register(this); MainApp.bus().register(this);
} }

View file

@ -10,17 +10,19 @@ import android.content.Intent;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.os.Build; import android.os.Build;
import android.support.v4.app.NotificationCompat;
import android.support.v4.app.RemoteInput; import androidx.core.app.NotificationCompat;
import android.support.v4.app.TaskStackBuilder; import androidx.core.app.RemoteInput;
import androidx.core.app.TaskStackBuilder;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
import javax.annotation.Nonnull;
import info.nightscout.androidaps.Constants; import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainActivity; import info.nightscout.androidaps.MainActivity;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus;
import info.nightscout.androidaps.data.IobTotal; import info.nightscout.androidaps.data.IobTotal;
import info.nightscout.androidaps.db.BgReading; import info.nightscout.androidaps.db.BgReading;
import info.nightscout.androidaps.db.DatabaseHelper; import info.nightscout.androidaps.db.DatabaseHelper;
@ -37,6 +39,7 @@ import info.nightscout.androidaps.interfaces.PluginDescription;
import info.nightscout.androidaps.interfaces.PluginType; import info.nightscout.androidaps.interfaces.PluginType;
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions; import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin; import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventAutosensCalculationFinished; import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventAutosensCalculationFinished;
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin; import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
@ -72,13 +75,14 @@ public class PersistentNotificationPlugin extends PluginBase {
/// End Android Auto /// End Android Auto
public PersistentNotificationPlugin(Context ctx) { private PersistentNotificationPlugin(Context ctx) {
super(new PluginDescription() super(new PluginDescription()
.mainType(PluginType.GENERAL) .mainType(PluginType.GENERAL)
.neverVisible(true) .neverVisible(true)
.pluginName(R.string.ongoingnotificaction) .pluginName(R.string.ongoingnotificaction)
.enableByDefault(true) .enableByDefault(true)
.alwaysEnabled(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) .alwaysEnabled(true)
.showInList(false)
.description(R.string.description_persistent_notification) .description(R.string.description_persistent_notification)
); );
this.ctx = ctx; this.ctx = ctx;
@ -86,8 +90,8 @@ public class PersistentNotificationPlugin extends PluginBase {
@Override @Override
protected void onStart() { protected void onStart() {
createNotificationChannel(); // make sure channels exist before triggering updates through the bus
MainApp.bus().register(this); MainApp.bus().register(this);
createNotificationChannel();
triggerNotificationUpdate(); triggerNotificationUpdate();
super.onStart(); super.onStart();
} }
@ -111,105 +115,107 @@ public class PersistentNotificationPlugin extends PluginBase {
} }
private void triggerNotificationUpdate() { private void triggerNotificationUpdate() {
MainApp.instance().startService(new Intent(MainApp.instance(), DummyService.class)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
MainApp.instance().startForegroundService(new Intent(MainApp.instance(), DummyService.class));
else
MainApp.instance().startService(new Intent(MainApp.instance(), DummyService.class));
} }
@Nonnull
Notification updateNotification() { Notification updateNotification() {
if (!isEnabled(PluginType.GENERAL)) { String line1 = null;
return null; String line2 = null;
} String line3 = null;
NotificationCompat.CarExtender.UnreadConversation.Builder unreadConversationBuilder = null;
String line1; if (ConfigBuilderPlugin.getPlugin().getActiveProfileInterface() != null && ProfileFunctions.getInstance().isProfileValid("Notification")) {
String line1_aa; String line1_aa;
String units = ProfileFunctions.getInstance().getProfileUnits();
if (ConfigBuilderPlugin.getPlugin().getActiveProfileInterface() == null || !ProfileFunctions.getInstance().isProfileValid("Notificiation"))
return null;
String units = ProfileFunctions.getInstance().getProfileUnits();
BgReading lastBG = DatabaseHelper.lastBg(); BgReading lastBG = DatabaseHelper.lastBg();
GlucoseStatus glucoseStatus = GlucoseStatus.getGlucoseStatusData(); GlucoseStatus glucoseStatus = GlucoseStatus.getGlucoseStatusData();
if (lastBG != null) { if (lastBG != null) {
line1 = line1_aa = lastBG.valueToUnitsToString(units); line1 = line1_aa = lastBG.valueToUnitsToString(units);
if (glucoseStatus != null) { if (glucoseStatus != null) {
line1 += " Δ" + deltastring(glucoseStatus.delta, glucoseStatus.delta * Constants.MGDL_TO_MMOLL, units) line1 += " Δ" + deltastring(glucoseStatus.delta, glucoseStatus.delta * Constants.MGDL_TO_MMOLL, units)
+ " avgΔ" + deltastring(glucoseStatus.avgdelta, glucoseStatus.avgdelta * Constants.MGDL_TO_MMOLL, units); + " avgΔ" + deltastring(glucoseStatus.avgdelta, glucoseStatus.avgdelta * Constants.MGDL_TO_MMOLL, units);
line1_aa += " " + lastBG.directionToSymbol(); line1_aa += " " + lastBG.directionToSymbol();
} else {
line1 += " " +
MainApp.gs(R.string.old_data) +
" ";
line1_aa += line1 + ".";
}
} else { } else {
line1 += " " + line1 = line1_aa = MainApp.gs(R.string.missed_bg_readings);
MainApp.gs(R.string.old_data) +
" ";
line1_aa += line1 + ".";
} }
} else {
line1 = line1_aa = MainApp.gs(R.string.missed_bg_readings); TemporaryBasal activeTemp = TreatmentsPlugin.getPlugin().getTempBasalFromHistory(System.currentTimeMillis());
if (activeTemp != null) {
line1 += " " + activeTemp.toStringShort();
line1_aa += " " + activeTemp.toStringShort() + ".";
}
//IOB
TreatmentsPlugin.getPlugin().updateTotalIOBTreatments();
TreatmentsPlugin.getPlugin().updateTotalIOBTempBasals();
IobTotal bolusIob = TreatmentsPlugin.getPlugin().getLastCalculationTreatments().round();
IobTotal basalIob = TreatmentsPlugin.getPlugin().getLastCalculationTempBasals().round();
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() + ".";
line3 = DecimalFormatter.to2Decimal(ConfigBuilderPlugin.getPlugin().getActivePump().getBaseBasalRate()) + " U/h";
String line3_aa = DecimalFormatter.to2Decimal(ConfigBuilderPlugin.getPlugin().getActivePump().getBaseBasalRate()) + " U/h.";
line3 += " - " + ProfileFunctions.getInstance().getProfileName();
line3_aa += " - " + ProfileFunctions.getInstance().getProfileName() + ".";
/// For Android Auto
Intent msgReadIntent = new Intent()
.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES)
.setAction(READ_ACTION)
.putExtra(CONVERSATION_ID, ONGOING_NOTIFICATION_ID)
.setPackage(PACKAGE);
PendingIntent msgReadPendingIntent =
PendingIntent.getBroadcast(ctx,
ONGOING_NOTIFICATION_ID,
msgReadIntent,
PendingIntent.FLAG_UPDATE_CURRENT);
Intent msgReplyIntent = new Intent()
.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES)
.setAction(REPLY_ACTION)
.putExtra(CONVERSATION_ID, ONGOING_NOTIFICATION_ID)
.setPackage(PACKAGE);
PendingIntent msgReplyPendingIntent = PendingIntent.getBroadcast(
ctx,
ONGOING_NOTIFICATION_ID,
msgReplyIntent,
PendingIntent.FLAG_UPDATE_CURRENT);
// Build a RemoteInput for receiving voice input from devices
RemoteInput remoteInput = new RemoteInput.Builder(EXTRA_VOICE_REPLY).build();
// Create the UnreadConversation
unreadConversationBuilder =
new NotificationCompat.CarExtender.UnreadConversation.Builder(line1_aa + "\n" + line2_aa)
.setLatestTimestamp(System.currentTimeMillis())
.setReadPendingIntent(msgReadPendingIntent)
.setReplyAction(msgReplyPendingIntent, remoteInput);
/// Add dot to produce a "more natural sounding result"
unreadConversationBuilder.addMessage(line3_aa);
/// End Android Auto
} }
TemporaryBasal activeTemp = TreatmentsPlugin.getPlugin().getTempBasalFromHistory(System.currentTimeMillis());
if (activeTemp != null) {
line1 += " " + activeTemp.toStringShort();
line1_aa += " " + activeTemp.toStringShort() + ".";
}
//IOB
TreatmentsPlugin.getPlugin().updateTotalIOBTreatments();
TreatmentsPlugin.getPlugin().updateTotalIOBTempBasals();
IobTotal bolusIob = TreatmentsPlugin.getPlugin().getLastCalculationTreatments().round();
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 line3 = DecimalFormatter.to2Decimal(ConfigBuilderPlugin.getPlugin().getActivePump().getBaseBasalRate()) + " U/h";
String line3_aa = DecimalFormatter.to2Decimal(ConfigBuilderPlugin.getPlugin().getActivePump().getBaseBasalRate()) + " U/h.";
line3 += " - " + ProfileFunctions.getInstance().getProfileName();
line3_aa += " - " + ProfileFunctions.getInstance().getProfileName() + ".";
/// For Android Auto
Intent msgReadIntent = new Intent()
.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES)
.setAction(READ_ACTION)
.putExtra(CONVERSATION_ID, ONGOING_NOTIFICATION_ID)
.setPackage(PACKAGE);
PendingIntent msgReadPendingIntent =
PendingIntent.getBroadcast(ctx,
ONGOING_NOTIFICATION_ID,
msgReadIntent,
PendingIntent.FLAG_UPDATE_CURRENT);
Intent msgReplyIntent = new Intent()
.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES)
.setAction(REPLY_ACTION)
.putExtra(CONVERSATION_ID, ONGOING_NOTIFICATION_ID)
.setPackage(PACKAGE);
PendingIntent msgReplyPendingIntent = PendingIntent.getBroadcast(
ctx,
ONGOING_NOTIFICATION_ID,
msgReplyIntent,
PendingIntent.FLAG_UPDATE_CURRENT);
// Build a RemoteInput for receiving voice input from devices
RemoteInput remoteInput = new RemoteInput.Builder(EXTRA_VOICE_REPLY).build();
// Create the UnreadConversation
NotificationCompat.CarExtender.UnreadConversation.Builder unreadConversationBuilder =
new NotificationCompat.CarExtender.UnreadConversation.Builder(line1_aa + "\n" + line2_aa)
.setLatestTimestamp(System.currentTimeMillis())
.setReadPendingIntent(msgReadPendingIntent)
.setReplyAction(msgReplyPendingIntent, remoteInput);
/// Add dot to produce a "more natural sounding result"
unreadConversationBuilder.addMessage(line3_aa);
/// End Android Auto
NotificationCompat.Builder builder = new NotificationCompat.Builder(ctx, CHANNEL_ID); NotificationCompat.Builder builder = new NotificationCompat.Builder(ctx, CHANNEL_ID);
builder.setOngoing(true); builder.setOngoing(true);
builder.setOnlyAlertOnce(true); builder.setOnlyAlertOnce(true);
@ -217,12 +223,14 @@ public class PersistentNotificationPlugin extends PluginBase {
builder.setSmallIcon(MainApp.getNotificationIcon()); builder.setSmallIcon(MainApp.getNotificationIcon());
Bitmap largeIcon = BitmapFactory.decodeResource(ctx.getResources(), MainApp.getIcon()); Bitmap largeIcon = BitmapFactory.decodeResource(ctx.getResources(), MainApp.getIcon());
builder.setLargeIcon(largeIcon); builder.setLargeIcon(largeIcon);
builder.setContentTitle(line1); builder.setContentTitle(line1 != null ? line1 : MainApp.gs(R.string.noprofileset));
builder.setContentText(line2); builder.setContentText(line2 != null ? line2 : MainApp.gs(R.string.noprofileset));
builder.setSubText(line3); builder.setSubText(line3 != null ? line3 : MainApp.gs(R.string.noprofileset));
/// Android Auto /// Android Auto
builder.extend(new NotificationCompat.CarExtender() if (unreadConversationBuilder != null) {
.setUnreadConversation(unreadConversationBuilder.build())); builder.extend(new NotificationCompat.CarExtender()
.setUnreadConversation(unreadConversationBuilder.build()));
}
/// End Android Auto /// End Android Auto

View file

@ -1,11 +1,11 @@
package info.nightscout.androidaps.plugins.general.tidepool package info.nightscout.androidaps.plugins.general.tidepool
import android.os.Bundle import android.os.Bundle
import android.support.v4.app.Fragment
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.ScrollView import android.widget.ScrollView
import androidx.fragment.app.Fragment
import info.nightscout.androidaps.R import info.nightscout.androidaps.R
import info.nightscout.androidaps.plugins.bus.RxBus import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.plugins.general.tidepool.comm.TidepoolUploader import info.nightscout.androidaps.plugins.general.tidepool.comm.TidepoolUploader

View file

@ -9,29 +9,21 @@ import info.nightscout.androidaps.logging.L
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification import info.nightscout.androidaps.plugins.general.overview.notifications.Notification
import info.nightscout.androidaps.utils.SP import info.nightscout.androidaps.utils.SP
import org.apache.http.HttpResponse
import org.apache.http.client.methods.HttpGet
import org.apache.http.impl.client.DefaultHttpClient
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
import java.io.IOException import java.io.IOException
import java.io.InputStream import java.net.URL
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
// check network connection // check network connection
fun isConnected(): Boolean { fun isConnected(): Boolean {
val connMgr = MainApp.instance().applicationContext.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager val connMgr = MainApp.instance().applicationContext.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
return connMgr.activeNetworkInfo?.isConnected ?: false return connMgr.activeNetworkInfo?.isConnected ?: false
} }
// convert inputstream to String fun findVersion(file :String?): String? {
@Throws(IOException::class)
inline fun InputStream.findVersion(): String? {
val regex = "(.*)version(.*)\"(((\\d+)\\.)+(\\d+))\"(.*)".toRegex() val regex = "(.*)version(.*)\"(((\\d+)\\.)+(\\d+))\"(.*)".toRegex()
return bufferedReader() return file?.lines()?.filter { regex.matches(it) }?.mapNotNull { regex.matchEntire(it)?.groupValues?.getOrNull(3) }?.firstOrNull()
.readLines()
.filter { regex.matches(it) }
.mapNotNull { regex.matchEntire(it)?.groupValues?.getOrNull(3) }
.firstOrNull()
} }
private val log = LoggerFactory.getLogger(L.CORE) private val log = LoggerFactory.getLogger(L.CORE)
@ -39,24 +31,21 @@ private val log = LoggerFactory.getLogger(L.CORE)
fun triggerCheckVersion() { fun triggerCheckVersion() {
if(!SP.contains(R.string.key_last_time_this_version_detected)) { if (!SP.contains(R.string.key_last_time_this_version_detected)) {
// On a new installation, set it as 30 days old in order to warn that there is a new version. // On a new installation, set it as 30 days old in order to warn that there is a new version.
SP.putLong(R.string.key_last_time_this_version_detected, System.currentTimeMillis() - TimeUnit.DAYS.toMillis(30)) SP.putLong(R.string.key_last_time_this_version_detected, System.currentTimeMillis() - TimeUnit.DAYS.toMillis(30))
} }
// If we are good, only check once every day. // If we are good, only check once every day.
if(System.currentTimeMillis() > SP.getLong(R.string.key_last_time_this_version_detected, 0) + CHECK_EVERY){ if (System.currentTimeMillis() > SP.getLong(R.string.key_last_time_this_version_detected, 0) + CHECK_EVERY) {
checkVersion() checkVersion()
} }
} }
@Suppress("DEPRECATION")
private fun checkVersion() = if (isConnected()) { private fun checkVersion() = if (isConnected()) {
Thread { Thread {
try { try {
val request = HttpGet("https://raw.githubusercontent.com/MilosKozak/AndroidAPS/master/app/build.gradle") val version: String? = findVersion(URL("https://raw.githubusercontent.com/MilosKozak/AndroidAPS/master/app/build.gradle").readText())
val response: HttpResponse = DefaultHttpClient().execute(request)
val version: String? = response.entity.content?.findVersion()
compareWithCurrentVersion(version, BuildConfig.VERSION_NAME) compareWithCurrentVersion(version, BuildConfig.VERSION_NAME)
} catch (e: IOException) { } catch (e: IOException) {
log.debug("Github master version check error: $e") log.debug("Github master version check error: $e")
@ -90,7 +79,7 @@ fun onVersionNotDetectable() {
fun onNewVersionDetected(currentVersion: String, newVersion: String?) { fun onNewVersionDetected(currentVersion: String, newVersion: String?) {
val now = System.currentTimeMillis() val now = System.currentTimeMillis()
if(now > SP.getLong(R.string.key_last_versionchecker_warning, 0) + WARN_EVERY) { if (now > SP.getLong(R.string.key_last_versionchecker_warning, 0) + WARN_EVERY) {
log.debug("Version ${currentVersion} outdated. Found $newVersion") log.debug("Version ${currentVersion} outdated. Found $newVersion")
val notification = Notification(Notification.NEWVERSIONDETECTED, String.format(MainApp.gs(R.string.versionavailable), newVersion.toString()), Notification.LOW) val notification = Notification(Notification.NEWVERSIONDETECTED, String.format(MainApp.gs(R.string.versionavailable), newVersion.toString()), Notification.LOW)
MainApp.bus().post(EventNewNotification(notification)) MainApp.bus().post(EventNewNotification(notification))

View file

@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.general.wear;
import android.app.NotificationManager; import android.app.NotificationManager;
import android.content.Context; import android.content.Context;
import android.os.HandlerThread; import android.os.HandlerThread;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.DecimalFormat; import java.text.DecimalFormat;

View file

@ -1,7 +1,7 @@
package info.nightscout.androidaps.plugins.general.wear; package info.nightscout.androidaps.plugins.general.wear;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.Fragment; import androidx.fragment.app.Fragment;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;

View file

@ -17,7 +17,7 @@ import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.HandlerThread; import android.os.HandlerThread;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.util.Log; import android.util.Log;
import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.ConnectionResult;

View file

@ -5,7 +5,7 @@ import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;

View file

@ -1,7 +1,7 @@
package info.nightscout.androidaps.plugins.insulin; package info.nightscout.androidaps.plugins.insulin;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.Fragment; import androidx.fragment.app.Fragment;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;

View file

@ -1,7 +1,7 @@
package info.nightscout.androidaps.plugins.iob.iobCobCalculator; package info.nightscout.androidaps.plugins.iob.iobCobCalculator;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import info.nightscout.androidaps.utils.DecimalFormatter; import info.nightscout.androidaps.utils.DecimalFormatter;

View file

@ -1,6 +1,6 @@
package info.nightscout.androidaps.plugins.iob.iobCobCalculator; package info.nightscout.androidaps.plugins.iob.iobCobCalculator;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;

View file

@ -1,9 +1,9 @@
package info.nightscout.androidaps.plugins.iob.iobCobCalculator; package info.nightscout.androidaps.plugins.iob.iobCobCalculator;
import android.os.SystemClock; import android.os.SystemClock;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import android.support.v4.util.LongSparseArray; import androidx.collection.LongSparseArray;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;

View file

@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.iob.iobCobCalculator;
import android.content.Context; import android.content.Context;
import android.os.PowerManager; import android.os.PowerManager;
import android.os.SystemClock; import android.os.SystemClock;
import android.support.v4.util.LongSparseArray; import androidx.collection.LongSparseArray;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;

View file

@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.iob.iobCobCalculator;
import android.content.Context; import android.content.Context;
import android.os.PowerManager; import android.os.PowerManager;
import android.os.SystemClock; import android.os.SystemClock;
import android.support.v4.util.LongSparseArray; import androidx.collection.LongSparseArray;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;

View file

@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.profile.local;
import android.app.Activity; import android.app.Activity;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.text.Editable; import android.text.Editable;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.view.LayoutInflater; import android.view.LayoutInflater;

View file

@ -1,6 +1,6 @@
package info.nightscout.androidaps.plugins.profile.local; package info.nightscout.androidaps.plugins.profile.local;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;

View file

@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.profile.ns;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;

View file

@ -5,7 +5,7 @@ import android.app.Activity;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;

View file

@ -2,10 +2,10 @@ package info.nightscout.androidaps.plugins.pump.combo;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.os.SystemClock; import android.os.SystemClock;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import android.support.v4.app.FragmentActivity; import androidx.fragment.app.FragmentActivity;
import android.support.v7.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import org.json.JSONObject; import org.json.JSONObject;
import org.slf4j.Logger; import org.slf4j.Logger;

View file

@ -1,7 +1,7 @@
package info.nightscout.androidaps.plugins.pump.combo; package info.nightscout.androidaps.plugins.pump.combo;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

View file

@ -1,6 +1,6 @@
package info.nightscout.androidaps.plugins.pump.combo.ruffyscripter; package info.nightscout.androidaps.plugins.pump.combo.ruffyscripter;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;

View file

@ -7,8 +7,8 @@ import android.content.ServiceConnection;
import android.os.IBinder; import android.os.IBinder;
import android.os.RemoteException; import android.os.RemoteException;
import android.os.SystemClock; import android.os.SystemClock;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;

View file

@ -1,6 +1,6 @@
package info.nightscout.androidaps.plugins.pump.combo.ruffyscripter; package info.nightscout.androidaps.plugins.pump.combo.ruffyscripter;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
public class WarningOrErrorCode { public class WarningOrErrorCode {
@Nullable @Nullable

View file

@ -1,6 +1,6 @@
package info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.commands; package info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.commands;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import org.monkey.d.ruffy.ruffy.driver.display.MenuAttribute; import org.monkey.d.ruffy.ruffy.driver.display.MenuAttribute;
import org.monkey.d.ruffy.ruffy.driver.display.MenuType; import org.monkey.d.ruffy.ruffy.driver.display.MenuType;

View file

@ -1,6 +1,6 @@
package info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.commands; package info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.commands;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import org.monkey.d.ruffy.ruffy.driver.display.MenuAttribute; import org.monkey.d.ruffy.ruffy.driver.display.MenuAttribute;
import org.monkey.d.ruffy.ruffy.driver.display.MenuType; import org.monkey.d.ruffy.ruffy.driver.display.MenuType;

View file

@ -1,6 +1,6 @@
package info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.history; package info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.history;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedList; import java.util.LinkedList;

Some files were not shown because too many files have changed in this diff Show more