diff --git a/app/src/main/java/info/nightscout/androidaps/MainActivity.kt b/app/src/main/java/info/nightscout/androidaps/MainActivity.kt
index ca5331004a..e812732141 100644
--- a/app/src/main/java/info/nightscout/androidaps/MainActivity.kt
+++ b/app/src/main/java/info/nightscout/androidaps/MainActivity.kt
@@ -407,6 +407,7 @@ class MainActivity : NoSplashAppCompatActivity() {
binding.mainPager.currentItem = 0
return
}
+ @Suppress("DEPRECATION")
super.onBackPressed()
}
diff --git a/app/src/main/java/info/nightscout/androidaps/activities/PreferencesActivity.kt b/app/src/main/java/info/nightscout/androidaps/activities/PreferencesActivity.kt
index 88cafc15f3..076c441126 100644
--- a/app/src/main/java/info/nightscout/androidaps/activities/PreferencesActivity.kt
+++ b/app/src/main/java/info/nightscout/androidaps/activities/PreferencesActivity.kt
@@ -72,6 +72,7 @@ class PreferencesActivity : NoSplashAppCompatActivity(), PreferenceFragmentCompa
override fun onOptionsItemSelected(item: MenuItem): Boolean =
when (item.itemId) {
android.R.id.home -> {
+ @Suppress("DEPRECATION")
onBackPressed()
true
}
diff --git a/openhumans/src/main/java/info/nightscout/androidaps/plugin/general/openhumans/ui/OHLoginActivity.kt b/openhumans/src/main/java/info/nightscout/androidaps/plugin/general/openhumans/ui/OHLoginActivity.kt
index 5a44d3fc84..801e83db7c 100644
--- a/openhumans/src/main/java/info/nightscout/androidaps/plugin/general/openhumans/ui/OHLoginActivity.kt
+++ b/openhumans/src/main/java/info/nightscout/androidaps/plugin/general/openhumans/ui/OHLoginActivity.kt
@@ -106,12 +106,14 @@ class OHLoginActivity : DaggerAppCompatActivity() {
override fun onBackPressed() {
if (!viewModel.goBack()) {
+ @Suppress("DEPRECATION")
super.onBackPressed()
}
}
override fun onOptionsItemSelected(item: MenuItem): Boolean =
if (item.itemId == android.R.id.home) {
+ @Suppress("DEPRECATION")
onBackPressed()
true
} else {
diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/AcceptActivity.kt b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/AcceptActivity.kt
index b3c395fb76..fcdd45b818 100644
--- a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/AcceptActivity.kt
+++ b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/AcceptActivity.kt
@@ -6,7 +6,6 @@ import android.content.Intent
import android.os.Bundle
import android.os.SystemClock
import android.os.Vibrator
-import android.support.wearable.view.GridPagerAdapter
import android.view.LayoutInflater
import android.view.MotionEvent
import android.view.View
@@ -21,6 +20,7 @@ import info.nightscout.androidaps.R
import info.nightscout.androidaps.comm.DataLayerListenerServiceWear
import info.nightscout.androidaps.comm.IntentCancelNotification
import info.nightscout.androidaps.comm.IntentWearToMobile
+import info.nightscout.androidaps.nondeprecated.GridPagerAdapterNonDeprecated
import kotlin.math.roundToInt
class AcceptActivity : ViewSelectorActivity() {
@@ -51,7 +51,7 @@ class AcceptActivity : ViewSelectorActivity() {
finish()
}
- private inner class MyGridViewPagerAdapter : GridPagerAdapter() {
+ private inner class MyGridViewPagerAdapter : GridPagerAdapterNonDeprecated() {
override fun getColumnCount(arg0: Int): Int = 2
override fun getRowCount(): Int = 1
diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/BolusActivity.kt b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/BolusActivity.kt
index f67a34f690..0b10ca6691 100644
--- a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/BolusActivity.kt
+++ b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/BolusActivity.kt
@@ -3,7 +3,6 @@
package info.nightscout.androidaps.interaction.actions
import android.os.Bundle
-import android.support.wearable.view.GridPagerAdapter
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@@ -12,6 +11,7 @@ import info.nightscout.androidaps.R
import info.nightscout.androidaps.events.EventWearToMobile
import info.nightscout.androidaps.interaction.utils.EditPlusMinusViewAdapter
import info.nightscout.androidaps.interaction.utils.PlusMinusEditText
+import info.nightscout.androidaps.nondeprecated.GridPagerAdapterNonDeprecated
import info.nightscout.shared.SafeParse
import info.nightscout.shared.weardata.EventData.ActionBolusPreCheck
import java.text.DecimalFormat
@@ -30,7 +30,7 @@ class BolusActivity : ViewSelectorActivity() {
finish()
}
- private inner class MyGridViewPagerAdapter : GridPagerAdapter() {
+ private inner class MyGridViewPagerAdapter : GridPagerAdapterNonDeprecated() {
override fun getColumnCount(arg0: Int): Int = 2
override fun getRowCount(): Int = 1
diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/CarbActivity.kt b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/CarbActivity.kt
index 6521ffd413..b2d3519ad3 100644
--- a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/CarbActivity.kt
+++ b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/CarbActivity.kt
@@ -3,7 +3,6 @@
package info.nightscout.androidaps.interaction.actions
import android.os.Bundle
-import android.support.wearable.view.GridPagerAdapter
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@@ -12,6 +11,7 @@ import info.nightscout.androidaps.R
import info.nightscout.androidaps.events.EventWearToMobile
import info.nightscout.androidaps.interaction.utils.EditPlusMinusViewAdapter
import info.nightscout.androidaps.interaction.utils.PlusMinusEditText
+import info.nightscout.androidaps.nondeprecated.GridPagerAdapterNonDeprecated
import info.nightscout.shared.SafeParse
import info.nightscout.shared.weardata.EventData.ActionECarbsPreCheck
import java.text.DecimalFormat
@@ -29,7 +29,7 @@ class CarbActivity : ViewSelectorActivity() {
finish()
}
- private inner class MyGridViewPagerAdapter : GridPagerAdapter() {
+ private inner class MyGridViewPagerAdapter : GridPagerAdapterNonDeprecated() {
val increment1 = sp.getInt(R.string.key_carbs_button_increment_1, 5).toDouble()
val increment2 = sp.getInt(R.string.key_carbs_button_increment_2, 10).toDouble()
diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/ECarbActivity.kt b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/ECarbActivity.kt
index bc2662066d..f6518bd1d7 100644
--- a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/ECarbActivity.kt
+++ b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/ECarbActivity.kt
@@ -3,7 +3,6 @@
package info.nightscout.androidaps.interaction.actions
import android.os.Bundle
-import android.support.wearable.view.GridPagerAdapter
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@@ -12,6 +11,7 @@ import info.nightscout.androidaps.R
import info.nightscout.androidaps.events.EventWearToMobile
import info.nightscout.androidaps.interaction.utils.EditPlusMinusViewAdapter
import info.nightscout.androidaps.interaction.utils.PlusMinusEditText
+import info.nightscout.androidaps.nondeprecated.GridPagerAdapterNonDeprecated
import info.nightscout.shared.SafeParse.stringToDouble
import info.nightscout.shared.SafeParse.stringToInt
import info.nightscout.shared.weardata.EventData.ActionECarbsPreCheck
@@ -32,7 +32,7 @@ class ECarbActivity : ViewSelectorActivity() {
finish()
}
- private inner class MyGridViewPagerAdapter : GridPagerAdapter() {
+ private inner class MyGridViewPagerAdapter : GridPagerAdapterNonDeprecated() {
override fun getColumnCount(arg0: Int): Int = 4
override fun getRowCount(): Int = 1
diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/FillActivity.kt b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/FillActivity.kt
index d2c3abc2a3..392a098388 100644
--- a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/FillActivity.kt
+++ b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/FillActivity.kt
@@ -3,7 +3,6 @@
package info.nightscout.androidaps.interaction.actions
import android.os.Bundle
-import android.support.wearable.view.GridPagerAdapter
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@@ -12,6 +11,7 @@ import info.nightscout.androidaps.R
import info.nightscout.androidaps.events.EventWearToMobile
import info.nightscout.androidaps.interaction.utils.EditPlusMinusViewAdapter
import info.nightscout.androidaps.interaction.utils.PlusMinusEditText
+import info.nightscout.androidaps.nondeprecated.GridPagerAdapterNonDeprecated
import info.nightscout.shared.SafeParse.stringToDouble
import info.nightscout.shared.weardata.EventData.ActionFillPreCheck
import java.text.DecimalFormat
@@ -29,7 +29,7 @@ class FillActivity : ViewSelectorActivity() {
finish()
}
- private inner class MyGridViewPagerAdapter : GridPagerAdapter() {
+ private inner class MyGridViewPagerAdapter : GridPagerAdapterNonDeprecated() {
override fun getColumnCount(arg0: Int): Int = 2
override fun getRowCount(): Int = 1
diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/ProfileSwitchActivity.kt b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/ProfileSwitchActivity.kt
index 75de43d82d..2e41a7876c 100644
--- a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/ProfileSwitchActivity.kt
+++ b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/ProfileSwitchActivity.kt
@@ -3,7 +3,6 @@
package info.nightscout.androidaps.interaction.actions
import android.os.Bundle
-import android.support.wearable.view.GridPagerAdapter
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@@ -12,6 +11,7 @@ import info.nightscout.androidaps.R
import info.nightscout.androidaps.events.EventWearToMobile
import info.nightscout.androidaps.interaction.utils.EditPlusMinusViewAdapter
import info.nightscout.androidaps.interaction.utils.PlusMinusEditText
+import info.nightscout.androidaps.nondeprecated.GridPagerAdapterNonDeprecated
import info.nightscout.shared.SafeParse
import info.nightscout.shared.weardata.EventData.ActionProfileSwitchPreCheck
import java.text.DecimalFormat
@@ -39,7 +39,7 @@ class ProfileSwitchActivity : ViewSelectorActivity() {
finish()
}
- private inner class MyGridViewPagerAdapter : GridPagerAdapter() {
+ private inner class MyGridViewPagerAdapter : GridPagerAdapterNonDeprecated() {
override fun getColumnCount(arg0: Int): Int = 3
override fun getRowCount(): Int = 1
diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/TempTargetActivity.kt b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/TempTargetActivity.kt
index dd18434b38..ac7cb56373 100644
--- a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/TempTargetActivity.kt
+++ b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/TempTargetActivity.kt
@@ -3,7 +3,6 @@
package info.nightscout.androidaps.interaction.actions
import android.os.Bundle
-import android.support.wearable.view.GridPagerAdapter
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@@ -12,6 +11,7 @@ import info.nightscout.androidaps.R
import info.nightscout.androidaps.events.EventWearToMobile
import info.nightscout.androidaps.interaction.utils.EditPlusMinusViewAdapter
import info.nightscout.androidaps.interaction.utils.PlusMinusEditText
+import info.nightscout.androidaps.nondeprecated.GridPagerAdapterNonDeprecated
import info.nightscout.shared.SafeParse
import info.nightscout.shared.weardata.EventData.ActionTempTargetPreCheck
import java.text.DecimalFormat
@@ -36,7 +36,7 @@ class TempTargetActivity : ViewSelectorActivity() {
finish()
}
- private inner class MyGridViewPagerAdapter : GridPagerAdapter() {
+ private inner class MyGridViewPagerAdapter : GridPagerAdapterNonDeprecated() {
override fun getColumnCount(arg0: Int): Int {
return if (isSingleTarget) 3 else 4
diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/TreatmentActivity.kt b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/TreatmentActivity.kt
index 82e631de58..d9a4491bbf 100644
--- a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/TreatmentActivity.kt
+++ b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/TreatmentActivity.kt
@@ -3,7 +3,6 @@
package info.nightscout.androidaps.interaction.actions
import android.os.Bundle
-import android.support.wearable.view.GridPagerAdapter
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@@ -12,6 +11,7 @@ import info.nightscout.androidaps.R
import info.nightscout.androidaps.events.EventWearToMobile
import info.nightscout.androidaps.interaction.utils.EditPlusMinusViewAdapter
import info.nightscout.androidaps.interaction.utils.PlusMinusEditText
+import info.nightscout.androidaps.nondeprecated.GridPagerAdapterNonDeprecated
import info.nightscout.shared.SafeParse.stringToDouble
import info.nightscout.shared.SafeParse.stringToInt
import info.nightscout.shared.weardata.EventData.ActionBolusPreCheck
@@ -32,7 +32,7 @@ class TreatmentActivity : ViewSelectorActivity() {
finish()
}
- private inner class MyGridViewPagerAdapter : GridPagerAdapter() {
+ private inner class MyGridViewPagerAdapter : GridPagerAdapterNonDeprecated() {
override fun getColumnCount(arg0: Int): Int = 3
override fun getRowCount(): Int = 1
@@ -48,7 +48,7 @@ class TreatmentActivity : ViewSelectorActivity() {
0 -> {
val viewAdapter = EditPlusMinusViewAdapter.getViewAdapter(sp, applicationContext, container, true)
val view = viewAdapter.root
- var initValue = stringToDouble(editInsulin?.editText?.text.toString(), 0.0)
+ var initValue = stringToDouble(editInsulin?.editText?.text.toString(), 0.0)
val maxBolus = sp.getDouble(getString(R.string.key_treatments_safety_max_bolus), 3.0)
editInsulin = PlusMinusEditText(viewAdapter, initValue, 0.0, maxBolus, stepValuesInsulin, DecimalFormat("#0.0"), false, getString(R.string.action_insulin))
container.addView(view)
diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/ViewSelectorActivity.kt b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/ViewSelectorActivity.kt
index d1d3b19099..5386492a3c 100644
--- a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/ViewSelectorActivity.kt
+++ b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/ViewSelectorActivity.kt
@@ -4,17 +4,16 @@ package info.nightscout.androidaps.interaction.actions
import android.content.Context
import android.os.Bundle
-import android.support.wearable.view.DotsPageIndicator
-import android.support.wearable.view.GridPagerAdapter
import android.support.wearable.view.GridViewPager
-import android.view.LayoutInflater
import android.view.View
-import android.view.ViewGroup
import android.widget.TextView
import android.widget.Toast
import androidx.wear.widget.CurvedTextView
import dagger.android.DaggerActivity
import info.nightscout.androidaps.R
+import info.nightscout.androidaps.nondeprecated.DotsPageIndicatorNonDeprecated
+import info.nightscout.androidaps.nondeprecated.GridPagerAdapterNonDeprecated
+import info.nightscout.androidaps.nondeprecated.GridViewPagerNonDeprecated
import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.shared.sharedPreferences.SP
import javax.inject.Inject
@@ -27,14 +26,14 @@ open class ViewSelectorActivity : DaggerActivity() {
@Inject lateinit var sp: SP
@Inject lateinit var rxBus: RxBus
- private var pager: GridViewPager? = null
+ private var pager: GridViewPagerNonDeprecated? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.grid_layout)
setTitleBasedOnScreenShape()
pager = findViewById(R.id.pager)
- val dotsPageIndicator: DotsPageIndicator = findViewById(R.id.page_indicator)
+ val dotsPageIndicator: DotsPageIndicatorNonDeprecated = findViewById(R.id.page_indicator)
dotsPageIndicator.setPager(pager)
pager?.setOnPageChangeListener(object : GridViewPager.OnPageChangeListener {
override fun onPageScrolled(row: Int, column: Int, rowOffset: Float, columnOffset: Float, rowOffsetPixels: Int, columnOffsetPixels: Int) {
@@ -52,7 +51,7 @@ open class ViewSelectorActivity : DaggerActivity() {
})
}
- fun setAdapter(adapter: GridPagerAdapter?) {
+ fun setAdapter(adapter: GridPagerAdapterNonDeprecated?) {
pager?.adapter = adapter
}
diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/WizardActivity.kt b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/WizardActivity.kt
index 58448f765f..8f6ff9e949 100644
--- a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/WizardActivity.kt
+++ b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/WizardActivity.kt
@@ -3,7 +3,6 @@
package info.nightscout.androidaps.interaction.actions
import android.os.Bundle
-import android.support.wearable.view.GridPagerAdapter
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@@ -12,6 +11,7 @@ import info.nightscout.androidaps.R
import info.nightscout.androidaps.events.EventWearToMobile
import info.nightscout.androidaps.interaction.utils.EditPlusMinusViewAdapter
import info.nightscout.androidaps.interaction.utils.PlusMinusEditText
+import info.nightscout.androidaps.nondeprecated.GridPagerAdapterNonDeprecated
import info.nightscout.shared.SafeParse
import info.nightscout.shared.weardata.EventData.ActionWizardPreCheck
import java.text.DecimalFormat
@@ -32,7 +32,7 @@ class WizardActivity : ViewSelectorActivity() {
finish()
}
- private inner class MyGridViewPagerAdapter : GridPagerAdapter() {
+ private inner class MyGridViewPagerAdapter : GridPagerAdapterNonDeprecated() {
override fun getColumnCount(arg0: Int): Int = if (hasPercentage) 3 else 2
override fun getRowCount(): Int = 1
diff --git a/wear/src/main/java/info/nightscout/androidaps/nondeprecated/DotsPageIndicatorNonDeprecated.kt b/wear/src/main/java/info/nightscout/androidaps/nondeprecated/DotsPageIndicatorNonDeprecated.kt
new file mode 100644
index 0000000000..f2fc56b633
--- /dev/null
+++ b/wear/src/main/java/info/nightscout/androidaps/nondeprecated/DotsPageIndicatorNonDeprecated.kt
@@ -0,0 +1,11 @@
+@file:Suppress("DEPRECATION")
+
+package info.nightscout.androidaps.nondeprecated
+
+import android.content.Context
+import android.support.wearable.view.DotsPageIndicator
+import android.util.AttributeSet
+
+// This file does exist only to bypass deprecation warnings in generated code
+
+class DotsPageIndicatorNonDeprecated @JvmOverloads constructor(context: Context?, attrs: AttributeSet? = null, defStyleAttr: Int = 0) : DotsPageIndicator(context, attrs, defStyleAttr)
\ No newline at end of file
diff --git a/wear/src/main/java/info/nightscout/androidaps/nondeprecated/GridPagerAdapterNonDeprecated.kt b/wear/src/main/java/info/nightscout/androidaps/nondeprecated/GridPagerAdapterNonDeprecated.kt
new file mode 100644
index 0000000000..5af3500ce6
--- /dev/null
+++ b/wear/src/main/java/info/nightscout/androidaps/nondeprecated/GridPagerAdapterNonDeprecated.kt
@@ -0,0 +1,9 @@
+@file:Suppress("DEPRECATION")
+
+package info.nightscout.androidaps.nondeprecated
+
+import android.support.wearable.view.GridPagerAdapter
+
+// This file does exist only to bypass deprecation warnings in generated code
+
+abstract class GridPagerAdapterNonDeprecated : GridPagerAdapter()
\ No newline at end of file
diff --git a/wear/src/main/java/info/nightscout/androidaps/nondeprecated/GridViewPagerNonDeprecated.kt b/wear/src/main/java/info/nightscout/androidaps/nondeprecated/GridViewPagerNonDeprecated.kt
new file mode 100644
index 0000000000..eeb476f4ab
--- /dev/null
+++ b/wear/src/main/java/info/nightscout/androidaps/nondeprecated/GridViewPagerNonDeprecated.kt
@@ -0,0 +1,11 @@
+@file:Suppress("DEPRECATION")
+
+package info.nightscout.androidaps.nondeprecated
+
+import android.content.Context
+import android.support.wearable.view.GridViewPager
+import android.util.AttributeSet
+
+// This file does exist only to bypass deprecation warnings in generated code
+
+class GridViewPagerNonDeprecated @JvmOverloads constructor(context: Context?, attrs: AttributeSet? = null, defStyle: Int = 0) : GridViewPager(context, attrs, defStyle)
\ No newline at end of file
diff --git a/wear/src/main/res/layout/grid_layout.xml b/wear/src/main/res/layout/grid_layout.xml
index 51091b08c4..6b1b7d6379 100644
--- a/wear/src/main/res/layout/grid_layout.xml
+++ b/wear/src/main/res/layout/grid_layout.xml
@@ -24,13 +24,13 @@
android:textSize="18sp"
tools:text="Title" />
-
-