suppress deprecation warnings
This commit is contained in:
parent
c7fee22a5b
commit
02e553ecc6
6 changed files with 15 additions and 12 deletions
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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?) {
|
||||
|
|
|
@ -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() : "<none>";
|
||||
}
|
||||
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue