diff --git a/.travis.yml b/.travis.yml index 5c6309f817..ec1632958e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,19 +2,19 @@ language: android jdk: oraclejdk8 env: 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: components: - platform-tools - tools - - build-tools-27.0.2 - - android-23 + - build-tools-28.0.3 + - android-28 - extra-google-m2repository - extra-android-m2repository - extra-google-google_play_services before_install: -- yes | sdkmanager "platforms;android-27" +- yes | sdkmanager "platforms;android-28" script: # Unit Test diff --git a/app/build.gradle b/app/build.gradle index e9da77c338..6b15175100 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,23 +6,30 @@ buildscript { dependencies { 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: 'kotlin-android-extensions' +apply plugin: 'com.android.application' apply plugin: 'kotlin-android' +apply plugin: 'kotlin-android-extensions' apply plugin: 'com.google.gms.google-services' -apply plugin: "io.fabric" -apply plugin: "jacoco-android" +apply plugin: 'io.fabric' +apply plugin: 'jacoco-android' apply plugin: 'com.jakewharton.butterknife' +apply plugin: 'de.undercouch.download' + + +jacoco { + toolVersion = "0.8.3" +} ext { - supportLibraryVersion = "27.1.1" + supportLibraryVersion = "28.0.0" ormLiteVersion = "4.46" powermockVersion = "1.7.3" dexmakerVersion = "1.2" - butterknifeVersion = "8.8.1" + butterknifeVersion = "10.1.0" } @@ -97,11 +104,11 @@ tasks.matching { it instanceof Test }.all { } android { - compileSdkVersion 27 + compileSdkVersion 28 defaultConfig { - minSdkVersion 21 - targetSdkVersion 25 + minSdkVersion 23 + targetSdkVersion 28 multiDexEnabled true versionCode 1500 version "2.3.1-tidepool" @@ -109,7 +116,7 @@ android { buildConfigField "String", "BUILDVERSION", '"' + generateGitBuild() + '-' + generateDate() + '"' buildConfigField "String", "REMOTE", '"' + generateGitRemote() + '"' 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 ndk { @@ -188,8 +195,15 @@ android { } testOptions { - unitTests.returnDefaultValues = true - unitTests.includeAndroidResources = true + unitTests { + returnDefaultValues = true + includeAndroidResources = true + + all { + maxParallelForks = 10 + forkEvery = 20 + } + } } useLibrary "org.apache.http.legacy" @@ -204,29 +218,24 @@ allprojects { } } -configurations { - libs -} - dependencies { wearApp project(':wear') implementation fileTree(include: ['*.jar'], dir: 'libs') 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") { transitive = true; } - libs "MilosKozak:danars-support-lib:master@zip" - implementation "com.android.support:appcompat-v7:${supportLibraryVersion}" - implementation "com.android.support:support-v13:${supportLibraryVersion}" - implementation "com.android.support:support-v4:${supportLibraryVersion}" - implementation "com.android.support:cardview-v7:${supportLibraryVersion}" - implementation "com.android.support:recyclerview-v7:${supportLibraryVersion}" - implementation "com.android.support:gridlayout-v7:${supportLibraryVersion}" - implementation "com.android.support:design:${supportLibraryVersion}" - implementation "com.android.support:percent:${supportLibraryVersion}" + implementation 'androidx.appcompat:appcompat:1.0.2' + implementation 'androidx.legacy:legacy-support-v13:1.0.0' + implementation 'androidx.legacy:legacy-support-v4:1.0.0' + implementation 'androidx.cardview:cardview:1.0.0' + implementation 'androidx.recyclerview:recyclerview:1.0.0' + implementation 'androidx.gridlayout:gridlayout:1.0.0' + implementation 'com.google.android.material:material:1.0.0' + implementation 'androidx.percentlayout:percentlayout:1.0.0' implementation "com.wdullaer:materialdatetimepicker:2.3.0" // Otto bus will be replaced by rx @@ -243,7 +252,7 @@ dependencies { // Graphview cannot be upgraded implementation "com.jjoe64:graphview:4.0.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 'com.madgag.spongycastle:core:1.58.0.0' @@ -274,7 +283,7 @@ dependencies { testImplementation "org.powermock:powermock-module-junit4:${powermockVersion}" testImplementation "joda-time:joda-time:2.9.9" 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" 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 } -task copyLibs(dependsOn: unzip, type: Copy) { + +task copyLibs(dependsOn: downloadAndUnzipFile, type: Copy) { def src = file("${buildDir}/unpacked/dist/danars-support-lib-master") def target = file("src/main/jniLibs/") diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3eaa81ba45..3424b84be1 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -17,10 +17,11 @@ + - + @@ -34,13 +35,15 @@ android:label="@string/app_name" android:roundIcon="${appIconRound}" android:supportsRtl="true" - android:theme="@style/AppTheme.NoActionBar"> + android:theme="@style/AppTheme.NoActionBar" + android:fullBackupContent="true"> + @@ -85,10 +88,8 @@ - - - - + + @@ -147,7 +148,7 @@ @@ -281,6 +282,10 @@ android:name=".plugins.pump.insight.activities.InsightPairingInformationActivity" android:label="@string/pairing_information" android:theme="@style/AppTheme" /> + + + + diff --git a/app/src/main/java/info/nightscout/androidaps/MainActivity.java b/app/src/main/java/info/nightscout/androidaps/MainActivity.java index 6779b0a467..b9622daf1b 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainActivity.java +++ b/app/src/main/java/info/nightscout/androidaps/MainActivity.java @@ -7,16 +7,16 @@ import android.graphics.Rect; import android.os.Bundle; import android.os.PersistableBundle; import android.os.PowerManager; -import android.support.annotation.Nullable; -import android.support.design.widget.NavigationView; -import android.support.design.widget.TabLayout; -import android.support.v4.app.ActivityCompat; -import android.support.v4.view.ViewPager; -import android.support.v4.widget.DrawerLayout; -import android.support.v7.app.ActionBarDrawerToggle; -import android.support.v7.app.AlertDialog; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.Toolbar; +import androidx.annotation.Nullable; +import com.google.android.material.navigation.NavigationView; +import com.google.android.material.tabs.TabLayout; +import androidx.core.app.ActivityCompat; +import androidx.viewpager.widget.ViewPager; +import androidx.drawerlayout.widget.DrawerLayout; +import androidx.appcompat.app.ActionBarDrawerToggle; +import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; import android.text.SpannableString; import android.text.method.LinkMovementMethod; import android.text.util.Linkify; diff --git a/app/src/main/java/info/nightscout/androidaps/MainApp.java b/app/src/main/java/info/nightscout/androidaps/MainApp.java index 9acd222b55..b64e5673a6 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainApp.java +++ b/app/src/main/java/info/nightscout/androidaps/MainApp.java @@ -4,9 +4,10 @@ import android.app.Application; import android.content.IntentFilter; import android.content.res.Resources; import android.os.SystemClock; -import android.support.annotation.Nullable; -import android.support.annotation.PluralsRes; -import android.support.v4.content.LocalBroadcastManager; + +import androidx.annotation.Nullable; +import androidx.annotation.PluralsRes; +import androidx.localbroadcastmanager.content.LocalBroadcastManager; import com.crashlytics.android.Crashlytics; 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.SensitivityOref1Plugin; import info.nightscout.androidaps.plugins.sensitivity.SensitivityWeightedAveragePlugin; -import info.nightscout.androidaps.plugins.source.SourceDexcomG5Plugin; -import info.nightscout.androidaps.plugins.source.SourceDexcomG6Plugin; +import info.nightscout.androidaps.plugins.source.SourceDexcomPlugin; import info.nightscout.androidaps.plugins.source.SourceEversensePlugin; import info.nightscout.androidaps.plugins.source.SourceGlimpPlugin; import info.nightscout.androidaps.plugins.source.SourceMM640gPlugin; @@ -193,8 +193,7 @@ public class MainApp extends Application { pluginsList.add(SourceNSClientPlugin.getPlugin()); pluginsList.add(SourceMM640gPlugin.getPlugin()); pluginsList.add(SourceGlimpPlugin.getPlugin()); - pluginsList.add(SourceDexcomG5Plugin.getPlugin()); - pluginsList.add(SourceDexcomG6Plugin.getPlugin()); + pluginsList.add(SourceDexcomPlugin.INSTANCE); pluginsList.add(SourcePoctechPlugin.getPlugin()); pluginsList.add(SourceTomatoPlugin.getPlugin()); pluginsList.add(SourceEversensePlugin.getPlugin()); @@ -205,7 +204,8 @@ public class MainApp extends Application { pluginsList.add(StatuslinePlugin.initPlugin(this)); pluginsList.add(PersistentNotificationPlugin.getPlugin()); pluginsList.add(NSClientPlugin.getPlugin()); - pluginsList.add(TidepoolPlugin.INSTANCE); + if (engineeringMode) + pluginsList.add(TidepoolPlugin.INSTANCE); pluginsList.add(MaintenancePlugin.initPlugin(this)); pluginsList.add(ConfigBuilderPlugin.getPlugin()); diff --git a/app/src/main/java/info/nightscout/androidaps/activities/HistoryBrowseActivity.java b/app/src/main/java/info/nightscout/androidaps/activities/HistoryBrowseActivity.java index c007d1fced..77ea7715cc 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/HistoryBrowseActivity.java +++ b/app/src/main/java/info/nightscout/androidaps/activities/HistoryBrowseActivity.java @@ -2,9 +2,9 @@ package info.nightscout.androidaps.activities; import android.os.Bundle; import android.os.SystemClock; -import android.support.v4.content.res.ResourcesCompat; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.PopupMenu; +import androidx.core.content.res.ResourcesCompat; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.PopupMenu; import android.text.SpannableString; import android.text.style.ForegroundColorSpan; import android.view.Menu; diff --git a/app/src/main/java/info/nightscout/androidaps/activities/PreferencesActivity.java b/app/src/main/java/info/nightscout/androidaps/activities/PreferencesActivity.java index 59c53ba0b6..863e7f231d 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/PreferencesActivity.java +++ b/app/src/main/java/info/nightscout/androidaps/activities/PreferencesActivity.java @@ -42,9 +42,9 @@ import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref0Plugin; import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref1Plugin; import info.nightscout.androidaps.plugins.sensitivity.SensitivityWeightedAveragePlugin; import info.nightscout.androidaps.plugins.general.smsCommunicator.SmsCommunicatorPlugin; -import info.nightscout.androidaps.plugins.source.SourceDexcomG5Plugin; import info.nightscout.androidaps.plugins.general.wear.WearPlugin; 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.OKDialog; import info.nightscout.androidaps.utils.SP; @@ -148,7 +148,7 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre addPreferencesFromResource(R.xml.pref_overview); - addPreferencesFromResourceIfEnabled(SourceDexcomG5Plugin.getPlugin(), PluginType.BGSOURCE); + addPreferencesFromResourceIfEnabled(SourceDexcomPlugin.INSTANCE, PluginType.BGSOURCE); addPreferencesFromResourceIfEnabled(CareportalPlugin.getPlugin(), PluginType.GENERAL); addPreferencesFromResourceIfEnabled(SafetyPlugin.getPlugin(), PluginType.CONSTRAINTS); if (Config.APS) { diff --git a/app/src/main/java/info/nightscout/androidaps/activities/RequestDexcomPermissionActivity.kt b/app/src/main/java/info/nightscout/androidaps/activities/RequestDexcomPermissionActivity.kt new file mode 100644 index 0000000000..321c7d07ea --- /dev/null +++ b/app/src/main/java/info/nightscout/androidaps/activities/RequestDexcomPermissionActivity.kt @@ -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, grantResults: IntArray) { + finish() + } + +} \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/activities/SingleFragmentActivity.java b/app/src/main/java/info/nightscout/androidaps/activities/SingleFragmentActivity.java index 2a381cd0a8..2c899784bd 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/SingleFragmentActivity.java +++ b/app/src/main/java/info/nightscout/androidaps/activities/SingleFragmentActivity.java @@ -2,9 +2,9 @@ package info.nightscout.androidaps.activities; import android.content.Intent; import android.os.Bundle; -import android.support.annotation.Nullable; -import android.support.v4.app.Fragment; -import android.support.v7.app.AppCompatActivity; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; +import androidx.appcompat.app.AppCompatActivity; import android.view.Menu; import android.view.MenuItem; diff --git a/app/src/main/java/info/nightscout/androidaps/activities/TDDStatsActivity.java b/app/src/main/java/info/nightscout/androidaps/activities/TDDStatsActivity.java index e42d31d7c0..832ca2ad85 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/TDDStatsActivity.java +++ b/app/src/main/java/info/nightscout/androidaps/activities/TDDStatsActivity.java @@ -4,7 +4,7 @@ import android.app.Activity; import android.graphics.Color; import android.graphics.Rect; import android.os.Bundle; -import android.support.v7.widget.LinearLayoutManager; +import androidx.recyclerview.widget.LinearLayoutManager; import android.text.TextUtils; import android.view.KeyEvent; import android.view.MotionEvent; diff --git a/app/src/main/java/info/nightscout/androidaps/data/ConstraintChecker.java b/app/src/main/java/info/nightscout/androidaps/data/ConstraintChecker.java index b1267e81bc..9d7a49493b 100644 --- a/app/src/main/java/info/nightscout/androidaps/data/ConstraintChecker.java +++ b/app/src/main/java/info/nightscout/androidaps/data/ConstraintChecker.java @@ -1,11 +1,9 @@ package info.nightscout.androidaps.data; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import java.util.ArrayList; -import javax.annotation.Nonnull; - import info.nightscout.androidaps.Constants; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.interfaces.Constraint; diff --git a/app/src/main/java/info/nightscout/androidaps/data/Intervals.java b/app/src/main/java/info/nightscout/androidaps/data/Intervals.java index 66d567d9bd..eb1b7154d3 100644 --- a/app/src/main/java/info/nightscout/androidaps/data/Intervals.java +++ b/app/src/main/java/info/nightscout/androidaps/data/Intervals.java @@ -1,7 +1,7 @@ package info.nightscout.androidaps.data; -import android.support.annotation.Nullable; -import android.support.v4.util.LongSparseArray; +import androidx.annotation.Nullable; +import androidx.collection.LongSparseArray; import java.util.ArrayList; import java.util.List; diff --git a/app/src/main/java/info/nightscout/androidaps/data/NonOverlappingIntervals.java b/app/src/main/java/info/nightscout/androidaps/data/NonOverlappingIntervals.java index 86bcc429fd..c426aede40 100644 --- a/app/src/main/java/info/nightscout/androidaps/data/NonOverlappingIntervals.java +++ b/app/src/main/java/info/nightscout/androidaps/data/NonOverlappingIntervals.java @@ -1,10 +1,8 @@ package info.nightscout.androidaps.data; -import android.support.annotation.Nullable; -import android.support.v4.util.LongSparseArray; +import androidx.annotation.Nullable; -import info.nightscout.androidaps.db.TemporaryBasal; import info.nightscout.androidaps.interfaces.Interval; /** diff --git a/app/src/main/java/info/nightscout/androidaps/data/OverlappingIntervals.java b/app/src/main/java/info/nightscout/androidaps/data/OverlappingIntervals.java index 76c2ff3615..5515ea15e1 100644 --- a/app/src/main/java/info/nightscout/androidaps/data/OverlappingIntervals.java +++ b/app/src/main/java/info/nightscout/androidaps/data/OverlappingIntervals.java @@ -1,7 +1,7 @@ package info.nightscout.androidaps.data; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import info.nightscout.androidaps.interfaces.Interval; diff --git a/app/src/main/java/info/nightscout/androidaps/data/Profile.java b/app/src/main/java/info/nightscout/androidaps/data/Profile.java index adfa864500..8524246d02 100644 --- a/app/src/main/java/info/nightscout/androidaps/data/Profile.java +++ b/app/src/main/java/info/nightscout/androidaps/data/Profile.java @@ -1,6 +1,6 @@ package info.nightscout.androidaps.data; -import android.support.v4.util.LongSparseArray; +import androidx.collection.LongSparseArray; import org.json.JSONArray; import org.json.JSONException; diff --git a/app/src/main/java/info/nightscout/androidaps/data/ProfileIntervals.java b/app/src/main/java/info/nightscout/androidaps/data/ProfileIntervals.java index 8938b53936..1a5c81036c 100644 --- a/app/src/main/java/info/nightscout/androidaps/data/ProfileIntervals.java +++ b/app/src/main/java/info/nightscout/androidaps/data/ProfileIntervals.java @@ -1,7 +1,7 @@ package info.nightscout.androidaps.data; -import android.support.annotation.Nullable; -import android.support.v4.util.LongSparseArray; +import androidx.annotation.Nullable; +import androidx.collection.LongSparseArray; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/app/src/main/java/info/nightscout/androidaps/data/ProfileStore.java b/app/src/main/java/info/nightscout/androidaps/data/ProfileStore.java index f97d8b5e02..a0b54ec0bb 100644 --- a/app/src/main/java/info/nightscout/androidaps/data/ProfileStore.java +++ b/app/src/main/java/info/nightscout/androidaps/data/ProfileStore.java @@ -1,7 +1,7 @@ package info.nightscout.androidaps.data; -import android.support.annotation.Nullable; -import android.support.v4.util.ArrayMap; +import androidx.annotation.Nullable; +import androidx.collection.ArrayMap; import org.json.JSONException; import org.json.JSONObject; diff --git a/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelper.java b/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelper.java index 9770f12510..94c4f3376e 100644 --- a/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelper.java +++ b/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelper.java @@ -3,7 +3,7 @@ package info.nightscout.androidaps.db; import android.content.Context; import android.database.DatabaseUtils; 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.dao.CloseableIterator; diff --git a/app/src/main/java/info/nightscout/androidaps/db/ProfileSwitch.java b/app/src/main/java/info/nightscout/androidaps/db/ProfileSwitch.java index 0e589f0595..5f37c3d96b 100644 --- a/app/src/main/java/info/nightscout/androidaps/db/ProfileSwitch.java +++ b/app/src/main/java/info/nightscout/androidaps/db/ProfileSwitch.java @@ -1,7 +1,7 @@ package info.nightscout.androidaps.db; import android.graphics.Color; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import com.j256.ormlite.field.DatabaseField; import com.j256.ormlite.table.DatabaseTable; diff --git a/app/src/main/java/info/nightscout/androidaps/events/EventNewBG.java b/app/src/main/java/info/nightscout/androidaps/events/EventNewBG.java index dc4d434e0a..db3498bed7 100644 --- a/app/src/main/java/info/nightscout/androidaps/events/EventNewBG.java +++ b/app/src/main/java/info/nightscout/androidaps/events/EventNewBG.java @@ -1,6 +1,6 @@ package info.nightscout.androidaps.events; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import info.nightscout.androidaps.db.BgReading; diff --git a/app/src/main/java/info/nightscout/androidaps/events/EventTreatmentChange.java b/app/src/main/java/info/nightscout/androidaps/events/EventTreatmentChange.java index 990f28a388..e1d9d527e1 100644 --- a/app/src/main/java/info/nightscout/androidaps/events/EventTreatmentChange.java +++ b/app/src/main/java/info/nightscout/androidaps/events/EventTreatmentChange.java @@ -1,6 +1,6 @@ package info.nightscout.androidaps.events; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import info.nightscout.androidaps.plugins.treatments.Treatment; diff --git a/app/src/main/java/info/nightscout/androidaps/interfaces/PluginBase.java b/app/src/main/java/info/nightscout/androidaps/interfaces/PluginBase.java index 01be296539..2032c89b14 100644 --- a/app/src/main/java/info/nightscout/androidaps/interfaces/PluginBase.java +++ b/app/src/main/java/info/nightscout/androidaps/interfaces/PluginBase.java @@ -1,7 +1,7 @@ package info.nightscout.androidaps.interfaces; import android.os.SystemClock; -import android.support.v4.app.FragmentActivity; +import androidx.fragment.app.FragmentActivity; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/app/src/main/java/info/nightscout/androidaps/interfaces/ProfileInterface.java b/app/src/main/java/info/nightscout/androidaps/interfaces/ProfileInterface.java index e3b368fe86..482278e437 100644 --- a/app/src/main/java/info/nightscout/androidaps/interfaces/ProfileInterface.java +++ b/app/src/main/java/info/nightscout/androidaps/interfaces/ProfileInterface.java @@ -1,6 +1,6 @@ package info.nightscout.androidaps.interfaces; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import info.nightscout.androidaps.data.ProfileStore; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopPlugin.java index 92378a1d6b..0cbeae2e71 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopPlugin.java @@ -10,8 +10,8 @@ import android.content.Context; import android.content.Intent; import android.os.Build; import android.os.SystemClock; -import android.support.annotation.NonNull; -import android.support.v4.app.NotificationCompat; +import androidx.annotation.NonNull; +import androidx.core.app.NotificationCompat; import com.squareup.otto.Subscribe; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/common/SubscriberFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/common/SubscriberFragment.java index 3ac877b42d..1cf6a35f7d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/common/SubscriberFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/common/SubscriberFragment.java @@ -1,6 +1,6 @@ package info.nightscout.androidaps.plugins.common; -import android.support.v4.app.Fragment; +import androidx.fragment.app.Fragment; import butterknife.Unbinder; import info.nightscout.androidaps.MainApp; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderFragment.java index 47b5d49357..3b2fa590bf 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderFragment.java @@ -3,8 +3,8 @@ package info.nightscout.androidaps.plugins.configBuilder; import android.content.Intent; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.annotation.StringRes; +import androidx.annotation.NonNull; +import androidx.annotation.StringRes; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderPlugin.java index 77398a1cae..a29b893ef4 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderPlugin.java @@ -1,6 +1,6 @@ package info.nightscout.androidaps.plugins.configBuilder; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/DetailedBolusInfoStorage.java b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/DetailedBolusInfoStorage.java index b19948fc5e..b81ae37983 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/DetailedBolusInfoStorage.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/DetailedBolusInfoStorage.java @@ -1,6 +1,6 @@ package info.nightscout.androidaps.plugins.configBuilder; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ProfileFunctions.java b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ProfileFunctions.java index 0360ba4a68..7c92cd98b3 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ProfileFunctions.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ProfileFunctions.java @@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.configBuilder; import android.content.Intent; import android.os.Bundle; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import com.google.firebase.analytics.FirebaseAnalytics; import com.squareup.otto.Subscribe; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/ObjectivesFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/ObjectivesFragment.java index b943571089..7600c017c2 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/ObjectivesFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/ObjectivesFragment.java @@ -4,11 +4,11 @@ import android.app.Activity; import android.os.Bundle; import android.os.Handler; import android.os.Looper; -import android.support.annotation.NonNull; -import android.support.v7.widget.CardView; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.LinearSmoothScroller; -import android.support.v7.widget.RecyclerView; +import androidx.annotation.NonNull; +import androidx.cardview.widget.CardView; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.LinearSmoothScroller; +import androidx.recyclerview.widget.RecyclerView; import android.text.Html; import android.view.LayoutInflater; import android.view.View; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/objectives/Objective.java b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/objectives/Objective.java index 83abe15688..55aba1b49f 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/objectives/Objective.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/objectives/Objective.java @@ -1,6 +1,6 @@ package info.nightscout.androidaps.plugins.constraints.objectives.objectives; -import android.support.annotation.StringRes; +import androidx.annotation.StringRes; import java.util.ArrayList; import java.util.Date; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.java index ff99978fed..11428ce204 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.java @@ -5,8 +5,8 @@ import android.app.Activity; import android.content.Intent; import android.graphics.drawable.Drawable; import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentManager; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/dialogs/FillDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/dialogs/FillDialog.java index 94d548a444..e5ba4b9a13 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/dialogs/FillDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/dialogs/FillDialog.java @@ -3,8 +3,8 @@ package info.nightscout.androidaps.plugins.general.actions.dialogs; import android.content.Context; import android.content.Intent; import android.os.Bundle; -import android.support.v4.app.DialogFragment; -import android.support.v7.app.AlertDialog; +import androidx.fragment.app.DialogFragment; +import androidx.appcompat.app.AlertDialog; import android.text.Editable; import android.text.Html; import android.text.TextWatcher; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/dialogs/NewExtendedBolusDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/dialogs/NewExtendedBolusDialog.java index 579e9e2f06..9b5b7af515 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/dialogs/NewExtendedBolusDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/dialogs/NewExtendedBolusDialog.java @@ -4,8 +4,8 @@ import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; -import android.support.v4.app.DialogFragment; -import android.support.v7.app.AlertDialog; +import androidx.fragment.app.DialogFragment; +import androidx.appcompat.app.AlertDialog; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/dialogs/NewTempBasalDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/dialogs/NewTempBasalDialog.java index 80969b51b0..30b6e60dbd 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/dialogs/NewTempBasalDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/dialogs/NewTempBasalDialog.java @@ -3,8 +3,8 @@ package info.nightscout.androidaps.plugins.general.actions.dialogs; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; -import android.support.v4.app.DialogFragment; -import android.support.v7.app.AlertDialog; +import androidx.fragment.app.DialogFragment; +import androidx.appcompat.app.AlertDialog; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/careportal/CareportalFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/careportal/CareportalFragment.java index 991fc962ee..ab98682fb4 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/careportal/CareportalFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/careportal/CareportalFragment.java @@ -4,7 +4,7 @@ package info.nightscout.androidaps.plugins.general.careportal; import android.app.Activity; import android.graphics.Color; import android.os.Bundle; -import android.support.v4.app.FragmentManager; +import androidx.fragment.app.FragmentManager; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/careportal/Dialogs/NewNSTreatmentDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/careportal/Dialogs/NewNSTreatmentDialog.java index 57414927b4..078b3fc1ce 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/careportal/Dialogs/NewNSTreatmentDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/careportal/Dialogs/NewNSTreatmentDialog.java @@ -3,8 +3,8 @@ package info.nightscout.androidaps.plugins.general.careportal.Dialogs; import android.app.Activity; import android.os.Bundle; -import android.support.v4.app.DialogFragment; -import android.support.v7.app.AlertDialog; +import androidx.fragment.app.DialogFragment; +import androidx.appcompat.app.AlertDialog; import android.text.Editable; import android.text.TextWatcher; import android.text.format.DateFormat; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/food/FoodFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/food/FoodFragment.java index 6eb55db266..66727f0f7f 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/food/FoodFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/food/FoodFragment.java @@ -4,9 +4,9 @@ import android.app.Activity; import android.content.DialogInterface; import android.graphics.Paint; import android.os.Bundle; -import android.support.v7.app.AlertDialog; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; +import androidx.appcompat.app.AlertDialog; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; import android.text.Editable; import android.text.TextWatcher; import android.view.LayoutInflater; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/food/FoodService.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/food/FoodService.java index 2d8d5f847b..3856ecfc22 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/food/FoodService.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/food/FoodService.java @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.general.food; import android.content.Intent; import android.os.Bundle; 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.OrmLiteBaseService; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/ImportExportPrefs.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/ImportExportPrefs.java index 67bf604f41..ea56115347 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/ImportExportPrefs.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/ImportExportPrefs.java @@ -8,9 +8,9 @@ import android.content.SharedPreferences; import android.content.pm.PackageManager; import android.os.Environment; import android.preference.PreferenceManager; -import android.support.v4.app.ActivityCompat; -import android.support.v4.app.Fragment; -import android.support.v4.content.ContextCompat; +import androidx.core.app.ActivityCompat; +import androidx.fragment.app.Fragment; +import androidx.core.content.ContextCompat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenanceFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenanceFragment.java index e0e9b58253..6b8863242a 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenanceFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenanceFragment.java @@ -2,8 +2,8 @@ package info.nightscout.androidaps.plugins.general.maintenance; import android.content.Intent; import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.support.v7.app.AlertDialog; +import androidx.fragment.app.Fragment; +import androidx.appcompat.app.AlertDialog; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenancePlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenancePlugin.java index 35bd9f9d06..1bad189aba 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenancePlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenancePlugin.java @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.general.maintenance; import android.content.Context; import android.content.Intent; import android.net.Uri; -import android.support.v4.content.FileProvider; +import androidx.core.content.FileProvider; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/activities/LogSettingActivity.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/activities/LogSettingActivity.java index 9d7681ae38..852554ed06 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/activities/LogSettingActivity.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/activities/LogSettingActivity.java @@ -1,7 +1,7 @@ package info.nightscout.androidaps.plugins.general.maintenance.activities; import android.os.Bundle; -import android.support.v7.app.AppCompatActivity; +import androidx.appcompat.app.AppCompatActivity; import android.view.View; import android.widget.CheckBox; import android.widget.LinearLayout; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSUpload.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSUpload.java index 40a411694b..881593b32a 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSUpload.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSUpload.java @@ -7,8 +7,8 @@ import android.content.pm.ResolveInfo; import android.os.Build; import android.os.Bundle; import android.preference.PreferenceManager; -import android.support.annotation.Nullable; -import android.support.v4.content.LocalBroadcastManager; +import androidx.annotation.Nullable; +import androidx.localbroadcastmanager.content.LocalBroadcastManager; import org.apache.commons.lang3.StringUtils; import org.json.JSONArray; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastAckAlarm.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastAckAlarm.java index 6873b59515..7179231068 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastAckAlarm.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastAckAlarm.java @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.general.nsclient.broadcasts; import android.content.Context; import android.content.Intent; import android.os.Bundle; -import android.support.v4.content.LocalBroadcastManager; +import androidx.localbroadcastmanager.content.LocalBroadcastManager; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastAlarm.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastAlarm.java index 9c1e3e7ae2..ce1de70900 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastAlarm.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastAlarm.java @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.general.nsclient.broadcasts; import android.content.Context; import android.content.Intent; import android.os.Bundle; -import android.support.v4.content.LocalBroadcastManager; +import androidx.localbroadcastmanager.content.LocalBroadcastManager; import org.json.JSONObject; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastAnnouncement.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastAnnouncement.java index b26c055851..f97f750287 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastAnnouncement.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastAnnouncement.java @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.general.nsclient.broadcasts; import android.content.Context; import android.content.Intent; import android.os.Bundle; -import android.support.v4.content.LocalBroadcastManager; +import androidx.localbroadcastmanager.content.LocalBroadcastManager; import org.json.JSONObject; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastCals.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastCals.java index 7d5dcddadc..83f3c0a0e4 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastCals.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastCals.java @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.general.nsclient.broadcasts; import android.content.Context; import android.content.Intent; import android.os.Bundle; -import android.support.v4.content.LocalBroadcastManager; +import androidx.localbroadcastmanager.content.LocalBroadcastManager; import org.json.JSONArray; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastClearAlarm.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastClearAlarm.java index fe9a194ca2..3f0586e65e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastClearAlarm.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastClearAlarm.java @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.general.nsclient.broadcasts; import android.content.Context; import android.content.Intent; import android.os.Bundle; -import android.support.v4.content.LocalBroadcastManager; +import androidx.localbroadcastmanager.content.LocalBroadcastManager; import org.json.JSONObject; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastDeviceStatus.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastDeviceStatus.java index 412c321817..4631834d9b 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastDeviceStatus.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastDeviceStatus.java @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.general.nsclient.broadcasts; import android.content.Context; import android.content.Intent; import android.os.Bundle; -import android.support.v4.content.LocalBroadcastManager; +import androidx.localbroadcastmanager.content.LocalBroadcastManager; import org.json.JSONArray; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastFood.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastFood.java index 0a8c21251b..35a2315ff2 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastFood.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastFood.java @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.general.nsclient.broadcasts; import android.content.Context; import android.content.Intent; import android.os.Bundle; -import android.support.v4.content.LocalBroadcastManager; +import androidx.localbroadcastmanager.content.LocalBroadcastManager; import org.json.JSONArray; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastMbgs.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastMbgs.java index 9c059ae8a2..248e5d627f 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastMbgs.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastMbgs.java @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.general.nsclient.broadcasts; import android.content.Context; import android.content.Intent; import android.os.Bundle; -import android.support.v4.content.LocalBroadcastManager; +import androidx.localbroadcastmanager.content.LocalBroadcastManager; import org.json.JSONArray; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastProfile.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastProfile.java index 9411ed6e9e..d6d051e327 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastProfile.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastProfile.java @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.general.nsclient.broadcasts; import android.content.Context; import android.content.Intent; import android.os.Bundle; -import android.support.v4.content.LocalBroadcastManager; +import androidx.localbroadcastmanager.content.LocalBroadcastManager; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastSgvs.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastSgvs.java index 04e957811d..06fd3c0a35 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastSgvs.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastSgvs.java @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.general.nsclient.broadcasts; import android.content.Context; import android.content.Intent; import android.os.Bundle; -import android.support.v4.content.LocalBroadcastManager; +import androidx.localbroadcastmanager.content.LocalBroadcastManager; import org.json.JSONArray; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastStatus.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastStatus.java index c037acc9bb..81de2248e4 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastStatus.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastStatus.java @@ -4,7 +4,7 @@ import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.os.Bundle; -import android.support.v4.content.LocalBroadcastManager; +import androidx.localbroadcastmanager.content.LocalBroadcastManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastTreatment.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastTreatment.java index e4ca7b577f..a364d0d4ae 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastTreatment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastTreatment.java @@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.general.nsclient.broadcasts; import android.content.Intent; import android.os.Bundle; -import android.support.v4.content.LocalBroadcastManager; +import androidx.localbroadcastmanager.content.LocalBroadcastManager; import org.json.JSONArray; import org.json.JSONException; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastUrgentAlarm.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastUrgentAlarm.java index 676dbe909d..b6b1c4f8d9 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastUrgentAlarm.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/broadcasts/BroadcastUrgentAlarm.java @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.general.nsclient.broadcasts; import android.content.Context; import android.content.Intent; import android.os.Bundle; -import android.support.v4.content.LocalBroadcastManager; +import androidx.localbroadcastmanager.content.LocalBroadcastManager; import org.json.JSONObject; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/data/NSSettingsStatus.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/data/NSSettingsStatus.java index 8511247e42..93cf70dd12 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/data/NSSettingsStatus.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/data/NSSettingsStatus.java @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.general.nsclient.data; import android.content.Intent; import android.content.pm.PackageManager; import android.os.Bundle; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import org.json.JSONException; import org.json.JSONObject; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/receivers/RestartReceiver.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/receivers/RestartReceiver.java index 0b221ee456..5024801827 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/receivers/RestartReceiver.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/receivers/RestartReceiver.java @@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.general.nsclient.receivers; import android.content.Context; import android.content.Intent; -import android.support.v4.content.WakefulBroadcastReceiver; +import androidx.legacy.content.WakefulBroadcastReceiver; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientRestart; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.java index 0b0724eefd..3b8a0030ab 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.java @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.general.overview; import android.annotation.SuppressLint; import android.app.Activity; import android.app.NotificationManager; -import android.arch.core.util.Function; +import androidx.arch.core.util.Function; import android.content.ActivityNotFoundException; import android.content.Context; import android.content.Intent; @@ -12,14 +12,14 @@ import android.graphics.Color; import android.graphics.Paint; import android.os.Bundle; import android.os.Handler; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentActivity; -import android.support.v4.app.FragmentManager; -import android.support.v4.content.res.ResourcesCompat; -import android.support.v7.app.AlertDialog; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.PopupMenu; -import android.support.v7.widget.RecyclerView; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentActivity; +import androidx.fragment.app.FragmentManager; +import androidx.core.content.res.ResourcesCompat; +import androidx.appcompat.app.AlertDialog; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.appcompat.widget.PopupMenu; +import androidx.recyclerview.widget.RecyclerView; import android.text.SpannableString; import android.text.style.ForegroundColorSpan; 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.events.EventAutosensCalculationFinished; import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventIobCalculationProgress; -import info.nightscout.androidaps.plugins.source.SourceDexcomG5Plugin; -import info.nightscout.androidaps.plugins.source.SourceDexcomG6Plugin; +import info.nightscout.androidaps.plugins.source.SourceDexcomPlugin; import info.nightscout.androidaps.plugins.source.SourceXdripPlugin; import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin; import info.nightscout.androidaps.plugins.treatments.fragments.ProfileViewerDialog; @@ -661,8 +660,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, @Override public void onClick(View v) { boolean xdrip = SourceXdripPlugin.getPlugin().isEnabled(PluginType.BGSOURCE); - boolean g5 = SourceDexcomG5Plugin.getPlugin().isEnabled(PluginType.BGSOURCE); - boolean g6 = SourceDexcomG6Plugin.getPlugin().isEnabled(PluginType.BGSOURCE); + boolean dexcom = SourceDexcomPlugin.INSTANCE.isEnabled(PluginType.BGSOURCE); String units = ProfileFunctions.getInstance().getProfileUnits(); FragmentManager manager = getFragmentManager(); @@ -685,10 +683,16 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, if (xdrip) { CalibrationDialog calibrationDialog = new CalibrationDialog(); calibrationDialog.show(manager, "CalibrationDialog"); - } else if (g5 || g6) { + } else if (dexcom) { try { - Intent i = new Intent("com.dexcom.cgm.activities.MeterEntryActivity"); - startActivity(i); + String packageName = SourceDexcomPlugin.INSTANCE.findDexcomPackageName(); + 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) { 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: if (xdrip) openCgmApp("com.eveningoutpost.dexdrip"); - else if (g5 && units.equals(Constants.MGDL)) - openCgmApp("com.dexcom.cgm.region5.mgdl"); - else if (g5 && units.equals(Constants.MMOL)) - openCgmApp("com.dexcom.cgm.region5.mmol"); - else if (g6 && units.equals(Constants.MGDL)) - openCgmApp("com.dexcom.g6.region3.mgdl"); - else if (g6 && units.equals(Constants.MMOL)) - openCgmApp("com.dexcom.g6.region3.mmol"); + else if (dexcom) { + String packageName = SourceDexcomPlugin.INSTANCE.findDexcomPackageName(); + if (packageName != null) { + openCgmApp(packageName); + } else { + ToastUtils.showToastInUiThread(getActivity(), MainApp.gs(R.string.dexcom_app_not_installed)); + } + } break; case R.id.overview_treatmentbutton: NewTreatmentDialog treatmentDialogFragment = new NewTreatmentDialog(); @@ -1188,10 +1192,10 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, // **** Calibration & CGM buttons **** 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; 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); } else { calibrationButton.setVisibility(View.GONE); @@ -1200,7 +1204,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, if (cgmButton != null) { if (xDripIsBgSource && SP.getBoolean(R.string.key_show_cgm_button, false)) { 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); } else { cgmButton.setVisibility(View.GONE); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/activities/QuickWizardListActivity.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/activities/QuickWizardListActivity.java index d7eb9c86dd..85adbf7e80 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/activities/QuickWizardListActivity.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/activities/QuickWizardListActivity.java @@ -2,11 +2,11 @@ package info.nightscout.androidaps.plugins.general.overview.activities; import android.app.Activity; import android.os.Bundle; -import android.support.v4.app.FragmentManager; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.CardView; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; +import androidx.fragment.app.FragmentManager; +import androidx.appcompat.app.AppCompatActivity; +import androidx.cardview.widget.CardView; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/BolusProgressDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/BolusProgressDialog.java index 4189fcdcdb..1b41ea0c44 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/BolusProgressDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/BolusProgressDialog.java @@ -4,7 +4,7 @@ package info.nightscout.androidaps.plugins.general.overview.dialogs; import android.app.Activity; import android.os.Bundle; import android.os.SystemClock; -import android.support.v4.app.DialogFragment; +import androidx.fragment.app.DialogFragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/BolusProgressHelperActivity.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/BolusProgressHelperActivity.java index fd1de6ce8c..7ca19d0334 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/BolusProgressHelperActivity.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/BolusProgressHelperActivity.java @@ -1,7 +1,7 @@ package info.nightscout.androidaps.plugins.general.overview.dialogs; import android.os.Bundle; -import android.support.v7.app.AppCompatActivity; +import androidx.appcompat.app.AppCompatActivity; /** * Created by adrian on 09/02/17. diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/CalibrationDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/CalibrationDialog.java index 0ab1b98ff6..7ec20254f2 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/CalibrationDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/CalibrationDialog.java @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.general.overview.dialogs; import android.content.Context; import android.os.Bundle; -import android.support.v4.app.DialogFragment; +import androidx.fragment.app.DialogFragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/EditQuickWizardDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/EditQuickWizardDialog.java index 9cd1277961..248ab30d7c 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/EditQuickWizardDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/EditQuickWizardDialog.java @@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.general.overview.dialogs; import android.os.Bundle; -import android.support.v4.app.DialogFragment; +import androidx.fragment.app.DialogFragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/ErrorDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/ErrorDialog.java index 209a585384..ea8dd8e4bb 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/ErrorDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/ErrorDialog.java @@ -2,8 +2,9 @@ package info.nightscout.androidaps.plugins.general.overview.dialogs; import android.content.Intent; +import android.os.Build; import android.os.Bundle; -import android.support.v4.app.DialogFragment; +import androidx.fragment.app.DialogFragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -98,7 +99,10 @@ public class ErrorDialog extends DialogFragment implements View.OnClickListener private void startAlarm() { Intent alarm = new Intent(MainApp.instance().getApplicationContext(), AlarmSoundService.class); 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() { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/ErrorHelperActivity.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/ErrorHelperActivity.java index 667cadf2b1..86e7ac5461 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/ErrorHelperActivity.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/ErrorHelperActivity.java @@ -1,7 +1,7 @@ package info.nightscout.androidaps.plugins.general.overview.dialogs; import android.os.Bundle; -import android.support.v7.app.AppCompatActivity; +import androidx.appcompat.app.AppCompatActivity; import info.nightscout.androidaps.R; import info.nightscout.androidaps.plugins.general.nsclient.NSUpload; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/NewCarbsDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/NewCarbsDialog.java index 789ced1df3..2a79a17bbd 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/NewCarbsDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/NewCarbsDialog.java @@ -2,8 +2,8 @@ package info.nightscout.androidaps.plugins.general.overview.dialogs; import android.os.Bundle; import android.os.HandlerThread; -import android.support.v4.app.DialogFragment; -import android.support.v7.app.AlertDialog; +import androidx.fragment.app.DialogFragment; +import androidx.appcompat.app.AlertDialog; import android.text.Editable; import android.text.Html; import android.text.TextWatcher; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/NewInsulinDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/NewInsulinDialog.java index 27e2e33ba7..6344f29ec8 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/NewInsulinDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/NewInsulinDialog.java @@ -4,8 +4,8 @@ import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.os.HandlerThread; -import android.support.v4.app.DialogFragment; -import android.support.v7.app.AlertDialog; +import androidx.fragment.app.DialogFragment; +import androidx.appcompat.app.AlertDialog; import android.text.Editable; import android.text.Html; import android.text.TextWatcher; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/NewTreatmentDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/NewTreatmentDialog.java index 837d206fb3..b8034c7fba 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/NewTreatmentDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/NewTreatmentDialog.java @@ -4,8 +4,8 @@ import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; -import android.support.v4.app.DialogFragment; -import android.support.v7.app.AlertDialog; +import androidx.fragment.app.DialogFragment; +import androidx.appcompat.app.AlertDialog; import android.text.Editable; import android.text.Html; import android.text.TextWatcher; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/WizardDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/WizardDialog.java index b4a3de4271..f9d54f9f9a 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/WizardDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/WizardDialog.java @@ -5,8 +5,8 @@ import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; -import android.support.v4.app.DialogFragment; -import android.support.v7.app.AlertDialog; +import androidx.fragment.app.DialogFragment; +import androidx.appcompat.app.AlertDialog; import android.text.Editable; import android.text.Html; import android.text.TextWatcher; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/notifications/DismissNotificationService.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/notifications/DismissNotificationService.java index a8d6fca1ba..475aa02332 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/notifications/DismissNotificationService.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/notifications/DismissNotificationService.java @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.general.overview.notifications; import android.app.IntentService; import android.app.PendingIntent; import android.content.Intent; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/notifications/NotificationRecyclerViewAdapter.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/notifications/NotificationRecyclerViewAdapter.java index de35e4bc8c..6cb5c2fdf4 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/notifications/NotificationRecyclerViewAdapter.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/notifications/NotificationRecyclerViewAdapter.java @@ -1,8 +1,8 @@ package info.nightscout.androidaps.plugins.general.overview.notifications; -import android.support.v4.content.ContextCompat; -import android.support.v7.widget.CardView; -import android.support.v7.widget.RecyclerView; +import androidx.core.content.ContextCompat; +import androidx.cardview.widget.CardView; +import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/notifications/NotificationStore.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/notifications/NotificationStore.java index 16913d26ae..2a94d2c859 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/notifications/NotificationStore.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/notifications/NotificationStore.java @@ -11,8 +11,8 @@ import android.media.AudioAttributes; import android.media.RingtoneManager; import android.net.Uri; import android.os.Build; -import android.support.v4.app.NotificationCompat; -import android.support.v7.widget.RecyclerView; +import androidx.core.app.NotificationCompat; +import androidx.recyclerview.widget.RecyclerView; import android.view.View; import org.slf4j.Logger; @@ -69,14 +69,20 @@ public class NotificationStore { if (usesChannels && n.soundId != null) { Intent alarm = new Intent(MainApp.instance().getApplicationContext(), AlarmSoundService.class); 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 { if (n.soundId != null) { Intent alarm = new Intent(MainApp.instance().getApplicationContext(), AlarmSoundService.class); 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); } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/persistentNotification/DummyService.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/persistentNotification/DummyService.java index 863046c0c4..1400185afa 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/persistentNotification/DummyService.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/persistentNotification/DummyService.java @@ -4,7 +4,8 @@ import android.app.Notification; import android.app.Service; import android.content.Intent; import android.os.IBinder; -import android.support.annotation.Nullable; + +import androidx.annotation.Nullable; import com.squareup.otto.Subscribe; @@ -29,9 +30,8 @@ public class DummyService extends Service { @Override public int onStartCommand(Intent intent, int flags, int startId) { - Notification notification = PersistentNotificationPlugin.getPlugin().updateNotification(); - if (notification != null) - startForeground(PersistentNotificationPlugin.ONGOING_NOTIFICATION_ID, notification); + super.onStartCommand(intent, flags, startId); + startForeground(PersistentNotificationPlugin.ONGOING_NOTIFICATION_ID, PersistentNotificationPlugin.getPlugin().updateNotification()); return START_STICKY; } @@ -45,6 +45,11 @@ public class DummyService extends Service { @Override 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); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/persistentNotification/PersistentNotificationPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/persistentNotification/PersistentNotificationPlugin.java index 987d9374bd..c302f71b38 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/persistentNotification/PersistentNotificationPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/persistentNotification/PersistentNotificationPlugin.java @@ -10,17 +10,19 @@ import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Build; -import android.support.v4.app.NotificationCompat; -import android.support.v4.app.RemoteInput; -import android.support.v4.app.TaskStackBuilder; + +import androidx.core.app.NotificationCompat; +import androidx.core.app.RemoteInput; +import androidx.core.app.TaskStackBuilder; import com.squareup.otto.Subscribe; +import javax.annotation.Nonnull; + import info.nightscout.androidaps.Constants; import info.nightscout.androidaps.MainActivity; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; -import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus; import info.nightscout.androidaps.data.IobTotal; import info.nightscout.androidaps.db.BgReading; 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.plugins.configBuilder.ConfigBuilderPlugin; 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.events.EventAutosensCalculationFinished; import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin; @@ -72,13 +75,14 @@ public class PersistentNotificationPlugin extends PluginBase { /// End Android Auto - public PersistentNotificationPlugin(Context ctx) { + private PersistentNotificationPlugin(Context ctx) { super(new PluginDescription() .mainType(PluginType.GENERAL) .neverVisible(true) .pluginName(R.string.ongoingnotificaction) .enableByDefault(true) - .alwaysEnabled(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) + .alwaysEnabled(true) + .showInList(false) .description(R.string.description_persistent_notification) ); this.ctx = ctx; @@ -86,8 +90,8 @@ public class PersistentNotificationPlugin extends PluginBase { @Override protected void onStart() { + createNotificationChannel(); // make sure channels exist before triggering updates through the bus MainApp.bus().register(this); - createNotificationChannel(); triggerNotificationUpdate(); super.onStart(); } @@ -111,105 +115,107 @@ public class PersistentNotificationPlugin extends PluginBase { } 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() { - if (!isEnabled(PluginType.GENERAL)) { - return null; - } + String line1 = null; + String line2 = null; + String line3 = null; + NotificationCompat.CarExtender.UnreadConversation.Builder unreadConversationBuilder = null; - String line1; - String line1_aa; - - if (ConfigBuilderPlugin.getPlugin().getActiveProfileInterface() == null || !ProfileFunctions.getInstance().isProfileValid("Notificiation")) - return null; - String units = ProfileFunctions.getInstance().getProfileUnits(); + if (ConfigBuilderPlugin.getPlugin().getActiveProfileInterface() != null && ProfileFunctions.getInstance().isProfileValid("Notification")) { + String line1_aa; + String units = ProfileFunctions.getInstance().getProfileUnits(); - BgReading lastBG = DatabaseHelper.lastBg(); - GlucoseStatus glucoseStatus = GlucoseStatus.getGlucoseStatusData(); + BgReading lastBG = DatabaseHelper.lastBg(); + GlucoseStatus glucoseStatus = GlucoseStatus.getGlucoseStatusData(); - if (lastBG != null) { - line1 = line1_aa = lastBG.valueToUnitsToString(units); - if (glucoseStatus != null) { - line1 += " Δ" + deltastring(glucoseStatus.delta, glucoseStatus.delta * Constants.MGDL_TO_MMOLL, units) - + " avgΔ" + deltastring(glucoseStatus.avgdelta, glucoseStatus.avgdelta * Constants.MGDL_TO_MMOLL, units); - line1_aa += " " + lastBG.directionToSymbol(); + if (lastBG != null) { + line1 = line1_aa = lastBG.valueToUnitsToString(units); + if (glucoseStatus != null) { + line1 += " Δ" + deltastring(glucoseStatus.delta, glucoseStatus.delta * Constants.MGDL_TO_MMOLL, units) + + " avgΔ" + deltastring(glucoseStatus.avgdelta, glucoseStatus.avgdelta * Constants.MGDL_TO_MMOLL, units); + line1_aa += " " + lastBG.directionToSymbol(); + } else { + line1 += " " + + MainApp.gs(R.string.old_data) + + " "; + line1_aa += line1 + "."; + } } else { - line1 += " " + - MainApp.gs(R.string.old_data) + - " "; - line1_aa += line1 + "."; + line1 = line1_aa = MainApp.gs(R.string.missed_bg_readings); } - } 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); builder.setOngoing(true); builder.setOnlyAlertOnce(true); @@ -217,12 +223,14 @@ public class PersistentNotificationPlugin extends PluginBase { builder.setSmallIcon(MainApp.getNotificationIcon()); Bitmap largeIcon = BitmapFactory.decodeResource(ctx.getResources(), MainApp.getIcon()); builder.setLargeIcon(largeIcon); - builder.setContentTitle(line1); - builder.setContentText(line2); - builder.setSubText(line3); + builder.setContentTitle(line1 != null ? line1 : MainApp.gs(R.string.noprofileset)); + builder.setContentText(line2 != null ? line2 : MainApp.gs(R.string.noprofileset)); + builder.setSubText(line3 != null ? line3 : MainApp.gs(R.string.noprofileset)); /// Android Auto - builder.extend(new NotificationCompat.CarExtender() - .setUnreadConversation(unreadConversationBuilder.build())); + if (unreadConversationBuilder != null) { + builder.extend(new NotificationCompat.CarExtender() + .setUnreadConversation(unreadConversationBuilder.build())); + } /// End Android Auto diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/TidepoolFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/TidepoolFragment.kt index 51c5dd95ea..7fc21ca510 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/TidepoolFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/TidepoolFragment.kt @@ -1,11 +1,11 @@ package info.nightscout.androidaps.plugins.general.tidepool import android.os.Bundle -import android.support.v4.app.Fragment import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.ScrollView +import androidx.fragment.app.Fragment import info.nightscout.androidaps.R import info.nightscout.androidaps.plugins.bus.RxBus import info.nightscout.androidaps.plugins.general.tidepool.comm.TidepoolUploader diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/versionChecker/VersionCheckerUtils.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/versionChecker/VersionCheckerUtils.kt index 8791030abb..daebb5deb6 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/versionChecker/VersionCheckerUtils.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/versionChecker/VersionCheckerUtils.kt @@ -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.notifications.Notification 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 java.io.IOException -import java.io.InputStream +import java.net.URL import java.util.concurrent.TimeUnit + // check network connection fun isConnected(): Boolean { val connMgr = MainApp.instance().applicationContext.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager return connMgr.activeNetworkInfo?.isConnected ?: false } -// convert inputstream to String -@Throws(IOException::class) -inline fun InputStream.findVersion(): String? { +fun findVersion(file :String?): String? { val regex = "(.*)version(.*)\"(((\\d+)\\.)+(\\d+))\"(.*)".toRegex() - return bufferedReader() - .readLines() - .filter { regex.matches(it) } - .mapNotNull { regex.matchEntire(it)?.groupValues?.getOrNull(3) } - .firstOrNull() + return file?.lines()?.filter { regex.matches(it) }?.mapNotNull { regex.matchEntire(it)?.groupValues?.getOrNull(3) }?.firstOrNull() } private val log = LoggerFactory.getLogger(L.CORE) @@ -39,24 +31,21 @@ private val log = LoggerFactory.getLogger(L.CORE) 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. 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(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() } } -@Suppress("DEPRECATION") private fun checkVersion() = if (isConnected()) { Thread { try { - val request = HttpGet("https://raw.githubusercontent.com/MilosKozak/AndroidAPS/master/app/build.gradle") - val response: HttpResponse = DefaultHttpClient().execute(request) - val version: String? = response.entity.content?.findVersion() + val version: String? = findVersion(URL("https://raw.githubusercontent.com/MilosKozak/AndroidAPS/master/app/build.gradle").readText()) compareWithCurrentVersion(version, BuildConfig.VERSION_NAME) } catch (e: IOException) { log.debug("Github master version check error: $e") @@ -90,7 +79,7 @@ fun onVersionNotDetectable() { fun onNewVersionDetected(currentVersion: String, newVersion: String?) { 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") val notification = Notification(Notification.NEWVERSIONDETECTED, String.format(MainApp.gs(R.string.versionavailable), newVersion.toString()), Notification.LOW) MainApp.bus().post(EventNewNotification(notification)) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/ActionStringHandler.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/ActionStringHandler.java index 1a01a783cd..e2ca7ac869 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/ActionStringHandler.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/ActionStringHandler.java @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.general.wear; import android.app.NotificationManager; import android.content.Context; import android.os.HandlerThread; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import java.text.DateFormat; import java.text.DecimalFormat; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/WearFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/WearFragment.java index 701784e9d9..9eb157de24 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/WearFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/WearFragment.java @@ -1,7 +1,7 @@ package info.nightscout.androidaps.plugins.general.wear; import android.os.Bundle; -import android.support.v4.app.Fragment; +import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/wearintegration/WatchUpdaterService.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/wearintegration/WatchUpdaterService.java index d121c5c55d..6f2f59faa1 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/wearintegration/WatchUpdaterService.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/wearintegration/WatchUpdaterService.java @@ -17,7 +17,7 @@ import android.os.Bundle; import android.os.Handler; import android.os.HandlerThread; import android.preference.PreferenceManager; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.util.Log; import com.google.android.gms.common.ConnectionResult; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/xdripStatusline/StatuslinePlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/xdripStatusline/StatuslinePlugin.java index fe89cc8304..2421a1561e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/xdripStatusline/StatuslinePlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/xdripStatusline/StatuslinePlugin.java @@ -5,7 +5,7 @@ import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.preference.PreferenceManager; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import com.squareup.otto.Subscribe; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinFragment.java index bcf445d0d1..02e9256a8a 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinFragment.java @@ -1,7 +1,7 @@ package info.nightscout.androidaps.plugins.insulin; import android.os.Bundle; -import android.support.v4.app.Fragment; +import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/CobInfo.java b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/CobInfo.java index 12d5cd5c11..fb99067008 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/CobInfo.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/CobInfo.java @@ -1,7 +1,7 @@ package info.nightscout.androidaps.plugins.iob.iobCobCalculator; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import info.nightscout.androidaps.utils.DecimalFormatter; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/GlucoseStatus.java b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/GlucoseStatus.java index 191ce9e1cd..159c5865af 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/GlucoseStatus.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/GlucoseStatus.java @@ -1,6 +1,6 @@ package info.nightscout.androidaps.plugins.iob.iobCobCalculator; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobCalculatorPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobCalculatorPlugin.java index 659af5ec56..c98de7c8be 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobCalculatorPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobCalculatorPlugin.java @@ -1,9 +1,9 @@ package info.nightscout.androidaps.plugins.iob.iobCobCalculator; import android.os.SystemClock; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.v4.util.LongSparseArray; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.collection.LongSparseArray; import com.squareup.otto.Subscribe; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOref1Thread.java b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOref1Thread.java index c483ffd2a6..8ca13a6694 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOref1Thread.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOref1Thread.java @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.iob.iobCobCalculator; import android.content.Context; import android.os.PowerManager; import android.os.SystemClock; -import android.support.v4.util.LongSparseArray; +import androidx.collection.LongSparseArray; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobThread.java b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobThread.java index 9ddf18abb0..943637fd4e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobThread.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobThread.java @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.iob.iobCobCalculator; import android.content.Context; import android.os.PowerManager; import android.os.SystemClock; -import android.support.v4.util.LongSparseArray; +import androidx.collection.LongSparseArray; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfileFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfileFragment.java index ec5dc55fa8..9fe86c087f 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfileFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfileFragment.java @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.profile.local; import android.app.Activity; import android.os.Bundle; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.text.Editable; import android.text.TextWatcher; import android.view.LayoutInflater; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfilePlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfilePlugin.java index 06f979876c..089611b40d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfilePlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfilePlugin.java @@ -1,6 +1,6 @@ package info.nightscout.androidaps.plugins.profile.local; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.json.JSONArray; import org.json.JSONException; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/profile/ns/NSProfilePlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/profile/ns/NSProfilePlugin.java index 11c38d1492..f741316732 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/profile/ns/NSProfilePlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/profile/ns/NSProfilePlugin.java @@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.profile.ns; import android.content.Intent; import android.os.Bundle; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import org.json.JSONException; import org.json.JSONObject; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboFragment.java index a533821d59..1a924fa9f5 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboFragment.java @@ -5,7 +5,7 @@ import android.app.Activity; import android.graphics.Color; import android.graphics.Typeface; import android.os.Bundle; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPlugin.java index 20a1d08e6d..7b6bf2d452 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPlugin.java @@ -2,10 +2,10 @@ package info.nightscout.androidaps.plugins.pump.combo; import android.content.DialogInterface; import android.os.SystemClock; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.v4.app.FragmentActivity; -import android.support.v7.app.AlertDialog; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.FragmentActivity; +import androidx.appcompat.app.AlertDialog; import org.json.JSONObject; import org.slf4j.Logger; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPump.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPump.java index cfe459fb58..c5d7fa0115 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPump.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPump.java @@ -1,7 +1,7 @@ package info.nightscout.androidaps.plugins.pump.combo; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import java.util.ArrayList; import java.util.List; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/CommandResult.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/CommandResult.java index 180f10f69d..9febf0e86a 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/CommandResult.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/CommandResult.java @@ -1,6 +1,6 @@ package info.nightscout.androidaps.plugins.pump.combo.ruffyscripter; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import java.util.LinkedList; import java.util.List; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/RuffyScripter.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/RuffyScripter.java index eb01c92c60..19603d99e6 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/RuffyScripter.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/RuffyScripter.java @@ -7,8 +7,8 @@ import android.content.ServiceConnection; import android.os.IBinder; import android.os.RemoteException; import android.os.SystemClock; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import com.google.common.base.Joiner; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/WarningOrErrorCode.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/WarningOrErrorCode.java index ae4723046e..7692afe84e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/WarningOrErrorCode.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/WarningOrErrorCode.java @@ -1,6 +1,6 @@ package info.nightscout.androidaps.plugins.pump.combo.ruffyscripter; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; public class WarningOrErrorCode { @Nullable diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/BaseCommand.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/BaseCommand.java index 6cd89f2938..1de9392cba 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/BaseCommand.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/BaseCommand.java @@ -1,6 +1,6 @@ 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.MenuType; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/ReadHistoryCommand.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/ReadHistoryCommand.java index 5f23b7e66d..b50ccaeb2c 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/ReadHistoryCommand.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/ReadHistoryCommand.java @@ -1,6 +1,6 @@ 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.MenuType; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/PumpHistory.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/PumpHistory.java index 0fffe13c50..b9e9c704a0 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/PumpHistory.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/PumpHistory.java @@ -1,6 +1,6 @@ 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.LinkedList; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/AbstractDanaRPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/AbstractDanaRPlugin.java index 24dc27fb18..b8b5409607 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/AbstractDanaRPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/AbstractDanaRPlugin.java @@ -1,6 +1,6 @@ package info.nightscout.androidaps.plugins.pump.danaR; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import org.json.JSONException; import org.json.JSONObject; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRFragment.java index e044a2db27..30e99ebbe2 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRFragment.java @@ -5,7 +5,7 @@ import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.os.Handler; -import android.support.v4.app.FragmentManager; +import androidx.fragment.app.FragmentManager; import android.text.Spanned; import android.view.LayoutInflater; import android.view.View; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRPlugin.java index 923247c39a..cbb06656fd 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRPlugin.java @@ -5,8 +5,8 @@ import android.content.Context; import android.content.Intent; import android.content.ServiceConnection; import android.os.IBinder; -import android.support.v4.app.FragmentActivity; -import android.support.v7.app.AlertDialog; +import androidx.fragment.app.FragmentActivity; +import androidx.appcompat.app.AlertDialog; import com.squareup.otto.Subscribe; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/Dialogs/ProfileViewDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/Dialogs/ProfileViewDialog.java index 2b09b180cf..06cfc289ad 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/Dialogs/ProfileViewDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/Dialogs/ProfileViewDialog.java @@ -1,7 +1,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.dialogs; import android.os.Bundle; -import android.support.v4.app.DialogFragment; +import androidx.fragment.app.DialogFragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/activities/DanaRHistoryActivity.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/activities/DanaRHistoryActivity.java index 95c9f25e37..617f99071d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/activities/DanaRHistoryActivity.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/activities/DanaRHistoryActivity.java @@ -4,9 +4,9 @@ import android.app.Activity; import android.os.Bundle; import android.os.Handler; import android.os.HandlerThread; -import android.support.v7.widget.CardView; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; +import androidx.cardview.widget.CardView; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusBolusExtended.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusBolusExtended.java index 9b27561d5a..aa272b546d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusBolusExtended.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusBolusExtended.java @@ -1,6 +1,6 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusTempBasal.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusTempBasal.java index 76fa0e9f43..00b3bf5f69 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusTempBasal.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusTempBasal.java @@ -1,6 +1,6 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRKorean/DanaRKoreanPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRKorean/DanaRKoreanPlugin.java index ef3301fc28..84e9cdf1e1 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRKorean/DanaRKoreanPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRKorean/DanaRKoreanPlugin.java @@ -5,8 +5,8 @@ import android.content.Context; import android.content.Intent; import android.content.ServiceConnection; import android.os.IBinder; -import android.support.v4.app.FragmentActivity; -import android.support.v7.app.AlertDialog; +import androidx.fragment.app.FragmentActivity; +import androidx.appcompat.app.AlertDialog; import com.squareup.otto.Subscribe; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/DanaRSPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/DanaRSPlugin.java index f653d764d4..4ec17af6d8 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/DanaRSPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/DanaRSPlugin.java @@ -5,9 +5,9 @@ import android.content.Context; import android.content.Intent; import android.content.ServiceConnection; import android.os.IBinder; -import android.support.annotation.Nullable; -import android.support.v4.app.FragmentActivity; -import android.support.v7.app.AlertDialog; +import androidx.annotation.Nullable; +import androidx.fragment.app.FragmentActivity; +import androidx.appcompat.app.AlertDialog; import com.squareup.otto.Subscribe; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/activities/BLEScanActivity.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/activities/BLEScanActivity.java index 502c18cbc9..e790fe7bfb 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/activities/BLEScanActivity.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/activities/BLEScanActivity.java @@ -7,7 +7,7 @@ import android.bluetooth.le.ScanCallback; import android.bluetooth.le.ScanResult; import android.os.Bundle; import android.os.Handler; -import android.support.v7.app.AppCompatActivity; +import androidx.appcompat.app.AppCompatActivity; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/activities/PairingHelperActivity.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/activities/PairingHelperActivity.java index a98d541963..6282ff8d0f 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/activities/PairingHelperActivity.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/activities/PairingHelperActivity.java @@ -1,6 +1,6 @@ package info.nightscout.androidaps.plugins.pump.danaRS.activities; -import android.support.v7.app.AppCompatActivity; +import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; public class PairingHelperActivity extends AppCompatActivity { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/activities/PairingProgressDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/activities/PairingProgressDialog.java index 1d9943a5f5..544b0c862e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/activities/PairingProgressDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/activities/PairingProgressDialog.java @@ -5,7 +5,7 @@ import android.app.Activity; import android.os.Bundle; import android.os.Handler; import android.os.HandlerThread; -import android.support.v4.app.DialogFragment; +import androidx.fragment.app.DialogFragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Basal_Get_Temporary_Basal_State.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Basal_Get_Temporary_Basal_State.java index 5724c5ff80..117baf23ff 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Basal_Get_Temporary_Basal_State.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Basal_Get_Temporary_Basal_State.java @@ -1,6 +1,6 @@ package info.nightscout.androidaps.plugins.pump.danaRS.comm; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import com.cozmo.danar.util.BleCommandUtil; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/DanaRv2Plugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/DanaRv2Plugin.java index 2087d3facf..13af8fff1b 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/DanaRv2Plugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/DanaRv2Plugin.java @@ -5,8 +5,8 @@ import android.content.Context; import android.content.Intent; import android.content.ServiceConnection; import android.os.IBinder; -import android.support.v4.app.FragmentActivity; -import android.support.v7.app.AlertDialog; +import androidx.fragment.app.FragmentActivity; +import androidx.appcompat.app.AlertDialog; import com.squareup.otto.Subscribe; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusBolusExtended_v2.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusBolusExtended_v2.java index 578be6d4b6..a829b3afcb 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusBolusExtended_v2.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusBolusExtended_v2.java @@ -1,6 +1,6 @@ package info.nightscout.androidaps.plugins.pump.danaRv2.comm; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusTempBasal_v2.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusTempBasal_v2.java index a92c534d92..19a0a2b6ce 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusTempBasal_v2.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusTempBasal_v2.java @@ -1,6 +1,6 @@ package info.nightscout.androidaps.plugins.pump.danaRv2.comm; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/InsightAlertService.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/InsightAlertService.java index d851389aaf..26555898c0 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/InsightAlertService.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/InsightAlertService.java @@ -15,7 +15,7 @@ import android.os.Handler; import android.os.IBinder; import android.os.Looper; import android.os.Vibrator; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightFragment.java index 26f5180f47..b973424d71 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightFragment.java @@ -3,8 +3,8 @@ package info.nightscout.androidaps.plugins.pump.insight; import android.os.Bundle; import android.os.Handler; import android.os.Looper; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/activities/InsightAlertActivity.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/activities/InsightAlertActivity.java index c40cb99ed6..46031d8666 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/activities/InsightAlertActivity.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/activities/InsightAlertActivity.java @@ -5,8 +5,8 @@ import android.content.Intent; import android.content.ServiceConnection; import android.os.Bundle; import android.os.IBinder; -import android.support.v4.content.ContextCompat; -import android.support.v7.app.AppCompatActivity; +import androidx.core.content.ContextCompat; +import androidx.appcompat.app.AppCompatActivity; import android.text.Html; import android.view.View; import android.view.WindowManager; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/activities/InsightPairingActivity.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/activities/InsightPairingActivity.java index 13fd698236..535d3d8bdb 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/activities/InsightPairingActivity.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/activities/InsightPairingActivity.java @@ -10,11 +10,11 @@ import android.content.IntentFilter; import android.content.ServiceConnection; import android.os.Bundle; import android.os.IBinder; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatActivity; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/activities/InsightPairingInformationActivity.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/activities/InsightPairingInformationActivity.java index 8580b30dca..9e6ee03d77 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/activities/InsightPairingInformationActivity.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/activities/InsightPairingInformationActivity.java @@ -5,8 +5,8 @@ import android.content.Intent; import android.content.ServiceConnection; import android.os.Bundle; import android.os.IBinder; -import android.support.annotation.Nullable; -import android.support.v7.app.AppCompatActivity; +import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatActivity; import android.view.View; import android.widget.TextView; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/connection_service/InsightConnectionService.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/connection_service/InsightConnectionService.java index e964c9fa20..cecb631776 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/connection_service/InsightConnectionService.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/connection_service/InsightConnectionService.java @@ -8,7 +8,7 @@ import android.content.Intent; import android.os.Binder; import android.os.IBinder; import android.os.PowerManager; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/virtual/VirtualPumpFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/virtual/VirtualPumpFragment.java index 0b764f5382..be9bf17c85 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/virtual/VirtualPumpFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/virtual/VirtualPumpFragment.java @@ -4,7 +4,7 @@ package info.nightscout.androidaps.plugins.pump.virtual; import android.app.Activity; import android.os.Bundle; import android.os.Handler; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -20,8 +20,6 @@ import info.nightscout.androidaps.R; import info.nightscout.androidaps.db.ExtendedBolus; import info.nightscout.androidaps.db.TemporaryBasal; import info.nightscout.androidaps.plugins.common.SubscriberFragment; -import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction; -import info.nightscout.androidaps.plugins.general.actions.defs.CustomActionType; import info.nightscout.androidaps.plugins.pump.common.defs.PumpType; import info.nightscout.androidaps.plugins.pump.virtual.events.EventVirtualPumpUpdateGui; import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityAAPSPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityAAPSPlugin.java index 8e33b16302..dfc4bed25d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityAAPSPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityAAPSPlugin.java @@ -1,6 +1,6 @@ package info.nightscout.androidaps.plugins.sensitivity; -import android.support.v4.util.LongSparseArray; +import androidx.collection.LongSparseArray; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityOref0Plugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityOref0Plugin.java index 83800e1721..cfcaf0eb22 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityOref0Plugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityOref0Plugin.java @@ -1,6 +1,6 @@ package info.nightscout.androidaps.plugins.sensitivity; -import android.support.v4.util.LongSparseArray; +import androidx.collection.LongSparseArray; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityOref1Plugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityOref1Plugin.java index 3ce5c4861c..bbd987e6bd 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityOref1Plugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityOref1Plugin.java @@ -1,6 +1,6 @@ package info.nightscout.androidaps.plugins.sensitivity; -import android.support.v4.util.LongSparseArray; +import androidx.collection.LongSparseArray; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityWeightedAveragePlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityWeightedAveragePlugin.java index 5b7268b560..91b69162bb 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityWeightedAveragePlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityWeightedAveragePlugin.java @@ -1,6 +1,6 @@ package info.nightscout.androidaps.plugins.sensitivity; -import android.support.v4.util.LongSparseArray; +import androidx.collection.LongSparseArray; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/BGSourceFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/source/BGSourceFragment.java index 211cbb0bb0..269ee2b3f5 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/source/BGSourceFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/BGSourceFragment.java @@ -4,10 +4,10 @@ import android.app.Activity; import android.content.DialogInterface; import android.graphics.Paint; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.v7.app.AlertDialog; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; +import androidx.annotation.NonNull; +import androidx.appcompat.app.AlertDialog; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/SourceDexcomG5Plugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/source/SourceDexcomG5Plugin.java deleted file mode 100644 index 3ba10564e6..0000000000 --- a/app/src/main/java/info/nightscout/androidaps/plugins/source/SourceDexcomG5Plugin.java +++ /dev/null @@ -1,232 +0,0 @@ -package info.nightscout.androidaps.plugins.source; - -import android.content.Intent; -import android.os.Bundle; - -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.Arrays; - -import info.nightscout.androidaps.Constants; -import info.nightscout.androidaps.MainApp; -import info.nightscout.androidaps.R; -import info.nightscout.androidaps.db.BgReading; -import info.nightscout.androidaps.db.CareportalEvent; -import info.nightscout.androidaps.interfaces.BgSourceInterface; -import info.nightscout.androidaps.interfaces.PluginBase; -import info.nightscout.androidaps.interfaces.PluginDescription; -import info.nightscout.androidaps.interfaces.PluginType; -import info.nightscout.androidaps.logging.L; -import info.nightscout.androidaps.plugins.general.nsclient.NSUpload; -import info.nightscout.androidaps.services.Intents; -import info.nightscout.androidaps.utils.DateUtil; -import info.nightscout.androidaps.utils.SP; - -/** - * Created by mike on 28.11.2017. - */ - -public class SourceDexcomG5Plugin extends PluginBase implements BgSourceInterface { - private static Logger log = LoggerFactory.getLogger(L.BGSOURCE); - - private static SourceDexcomG5Plugin plugin = null; - - public static SourceDexcomG5Plugin getPlugin() { - if (plugin == null) - plugin = new SourceDexcomG5Plugin(); - return plugin; - } - - private SourceDexcomG5Plugin() { - super(new PluginDescription() - .mainType(PluginType.BGSOURCE) - .fragmentClass(BGSourceFragment.class.getName()) - .pluginName(R.string.DexcomG5) - .shortName(R.string.dexcomG5_shortname) - .preferencesId(R.xml.pref_bgsource) - .description(R.string.description_source_dexcom_g5) - ); - } - - @Override - public boolean advancedFilteringSupported() { - return true; - } - - @Override - public void handleNewData(Intent intent) { - // onHandleIntent Bundle{ data => [{"m_time":1511939180,"m_trend":"NotComputable","m_value":335}]; android.support.content.wakelockid => 95; }Bundle - - if (!isEnabled(PluginType.BGSOURCE)) return; - - if (intent.getAction().equals(Intents.DEXCOMG5_BG)) - handleNewDataOld(intent); - - if (intent.getAction().equals(Intents.DEXCOMG5_BG_NEW)) - handleNewDataNew(intent); - } - - public void handleNewDataOld(Intent intent) { - // onHandleIntent Bundle{ data => [{"m_time":1511939180,"m_trend":"NotComputable","m_value":335}]; android.support.content.wakelockid => 95; }Bundle - - Bundle bundle = intent.getExtras(); - if (bundle == null) return; - - BgReading bgReading = new BgReading(); - - String data = bundle.getString("data"); - if (L.isEnabled(L.BGSOURCE)) - log.debug("Received Dexcom Data", data); - - if (data == null) return; - - try { - JSONArray jsonArray = new JSONArray(data); - if (L.isEnabled(L.BGSOURCE)) - log.debug("Received Dexcom Data size:" + jsonArray.length()); - for (int i = 0; i < jsonArray.length(); i++) { - JSONObject json = jsonArray.getJSONObject(i); - bgReading.value = json.getInt("m_value"); - bgReading.direction = json.getString("m_trend"); - bgReading.date = json.getLong("m_time") * 1000L; - bgReading.raw = 0; - boolean isNew = MainApp.getDbHelper().createIfNotExists(bgReading, "DexcomG5"); - if (isNew && SP.getBoolean(R.string.key_dexcomg5_nsupload, false)) { - NSUpload.uploadBg(bgReading, "AndroidAPS-DexcomG5"); - } - if (isNew && SP.getBoolean(R.string.key_dexcomg5_xdripupload, false)) { - NSUpload.sendToXdrip(bgReading); - } - } - - } catch (JSONException e) { - log.error("Exception: ", e); - } - } - - public void handleNewDataNew(Intent intent) { - - Bundle bundle = intent.getExtras(); - if (bundle == null) return; - - if (L.isEnabled(L.BGSOURCE)) { - if (bundle.containsKey("transmitterSystemTime")) - log.debug("transmitterSystemTime: " + DateUtil.dateAndTimeFullString(bundle.getLong("transmitterSystemTime"))); - if (bundle.containsKey("transmitterRemainingTime")) - log.debug("transmitterRemainingTime: " + DateUtil.dateAndTimeFullString(bundle.getLong("transmitterRemainingTime"))); - log.debug("transmitterId: " + bundle.getString("transmitterId")); - if (bundle.containsKey("transmitterActivatedOn")) - log.debug("transmitterActivatedOn: " + DateUtil.dateAndTimeFullString(bundle.getLong("transmitterActivatedOn"))); - log.debug("transmitterVersion: " + bundle.getString("transmitterVersion")); - log.debug("transmitterSoftwareNumber: " + bundle.getString("transmitterSoftwareNumber")); - log.debug("transmitterStorageTimeDays: " + bundle.getInt("transmitterStorageTimeDays")); - log.debug("transmitterApiVersion: " + bundle.getInt("transmitterApiVersion")); - log.debug("transmitterMaxRuntimeDays: " + bundle.getInt("transmitterMaxRuntimeDays")); - log.debug("transmitterMaxStorageTimeDays: " + bundle.getInt("transmitterMaxStorageTimeDays")); - log.debug("transmitterCGMProcessorFirmwareVersion: " + bundle.getString("transmitterCGMProcessorFirmwareVersion")); - log.debug("transmitterBleRadioFirmwareVersion: " + bundle.getString("transmitterBleRadioFirmwareVersion")); - log.debug("transmitterHardwareVersion: " + bundle.getInt("transmitterHardwareVersion")); - log.debug("transmitterBleSoftDeviceVersion: " + bundle.getString("transmitterBleSoftDeviceVersion")); - log.debug("transmitterNordicAsicHwID: " + bundle.getInt("transmitterNordicAsicHwID")); - log.debug("transmitterSessionTimeDays: " + bundle.getInt("transmitterSessionTimeDays")); - log.debug("transmitterFeatureFlags: " + bundle.getInt("transmitterFeatureFlags")); - } - - if (bundle.containsKey("sensorInsertionTime")) { - long sensorInsertionTime = bundle.getLong("sensorInsertionTime"); - if (L.isEnabled(L.BGSOURCE)) - log.debug("sensorInsertionTime: " + DateUtil.dateAndTimeFullString(sensorInsertionTime)); - if (SP.getBoolean(R.string.key_dexcom_lognssensorchange, false)) { - try { - if (MainApp.getDbHelper().getCareportalEventFromTimestamp(sensorInsertionTime) == null) { - JSONObject data = new JSONObject(); - data.put("enteredBy", "AndroidAPS-DexcomG5"); - data.put("created_at", DateUtil.toISOString(sensorInsertionTime)); - data.put("eventType", CareportalEvent.SENSORCHANGE); - NSUpload.uploadCareportalEntryToNS(data); - } - } catch (JSONException e) { - log.error("Unhandled exception", e); - } - } - } - - if (bundle.containsKey("glucoseValues")) { - int[] glucoseValues = bundle.getIntArray("glucoseValues"); - int[] glucoseRecordIDs = bundle.getIntArray("glucoseRecordIDs"); - long[] glucoseRecordedTimestamps = bundle.getLongArray("glucoseRecordedTimestamps"); - long[] glucoseSessionStartTimes = bundle.getLongArray("glucoseSessionStartTimes"); - long[] glucoseSystemTimestamps = bundle.getLongArray("glucoseSystemTimestamps"); - String[] glucoseTransmitterIDS = bundle.getStringArray("glucoseTransmitterIDS"); - long[] glucoseTransmitterTimestamps = bundle.getLongArray("glucoseTransmitterTimestamps"); - String[] glucoseTrendsArrows = bundle.getStringArray("glucoseTrendsArrows"); - boolean[] glucoseWasBackfilled = bundle.getBooleanArray("glucoseWasBackfilled"); - - if (L.isEnabled(L.BGSOURCE)) { - log.debug("glucoseValues", Arrays.toString(glucoseValues)); - log.debug("glucoseRecordIDs", Arrays.toString(glucoseRecordIDs)); - log.debug("glucoseRecordedTimestamps", Arrays.toString(glucoseRecordedTimestamps)); - log.debug("glucoseSessionStartTimes", Arrays.toString(glucoseSessionStartTimes)); - log.debug("glucoseSystemTimestamps", Arrays.toString(glucoseSystemTimestamps)); - log.debug("glucoseTransmitterIDS", Arrays.toString(glucoseTransmitterIDS)); - log.debug("glucoseTransmitterTimestamps", Arrays.toString(glucoseTransmitterTimestamps)); - log.debug("glucoseTrendsArrows", Arrays.toString(glucoseTrendsArrows)); - log.debug("glucoseWasBackfilled", Arrays.toString(glucoseWasBackfilled)); - } - - for (int i = 0; i < glucoseValues.length; i++) { - BgReading bgReading = new BgReading(); - bgReading.value = glucoseValues[i]; - bgReading.direction = glucoseTrendsArrows[i]; - bgReading.date = glucoseTransmitterTimestamps[i]; - bgReading.raw = 0; - boolean isNew = MainApp.getDbHelper().createIfNotExists(bgReading, "DexcomG5"); - if (isNew && SP.getBoolean(R.string.key_dexcomg5_nsupload, false)) { - NSUpload.uploadBg(bgReading, "AndroidAPS-DexcomG5"); - } - if (isNew && SP.getBoolean(R.string.key_dexcomg5_xdripupload, false)) { - NSUpload.sendToXdrip(bgReading); - } - } - } - - if (bundle.containsKey("meterValues")) { - String[] meterEntryTypes = bundle.getStringArray("meterEntryTypes"); - long[] meterTimestamps = bundle.getLongArray("meterTimestamps"); - int[] meterValues = bundle.getIntArray("meterValues"); - long[] meterRecordedTimestamps = bundle.getLongArray("meterRecordedTimestamps"); - int[] meterTransmitterIDs = bundle.getIntArray("meterTransmitterIDs"); - long[] meterTransmitterTimestamps = bundle.getLongArray("meterTransmitterTimestamps"); - - if (L.isEnabled(L.BGSOURCE)) { - log.debug("meterValues", Arrays.toString(meterValues)); - log.debug("meterEntryTypes", Arrays.toString(meterEntryTypes)); - log.debug("meterTimestamps", Arrays.toString(meterTimestamps)); - log.debug("meterTransmitterTimestamps", Arrays.toString(meterTransmitterTimestamps)); - log.debug("meterRecordedTimestamps", Arrays.toString(meterRecordedTimestamps)); - log.debug("meterTransmitterIDs", Arrays.toString(meterTransmitterIDs)); - } - - for (int i = 0; i < meterValues.length; i++) { - try { - if (MainApp.getDbHelper().getCareportalEventFromTimestamp(meterTimestamps[i]) == null) { - JSONObject data = new JSONObject(); - data.put("enteredBy", "AndroidAPS-DexcomG5"); - data.put("created_at", DateUtil.toISOString(meterTimestamps[i])); - data.put("eventType", CareportalEvent.BGCHECK); - data.put("glucoseType", "Finger"); - data.put("glucose", meterValues[i]); - data.put("units", Constants.MGDL); - NSUpload.uploadCareportalEntryToNS(data); - } - } catch (JSONException e) { - log.error("Unhandled exception", e); - } - } - } - } -} diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/SourceDexcomG6Plugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/source/SourceDexcomG6Plugin.java deleted file mode 100644 index ad63a9b9ae..0000000000 --- a/app/src/main/java/info/nightscout/androidaps/plugins/source/SourceDexcomG6Plugin.java +++ /dev/null @@ -1,174 +0,0 @@ -package info.nightscout.androidaps.plugins.source; - -import android.content.Intent; -import android.os.Bundle; - -import org.json.JSONException; -import org.json.JSONObject; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.Arrays; - -import info.nightscout.androidaps.Constants; -import info.nightscout.androidaps.MainApp; -import info.nightscout.androidaps.R; -import info.nightscout.androidaps.db.BgReading; -import info.nightscout.androidaps.db.CareportalEvent; -import info.nightscout.androidaps.interfaces.BgSourceInterface; -import info.nightscout.androidaps.interfaces.PluginBase; -import info.nightscout.androidaps.interfaces.PluginDescription; -import info.nightscout.androidaps.interfaces.PluginType; -import info.nightscout.androidaps.logging.L; -import info.nightscout.androidaps.plugins.general.nsclient.NSUpload; -import info.nightscout.androidaps.utils.DateUtil; -import info.nightscout.androidaps.utils.SP; - -/** - * Created by mike on 30.11.2018. - */ - -public class SourceDexcomG6Plugin extends PluginBase implements BgSourceInterface { - private static Logger log = LoggerFactory.getLogger(L.BGSOURCE); - - private static SourceDexcomG6Plugin plugin = null; - - public static SourceDexcomG6Plugin getPlugin() { - if (plugin == null) - plugin = new SourceDexcomG6Plugin(); - return plugin; - } - - private SourceDexcomG6Plugin() { - super(new PluginDescription() - .mainType(PluginType.BGSOURCE) - .fragmentClass(BGSourceFragment.class.getName()) - .pluginName(R.string.DexcomG6) - .shortName(R.string.dexcomG6_shortname) - .preferencesId(R.xml.pref_bgsource) - .description(R.string.description_source_dexcom_g6) - ); - } - - @Override - public boolean advancedFilteringSupported() { - return true; - } - - @Override - public void handleNewData(Intent intent) { - if (!isEnabled(PluginType.BGSOURCE)) return; - - Bundle bundle = intent.getExtras(); - if (bundle == null) return; - - if (L.isEnabled(L.BGSOURCE)) { - if (bundle.containsKey("transmitterSystemTime")) - log.debug("transmitterSystemTime: " + DateUtil.dateAndTimeFullString(bundle.getLong("transmitterSystemTime"))); - log.debug("transmitterId: " + bundle.getString("transmitterId")); - if (bundle.containsKey("transmitterActivatedOn")) - log.debug("transmitterActivatedOn: " + DateUtil.dateAndTimeFullString(bundle.getLong("transmitterActivatedOn"))); - log.debug("transmitterVersion: " + bundle.getString("transmitterVersion")); - log.debug("transmitterSoftwareNumber: " + bundle.getString("transmitterSoftwareNumber")); - log.debug("transmitterStorageTimeDays: " + bundle.getInt("transmitterStorageTimeDays")); - log.debug("transmitterApiVersion: " + bundle.getInt("transmitterApiVersion")); - log.debug("transmitterMaxRuntimeDays: " + bundle.getInt("transmitterMaxRuntimeDays")); - log.debug("transmitterMaxStorageTimeDays: " + bundle.getInt("transmitterMaxStorageTimeDays")); - log.debug("transmitterCGMProcessorFirmwareVersion: " + bundle.getString("transmitterCGMProcessorFirmwareVersion")); - log.debug("transmitterBleRadioFirmwareVersion: " + bundle.getString("transmitterBleRadioFirmwareVersion")); - log.debug("transmitterHardwareVersion: " + bundle.getInt("transmitterHardwareVersion")); - log.debug("transmitterBleSoftDeviceVersion: " + bundle.getString("transmitterBleSoftDeviceVersion")); - log.debug("transmitterNordicAsicHwID: " + bundle.getInt("transmitterNordicAsicHwID")); - log.debug("transmitterSessionTimeDays: " + bundle.getInt("transmitterSessionTimeDays")); - log.debug("transmitterFeatureFlags: " + bundle.getInt("transmitterFeatureFlags")); - - if (bundle.containsKey("sensorCode")) - log.debug("sensorCode: " + bundle.getString("sensorCode")); - } - - if (bundle.containsKey("sensorInsertionTime")) { - long sensorInsertionTime = bundle.getLong("sensorInsertionTime"); - if (L.isEnabled(L.BGSOURCE)) - log.debug("sensorInsertionTime: " + DateUtil.dateAndTimeFullString(sensorInsertionTime)); - if (SP.getBoolean(R.string.key_dexcom_lognssensorchange, false)) { - try { - if (MainApp.getDbHelper().getCareportalEventFromTimestamp(sensorInsertionTime) == null) { - JSONObject data = new JSONObject(); - data.put("enteredBy", "AndroidAPS-DexcomG6"); - data.put("created_at", DateUtil.toISOString(sensorInsertionTime)); - data.put("eventType", CareportalEvent.SENSORCHANGE); - NSUpload.uploadCareportalEntryToNS(data); - } - } catch (JSONException e) { - log.error("Unhandled exception", e); - } - } - } - - if (bundle.containsKey("evgTimestamps")) { - long[] timestamps = bundle.getLongArray("evgTimestamps"); - long[] transmitterTimes = bundle.getLongArray("transmitterTimes"); - int[] evgs = bundle.getIntArray("evgs"); - int[] predictiveEVGs = bundle.getIntArray("predictiveEVGs"); - String[] trendArrows = bundle.getStringArray("trendArrows"); - - if (L.isEnabled(L.BGSOURCE)) { - log.debug("timestamps", Arrays.toString(timestamps)); - log.debug("transmitterTimes", Arrays.toString(transmitterTimes)); - log.debug("evgs", Arrays.toString(evgs)); - log.debug("predictiveEVGs", Arrays.toString(predictiveEVGs)); - log.debug("trendArrows", Arrays.toString(trendArrows)); - } - - for (int i = 0; i < transmitterTimes.length; i++) { - BgReading bgReading = new BgReading(); - bgReading.value = evgs[i]; - bgReading.direction = trendArrows[i]; - bgReading.date = timestamps[i]; - bgReading.raw = 0; - boolean isNew = MainApp.getDbHelper().createIfNotExists(bgReading, "DexcomG6"); - if (isNew && SP.getBoolean(R.string.key_dexcomg5_nsupload, false)) { - NSUpload.uploadBg(bgReading, "AndroidAPS-DexcomG6"); - } - if (isNew && SP.getBoolean(R.string.key_dexcomg5_xdripupload, false)) { - NSUpload.sendToXdrip(bgReading); - } - } - } - - if (bundle.containsKey("meterValues")) { - int[] meterValues = bundle.getIntArray("meterValues"); - String[] meterEntryTypes = bundle.getStringArray("meterEntryTypes"); - long[] meterTimestamps = bundle.getLongArray("meterTimestamps"); - long[] meterTransmitterTimestamps = bundle.getLongArray("meterTransmitterTimestamps"); - long[] meterRecordedTimestamps = bundle.getLongArray("meterRecordedTimestamps"); - int[] meterRecordIDs = bundle.getIntArray("meterRecordIDs"); - - if (L.isEnabled(L.BGSOURCE)) { - log.debug("meterValues", Arrays.toString(meterValues)); - log.debug("meterEntryTypes", Arrays.toString(meterEntryTypes)); - log.debug("meterTimestamps", Arrays.toString(meterTimestamps)); - log.debug("meterTransmitterTimestamps", Arrays.toString(meterTransmitterTimestamps)); - log.debug("meterRecordedTimestamps", Arrays.toString(meterRecordedTimestamps)); - log.debug("meterRecordIDs", Arrays.toString(meterRecordIDs)); - } - - for (int i = 0; i < meterValues.length; i++) { - try { - if (MainApp.getDbHelper().getCareportalEventFromTimestamp(meterTimestamps[i]) == null) { - JSONObject data = new JSONObject(); - data.put("enteredBy", "AndroidAPS-DexcomG6"); - data.put("created_at", DateUtil.toISOString(meterTimestamps[i])); - data.put("eventType", CareportalEvent.BGCHECK); - data.put("glucoseType", "Finger"); - data.put("glucose", meterValues[i]); - data.put("units", Constants.MGDL); - NSUpload.uploadCareportalEntryToNS(data); - } - } catch (JSONException e) { - log.error("Unhandled exception", e); - } - } - } - } -} diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/SourceDexcomPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/SourceDexcomPlugin.kt new file mode 100644 index 0000000000..2131d5e321 --- /dev/null +++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/SourceDexcomPlugin.kt @@ -0,0 +1,111 @@ +package info.nightscout.androidaps.plugins.source + +import android.Manifest +import android.content.Intent +import android.content.pm.PackageManager +import android.os.Build +import androidx.core.content.ContextCompat +import info.nightscout.androidaps.Constants +import info.nightscout.androidaps.MainApp +import info.nightscout.androidaps.R +import info.nightscout.androidaps.activities.RequestDexcomPermissionActivity +import info.nightscout.androidaps.db.BgReading +import info.nightscout.androidaps.db.CareportalEvent +import info.nightscout.androidaps.interfaces.BgSourceInterface +import info.nightscout.androidaps.interfaces.PluginBase +import info.nightscout.androidaps.interfaces.PluginDescription +import info.nightscout.androidaps.interfaces.PluginType +import info.nightscout.androidaps.logging.L +import info.nightscout.androidaps.plugins.general.nsclient.NSUpload +import info.nightscout.androidaps.utils.DateUtil +import info.nightscout.androidaps.utils.SP +import org.json.JSONObject +import org.slf4j.LoggerFactory + +object SourceDexcomPlugin : PluginBase(PluginDescription() + .mainType(PluginType.BGSOURCE) + .fragmentClass(BGSourceFragment::class.java.name) + .pluginName(R.string.dexcom_app_patched) + .shortName(R.string.dexcom_short) + .preferencesId(R.xml.pref_bgsource) + .description(R.string.description_source_dexcom)), BgSourceInterface { + + private val log = LoggerFactory.getLogger(L.BGSOURCE) + + private val PACKAGE_NAMES = arrayOf("com.dexcom.cgm.region1.mgdl", "com.dexcom.cgm.region1.mmol", + "com.dexcom.cgm.region2.mgdl", "com.dexcom.cgm.region2.mmol", + "com.dexcom.g6.region1.mmol", "com.dexcom.g6.region2.mgdl", + "com.dexcom.g6.region3.mgdl", "com.dexcom.g6.region3.mmol") + + const val PERMISSION = "com.dexcom.cgm.EXTERNAL_PERMISSION" + + override fun advancedFilteringSupported(): Boolean { + return true + } + + override fun onStart() { + super.onStart() + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && ContextCompat.checkSelfPermission(MainApp.instance(), PERMISSION) != PackageManager.PERMISSION_GRANTED) { + val intent = Intent(MainApp.instance(), RequestDexcomPermissionActivity::class.java) + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) + MainApp.instance().startActivity(intent) + } + } + + fun findDexcomPackageName(): String? { + val packageManager = MainApp.instance().packageManager; + for (packageInfo in packageManager.getInstalledPackages(0)) { + if (PACKAGE_NAMES.contains(packageInfo.packageName)) return packageInfo.packageName + } + return null + } + + override fun handleNewData(intent: Intent) { + if (!isEnabled(PluginType.BGSOURCE)) return + try { + val glucoseValues = intent.getBundleExtra("glucoseValues") + for (i in 0 until glucoseValues.size()) { + val glucoseValue = glucoseValues.getBundle(i.toString()) + val bgReading = BgReading() + bgReading.value = glucoseValue!!.getInt("glucoseValue").toDouble() + bgReading.direction = glucoseValue.getString("trendArrow") + bgReading.date = glucoseValue.getLong("timestamp") * 1000 + bgReading.raw = 0.0 + if (MainApp.getDbHelper().createIfNotExists(bgReading, "Dexcom")) { + if (SP.getBoolean(R.string.key_dexcomg5_nsupload, false)) { + NSUpload.uploadBg(bgReading, "AndroidAPS-DexcomG6") + } + if (SP.getBoolean(R.string.key_dexcomg5_xdripupload, false)) { + NSUpload.sendToXdrip(bgReading) + } + } + } + val meters = intent.getBundleExtra("meters") + for (i in 0 until meters.size()) { + val meter = meters.getBundle(i.toString()) + val timestamp = meter.getLong("timestamp") * 1000 + if (MainApp.getDbHelper().getCareportalEventFromTimestamp(timestamp) != null) continue + val jsonObject = JSONObject() + jsonObject.put("enteredBy", "AndroidAPS-Dexcom") + jsonObject.put("created_at", DateUtil.toISOString(timestamp)) + jsonObject.put("eventType", CareportalEvent.BGCHECK) + jsonObject.put("glucoseType", "Finger") + jsonObject.put("glucose", meter.getInt("meterValue")) + jsonObject.put("units", Constants.MGDL) + NSUpload.uploadCareportalEntryToNS(jsonObject) + } + if (SP.getBoolean(R.string.key_dexcom_lognssensorchange, false) && intent.hasExtra("sensorInsertionTime")) { + val sensorInsertionTime = intent.extras.getLong("sensorInsertionTime") * 1000 + if (MainApp.getDbHelper().getCareportalEventFromTimestamp(sensorInsertionTime) == null) { + val jsonObject = JSONObject() + jsonObject.put("enteredBy", "AndroidAPS-Dexcom") + jsonObject.put("created_at", DateUtil.toISOString(sensorInsertionTime)) + jsonObject.put("eventType", CareportalEvent.SENSORCHANGE) + NSUpload.uploadCareportalEntryToNS(jsonObject) + } + } + } catch (e : Exception) { + log.error("Error while processing intent from Dexcom App", e) + } + } +} diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/CarbsGenerator.java b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/CarbsGenerator.java index ac9be50a23..0e7215b368 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/CarbsGenerator.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/CarbsGenerator.java @@ -1,7 +1,7 @@ package info.nightscout.androidaps.plugins.treatments; import android.content.Intent; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/Treatment.java b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/Treatment.java index 1af572f6ea..9a26e4f4e9 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/Treatment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/Treatment.java @@ -1,7 +1,7 @@ package info.nightscout.androidaps.plugins.treatments; import android.graphics.Color; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import com.j256.ormlite.field.DatabaseField; import com.j256.ormlite.table.DatabaseTable; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentService.java b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentService.java index 842c01d9ee..be1ca8e8e6 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentService.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentService.java @@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.treatments; import android.content.Intent; 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.OrmLiteBaseService; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentsFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentsFragment.java index d30565b4a7..192952057d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentsFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentsFragment.java @@ -1,8 +1,8 @@ package info.nightscout.androidaps.plugins.treatments; import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentTransaction; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentTransaction; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentsPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentsPlugin.java index aed49c21d6..60e7be9559 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentsPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentsPlugin.java @@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.treatments; import android.content.Intent; import android.os.Bundle; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import com.google.firebase.analytics.FirebaseAnalytics; import com.squareup.otto.Subscribe; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/dialogs/WizardInfoDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/dialogs/WizardInfoDialog.java index c38672311b..e068e094f1 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/dialogs/WizardInfoDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/dialogs/WizardInfoDialog.java @@ -1,7 +1,7 @@ package info.nightscout.androidaps.plugins.treatments.dialogs; import android.os.Bundle; -import android.support.v4.app.DialogFragment; +import androidx.fragment.app.DialogFragment; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/ProfileViewerDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/ProfileViewerDialog.java index c8db29b617..a3b6234a22 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/ProfileViewerDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/ProfileViewerDialog.java @@ -1,7 +1,7 @@ package info.nightscout.androidaps.plugins.treatments.fragments; import android.os.Bundle; -import android.support.v4.app.DialogFragment; +import androidx.fragment.app.DialogFragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsBolusFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsBolusFragment.java index 26a8494dd7..c2320fc3ce 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsBolusFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsBolusFragment.java @@ -6,12 +6,12 @@ import android.content.DialogInterface; import android.content.Intent; import android.graphics.Paint; import android.os.Bundle; -import android.support.v4.app.FragmentManager; -import android.support.v4.content.ContextCompat; -import android.support.v7.app.AlertDialog; -import android.support.v7.widget.CardView; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; +import androidx.fragment.app.FragmentManager; +import androidx.core.content.ContextCompat; +import androidx.appcompat.app.AlertDialog; +import androidx.cardview.widget.CardView; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsCareportalFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsCareportalFragment.java index 2f45f67c3b..2ec61597d7 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsCareportalFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsCareportalFragment.java @@ -6,10 +6,10 @@ import android.content.DialogInterface; import android.content.Intent; import android.graphics.Paint; import android.os.Bundle; -import android.support.v7.app.AlertDialog; -import android.support.v7.widget.CardView; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; +import androidx.appcompat.app.AlertDialog; +import androidx.cardview.widget.CardView; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsExtendedBolusesFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsExtendedBolusesFragment.java index 766190e378..24a5185ef0 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsExtendedBolusesFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsExtendedBolusesFragment.java @@ -5,11 +5,11 @@ import android.content.Context; import android.content.DialogInterface; import android.graphics.Paint; import android.os.Bundle; -import android.support.v4.content.ContextCompat; -import android.support.v7.app.AlertDialog; -import android.support.v7.widget.CardView; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; +import androidx.core.content.ContextCompat; +import androidx.appcompat.app.AlertDialog; +import androidx.cardview.widget.CardView; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsProfileSwitchFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsProfileSwitchFragment.java index c59d5e1836..5d5919f69f 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsProfileSwitchFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsProfileSwitchFragment.java @@ -6,12 +6,12 @@ import android.content.DialogInterface; import android.content.Intent; import android.graphics.Paint; import android.os.Bundle; -import android.support.v4.app.FragmentManager; -import android.support.v4.content.ContextCompat; -import android.support.v7.app.AlertDialog; -import android.support.v7.widget.CardView; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; +import androidx.fragment.app.FragmentManager; +import androidx.core.content.ContextCompat; +import androidx.appcompat.app.AlertDialog; +import androidx.cardview.widget.CardView; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTempTargetFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTempTargetFragment.java index eda62a8318..56b887c295 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTempTargetFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTempTargetFragment.java @@ -6,11 +6,11 @@ import android.content.DialogInterface; import android.content.Intent; import android.graphics.Paint; import android.os.Bundle; -import android.support.v4.content.ContextCompat; -import android.support.v7.app.AlertDialog; -import android.support.v7.widget.CardView; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; +import androidx.core.content.ContextCompat; +import androidx.appcompat.app.AlertDialog; +import androidx.cardview.widget.CardView; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTemporaryBasalsFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTemporaryBasalsFragment.java index 7b935d354e..6aed7aea43 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTemporaryBasalsFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTemporaryBasalsFragment.java @@ -4,12 +4,12 @@ import android.app.Activity; import android.content.Context; import android.graphics.Paint; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.v4.content.ContextCompat; -import android.support.v7.app.AlertDialog; -import android.support.v7.widget.CardView; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; +import androidx.annotation.NonNull; +import androidx.core.content.ContextCompat; +import androidx.appcompat.app.AlertDialog; +import androidx.cardview.widget.CardView; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java index c1c023c451..edfb2aeff1 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java +++ b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java @@ -3,7 +3,7 @@ package info.nightscout.androidaps.queue; import android.content.Context; import android.content.Intent; import android.os.SystemClock; -import android.support.v7.app.AppCompatActivity; +import androidx.appcompat.app.AppCompatActivity; import android.text.Html; import android.text.Spanned; diff --git a/app/src/main/java/info/nightscout/androidaps/receivers/DataReceiver.java b/app/src/main/java/info/nightscout/androidaps/receivers/DataReceiver.java index 087cd3a5f5..6c2e7c6920 100644 --- a/app/src/main/java/info/nightscout/androidaps/receivers/DataReceiver.java +++ b/app/src/main/java/info/nightscout/androidaps/receivers/DataReceiver.java @@ -2,7 +2,7 @@ package info.nightscout.androidaps.receivers; import android.content.Context; import android.content.Intent; -import android.support.v4.content.WakefulBroadcastReceiver; +import androidx.legacy.content.WakefulBroadcastReceiver; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/app/src/main/java/info/nightscout/androidaps/receivers/NetworkChangeReceiver.java b/app/src/main/java/info/nightscout/androidaps/receivers/NetworkChangeReceiver.java index a2ab418914..4a462906b3 100644 --- a/app/src/main/java/info/nightscout/androidaps/receivers/NetworkChangeReceiver.java +++ b/app/src/main/java/info/nightscout/androidaps/receivers/NetworkChangeReceiver.java @@ -8,7 +8,7 @@ import android.net.NetworkInfo; import android.net.wifi.SupplicantState; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/app/src/main/java/info/nightscout/androidaps/services/DataService.java b/app/src/main/java/info/nightscout/androidaps/services/DataService.java index b98ff6bf94..6b8ac46f11 100644 --- a/app/src/main/java/info/nightscout/androidaps/services/DataService.java +++ b/app/src/main/java/info/nightscout/androidaps/services/DataService.java @@ -25,8 +25,7 @@ import info.nightscout.androidaps.plugins.general.overview.notifications.Notific import info.nightscout.androidaps.plugins.profile.ns.NSProfilePlugin; import info.nightscout.androidaps.plugins.pump.danaR.activities.DanaRNSHistorySync; import info.nightscout.androidaps.plugins.general.smsCommunicator.SmsCommunicatorPlugin; -import info.nightscout.androidaps.plugins.source.SourceDexcomG5Plugin; -import info.nightscout.androidaps.plugins.source.SourceDexcomG6Plugin; +import info.nightscout.androidaps.plugins.source.SourceDexcomPlugin; import info.nightscout.androidaps.plugins.source.SourceEversensePlugin; import info.nightscout.androidaps.plugins.source.SourceGlimpPlugin; import info.nightscout.androidaps.plugins.source.SourceMM640gPlugin; @@ -69,12 +68,8 @@ public class DataService extends IntentService { SourceMM640gPlugin.getPlugin().handleNewData(intent); } else if (Intents.GLIMP_BG.equals(action)) { SourceGlimpPlugin.getPlugin().handleNewData(intent); - } else if (Intents.DEXCOMG5_BG.equals(action)) { - SourceDexcomG5Plugin.getPlugin().handleNewData(intent); - } else if (Intents.DEXCOMG5_BG_NEW.equals(action)) { - SourceDexcomG5Plugin.getPlugin().handleNewData(intent); - } else if (Intents.DEXCOMG6_BG.equals(action)) { - SourceDexcomG6Plugin.getPlugin().handleNewData(intent); + } else if (Intents.DEXCOM_BG.equals(action)) { + SourceDexcomPlugin.INSTANCE.handleNewData(intent); } else if (Intents.POCTECH_BG.equals(action)) { SourcePoctechPlugin.getPlugin().handleNewData(intent); } else if (Intents.TOMATO_BG.equals(action)) { diff --git a/app/src/main/java/info/nightscout/androidaps/services/Intents.java b/app/src/main/java/info/nightscout/androidaps/services/Intents.java index 5011215b45..a5b26561b5 100644 --- a/app/src/main/java/info/nightscout/androidaps/services/Intents.java +++ b/app/src/main/java/info/nightscout/androidaps/services/Intents.java @@ -48,9 +48,7 @@ public interface Intents { String GLIMP_BG = "it.ct.glicemia.ACTION_GLUCOSE_MEASURED"; - String DEXCOMG5_BG = "com.dexcom.cgm.DATA"; - String DEXCOMG5_BG_NEW = "com.dexcom.cgm.g5.AndroidAPSEVGCallback.BROADCAST"; - String DEXCOMG6_BG = "com.dexcom.cgm.AndroidAPSEVGCallback.BROADCAST"; + String DEXCOM_BG = "com.dexcom.cgm.EXTERNAL_BROADCAST"; String EVERSENSE_BG = "com.senseonics.AndroidAPSEventSubscriber.BROADCAST"; String POCTECH_BG = "com.china.poctech.data"; diff --git a/app/src/main/java/info/nightscout/androidaps/setupwizard/SWDefinition.java b/app/src/main/java/info/nightscout/androidaps/setupwizard/SWDefinition.java index 1d143d073f..3be94c494e 100644 --- a/app/src/main/java/info/nightscout/androidaps/setupwizard/SWDefinition.java +++ b/app/src/main/java/info/nightscout/androidaps/setupwizard/SWDefinition.java @@ -3,7 +3,7 @@ package info.nightscout.androidaps.setupwizard; import android.Manifest; import android.content.Intent; import android.os.Build; -import android.support.v7.app.AppCompatActivity; +import androidx.appcompat.app.AppCompatActivity; import com.squareup.otto.Subscribe; diff --git a/app/src/main/java/info/nightscout/androidaps/setupwizard/SetupWizardActivity.java b/app/src/main/java/info/nightscout/androidaps/setupwizard/SetupWizardActivity.java index 9049ad7463..777463583d 100644 --- a/app/src/main/java/info/nightscout/androidaps/setupwizard/SetupWizardActivity.java +++ b/app/src/main/java/info/nightscout/androidaps/setupwizard/SetupWizardActivity.java @@ -3,9 +3,9 @@ package info.nightscout.androidaps.setupwizard; import android.content.Intent; import android.content.pm.PackageManager; import android.os.Bundle; -import android.support.v4.app.ActivityCompat; -import android.support.v7.app.AlertDialog; -import android.support.v7.app.AppCompatActivity; +import androidx.core.app.ActivityCompat; +import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.app.AppCompatActivity; import android.view.View; import android.widget.LinearLayout; import android.widget.ScrollView; diff --git a/app/src/main/java/info/nightscout/androidaps/setupwizard/elements/SWFragment.java b/app/src/main/java/info/nightscout/androidaps/setupwizard/elements/SWFragment.java index a061f57eb6..29149e5b81 100644 --- a/app/src/main/java/info/nightscout/androidaps/setupwizard/elements/SWFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/setupwizard/elements/SWFragment.java @@ -1,7 +1,7 @@ package info.nightscout.androidaps.setupwizard.elements; -import android.support.v4.app.Fragment; -import android.view.View; +import androidx.fragment.app.Fragment; + import android.widget.LinearLayout; import org.slf4j.Logger; diff --git a/app/src/main/java/info/nightscout/androidaps/tabs/TabPageAdapter.java b/app/src/main/java/info/nightscout/androidaps/tabs/TabPageAdapter.java index 53b3700c72..c567df7b49 100644 --- a/app/src/main/java/info/nightscout/androidaps/tabs/TabPageAdapter.java +++ b/app/src/main/java/info/nightscout/androidaps/tabs/TabPageAdapter.java @@ -1,10 +1,10 @@ package info.nightscout.androidaps.tabs; import android.content.Context; -import android.support.annotation.Nullable; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentManager; -import android.support.v4.app.FragmentPagerAdapter; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentPagerAdapter; import android.view.ViewGroup; import org.slf4j.Logger; diff --git a/app/src/main/java/info/nightscout/androidaps/utils/AndroidPermission.java b/app/src/main/java/info/nightscout/androidaps/utils/AndroidPermission.java index 3f6c3a3ce0..527a98dda2 100644 --- a/app/src/main/java/info/nightscout/androidaps/utils/AndroidPermission.java +++ b/app/src/main/java/info/nightscout/androidaps/utils/AndroidPermission.java @@ -5,8 +5,8 @@ import android.app.Activity; import android.content.Context; import android.content.pm.PackageManager; import android.os.Build; -import android.support.v4.app.ActivityCompat; -import android.support.v4.content.ContextCompat; +import androidx.core.app.ActivityCompat; +import androidx.core.content.ContextCompat; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; diff --git a/app/src/main/java/info/nightscout/androidaps/utils/DateUtil.java b/app/src/main/java/info/nightscout/androidaps/utils/DateUtil.java index 8e875e6dca..4b19c6d114 100644 --- a/app/src/main/java/info/nightscout/androidaps/utils/DateUtil.java +++ b/app/src/main/java/info/nightscout/androidaps/utils/DateUtil.java @@ -1,6 +1,6 @@ package info.nightscout.androidaps.utils; -import android.support.v4.util.LongSparseArray; +import androidx.collection.LongSparseArray; import org.joda.time.DateTime; import org.joda.time.format.DateTimeFormat; diff --git a/app/src/main/java/info/nightscout/androidaps/utils/JsonHelper.java b/app/src/main/java/info/nightscout/androidaps/utils/JsonHelper.java index 8f7d9611b1..c130353419 100644 --- a/app/src/main/java/info/nightscout/androidaps/utils/JsonHelper.java +++ b/app/src/main/java/info/nightscout/androidaps/utils/JsonHelper.java @@ -1,6 +1,6 @@ package info.nightscout.androidaps.utils; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import org.json.JSONException; import org.json.JSONObject; diff --git a/app/src/main/java/info/nightscout/androidaps/utils/OKDialog.java b/app/src/main/java/info/nightscout/androidaps/utils/OKDialog.java index 00b3c29692..98d8845ff8 100644 --- a/app/src/main/java/info/nightscout/androidaps/utils/OKDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/utils/OKDialog.java @@ -5,8 +5,8 @@ import android.content.Context; import android.content.DialogInterface; import android.os.Handler; import android.os.SystemClock; -import android.support.v7.app.AlertDialog; -import android.support.v7.view.ContextThemeWrapper; +import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.view.ContextThemeWrapper; import android.text.Spanned; import org.slf4j.Logger; diff --git a/app/src/main/java/info/nightscout/androidaps/utils/SingleClickButton.java b/app/src/main/java/info/nightscout/androidaps/utils/SingleClickButton.java index eef4ca57fe..74500ebdbc 100644 --- a/app/src/main/java/info/nightscout/androidaps/utils/SingleClickButton.java +++ b/app/src/main/java/info/nightscout/androidaps/utils/SingleClickButton.java @@ -3,7 +3,7 @@ package info.nightscout.androidaps.utils; import android.app.Activity; import android.content.Context; import android.os.SystemClock; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import android.util.AttributeSet; import android.view.View; @@ -14,7 +14,7 @@ import org.slf4j.LoggerFactory; * Created by mike on 22.12.2017. */ -public class SingleClickButton extends android.support.v7.widget.AppCompatButton implements View.OnClickListener { +public class SingleClickButton extends androidx.appcompat.widget.AppCompatButton implements View.OnClickListener { private static Logger log = LoggerFactory.getLogger(SingleClickButton.class); Context context; diff --git a/app/src/main/java/info/nightscout/androidaps/utils/TimeListEdit.java b/app/src/main/java/info/nightscout/androidaps/utils/TimeListEdit.java index d120e102d1..c8f767f77e 100644 --- a/app/src/main/java/info/nightscout/androidaps/utils/TimeListEdit.java +++ b/app/src/main/java/info/nightscout/androidaps/utils/TimeListEdit.java @@ -2,8 +2,8 @@ package info.nightscout.androidaps.utils; import android.content.Context; import android.os.Handler; -import android.support.v4.content.ContextCompat; -import android.support.v4.widget.TextViewCompat; +import androidx.core.content.ContextCompat; +import androidx.core.widget.TextViewCompat; import android.text.Editable; import android.text.TextWatcher; import android.view.Gravity; diff --git a/app/src/main/java/info/nightscout/androidaps/utils/XdripCalibrations.java b/app/src/main/java/info/nightscout/androidaps/utils/XdripCalibrations.java index 99961a156b..f7b8761823 100644 --- a/app/src/main/java/info/nightscout/androidaps/utils/XdripCalibrations.java +++ b/app/src/main/java/info/nightscout/androidaps/utils/XdripCalibrations.java @@ -5,7 +5,7 @@ import android.content.DialogInterface; import android.content.Intent; import android.content.pm.ResolveInfo; import android.os.Bundle; -import android.support.v7.app.AlertDialog; +import androidx.appcompat.app.AlertDialog; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/app/src/main/res/layout/activity_historybrowse.xml b/app/src/main/res/layout/activity_historybrowse.xml index 96b2b5871c..84f52f48c8 100644 --- a/app/src/main/res/layout/activity_historybrowse.xml +++ b/app/src/main/res/layout/activity_historybrowse.xml @@ -1,5 +1,5 @@ - - + diff --git a/app/src/main/res/layout/activity_insight_pairing.xml b/app/src/main/res/layout/activity_insight_pairing.xml index d90b5f091d..83412a8645 100644 --- a/app/src/main/res/layout/activity_insight_pairing.xml +++ b/app/src/main/res/layout/activity_insight_pairing.xml @@ -18,7 +18,7 @@ android:text="@string/searching_for_devices" android:textSize="20sp" /> - - - - - + - - - - + \ No newline at end of file diff --git a/app/src/main/res/layout/bgsource_fragment.xml b/app/src/main/res/layout/bgsource_fragment.xml index 73829c12d4..6619b6bafa 100644 --- a/app/src/main/res/layout/bgsource_fragment.xml +++ b/app/src/main/res/layout/bgsource_fragment.xml @@ -10,12 +10,12 @@ android:layout_height="match_parent" android:orientation="vertical"> - - + diff --git a/app/src/main/res/layout/bgsource_item.xml b/app/src/main/res/layout/bgsource_item.xml index acd0454327..4cb3be97b8 100644 --- a/app/src/main/res/layout/bgsource_item.xml +++ b/app/src/main/res/layout/bgsource_item.xml @@ -1,5 +1,5 @@ - - + diff --git a/app/src/main/res/layout/careportal_fragment.xml b/app/src/main/res/layout/careportal_fragment.xml index 1e4c72dd72..a9791a1b88 100644 --- a/app/src/main/res/layout/careportal_fragment.xml +++ b/app/src/main/res/layout/careportal_fragment.xml @@ -45,7 +45,7 @@ android:paddingStart="15dp" android:text="@string/careportal_activity_label" /> - - + - - + - - + - - + diff --git a/app/src/main/res/layout/danar_history_item.xml b/app/src/main/res/layout/danar_history_item.xml index 6df07edd62..b03a26f55a 100644 --- a/app/src/main/res/layout/danar_history_item.xml +++ b/app/src/main/res/layout/danar_history_item.xml @@ -1,5 +1,5 @@ - - + diff --git a/app/src/main/res/layout/danar_historyactivity.xml b/app/src/main/res/layout/danar_historyactivity.xml index 8c7f8a8e6e..f3cc2ece29 100644 --- a/app/src/main/res/layout/danar_historyactivity.xml +++ b/app/src/main/res/layout/danar_historyactivity.xml @@ -50,7 +50,7 @@ android:layout_gravity="center_horizontal" android:gravity="center_horizontal" /> - - - + diff --git a/app/src/main/res/layout/food_item.xml b/app/src/main/res/layout/food_item.xml index d4efc403a3..b6b6adbcf8 100644 --- a/app/src/main/res/layout/food_item.xml +++ b/app/src/main/res/layout/food_item.xml @@ -1,5 +1,5 @@ - - + diff --git a/app/src/main/res/layout/objectives_fragment.xml b/app/src/main/res/layout/objectives_fragment.xml index f2b18e703d..56edc011f9 100644 --- a/app/src/main/res/layout/objectives_fragment.xml +++ b/app/src/main/res/layout/objectives_fragment.xml @@ -31,7 +31,7 @@ android:text="Reset" /> - - - + diff --git a/app/src/main/res/layout/overview_fragment.xml b/app/src/main/res/layout/overview_fragment.xml index a21cf30d03..2192ac62f4 100644 --- a/app/src/main/res/layout/overview_fragment.xml +++ b/app/src/main/res/layout/overview_fragment.xml @@ -20,12 +20,12 @@ android:layout_height="wrap_content" android:orientation="vertical"> - - + - - + - - + - - + - - + diff --git a/app/src/main/res/layout/overview_quickwizardlist_activity.xml b/app/src/main/res/layout/overview_quickwizardlist_activity.xml index 227f946486..3ef067d044 100644 --- a/app/src/main/res/layout/overview_quickwizardlist_activity.xml +++ b/app/src/main/res/layout/overview_quickwizardlist_activity.xml @@ -29,7 +29,7 @@ android:layout_height="wrap_content" android:id="@+id/overview_quickwizardactivity_add_button" /> - diff --git a/app/src/main/res/layout/overview_quickwizardlist_item.xml b/app/src/main/res/layout/overview_quickwizardlist_item.xml index 429e2ca2de..5d186ffaf4 100644 --- a/app/src/main/res/layout/overview_quickwizardlist_item.xml +++ b/app/src/main/res/layout/overview_quickwizardlist_item.xml @@ -1,5 +1,5 @@ - - + diff --git a/app/src/main/res/layout/treatments_bolus_fragment.xml b/app/src/main/res/layout/treatments_bolus_fragment.xml index c04aac5f9f..db8e0bbbbb 100644 --- a/app/src/main/res/layout/treatments_bolus_fragment.xml +++ b/app/src/main/res/layout/treatments_bolus_fragment.xml @@ -75,12 +75,12 @@ - - + diff --git a/app/src/main/res/layout/treatments_bolus_item.xml b/app/src/main/res/layout/treatments_bolus_item.xml index 29cbb6fe1d..ff277dcbc0 100644 --- a/app/src/main/res/layout/treatments_bolus_item.xml +++ b/app/src/main/res/layout/treatments_bolus_item.xml @@ -1,5 +1,5 @@ - - + diff --git a/app/src/main/res/layout/treatments_careportal_fragment.xml b/app/src/main/res/layout/treatments_careportal_fragment.xml index e0918d0301..5460c738af 100644 --- a/app/src/main/res/layout/treatments_careportal_fragment.xml +++ b/app/src/main/res/layout/treatments_careportal_fragment.xml @@ -34,12 +34,12 @@ - - + diff --git a/app/src/main/res/layout/treatments_careportal_item.xml b/app/src/main/res/layout/treatments_careportal_item.xml index 9f688d2438..251272cb25 100644 --- a/app/src/main/res/layout/treatments_careportal_item.xml +++ b/app/src/main/res/layout/treatments_careportal_item.xml @@ -1,5 +1,5 @@ - - + diff --git a/app/src/main/res/layout/treatments_extendedbolus_fragment.xml b/app/src/main/res/layout/treatments_extendedbolus_fragment.xml index cf5b425f8d..5c46d9e3a6 100644 --- a/app/src/main/res/layout/treatments_extendedbolus_fragment.xml +++ b/app/src/main/res/layout/treatments_extendedbolus_fragment.xml @@ -9,12 +9,12 @@ android:layout_height="match_parent" android:orientation="vertical"> - - + diff --git a/app/src/main/res/layout/treatments_extendedbolus_item.xml b/app/src/main/res/layout/treatments_extendedbolus_item.xml index 421bbccb81..24230e70ac 100644 --- a/app/src/main/res/layout/treatments_extendedbolus_item.xml +++ b/app/src/main/res/layout/treatments_extendedbolus_item.xml @@ -1,5 +1,5 @@ - - + diff --git a/app/src/main/res/layout/treatments_profileswitch_fragment.xml b/app/src/main/res/layout/treatments_profileswitch_fragment.xml index bb63495dce..f6b0881982 100644 --- a/app/src/main/res/layout/treatments_profileswitch_fragment.xml +++ b/app/src/main/res/layout/treatments_profileswitch_fragment.xml @@ -17,12 +17,12 @@ android:layout_gravity="center_horizontal" android:text="@string/refresheventsfromnightscout" /> - - + diff --git a/app/src/main/res/layout/treatments_profileswitch_item.xml b/app/src/main/res/layout/treatments_profileswitch_item.xml index bcd3836fe2..de457274ff 100644 --- a/app/src/main/res/layout/treatments_profileswitch_item.xml +++ b/app/src/main/res/layout/treatments_profileswitch_item.xml @@ -1,5 +1,5 @@ - - + diff --git a/app/src/main/res/layout/treatments_tempbasals_fragment.xml b/app/src/main/res/layout/treatments_tempbasals_fragment.xml index 062db7a4a8..47c15d6117 100644 --- a/app/src/main/res/layout/treatments_tempbasals_fragment.xml +++ b/app/src/main/res/layout/treatments_tempbasals_fragment.xml @@ -34,12 +34,12 @@ - - + diff --git a/app/src/main/res/layout/treatments_tempbasals_item.xml b/app/src/main/res/layout/treatments_tempbasals_item.xml index 2504292034..f57a3426e0 100644 --- a/app/src/main/res/layout/treatments_tempbasals_item.xml +++ b/app/src/main/res/layout/treatments_tempbasals_item.xml @@ -1,5 +1,5 @@ - - + diff --git a/app/src/main/res/layout/treatments_temptarget_fragment.xml b/app/src/main/res/layout/treatments_temptarget_fragment.xml index 3f3e26e899..c83332fb53 100644 --- a/app/src/main/res/layout/treatments_temptarget_fragment.xml +++ b/app/src/main/res/layout/treatments_temptarget_fragment.xml @@ -17,12 +17,12 @@ android:layout_gravity="center_horizontal" android:text="@string/refresheventsfromnightscout" /> - - + diff --git a/app/src/main/res/layout/treatments_temptarget_item.xml b/app/src/main/res/layout/treatments_temptarget_item.xml index b85ef8a80a..c26fb8c22e 100644 --- a/app/src/main/res/layout/treatments_temptarget_item.xml +++ b/app/src/main/res/layout/treatments_temptarget_item.xml @@ -1,5 +1,5 @@ - - + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a43733f56a..fe8b7ba397 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -991,6 +991,7 @@ Fabric Upload Allow automated crash reporting and feature usage data to be sent to the developers via the fabric.io service. Please update your Dexcom app to supported version + Dexcom app is not installed. Start Activity TT Start Eating soon TT TT @@ -1375,6 +1376,10 @@ Upload BG tests instanceid + Dexcom App (patched) + DXCM + Receive BG values from the patched Dexcom app. + %1$d day %1$d days diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/general/versionChecker/VersionCheckerUtilsKtTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/general/versionChecker/VersionCheckerUtilsKtTest.kt index 2d07e40c1d..1e67bb2d4f 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/general/versionChecker/VersionCheckerUtilsKtTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/general/versionChecker/VersionCheckerUtilsKtTest.kt @@ -26,7 +26,7 @@ class VersionCheckerUtilsKtTest { | version = "2.2.2" | appName = "Aaoeu" """.trimMargin() - val detectedVersion: String? = buildGradle.byteInputStream().findVersion() + val detectedVersion: String? = findVersion(buildGradle) assertEquals("2.2.2", detectedVersion) } @@ -41,14 +41,14 @@ class VersionCheckerUtilsKtTest { | version = "2.2.2-nefarious-underground-mod" | appName = "Aaoeu" """.trimMargin() - val detectedVersion: String? = buildGradle.byteInputStream().findVersion() + val detectedVersion: String? = findVersion(buildGradle) assertEquals(null, detectedVersion) } @Test fun findVersionMatchesDoesNotMatchErrorResponse() { val buildGradle = """Balls! No build.gradle here. Move along""" - val detectedVersion: String? = buildGradle.byteInputStream().findVersion() + val detectedVersion: String? = findVersion(buildGradle) assertEquals(null, detectedVersion) } @@ -166,7 +166,7 @@ class VersionCheckerUtilsKtTest { | appName = "Aaoeu" """.trimMargin() val bus = prepareBus() - compareWithCurrentVersion(buildGradle.byteInputStream().findVersion(), currentVersion = "2.2.2") + compareWithCurrentVersion(findVersion(buildGradle), currentVersion = "2.2.2") verify(bus, times(0)).post(any()) @@ -186,7 +186,7 @@ class VersionCheckerUtilsKtTest { | appName = "Aaoeu" """.trimMargin() val bus = prepareBus() - compareWithCurrentVersion(buildGradle.byteInputStream().findVersion(), currentVersion = "2.2.2") + compareWithCurrentVersion(findVersion(buildGradle), currentVersion = "2.2.2") verify(bus, times(1)).post(any()) diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/source/SourceDexcomG5PluginTest.java b/app/src/test/java/info/nightscout/androidaps/plugins/source/SourceDexcomG5PluginTest.java deleted file mode 100644 index a4977719c6..0000000000 --- a/app/src/test/java/info/nightscout/androidaps/plugins/source/SourceDexcomG5PluginTest.java +++ /dev/null @@ -1,20 +0,0 @@ -package info.nightscout.androidaps.plugins.source; - -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.powermock.modules.junit4.PowerMockRunner; - -@RunWith(PowerMockRunner.class) -public class SourceDexcomG5PluginTest { - - @Test - public void getPlugin() { - Assert.assertNotEquals(null, SourceDexcomG5Plugin.getPlugin()); - } - - @Test - public void advancedFilteringSupported() { - Assert.assertEquals(true, SourceDexcomG5Plugin.getPlugin().advancedFilteringSupported()); - } -} \ No newline at end of file diff --git a/build.gradle b/build.gradle index 6826c29a13..398f280881 100644 --- a/build.gradle +++ b/build.gradle @@ -1,22 +1,23 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.3.21' + ext.kotlin_version = '1.3.31' + ext.butterknifeVersion = '10.1.0' repositories { google() jcenter() - maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } + //maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } maven { url 'https://maven.fabric.io/public' } } dependencies { - classpath 'com.android.tools.build:gradle:3.2.0' + classpath 'com.android.tools.build:gradle:3.4.1' classpath 'com.google.gms:google-services:4.2.0' - classpath 'io.fabric.tools:gradle:1.28.1' + classpath 'io.fabric.tools:gradle:1.29.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files - classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0-SNAPSHOT' + classpath "com.jakewharton:butterknife-gradle-plugin:$butterknifeVersion" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } diff --git a/gradle.properties b/gradle.properties index 1d3591c8a4..1bc51c91af 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,4 +15,9 @@ # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true \ No newline at end of file +# org.gradle.parallel=true + +org.gradle.jvmargs=-Xmx2g + +android.enableJetifier=true +android.useAndroidX=true \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index c25a2b3e46..219a2e077c 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip diff --git a/wear/build.gradle b/wear/build.gradle index 9f094935fd..c26800859a 100644 --- a/wear/build.gradle +++ b/wear/build.gradle @@ -1,7 +1,7 @@ apply plugin: 'com.android.application' ext { - wearableVersion = "2.0.1" + wearableVersion = "2.4.0" playServicesWearable = "16.0.1" } @@ -27,12 +27,12 @@ def generateGitBuild = { -> } android { - compileSdkVersion 27 + compileSdkVersion 28 defaultConfig { applicationId "info.nightscout.androidaps" minSdkVersion 23 - targetSdkVersion 23 + targetSdkVersion 28 versionCode 1 versionName "1.0.2" buildConfigField "String", "BUILDVERSION", generateGitBuild() @@ -90,13 +90,15 @@ allprojects { dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') - implementation files("libs/hellocharts-library-1.5.5.jar") + //implementation files("libs/hellocharts-library-1.5.5.jar") //compile "com.ustwo.android:clockwise-wearable:1.0.2" compileOnly "com.google.android.wearable:wearable:${wearableVersion}" implementation "com.google.android.support:wearable:${wearableVersion}" implementation "com.google.android.gms:play-services-wearable:${playServicesWearable}" - implementation(name:"ustwo-clockwise-debug", ext:"aar") - implementation "com.android.support:support-v4:27.0.1" - implementation 'com.android.support:wear:27.0.1' - implementation "me.denley.wearpreferenceactivity:wearpreferenceactivity:0.5.0" + implementation(name: 'ustwo-clockwise-debug', ext: 'aar') + implementation 'androidx.legacy:legacy-support-v4:1.0.0' + implementation 'androidx.percentlayout:percentlayout:1.0.0' + implementation 'androidx.wear:wear:1.0.0' + implementation('me.denley.wearpreferenceactivity:wearpreferenceactivity:0.5.0') + implementation('com.github.lecho:hellocharts-library:1.5.8@aar') } diff --git a/wear/libs/hellocharts-library-1.5.5.jar b/wear/libs/hellocharts-library-1.5.5.jar deleted file mode 100644 index 142316706e..0000000000 Binary files a/wear/libs/hellocharts-library-1.5.5.jar and /dev/null differ diff --git a/wear/src/main/java/info/nightscout/androidaps/data/ListenerService.java b/wear/src/main/java/info/nightscout/androidaps/data/ListenerService.java index 094b8aad76..8fc8dcf215 100644 --- a/wear/src/main/java/info/nightscout/androidaps/data/ListenerService.java +++ b/wear/src/main/java/info/nightscout/androidaps/data/ListenerService.java @@ -10,14 +10,13 @@ import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.os.AsyncTask; -import android.os.Build; import android.os.Bundle; import android.os.SystemClock; import android.preference.PreferenceManager; -import android.support.v4.content.LocalBroadcastManager; -import android.support.v4.app.NotificationCompat; -import android.support.v4.app.NotificationManagerCompat; -import android.support.v4.content.LocalBroadcastManager; +import androidx.localbroadcastmanager.content.LocalBroadcastManager; +import androidx.core.app.NotificationCompat; +import androidx.core.app.NotificationManagerCompat; + import android.util.Log; @@ -37,8 +36,6 @@ import com.google.android.gms.wearable.NodeApi; import com.google.android.gms.wearable.Wearable; import com.google.android.gms.wearable.WearableListenerService; -import java.util.concurrent.TimeUnit; - import info.nightscout.androidaps.interaction.AAPSPreferences; import info.nightscout.androidaps.R; import info.nightscout.androidaps.interaction.actions.AcceptActivity; diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/AcceptActivity.java b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/AcceptActivity.java index f0ae184dfe..07e4bf02b3 100644 --- a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/AcceptActivity.java +++ b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/AcceptActivity.java @@ -7,7 +7,7 @@ import android.content.res.Resources; import android.os.Bundle; import android.os.SystemClock; import android.os.Vibrator; -import android.support.v4.app.NotificationManagerCompat; +import androidx.core.app.NotificationManagerCompat; import android.support.wearable.view.DotsPageIndicator; import android.support.wearable.view.GridPagerAdapter; import android.support.wearable.view.GridViewPager; diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/utils/VersionPreference.java b/wear/src/main/java/info/nightscout/androidaps/interaction/utils/VersionPreference.java index 3bc05af82d..a190b7e65a 100644 --- a/wear/src/main/java/info/nightscout/androidaps/interaction/utils/VersionPreference.java +++ b/wear/src/main/java/info/nightscout/androidaps/interaction/utils/VersionPreference.java @@ -1,9 +1,8 @@ package info.nightscout.androidaps.interaction.utils; import android.content.Context; -import android.content.SharedPreferences; -import android.preference.PreferenceManager; -import android.support.annotation.NonNull; + +import androidx.annotation.NonNull; import android.util.AttributeSet; import android.widget.Toast; diff --git a/wear/src/main/java/info/nightscout/androidaps/watchfaces/BIGChart.java b/wear/src/main/java/info/nightscout/androidaps/watchfaces/BIGChart.java index ec2e8c6e5e..1717fbf662 100644 --- a/wear/src/main/java/info/nightscout/androidaps/watchfaces/BIGChart.java +++ b/wear/src/main/java/info/nightscout/androidaps/watchfaces/BIGChart.java @@ -17,8 +17,8 @@ import android.os.Bundle; import android.os.PowerManager; import android.os.SystemClock; import android.preference.PreferenceManager; -import android.support.v4.content.ContextCompat; -import android.support.v4.content.LocalBroadcastManager; +import androidx.core.content.ContextCompat; +import androidx.localbroadcastmanager.content.LocalBroadcastManager; import android.support.wearable.view.WatchViewStub; import android.support.wearable.watchface.WatchFaceStyle; import android.text.format.DateFormat; diff --git a/wear/src/main/java/info/nightscout/androidaps/watchfaces/BaseWatchFace.java b/wear/src/main/java/info/nightscout/androidaps/watchfaces/BaseWatchFace.java index 3c10981923..229eb64f1b 100644 --- a/wear/src/main/java/info/nightscout/androidaps/watchfaces/BaseWatchFace.java +++ b/wear/src/main/java/info/nightscout/androidaps/watchfaces/BaseWatchFace.java @@ -13,7 +13,7 @@ import android.graphics.Rect; import android.os.Bundle; import android.os.PowerManager; import android.preference.PreferenceManager; -import android.support.v4.content.LocalBroadcastManager; +import androidx.localbroadcastmanager.content.LocalBroadcastManager; import android.support.wearable.view.WatchViewStub; import android.text.format.DateFormat; import android.util.Log; diff --git a/wear/src/main/java/info/nightscout/androidaps/watchfaces/CircleWatchface.java b/wear/src/main/java/info/nightscout/androidaps/watchfaces/CircleWatchface.java index c795a03ae4..fffb0a555e 100644 --- a/wear/src/main/java/info/nightscout/androidaps/watchfaces/CircleWatchface.java +++ b/wear/src/main/java/info/nightscout/androidaps/watchfaces/CircleWatchface.java @@ -17,7 +17,7 @@ import android.os.Bundle; import android.os.PowerManager; import android.os.SystemClock; import android.preference.PreferenceManager; -import android.support.v4.content.LocalBroadcastManager; +import androidx.localbroadcastmanager.content.LocalBroadcastManager; import android.support.wearable.watchface.WatchFaceStyle; import android.util.Log; import android.util.TypedValue; diff --git a/wear/src/main/java/info/nightscout/androidaps/watchfaces/Home.java b/wear/src/main/java/info/nightscout/androidaps/watchfaces/Home.java index ba557f200b..430a3feb47 100644 --- a/wear/src/main/java/info/nightscout/androidaps/watchfaces/Home.java +++ b/wear/src/main/java/info/nightscout/androidaps/watchfaces/Home.java @@ -2,7 +2,7 @@ package info.nightscout.androidaps.watchfaces; import android.content.Intent; import android.graphics.Color; -import android.support.v4.content.ContextCompat; +import androidx.core.content.ContextCompat; import android.support.wearable.watchface.WatchFaceStyle; import android.view.LayoutInflater; diff --git a/wear/src/main/java/info/nightscout/androidaps/watchfaces/Home2.java b/wear/src/main/java/info/nightscout/androidaps/watchfaces/Home2.java index 367b93a729..41c9fd3029 100644 --- a/wear/src/main/java/info/nightscout/androidaps/watchfaces/Home2.java +++ b/wear/src/main/java/info/nightscout/androidaps/watchfaces/Home2.java @@ -2,7 +2,7 @@ package info.nightscout.androidaps.watchfaces; import android.content.Intent; import android.graphics.Color; -import android.support.v4.content.ContextCompat; +import androidx.core.content.ContextCompat; import android.support.wearable.watchface.WatchFaceStyle; import android.view.LayoutInflater; diff --git a/wear/src/main/java/info/nightscout/androidaps/watchfaces/LargeHome.java b/wear/src/main/java/info/nightscout/androidaps/watchfaces/LargeHome.java index 2cb09c9b7b..ffb8dce3ad 100644 --- a/wear/src/main/java/info/nightscout/androidaps/watchfaces/LargeHome.java +++ b/wear/src/main/java/info/nightscout/androidaps/watchfaces/LargeHome.java @@ -2,7 +2,7 @@ package info.nightscout.androidaps.watchfaces; import android.content.Intent; import android.graphics.Color; -import android.support.v4.content.ContextCompat; +import androidx.core.content.ContextCompat; import android.support.wearable.watchface.WatchFaceStyle; import android.view.LayoutInflater; diff --git a/wear/src/main/java/info/nightscout/androidaps/watchfaces/NOChart.java b/wear/src/main/java/info/nightscout/androidaps/watchfaces/NOChart.java index 991d0c4e80..f799b0cf6e 100644 --- a/wear/src/main/java/info/nightscout/androidaps/watchfaces/NOChart.java +++ b/wear/src/main/java/info/nightscout/androidaps/watchfaces/NOChart.java @@ -13,13 +13,12 @@ import android.graphics.Paint; import android.graphics.Point; import android.graphics.Rect; import android.graphics.Shader; -import android.os.Build; import android.os.Bundle; import android.os.PowerManager; import android.os.SystemClock; import android.preference.PreferenceManager; -import android.support.v4.content.ContextCompat; -import android.support.v4.content.LocalBroadcastManager; +import androidx.core.content.ContextCompat; +import androidx.localbroadcastmanager.content.LocalBroadcastManager; import android.support.wearable.view.WatchViewStub; import android.support.wearable.watchface.WatchFaceStyle; import android.text.format.DateFormat; @@ -32,7 +31,6 @@ import android.view.WindowInsets; import android.view.WindowManager; import android.widget.RelativeLayout; import android.widget.TextView; -import android.widget.Toast; import com.google.android.gms.wearable.DataMap; import com.ustwo.clockwise.common.WatchFaceTime; @@ -43,13 +41,11 @@ import com.ustwo.clockwise.wearable.WatchFace; import java.util.ArrayList; import info.nightscout.androidaps.R; -import info.nightscout.androidaps.BuildConfig; import info.nightscout.androidaps.data.BasalWatchData; import info.nightscout.androidaps.data.BgWatchData; import info.nightscout.androidaps.data.ListenerService; import info.nightscout.androidaps.data.TempWatchData; import info.nightscout.androidaps.interaction.menus.MainMenuActivity; -import lecho.lib.hellocharts.view.LineChartView; /** * Created by adrianLxM. diff --git a/wear/src/main/java/info/nightscout/androidaps/watchfaces/Steampunk.java b/wear/src/main/java/info/nightscout/androidaps/watchfaces/Steampunk.java index 3549b2a67d..c42aff1518 100644 --- a/wear/src/main/java/info/nightscout/androidaps/watchfaces/Steampunk.java +++ b/wear/src/main/java/info/nightscout/androidaps/watchfaces/Steampunk.java @@ -1,7 +1,7 @@ package info.nightscout.androidaps.watchfaces; import android.content.Intent; -import android.support.v4.content.ContextCompat; +import androidx.core.content.ContextCompat; import android.support.wearable.watchface.WatchFaceStyle; import android.view.LayoutInflater; import android.view.animation.Animation; diff --git a/wear/src/main/res/layout/action_confirm_text.xml b/wear/src/main/res/layout/action_confirm_text.xml index 291b05116d..9e6355949f 100644 --- a/wear/src/main/res/layout/action_confirm_text.xml +++ b/wear/src/main/res/layout/action_confirm_text.xml @@ -1,4 +1,4 @@ - - @@ -34,7 +34,7 @@ android:textColor="@color/white" /> - + - \ No newline at end of file + \ No newline at end of file