diff --git a/app/src/main/java/info/nightscout/androidaps/activities/HistoryBrowseActivity.kt b/app/src/main/java/info/nightscout/androidaps/activities/HistoryBrowseActivity.kt index 3cf77eaf74..a9bc13f1c3 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/HistoryBrowseActivity.kt +++ b/app/src/main/java/info/nightscout/androidaps/activities/HistoryBrowseActivity.kt @@ -188,10 +188,11 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() { } val dm = DisplayMetrics() + @Suppress("DEPRECATION") if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.R) display?.getRealMetrics(dm) else - @Suppress("DEPRECATION") windowManager.defaultDisplay.getMetrics(dm) + windowManager.defaultDisplay.getMetrics(dm) axisWidth = if (dm.densityDpi <= 120) 3 else if (dm.densityDpi <= 160) 10 else if (dm.densityDpi <= 320) 35 else if (dm.densityDpi <= 420) 50 else if (dm.densityDpi <= 560) 70 else 80 @@ -305,7 +306,7 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() { private fun loadAll(from: String) { updateDate() Thread { - overviewData.prepareBgData("$from") + overviewData.prepareBgData(from) overviewData.prepareTreatmentsData(from) rxBus.send(EventRefreshOverview("loadAll_$from")) overviewData.prepareTemporaryTargetData(from) @@ -344,6 +345,7 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() { @Volatile var runningRefresh = false + @Suppress("SameParameterValue") private fun refreshLoop(from: String) { if (runningRefresh) return runningRefresh = true diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt index 9ef905195d..d93cd1fa83 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt @@ -88,6 +88,7 @@ class ActionsFragment : DaggerFragment() { //check screen width dm = DisplayMetrics() if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.R) { + @Suppress("DEPRECATION") activity?.display?.getRealMetrics(dm) } else { @Suppress("DEPRECATION") activity?.windowManager?.defaultDisplay?.getMetrics(dm) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt index b187005054..07c402a0e7 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt @@ -34,7 +34,6 @@ import info.nightscout.androidaps.database.entities.UserEntry.Action import info.nightscout.androidaps.database.entities.UserEntry.Sources import info.nightscout.androidaps.database.interfaces.end import info.nightscout.androidaps.databinding.OverviewFragmentBinding -import info.nightscout.androidaps.diaconn.DiaconnG8Plugin import info.nightscout.androidaps.dialogs.* import info.nightscout.androidaps.events.EventAcceptOpenLoopChange import info.nightscout.androidaps.events.EventInitializationChanged @@ -46,7 +45,6 @@ import info.nightscout.androidaps.extensions.isInProgress import info.nightscout.androidaps.extensions.toVisibility import info.nightscout.androidaps.extensions.valueToUnitsString import info.nightscout.androidaps.interfaces.* -import info.nightscout.shared.logging.AAPSLogger import info.nightscout.androidaps.logging.UserEntryLogger import info.nightscout.androidaps.plugins.aps.loop.events.EventNewOpenLoopNotification import info.nightscout.androidaps.plugins.aps.openAPSSMB.DetermineBasalResultSMB @@ -76,16 +74,16 @@ import info.nightscout.androidaps.utils.buildHelper.BuildHelper import info.nightscout.androidaps.utils.protection.ProtectionCheck import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.rx.AapsSchedulers -import info.nightscout.shared.sharedPreferences.SP import info.nightscout.androidaps.utils.ui.SingleClickButton import info.nightscout.androidaps.utils.ui.UIRunnable import info.nightscout.androidaps.utils.wizard.QuickWizard +import info.nightscout.shared.logging.AAPSLogger +import info.nightscout.shared.sharedPreferences.SP import io.reactivex.rxjava3.disposables.CompositeDisposable import io.reactivex.rxjava3.kotlin.plusAssign import java.util.* import java.util.concurrent.TimeUnit import javax.inject.Inject -import kotlin.collections.ArrayList import kotlin.math.abs import kotlin.math.min @@ -152,10 +150,11 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList _binding = it //check screen width dm = DisplayMetrics() + @Suppress("DEPRECATION") if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) activity?.display?.getRealMetrics(dm) else - @Suppress("DEPRECATION") activity?.windowManager?.defaultDisplay?.getMetrics(dm) + activity?.windowManager?.defaultDisplay?.getMetrics(dm) }.root override fun onViewCreated(view: View, savedInstanceState: Bundle?) { diff --git a/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/RuffyScripter.java b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/RuffyScripter.java index 3aa46ad0f4..f2fcf05bbf 100644 --- a/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/RuffyScripter.java +++ b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/RuffyScripter.java @@ -510,7 +510,7 @@ public class RuffyScripter implements RuffyCommands { * This reads the state of the pump, which is whatever is currently displayed on the display, * no actions are performed. */ - public PumpState readPumpStateInternal() { + @SuppressWarnings("deprecation") public PumpState readPumpStateInternal() { PumpState state = new PumpState(); state.timestamp = System.currentTimeMillis(); Menu menu = currentMenu; @@ -626,8 +626,7 @@ public class RuffyScripter implements RuffyCommands { return menu; } - @Nullable - private String getCurrentMenuName() { + @NonNull private String getCurrentMenuName() { Menu menu = this.currentMenu; return menu != null ? menu.getType().toString() : ""; } @@ -785,7 +784,7 @@ public class RuffyScripter implements RuffyCommands { waitForScreenUpdate(); retries--; if (retries == 0) { - throw new CommandException("Failed to read blinkng value: " + attribute + "=" + value + " type=" + value); + throw new CommandException("Failed to read blinking value: " + attribute + "=" + value + " type=" + value); } } return (T) value; diff --git a/core/src/main/java/info/nightscout/androidaps/receivers/NetworkChangeReceiver.kt b/core/src/main/java/info/nightscout/androidaps/receivers/NetworkChangeReceiver.kt index 85119aaaf9..3a9f65c500 100644 --- a/core/src/main/java/info/nightscout/androidaps/receivers/NetworkChangeReceiver.kt +++ b/core/src/main/java/info/nightscout/androidaps/receivers/NetworkChangeReceiver.kt @@ -25,6 +25,7 @@ class NetworkChangeReceiver : DaggerBroadcastReceiver() { rxBus.send(grabNetworkStatus(context, aapsLogger)) } + @Suppress("DEPRECATION") private fun grabNetworkStatus(context: Context, aapsLogger: AAPSLogger): EventNetworkChange { val event = EventNetworkChange() val cm = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager diff --git a/openhumans/src/main/java/info/nightscout/androidaps/plugin/general/openhumans/OpenHumansUploader.kt b/openhumans/src/main/java/info/nightscout/androidaps/plugin/general/openhumans/OpenHumansUploader.kt index a974d09fb5..0d4ab2eeaf 100644 --- a/openhumans/src/main/java/info/nightscout/androidaps/plugin/general/openhumans/OpenHumansUploader.kt +++ b/openhumans/src/main/java/info/nightscout/androidaps/plugin/general/openhumans/OpenHumansUploader.kt @@ -233,10 +233,11 @@ class OpenHumansUploader @Inject internal constructor( tags.add("DeviceInfo") val displayMetrics = DisplayMetrics() + @Suppress("DEPRECATION") if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.R) context.display?.getRealMetrics(displayMetrics) else - @Suppress("DEPRECATION") (context.getSystemService(Context.WINDOW_SERVICE) as WindowManager).defaultDisplay.getMetrics(displayMetrics) + (context.getSystemService(Context.WINDOW_SERVICE) as WindowManager).defaultDisplay.getMetrics(displayMetrics) val displayInfo = JSONObject() displayInfo.put("height", displayMetrics.heightPixels)