compileSdkVersion 30

This commit is contained in:
Milos Kozak 2021-08-06 00:08:49 +02:00
parent 776d85ec90
commit 0e928bbb9c
11 changed files with 29 additions and 31 deletions

View file

@ -63,7 +63,7 @@ class LoopDialog : DaggerDialogFragment() {
private var showOkCancel: Boolean = true
private var _binding: DialogLoopBinding? = null
private var loopHandler = Handler()
private var refreshDialog: Runnable? = null
private lateinit var refreshDialog: Runnable
// This property is only valid between onCreateView and
// onDestroyView.
@ -415,7 +415,7 @@ class LoopDialog : DaggerDialogFragment() {
it.commitAllowingStateLoss()
}
} catch (e: IllegalStateException) {
aapsLogger.debug(e.localizedMessage)
aapsLogger.debug(e.localizedMessage ?: e.toString())
}
}
}

View file

@ -119,7 +119,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
private var smallHeight = false
private lateinit var dm: DisplayMetrics
private var axisWidth: Int = 0
private var refreshLoop: Runnable? = null
private lateinit var refreshLoop: Runnable
private lateinit var handler: Handler
private val secondaryGraphs = ArrayList<GraphView>()
@ -583,9 +583,9 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
task = null
}
}
handler.removeCallbacks(task)
task?.let { handler.removeCallbacks(it) }
task = UpdateRunnable()
handler.postDelayed(task, 500)
task?.let { handler.postDelayed(it, 500) }
}
@Suppress("UNUSED_PARAMETER")

View file

@ -88,7 +88,7 @@ class SmsCommunicatorOtpActivity : NoSplashAppCompatActivity() {
Runnable {
val clipboard = getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
val clip = ClipData.newPlainText("OTP Secret", otp.provisioningSecret())
clipboard.primaryClip = clip
clipboard.setPrimaryClip(clip)
ToastUtils.Long.infoToast(this, resourceHelper.gs(R.string.smscommunicator_otp_export_successful))
uel.log(Action.OTP_EXPORT, Sources.SMS)
})

View file

@ -13,7 +13,7 @@ class BTReceiver : DaggerBroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
super.onReceive(context, intent)
val device: BluetoothDevice = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE)
val device: BluetoothDevice = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE) ?: return
when (intent.action) {
BluetoothDevice.ACTION_ACL_CONNECTED ->

View file

@ -20,8 +20,8 @@ class ActivityMonitor @Inject constructor(
private val dateUtil: DateUtil
) : Application.ActivityLifecycleCallbacks {
override fun onActivityPaused(activity: Activity?) {
val name = activity?.javaClass?.simpleName ?: return
override fun onActivityPaused(activity: Activity) {
val name = activity.javaClass.simpleName
val resumed = sp.getLong("Monitor_" + name + "_" + "resumed", 0)
if (resumed == 0L) {
aapsLogger.debug(LTag.UI, "onActivityPaused: $name resumed == 0")
@ -36,25 +36,25 @@ class ActivityMonitor @Inject constructor(
aapsLogger.debug(LTag.UI, "onActivityPaused: $name elapsed=$elapsed total=${total + elapsed}")
}
override fun onActivityResumed(activity: Activity?) {
val name = activity?.javaClass?.simpleName ?: return
override fun onActivityResumed(activity: Activity) {
val name = activity.javaClass.simpleName
aapsLogger.debug(LTag.UI, "onActivityResumed: $name")
sp.putLong("Monitor_" + name + "_" + "resumed", dateUtil.now())
}
override fun onActivityStarted(activity: Activity?) {
override fun onActivityStarted(activity: Activity) {
}
override fun onActivityDestroyed(activity: Activity?) {
override fun onActivityDestroyed(activity: Activity) {
}
override fun onActivitySaveInstanceState(activity: Activity?, outState: Bundle?) {
override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {
}
override fun onActivityStopped(activity: Activity?) {
override fun onActivityStopped(activity: Activity) {
}
override fun onActivityCreated(activity: Activity?, savedInstanceState: Bundle?) {
override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {
}
private fun toText(): String {

View file

@ -148,16 +148,14 @@ class LocationService : DaggerService() {
override fun onDestroy() {
super.onDestroy()
if (locationManager != null) {
try {
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
return
}
locationManager!!.removeUpdates(locationListener)
locationListener?.let { locationManager?.removeUpdates(it) }
} catch (ex: Exception) {
aapsLogger.error(LTag.LOCATION, "fail to remove location listener, ignore", ex)
}
}
disposable.clear()
}

View file

@ -87,7 +87,7 @@ dependencies {
api 'com.google.android.gms:play-services-wearable:17.0.0'
api 'com.google.android.gms:play-services-location:17.1.0'
api("com.google.android:flexbox:2.0.1")
api 'com.google.android.flexbox:flexbox:3.0.0'
api("io.socket:socket.io-client:1.0.0") {
// excluding org.json which is provided by Android
exclude group: "org.json", module: "json"

View file

@ -25,13 +25,13 @@ class ErrorHelperActivity : DialogAppCompatActivity() {
super.onCreate(savedInstanceState)
val errorDialog = ErrorDialog()
errorDialog.helperActivity = this
errorDialog.status = intent.getStringExtra(STATUS)
errorDialog.status = intent.getStringExtra(STATUS) ?: ""
errorDialog.sound = intent.getIntExtra(SOUND_ID, R.raw.error)
errorDialog.title = intent.getStringExtra(TITLE)
errorDialog.title = intent.getStringExtra(TITLE)?: ""
errorDialog.show(supportFragmentManager, "Error")
if (sp.getBoolean(R.string.key_ns_create_announcements_from_errors, true))
disposable += repository.runTransaction(InsertTherapyEventAnnouncementTransaction(intent.getStringExtra(STATUS))).subscribe()
disposable += repository.runTransaction(InsertTherapyEventAnnouncementTransaction(intent.getStringExtra(STATUS) ?: "")).subscribe()
}
companion object {

View file

@ -50,7 +50,7 @@ object LocaleHelper {
configuration.setLocale(newLocale)
val localeList = LocaleList(newLocale)
LocaleList.setDefault(localeList)
configuration.locales = localeList
configuration.setLocales(localeList)
val context = ctx.createConfigurationContext(configuration)
return ContextWrapper(context)
}

View file

@ -1,5 +1,5 @@
android {
compileSdkVersion 28
compileSdkVersion 30
defaultConfig {
minSdkVersion 26
targetSdkVersion 28

View file

@ -46,7 +46,7 @@ def generateGitBuild = { ->
}
android {
compileSdkVersion 28
compileSdkVersion 30
defaultConfig {
applicationId "info.nightscout.androidaps"